Commit 3a297c3f authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents daf0d06f e2bcc1d4
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 统计-全年一次性奖金
*
* @author huyc
* @date 2022-08-05 11:40:15
*/
@Data
public class TStatisticsAnnualBonusImportVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@Length(max = 50, message = "员工姓名 不能超过50 个字符")
@NotNull(message = "员工姓名不可为空")
@ExcelAttribute(name = "员工姓名", maxLength = 50, isNotEmpty = true)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Length(max = 25, message = "身份证号不能超过25个字符")
@NotNull(message = "身份证号不可为空")
@ExcelAttribute(name = "身份证号", maxLength = 25, isNotEmpty = true)
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 年终奖
*/
@ExcelAttribute(name = "待发年终奖", isNotEmpty = true)
@NotNull(message = "待发年终奖不可为空")
@Schema(description = "待发年终奖")
@ExcelProperty("待发年终奖")
private BigDecimal preAnnualBonus;
/**
* 年终奖单独税
*/
@ExcelAttribute(name = "待发12月工资", isNotEmpty = true)
@NotNull(message = "待发12月工资不可为空")
@Schema(description = "待发12月工资")
@ExcelProperty("待发12月工资")
private BigDecimal preDecSalary;
/**
* 年终奖单独扣税12月税费
*/
@ExcelAttribute(name = "年终奖单独扣税12月税费")
@Schema(description = "年终奖单独扣税12月税费")
@ExcelProperty("年终奖单独扣税12月税费")
private BigDecimal onlyTax;
/**
* 年终奖合并扣税12月税费
*/
@ExcelAttribute(name = "年终奖合并扣税12月税费")
@Schema(description = "年终奖合并扣税12月税费")
@ExcelProperty("年终奖合并扣税12月税费")
private BigDecimal sumTax;
/**
* 最优方案-年终奖
*/
@ExcelAttribute(name = "最优方案-年终奖")
@Schema(description = "最优方案-年终奖")
@ExcelProperty("最优方案-年终奖")
private BigDecimal bestSolutionTax;
/**
* 最优方案-12月扣税
*/
@ExcelAttribute(name = "最优方案-12月扣税")
@Schema(description = "最优方案-12月扣税")
@ExcelProperty("最优方案-12月扣税")
private BigDecimal bestSolutionDecTax;
}
......@@ -38,16 +38,6 @@ import java.math.BigDecimal;
@Data
public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "id 不能为空")
@Length(max = 32, message = "id 不能超过32 个字符")
@ExcelAttribute(name = "id", isNotEmpty = true, errorInfo = "id 不能为空", maxLength = 32)
@Schema(description = "id")
@ExcelProperty("id")
private String id;
/**
* 税务主体(封面抬头)
*/
......
......@@ -127,4 +127,17 @@ public class TSalaryStandardController {
public void export(HttpServletResponse response, @RequestBody TSalaryStandardSearchVo searchVo) {
tSalaryStandardService.listExport(response, searchVo);
}
/**
* 审核页面简单分页查询
*
* @param page 分页对象
* @param tSalaryStandard 标准薪酬工资表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/auditPage")
public R<IPage<TSalaryStandard>> getTSalaryStandardAuditPage(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard) {
return new R<>(tSalaryStandardService.getTSalaryStandardAuditPage(page, tSalaryStandard));
}
}
......@@ -19,7 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsAnnualBonusService;
......@@ -27,10 +27,13 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
......@@ -44,11 +47,11 @@ import java.util.List;
@RequiredArgsConstructor
@RequestMapping("/tstatisticsannualbonus")
@Tag(name = "统计-全年一次性奖金管理")
@Slf4j
public class TStatisticsAnnualBonusController {
private final TStatisticsAnnualBonusService tStatisticsAnnualBonusService;
/**
* 简单分页查询
*
......@@ -70,7 +73,6 @@ public class TStatisticsAnnualBonusController {
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
//@PreAuthorize("@pms.hasPermission('salary_tstatisticsannualbonus_get')" )
public R<List<TStatisticsAnnualBonus>> getTStatisticsAnnualBonusNoPage(@RequestBody TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus) {
return R.ok(tStatisticsAnnualBonusService.noPageDiy(tStatisticsAnnualBonus));
}
......@@ -81,7 +83,7 @@ public class TStatisticsAnnualBonusController {
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('salary_tstatisticsannualbonus_get')")
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<TStatisticsAnnualBonus> getById(@PathVariable("id") String id) {
return R.ok(tStatisticsAnnualBonusService.getById(id));
......@@ -128,4 +130,19 @@ public class TStatisticsAnnualBonusController {
public void export(HttpServletResponse response, @RequestBody TStatisticsAnnualBonusSearchVo searchVo) {
tStatisticsAnnualBonusService.listExport(response, searchVo);
}
/**
* 年终奖分配方案导入导出
*
* @author huyc
* @date 2022-08-08
**/
@Operation(description = "年终奖分配方案导入导出 hasPermission('salary_tstatisticsannualbonus_import')")
@PostMapping("/bestSolutionExport")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsannualbonus_import')")
public R<List<ErrorMessage>> bestSolutionExport(@RequestBody MultipartFile file
, HttpServletResponse response, List<String> exportFields) throws IOException {
return tStatisticsAnnualBonusService.bestSendExport(file.getInputStream(), response, exportFields);
}
}
......@@ -37,4 +37,11 @@ public interface TSalaryStandardMapper extends BaseMapper<TSalaryStandard> {
* @return
*/
IPage<TSalaryStandard> getTSalaryStandardPage(Page<TSalaryStandard> page, @Param("tSalaryStandard") TSalaryStandard tSalaryStandard);
/**
* 标准薪酬工资表审核页面简单分页查询
* @param tSalaryStandard 标准薪酬工资表
* @return
*/
IPage<TSalaryStandard> getTSalaryStandardAuditPage(Page<TSalaryStandard> page, @Param("tSalaryStandard") TSalaryStandard tSalaryStandard);
}
......@@ -48,4 +48,11 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
void listExport(HttpServletResponse response, TSalaryStandardSearchVo searchVo);
List<TSalaryStandard> noPageDiy(TSalaryStandardSearchVo searchVo);
/**
* 标准薪酬工资表审核页面简单分页查询
* @param tSalaryStandard 标准薪酬工资表
* @return
*/
IPage<TSalaryStandard> getTSalaryStandardAuditPage(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard);
}
......@@ -41,11 +41,19 @@ public interface TStatisticsAnnualBonusService extends IService<TStatisticsAnnua
* @param tStatisticsAnnualBonus 统计-全年一次性奖金
* @return
*/
IPage<TStatisticsAnnualBonus> getTStatisticsAnnualBonusPage(Page<TStatisticsAnnualBonus> page, TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus);
IPage<TStatisticsAnnualBonus> getTStatisticsAnnualBonusPage(Page<TStatisticsAnnualBonus> page,
TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus);
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, TStatisticsAnnualBonusSearchVo searchVo);
List<TStatisticsAnnualBonus> noPageDiy(TStatisticsAnnualBonusSearchVo searchVo);
/**
* 年终奖分配方案导入导出
* @param inputStream
* @return
*/
R<List<ErrorMessage>> bestSendExport(InputStream inputStream, HttpServletResponse response,List<String> exportFields);
}
......@@ -250,4 +250,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
@Override
public IPage<TSalaryStandard> getTSalaryStandardAuditPage(Page<TSalaryStandard> page, TSalaryStandardSearchVo tSalaryStandard) {
return baseMapper.getTSalaryStandardAuditPage(page, tSalaryStandard);
}
}
......@@ -29,11 +29,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsAnnualBonusMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsAnnualBonusService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusImportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusVo;
import lombok.extern.log4j.Log4j2;
......@@ -145,6 +149,100 @@ public class TStatisticsAnnualBonusServiceImpl extends ServiceImpl<TStatisticsAn
return baseMapper.selectList(wrapper);
}
@Override
public R<List<ErrorMessage>> bestSendExport(InputStream inputStream, HttpServletResponse response,
List<String> exportFields) {
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TStatisticsAnnualBonusImportVo> util1 = new ExcelUtil<>(TStatisticsAnnualBonusImportVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TStatisticsAnnualBonusImportVo.class, new ReadListener<TStatisticsAnnualBonusImportVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<TStatisticsAnnualBonusImportVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TStatisticsAnnualBonusImportVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importBestSendTax(cachedDataList, errorMessageList, user, response, exportFields);
log.info("存储数据库成功!");
}
}).sheet().doRead();
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importBestSendTax(List<TStatisticsAnnualBonusImportVo> list, List<ErrorMessage> errorMessageList,
YifuUser user, HttpServletResponse response, List<String> exportFields) {
if (errorMessageList.size() == CommonConstants.ZERO_INT) {
String fileName = "年终奖测算导出" + DateUtil.getThisTime() + ".xlsx";
ServletOutputStream out = null;
for (TStatisticsAnnualBonusImportVo infoVo : list) {
//todo
}
try {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, TStatisticsAnnualBonusImportVo.class).includeColumnFiledNames(exportFields).sheet("年终奖测算")
.doWrite(list);
out.flush();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
}
private Long noPageCountDiy(TStatisticsAnnualBonusSearchVo searchVo) {
LambdaQueryWrapper<TStatisticsAnnualBonus> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
......
......@@ -212,4 +212,30 @@
<include refid="tSalaryStandard_where"/>
</where>
</select>
<!--tSalaryStandard简单分页查询-->
<select id="getTSalaryStandardAuditPage" resultMap="tSalaryStandardMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_salary_standard a
<where>
1=1
<if test="tSalaryStandard != null">
<if test="tSalaryStandard.deptName != null and tSalaryStandard.deptName.trim() != ''">
AND a.DEPT_NAME like concat(#{'%',#{tSalaryStandard.deptName},'%')
</if>
<if test="tSalaryStandard.deptNo != null and tSalaryStandard.deptNo.trim() != ''">
AND a.DEPT_NO = #{tSalaryStandard.deptNo}
</if>
<if test="tSalaryStandard.salaryMonth != null and tSalaryStandard.salaryMonth.trim() != ''">
AND a.SALARY_MONTH = #{tSalaryStandard.salaryMonth}
</if>
<if test="tSalaryStandard.status == null">
AND a.STATUS = 1 OR a.STATUS = 2
</if>
<if test="tSalaryStandard.status != null">
AND a.STATUS = #{tSalaryStandard.status}
</if>
</if>
</where>
</select>
</mapper>
......@@ -369,7 +369,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
errorMessageList = handleFileAddress(1, preInfo, areaMap, areaIdMap, importVo, errorMessageList);
}
// 档案地市没问题 开始派单处理
if (Common.isEmpty(errorMessageList)) {
if (errorMessageList.size() == CommonConstants.ZERO_INT) {
dispatchInfoService.importTDispatchInfo(importVoList, errorMessageList, user);
}
// 处理派增结果
......@@ -456,8 +456,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
.eq(TPreDispatchInfo::getDispatchFlag, CommonConstants.ZERO_STRING)
.eq(TPreDispatchInfo::getPreStatus, CommonConstants.ZERO_STRING));
}
if (Common.isEmpty(preList)) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
if (!Common.isNotNull(preList)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
// 找出所有需要派减的社保或公积金数据 主要用于派减是获取项目相关数据
HashMap<String, TSocialInfo> socialMap = new HashMap<>();
......@@ -501,7 +501,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
resetMessageList(pre, errorMessageList, errorMsgList, i + 1);
}
}
return R.ok(errorMsgList);
if (Common.isNotNull(errorMsgList)) {
return R.failed(errorMsgList);
}
return R.ok();
}
@Override
......@@ -2094,27 +2097,24 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Date 2022-07-18
**/
private R<Boolean> handleDispatchAddRes(TPreDispatchInfo preInfo, List<ErrorMessage> errorMessageList) {
if (Common.isEmpty(errorMessageList)) {
return R.failed(preInfo.getEmpIdcard() +
CommonConstants.COLON_STRING +
PreDispatchConstants.PREDISPATCH_EXCEPTION);
}
ErrorMessage errorMessage = errorMessageList.get(CommonConstants.ZERO_INT);
if (null != errorMessage) {
if (errorMessage.getMessage().indexOf(PreDispatchConstants.DISPATCH_ADD_SUCCESS) >= CommonConstants.ZERO_INT) {
preInfo.setPreStatus(CommonConstants.TWO_STRING);
preInfo.setExceptionContent(CommonConstants.EMPTY_STRING);
baseMapper.updatePreStatusById(preInfo);
return R.ok(null, preInfo.getEmpIdcard() +
CommonConstants.COLON_STRING +
PreDispatchConstants.DISPATCH_ADD_SUCCESS);
} else {
preInfo.setPreStatus(CommonConstants.ONE_STRING);
preInfo.setExceptionContent(errorMessage.getMessage());
baseMapper.updatePreStatusById(preInfo);
return R.failed(preInfo.getEmpIdcard() +
CommonConstants.COLON_STRING +
errorMessage.getMessage());
if (errorMessageList.size() > CommonConstants.ZERO_INT) {
ErrorMessage errorMessage = errorMessageList.get(CommonConstants.ZERO_INT);
if (null != errorMessage) {
if (errorMessage.getMessage().indexOf(PreDispatchConstants.DISPATCH_ADD_SUCCESS) >= CommonConstants.ZERO_INT) {
preInfo.setPreStatus(CommonConstants.TWO_STRING);
preInfo.setExceptionContent(CommonConstants.EMPTY_STRING);
baseMapper.updatePreStatusById(preInfo);
return R.ok(null, preInfo.getEmpIdcard() +
CommonConstants.COLON_STRING +
PreDispatchConstants.DISPATCH_ADD_SUCCESS);
} else {
preInfo.setPreStatus(CommonConstants.ONE_STRING);
preInfo.setExceptionContent(errorMessage.getMessage());
baseMapper.updatePreStatusById(preInfo);
return R.failed(preInfo.getEmpIdcard() +
CommonConstants.COLON_STRING +
errorMessage.getMessage());
}
}
}
return null;
......@@ -2371,7 +2371,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
errorMessageList = handleFileAddress(i, pre, areaMap, areaIdMap, importVo, errorMessageList);
}
// 档案地市没问题 开始派单处理
if (Common.isEmpty(errorMessageList)){
if (!Common.isNotNull(errorMessageList)){
dispatchInfoService.importTDispatchInfo(importVoList, errorMessageList, user);
}
// 处理派增结果
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment