diff --git a/src/com/api/salary/web/AddUpDeductionController.java b/src/com/api/salary/web/AddUpDeductionController.java index 0355200b5..6e89b73c7 100644 --- a/src/com/api/salary/web/AddUpDeductionController.java +++ b/src/com/api/salary/web/AddUpDeductionController.java @@ -9,10 +9,4 @@ import javax.ws.rs.Path; @Path("/bs/hrmsalary/addUpDeduction") public class AddUpDeductionController extends com.engine.salary.web.AddUpDeductionController{ - - public static void main(String[] args) { - SpecialAddDeductionParam specialAddDeductionParam = new SpecialAddDeductionParam(); - String s = JSON.toJSONString(specialAddDeductionParam, SerializerFeature.WriteNullStringAsEmpty); - System.out.println(s); - } } diff --git a/src/com/engine/salary/biz/SpecialAddDeductionBiz.java b/src/com/engine/salary/biz/SpecialAddDeductionBiz.java index ab63a4540..b841a12d0 100644 --- a/src/com/engine/salary/biz/SpecialAddDeductionBiz.java +++ b/src/com/engine/salary/biz/SpecialAddDeductionBiz.java @@ -6,6 +6,8 @@ import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper; +import com.engine.salary.util.db.MapperProxyFactory; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; @@ -16,6 +18,10 @@ import java.util.*; import java.util.stream.Collectors; public class SpecialAddDeductionBiz extends BaseBean { + private SpecialAddDeductionMapper mapper() { + return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class); + } + /** * 根据id获取 * @@ -31,19 +37,14 @@ public class SpecialAddDeductionBiz extends BaseBean { } public List listDTOByParam(SpecialAddDeductionQueryParam param) { - try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) { - SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class); - List specialAddDeductionRecordDTOS = mapper.listDtoByParam(param); - return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionRecordDTOS); - } + List specialAddDeductionRecordDTOS = mapper().listDtoByParam(param); + return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionRecordDTOS); } + public List listByParam(SpecialAddDeductionQueryParam param) { - try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) { - SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class); - List specialAddDeductionListDTOS = mapper.listByParam(param); - return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionListDTOS); - } + List specialAddDeductionListDTOS = mapper().listByParam(param); + return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionListDTOS); } public List listByTaxAgentIds(List taxAgentIds) { @@ -111,9 +112,9 @@ public class SpecialAddDeductionBiz extends BaseBean { // 去重(通过记录的唯一条件(申报月份,人员id,个税扣缴义务人id)拼接) List finalPos = pos.stream() .collect(Collectors.collectingAndThen( - Collectors.toCollection(() -> - new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), - ArrayList::new) + Collectors.toCollection(() -> + new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), + ArrayList::new) ); // 查询已有数据 List list = listByTaxAgentIds(null); @@ -156,4 +157,15 @@ public class SpecialAddDeductionBiz extends BaseBean { sqlSession.commit(); } } + + public List getByEmployeeId(List employeeIds, Long taxAgentId) { + if (CollectionUtils.isEmpty(employeeIds)) { + return Collections.emptyList(); + } + return mapper().getByEmployeeIds(employeeIds, taxAgentId) + .stream() + .filter(Objects::nonNull) + .filter(s -> s.getEmployeeId() != null) + .collect(Collectors.toList()); + } } diff --git a/src/com/engine/salary/entity/datacollection/param/SpecialAddDeductionRecordDeleteParam.java b/src/com/engine/salary/entity/datacollection/param/SpecialAddDeductionRecordDeleteParam.java new file mode 100644 index 000000000..58332b91a --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/SpecialAddDeductionRecordDeleteParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.entity.datacollection.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author lfc + * @description 专项附加扣-除删除参数 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SpecialAddDeductionRecordDeleteParam { + + // 删除id + private List ids; + + // 个税扣缴义务人 + private String taxAgentId; +} diff --git a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java index 8d097b221..0915acf16 100644 --- a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java +++ b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java @@ -28,4 +28,6 @@ public interface SpecialAddDeductionMapper { int deleteByIds(@Param("ids")List id); + List getByEmployeeIds(@Param("employeeIds") List employeeIds, + @Param("taxAgentId") Long taxAgentId); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml index 657985390..e3472dfc5 100644 --- a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml @@ -66,6 +66,9 @@ #{id} + + AND t1.id = #{param.specialAddDeductionId} + AND t1.employee_id = #{param.employeeId} @@ -119,6 +122,9 @@ #{id} + + AND t1.id = #{param.specialAddDeductionId} + AND t1.employee_id = #{param.employeeId} @@ -171,6 +177,9 @@ #{id} + + AND t1.id = #{param.specialAddDeductionId} + AND t1.employee_id = #{param.employeeId} @@ -217,10 +226,6 @@ - - - - @@ -556,4 +560,19 @@ ) and delete_type = 0 + + \ No newline at end of file diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 1b4a7aba7..6596ad887 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -147,4 +147,11 @@ public interface AddUpDeductionService { * @date 2022/10/31 11:33 */ AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam id); + + /** + * 自动累计专项附加扣除 + * @return void + * @author lfc + */ + void autoAddAll(); } diff --git a/src/com/engine/salary/service/SpecialAddDeductionService.java b/src/com/engine/salary/service/SpecialAddDeductionService.java index 18025b7bb..543679d55 100644 --- a/src/com/engine/salary/service/SpecialAddDeductionService.java +++ b/src/com/engine/salary/service/SpecialAddDeductionService.java @@ -2,10 +2,7 @@ package com.engine.salary.service; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -102,10 +99,14 @@ public interface SpecialAddDeductionService { /** * 删除所选数据 */ - void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam); + void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam); /** * 一键清空数据 */ - void deleteAllData(AddUpDeductionRecordDeleteParam deleteParam); + void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam); + + List getSpecialAddDeductionPOByEmployee(List employeeId, Long taxAgentId); + + SpecialAddDeductionRecordDTO getRecordById(Long id); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index e7086f94c..207654f8f 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -20,6 +20,7 @@ import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; +import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; @@ -59,6 +60,7 @@ import weaver.hrm.User; import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; @@ -102,6 +104,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private SpecialAddDeductionService getSpecialAddDeductionService(User user) { + return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user); + } + @Override public Map getSearchCondition(Map params) { Map apidatas = new HashMap(); @@ -629,6 +635,29 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return addUpDeductionRecordDTOS.get(0); } + @Override + public void autoAddAll() { + int uid = user.getUID(); + Collection taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) uid); + for (TaxAgentPO taxAgent : taxAgents) { + Collection employeeIds = getTaxAgentService(user) + .listEmployeeIdsInTaxAgent(taxAgent.getId()); + List employeePOs = getSpecialAddDeductionService(user) + .getSpecialAddDeductionPOByEmployee(new ArrayList<>(employeeIds), taxAgent.getId()); + Map> lastEmpInfo = getLastEmpInfo(taxAgent, employeePOs); + + } + } + + private Map> getLastEmpInfo(TaxAgentPO taxAgent, List employeePOs) { + LocalDateTime lastMonthDateTime = LocalDateTime.now().minusMonths(1); + YearMonth lastMonth = YearMonth.of(lastMonthDateTime.getYear(), lastMonthDateTime.getMonth()); + List addUpDeductionList = getAddUpDeductionList(lastMonth, + employeePOs.stream().map(SpecialAddDeductionPO::getEmployeeId).collect(Collectors.toList()), + taxAgent.getId()); + return addUpDeductionList.stream().collect(Collectors.groupingBy(AddUpDeduction::getEmployeeId)); + } + private void checkImportParam(AddUpDeductionImportParam importParam) { diff --git a/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java b/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java index ae3214328..dbc68250e 100644 --- a/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java @@ -9,17 +9,14 @@ import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; -import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; @@ -31,6 +28,7 @@ import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; import com.engine.salary.util.excel.ExcelUtil; @@ -57,10 +55,14 @@ import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TEN public class SpecialAddDeductionServiceImpl extends Service implements SpecialAddDeductionService { - private SpecialAddDeductionBiz getSpecialAddDeductionMapper() { + private SpecialAddDeductionBiz getSpecialAddDeductionBiz() { return new SpecialAddDeductionBiz(); } + private SpecialAddDeductionMapper getSpecialAddDeductionMapper() { + return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class); + } + private TaxAgentService getTaxAgentService(User user) { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } @@ -83,7 +85,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd @Override public SpecialAddDeductionPO getById(Long id) { - return getSpecialAddDeductionMapper().getById(id); + return getSpecialAddDeductionBiz().getById(id); } @@ -101,6 +103,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd } SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getSpecialAddDeductionMapper().listByParam(queryParam); + SpecialAddDeductionEncrypt.decrypt(list); return new PageInfo<>(list, SpecialAddDeductionListDTO.class); } @@ -113,7 +116,9 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd putQueryRange(queryParam, employeeId); } SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getSpecialAddDeductionMapper().listDTOByParam(queryParam); + List list = getSpecialAddDeductionMapper().listDtoByParam(queryParam); + SpecialAddDeductionEncrypt.decrypt(list); + return new PageInfo<>(list, SpecialAddDeductionRecordDTO.class); } @@ -197,7 +202,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd // 获取所有个税扣缴义务人 Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); // 查询已有数据 - List list = getSpecialAddDeductionMapper() + List list = getSpecialAddDeductionBiz() .listByTaxAgentIds(null); // 错误excel内容 @@ -375,7 +380,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); param.setOrderRule(orderRule); - List list = getSpecialAddDeductionMapper().listByParam(param); + List list = getSpecialAddDeductionBiz().listByParam(param); // 开启分权并且不是薪酬模块总管理员 if (getTaxAgentService(user).isOpenDevolution() && !getTaxAgentService(user).isChief(employeeId)) { List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); @@ -465,7 +470,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); //查询详细信息 - List list = getSpecialAddDeductionMapper().listDTOByParam(param); + List list = getSpecialAddDeductionBiz().listDTOByParam(param); SpecialAddDeductionEncrypt.decrypt(list); final List> dataRowList = Optional.ofNullable(list) .map(List::stream) @@ -548,7 +553,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd // 获取所有个税扣缴义务人 Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); // 查询已有数据 - List list = getSpecialAddDeductionMapper().listByTaxAgentIds(null); + List list = getSpecialAddDeductionBiz().listByTaxAgentIds(null); //合规数据 List insertData = new ArrayList<>(); Date now = new Date(); @@ -595,19 +600,13 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd } @Override - public void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam) { + public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) { long currentEmployeeId = user.getUID(); // 获取所有个税扣缴义务人 Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz(); - String declareMonthStr = deleteParam.getDeclareMonth(); List deleteIds = deleteParam.getIds(); - // 已经核算过的不可操作 - // 获取已经核算的数据 - List salaryAcctEmployees = - getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr); - // 判断是否有核算过 List deleteList = new ArrayList<>(); for (Long id : deleteIds) { SpecialAddDeductionPO byId = SpecialAddDeductionBiz.getById(id); @@ -621,37 +620,20 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd if (isNotInRegion) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内"); } - // 判断用户是否存在 - if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { - Optional optionalAcctEmp = - salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(byId.getEmployeeId()) && f.getTaxAgentId().equals(byId.getTaxAgentId())).findFirst(); - if (optionalAcctEmp.isPresent()) { - throw new SalaryRunTimeException("所选数据在该年月中已经核算过并归档,不可进行删除!"); - } - } deleteList.add(byId.getId()); } SpecialAddDeductionBiz.batchDeleteByIds(deleteList); } @Override - public void deleteAllData(AddUpDeductionRecordDeleteParam deleteParam) { - String declareMonthStr = deleteParam.getDeclareMonth(); - long currentEmployeeId = user.getUID(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) { // 获取所有个税扣缴义务人 Collection taxAgentList = - getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); + getTaxAgentService(user).listTaxAgentAndEmployeeTree((long) user.getUID()); List taxAgentIds = taxAgentList.stream() .map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId) .collect(Collectors.toList()); SpecialAddDeductionBiz specialAddDeductionBiz = new SpecialAddDeductionBiz(); - Date declareMonthDate = null; - try { - declareMonthDate = sdf.parse(declareMonthStr + "-01"); - } catch (Exception e) { - throw new SalaryRunTimeException("日期异常"); - } if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) { // 设置了个税扣缴义务人 @@ -666,21 +648,22 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd } // 获取所有想要删除的数据 List list = specialAddDeductionBiz.listByTaxAgentIds(taxAgentIds); - // 获取已经核算的数据 - List salaryAcctEmployees = getAddUpDeductionService(user) - .getAccountedEmployeeData(declareMonthStr); - for (SpecialAddDeductionPO item : list) { - if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { - Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst(); - if (optionalAcctEmp.isPresent()) { - throw new SalaryRunTimeException("有员工在该年月中已经完成核算并归档,不能进行一键清空!"); - } - } - } List deleteIds = list.stream().map(SpecialAddDeductionPO::getId).collect(Collectors.toList()); specialAddDeductionBiz.batchDeleteByIds(deleteIds); } + @Override + public List getSpecialAddDeductionPOByEmployee(List employeeId, Long taxAgentId) { + return getSpecialAddDeductionBiz().getByEmployeeId(employeeId, taxAgentId); + } + + @Override + public SpecialAddDeductionRecordDTO getRecordById(Long id) { + return getSpecialAddDeductionBiz() + .listDTOByParam(SpecialAddDeductionQueryParam.builder().specialAddDeductionId(id).build()) + .stream().findFirst().orElse(null); + } + @Override public XSSFWorkbook downloadTemplate(SpecialAddDeductionQueryParam param) { // 1.工作簿名称 diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index 894fbc81d..d97aaaed3 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -340,4 +340,15 @@ public class AddUpDeductionController { } + /** + * 一键自动累计 + * @return + */ + @POST + @Path("/autoAddAll") + @Produces(MediaType.APPLICATION_JSON) + public String autoAddAll(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::autoAddAll, user); + } } diff --git a/src/com/engine/salary/web/SpecialAddDeductionController.java b/src/com/engine/salary/web/SpecialAddDeductionController.java index 49416aa62..940ab5ede 100644 --- a/src/com/engine/salary/web/SpecialAddDeductionController.java +++ b/src/com/engine/salary/web/SpecialAddDeductionController.java @@ -5,7 +5,6 @@ import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.util.ResponseResult; -import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.wrapper.SpecialAddDeductionWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -74,10 +73,19 @@ public class SpecialAddDeductionController { } + @POST + @Path("/getSpecialAddDeduction") + @Produces(MediaType.APPLICATION_JSON) + public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam param) { + User user = HrmUserVarify.getUser(request, response); + Long id = param.getId(); + return new ResponseResult(user).run(getSpecialAddDeductionWrapper(user)::getRecordById, id); + } + @POST @Path("/getDetailList") @Produces(MediaType.APPLICATION_JSON) - public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam queryParam) { + public String getSpecialAddDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); return new ResponseResult>(user).run(getSpecialAddDeductionWrapper(user)::getDetailList, queryParam); } @@ -284,8 +292,7 @@ public class SpecialAddDeductionController { /** * @return String * @description 新建专项附加扣除 - * @author Harryxzy - * @date 2022/10/27 14:41 + * @author lfc */ @POST @Path("/createData") @@ -298,30 +305,26 @@ public class SpecialAddDeductionController { /** * @return String * @description 删除所选专项附加扣除 - * @author Harryxzy - * @date 2022/10/27 14:41 + * @author lfc */ @POST @Path("/deleteSelectData") @Produces(MediaType.APPLICATION_JSON) - public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam otherDeductionDeleteParam) { + public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionRecordDeleteParam deleteParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getSpecialAddDeductionWrapper(user)::deleteSelectData, otherDeductionDeleteParam); + return new ResponseResult>(user).run(getSpecialAddDeductionWrapper(user)::deleteSelectData, deleteParam); } /** * @return null * @description 一键清空专项附加扣除 - * @author Harryxzy - * @date 2022/10/27 15:15 + * @author lfc */ @POST @Path("/deleteAllData") @Produces(MediaType.APPLICATION_JSON) - public String deleteAllOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam otherDeductionDeleteParam) { + public String deleteAllOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionRecordDeleteParam deductionRecordDeleteParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getSpecialAddDeductionWrapper(user)::deleteAllData, otherDeductionDeleteParam); + return new ResponseResult>(user).run(getSpecialAddDeductionWrapper(user)::deleteAllData, deductionRecordDeleteParam); } - - } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index bf50b1960..e91305bf6 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -19,6 +19,7 @@ import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; @@ -35,6 +36,7 @@ import java.util.stream.Collectors; * @author qiantao * @version 1.0 **/ +@Slf4j public class AddUpDeductionWrapper extends Service { private AddUpDeductionService getAddUpDeductionService(User user) { @@ -162,4 +164,9 @@ public class AddUpDeductionWrapper extends Service { public AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam param) { return getAddUpDeductionService(user).getAddUpDeduction(param); } + + public void autoAddAll(User opt) { + log.info("一键累计, 操作人 「{}」", opt.getUsername()); + getAddUpDeductionService(user).autoAddAll(); + } } diff --git a/src/com/engine/salary/wrapper/SpecialAddDeductionWrapper.java b/src/com/engine/salary/wrapper/SpecialAddDeductionWrapper.java index 270022b3f..817fe6058 100644 --- a/src/com/engine/salary/wrapper/SpecialAddDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/SpecialAddDeductionWrapper.java @@ -8,10 +8,7 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO; import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam; -import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.SalaryEmployeeService; @@ -22,13 +19,11 @@ import com.engine.salary.service.impl.SpecialAddDeductionServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; +import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 专项附加扣除 @@ -189,14 +184,18 @@ public class SpecialAddDeductionWrapper extends Service { /** * 删除所选数据 */ - public void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam) { + public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) { getSpecialAddDeductionService(user).deleteSelectData(deleteParam); } /** * 一键清空所有数据 */ - public void deleteAllData(AddUpDeductionRecordDeleteParam deleteParam) { + public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) { getSpecialAddDeductionService(user).deleteAllData(deleteParam); } + + public SpecialAddDeductionRecordDTO getRecordById(Long id) { + return getSpecialAddDeductionService(user).getRecordById(id); + } }