From bf555b5b3230a434da55b116cf42fcf4907d247f Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Mon, 14 Aug 2023 16:38:40 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9jackson=E8=A7=A3=E6=9E=90?= =?UTF-8?q?map=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FormulaRunServiceImpl.java | 41 +++++++++---------- .../impl/SalaryFormulaServiceImpl.java | 14 ++----- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java index b1d19353a..9e5303a62 100644 --- a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java +++ b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java @@ -11,9 +11,7 @@ import com.engine.salary.formlua.entity.parameter.DataType; import com.engine.salary.formlua.entity.standard.ExcelResult; import com.engine.salary.service.FormulaRunService; import com.engine.salary.sys.enums.OpenEnum; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; +import com.engine.salary.util.JsonUtil; import com.ql.util.express.DefaultContext; import com.ql.util.express.ExpressRunner; import lombok.extern.slf4j.Slf4j; @@ -34,8 +32,6 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService private static ExpressRunner runner = new ExpressRunner(true, false); - private static final ObjectMapper objectMapper = new ObjectMapper(); - private final BaseBean baseBean = new BaseBean(); private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log")); @@ -69,24 +65,25 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService String openDecrypt = ""; String result = ""; try { - JsonNode jsonNode = objectMapper.readTree(extendParam); + Map map = JsonUtil.parseMap(extendParam, String.class); //返回值配置 - JsonNode sqlReturnKeyNode = jsonNode.get("sqlReturnKey"); - if (sqlReturnKeyNode != null) { - sqlReturnKey = sqlReturnKeyNode.asText().trim(); + sqlReturnKey = map.getOrDefault("sqlReturnKey", ""); + if (StringUtils.isNotBlank(sqlReturnKey)) { + sqlReturnKey = sqlReturnKey.trim(); } //数据源配置 - JsonNode datasourceNode = jsonNode.get("datasource"); - if (datasourceNode != null) { - JsonNode datasourceIdNode = datasourceNode.get("datasourceId"); - if (datasourceIdNode != null) { - datasourceId = datasourceIdNode.asText(); + String datasourceJson = map.getOrDefault("datasource", ""); + if (StringUtils.isNotBlank(datasourceJson)) { + Map datasourceIdMap = JsonUtil.parseMap(datasourceJson, String.class); + String datasourceIdNode = datasourceIdMap.getOrDefault("datasourceId",""); + if (StringUtils.isNotBlank(datasourceIdNode)) { + datasourceId = datasourceIdNode; } } //是否需要解密 - JsonNode decrypt = jsonNode.get("openDecrypt"); - if (decrypt != null) { - openDecrypt = decrypt.asText().trim(); + String decrypt = map.get("openDecrypt"); + if (StringUtils.isNotBlank(decrypt)) { + openDecrypt = decrypt.trim(); } //解析sql @@ -144,13 +141,13 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService String extendParam = expressFormula.getExtendParam(); try { - JsonNode jsonNode = objectMapper.readTree(extendParam); + Map map = JsonUtil.parseMap(extendParam, String.class); //返回值配置 - JsonNode isCustomFunctionNode = jsonNode.get("isCustomFunction"); - if (isCustomFunctionNode != null) { - isCustomFunction = StringUtils.equals(isCustomFunctionNode.asText().trim(), "1"); + String isCustomFunctionNode = map.getOrDefault("isCustomFunction", ""); + if (StringUtils.isNotBlank(isCustomFunctionNode)) { + isCustomFunction = StringUtils.equals(isCustomFunctionNode.trim(), "1"); } - } catch (JsonProcessingException e) { + } catch (Exception e) { log.error("express execute fail, sql extendParam parse fail", e); } diff --git a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java index 401a761d7..3e34a2715 100644 --- a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java @@ -18,11 +18,9 @@ import com.engine.salary.mapper.formula.FormulaVarMapper; import com.engine.salary.service.FormulaRunService; import com.engine.salary.service.RemoteExcelService; import com.engine.salary.service.SalaryFormulaService; +import com.engine.salary.util.JsonUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.valid.ValidUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import lombok.extern.slf4j.Slf4j; @@ -47,7 +45,6 @@ import java.util.stream.Collectors; **/ @Slf4j public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaService { - private static final ObjectMapper objectMapper = new ObjectMapper(); private FormulaMapper getFormulaMapper() { return MapperProxyFactory.getProxy(FormulaMapper.class); @@ -171,12 +168,9 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe String sqlReturnKey = ""; try { - JsonNode jsonNode = objectMapper.readTree(extendParam); - JsonNode sqlReturnKeyNode = jsonNode.get("sqlReturnKey"); - if (sqlReturnKeyNode != null) { - sqlReturnKey = sqlReturnKeyNode.asText(); - } - } catch (JsonProcessingException e) { + Map map = JsonUtil.parseMap(extendParam, String.class); + sqlReturnKey = map.getOrDefault("sqlReturnKey", ""); + } catch (Exception e) { log.error("express execute fail, sql extendParam parse fail", e); } From 7c5e373b0129bcb6d4374446f5914198dd883001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 1 Sep 2023 09:23:43 +0800 Subject: [PATCH 2/8] 2 --- .../dto/AddUpDeductionRequestResultDTO.java | 34 +++++++ .../AddUpDeductionMonthTaxAgentParam.java | 25 +++++ .../salary/service/AddUpDeductionService.java | 47 ++++++++- .../salary/web/AddUpDeductionController.java | 98 +++++++++++++++++-- .../salary/wrapper/AddUpDeductionWrapper.java | 47 +++++++++ 5 files changed, 238 insertions(+), 13 deletions(-) create mode 100644 src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java create mode 100644 src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java new file mode 100644 index 000000000..5ef39f2e0 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestResultDTO.java @@ -0,0 +1,34 @@ +package com.engine.salary.entity.datacollection.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 数据采集-累计专项附加扣除-在线获取结果 + * + * @author chengliming + * @date 2022-11-01 09:47:27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ApiModel("数据采集-累计专项附加扣除-在线获取结果") +public class AddUpDeductionRequestResultDTO { + @ApiModelProperty("请求id") + private String requestId; + + @ApiModelProperty("提示语") + private String msg; + + @ApiModelProperty("处理结果") + private String result; + + @ApiModelProperty("是否结束轮询") + private Boolean finish; +} diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java new file mode 100644 index 000000000..843ecd238 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.entity.datacollection.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 数据采集-累计专项附加月份+扣缴主体参数 + * + * @author : chengliming + * @Date: 2022-09-29 10:38:25 + */ +@Data +@ApiModel("数据采集-累计专项附加月份+扣缴主体参数") +public class AddUpDeductionMonthTaxAgentParam { + + @ApiModelProperty("税款所属期") + private Date declareMonth; + + @ApiModelProperty("个税扣缴义务人的主键id") + private Long taxAgentId; + +} diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 51498f653..6f7a5f372 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -3,10 +3,8 @@ package com.engine.salary.service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -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.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -157,4 +155,45 @@ public interface AddUpDeductionService { * @author lfc */ String autoAddAll(Date yearMonth, Boolean isAdmin); + + /** + * 在线获取数据 + * + * @param param + * @return + */ + Map onlineRequest(AddUpDeductionMonthTaxAgentParam param); + + /** + * 在线获取结果查询 + * + * @return + */ + AddUpDeductionRequestResultDTO onlineFeedback(); + + /** + * 在线获取失败记录 + * + * @param queryParam + * @return + */ + PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam); + + /** + * 获取反馈失败记录 + * + * @param requestId + * @param tenantKey + * @return + */ + List getAddUpDeductionRequestFailPOList(Long requestId); + + /** + * 导出反馈失败记录 + * + * @param map + * @param requestId + */ + void exportOnlineFeedbackFail(Map map, Long requestId); + } diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index b153fd475..ef2754c5e 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -12,11 +12,13 @@ import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.wrapper.AddUpDeductionWrapper; +import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.jetbrains.annotations.Nullable; +import org.springframework.web.bind.annotation.RequestParam; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -35,10 +37,7 @@ import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -271,8 +270,8 @@ public class AddUpDeductionController { } /** - * @description 新建累计专项附加扣除 * @return String + * @description 新建累计专项附加扣除 * @author Harryxzy * @date 2022/10/26 14:23 */ @@ -285,8 +284,8 @@ public class AddUpDeductionController { } /** - * @description 获取累计专项附加扣除信息 * @return String + * @description 获取累计专项附加扣除信息 * @author Harryxzy * @date 2022/10/31 11:23 */ @@ -300,8 +299,8 @@ public class AddUpDeductionController { /** - * @description 编辑累计专项附加扣除 * @return String + * @description 编辑累计专项附加扣除 * @author Harryxzy * @date 2022/10/25 14:08 */ @@ -314,8 +313,8 @@ public class AddUpDeductionController { } /** - * @description 累计专项附加扣除-删除所选 * @return String + * @description 累计专项附加扣除-删除所选 * @author Harryxzy * @date 2022/10/27 14:08 */ @@ -328,8 +327,8 @@ public class AddUpDeductionController { } /** - * @description 累计专项附加扣除-一键清空 * @return String + * @description 累计专项附加扣除-一键清空 * @author Harryxzy * @date 2022/10/27 14:08 */ @@ -353,6 +352,7 @@ public class AddUpDeductionController { /** * 一键自动累计 + * * @return */ @POST @@ -374,4 +374,84 @@ public class AddUpDeductionController { User user = HrmUserVarify.getUser(request, response); return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::autoAddAll, date); } + + + /** + * 在线获取 + * + * @param param 前端请求参数 + * @return WeaResult 接口返回信息 + */ + @Path("/online/request") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionMonthTaxAgentParam param) { + Map result = addUpDeductionWrapper.onlineRequest(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); + if (Objects.nonNull(result.get("msg"))) { + return WeaResult.fail(result.get("msg").toString()); + } + return WeaResult.success(null); + } + + /** + * 在线获取结果查询 + * + * @return WeaResult 接口返回信息 + */ + @Path("/online/feedback") + @GET + @Produces(MediaType.APPLICATION_JSON) + public String onlineFeedback() { + return WeaResult.success(addUpDeductionWrapper.onlineFeedback(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + } + + /** + * 在线获取失败结果查询 + * + * @return WeaResult 接口返回信息 + */ + @Path("/online/feedback/fail") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String onlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionRequestFailQueryParam queryParam) { + return WeaResult.success(addUpDeductionWrapper.onlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), queryParam)); + } + + /** + * 在线获取结果导出 + * + * @return WeaResult 接口返回信息 + */ + @Path("/online/feedback/fail/export") + @GET + @Produces(MediaType.APPLICATION_JSON) + public String exportOnlineFeedbackFail(@RequestParam Long requestId) { + return WeaResult.success(addUpDeductionWrapper.exportOnlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), requestId)); + } + + /** + * 在线获取表单 + * + * @return WeaResult 返回结果 + */ + @Path("/online/request/form") + @GET + @Produces(MediaType.APPLICATION_JSON) + public String getForm() { + return WeaResult.success(addUpDeductionWrapper.getRequestForm()); + } + + /** + * 自动计算次月 + * + * @param queryParam 查询条件 + * @return WeaResult 返回结果 + */ + @Path("/autoCalculate") + @POST + @Produces(MediaType.APPLICATION_JSON) + public String autoCalculate(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionQueryParam queryParam) { + addUpDeductionWrapper.autoCalculate(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); + return WeaResult.success(null); + } } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index aa89c3c58..3ac0dfe17 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -179,4 +179,51 @@ public class AddUpDeductionWrapper extends Service { } return getAddUpDeductionService(user).autoAddAll(yearMonth, null); } + + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param, Long currentEmployeeId, String currentTenantKey) { + return addUpDeductionService.onlineRequest(param, currentEmployeeId, currentTenantKey); + } + + public AddUpDeductionRequestResultDTO onlineFeedback(Long currentEmployeeId, String currentTenantKey) { + return addUpDeductionService.onlineFeedback(currentEmployeeId, currentTenantKey); + } + + public WeaTable onlineFeedbackFail(Long currentEmployeeId, String currentTenantKey, AddUpDeductionRequestFailQueryParam queryParam) { + if (queryParam.getRequestId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 153345, "在线获取的请求ID不可为空")); + } + Page page = addUpDeductionService.onlineFeedbackFail(currentEmployeeId, currentTenantKey, queryParam); + return SalaryFormatUtil.getInstance().buildTable(AddUpDeductionRequestFailListDTO.class, page); + } + + public Map exportOnlineFeedbackFail(Long employeeId, String tenantKey, Long requestId) { + List poList = addUpDeductionService.getAddUpDeductionRequestFailPOList(requestId, tenantKey); + if (CollectionUtils.isEmpty(poList)) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95795, "数据不存在") + "[id:%s]", requestId)); + } + // 构建异步导出参数 + Map map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail"); + map.put("sheetName", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 183778, "在线获取专项附加扣除失败数据")); + LocalRunnable localRunnable = new LocalRunnable() { + @Override + public void execute() { + try { + DSTenantKeyThreadVar.tenantKey.set(tenantKey); + addUpDeductionService.exportOnlineFeedbackFail(map, requestId, employeeId, tenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + } + }; + ThreadPoolUtil.execute(localRunnable); + return map; + } + + public WeaForm getRequestForm() { + WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); + WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); + item.setRequired(true); + weaForm.getItems().put("declareMonth", item); + return weaForm; + } } From c0c29b74728eb12c07b2af8a3f5cee8a44c8488f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 4 Sep 2023 09:29:00 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E4=B8=93=E9=A1=B9=E9=99=84=E5=8A=A0=E6=89=A3?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacollection/bo/DataCollectionBO.java | 91 +-- .../dto/AddUpDeductionRequestFailListDTO.java | 57 ++ .../AddUpDeductionRequestFailQueryParam.java | 25 + .../po/AddUpDeductionRequestFailPO.java | 72 +++ .../po/AddUpDeductionRequestPO.java | 67 ++ .../po/DataCollectionBaseInfo.java | 51 ++ .../response/QuerySpecialAmountResponse.java | 8 +- .../employeedeclare/po/EmployeeDeclarePO.java | 1 + .../EnumAddUpDeductionRequestStatus.java | 52 ++ .../employeedeclare/EmployeeDeclareMapper.xml | 6 + .../salary/service/AddUpDeductionService.java | 3 +- .../impl/AbstractTaxPaymentService.java | 2 +- .../impl/AddUpDeductionServiceImpl.java | 587 +++++++++++++++++- 13 files changed, 960 insertions(+), 62 deletions(-) create mode 100644 src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java create mode 100644 src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java create mode 100644 src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java create mode 100644 src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java create mode 100644 src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java create mode 100644 src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java diff --git a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java index db9a2241d..ad132635e 100644 --- a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java +++ b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java @@ -1,14 +1,25 @@ package com.engine.salary.entity.datacollection.bo; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.engine.salary.enums.SalaryOnOffEnum; +import com.engine.salary.enums.employeedeclare.CardTypeEnum; +import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum; +import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum; +import com.engine.salary.enums.employeedeclare.GenderEnum; import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum; +import com.engine.salary.service.impl.AddUpDeductionServiceImpl; +import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.SalaryI18nUtil; import dm.jdbc.util.IdGenerator; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -318,34 +329,34 @@ public class DataCollectionBO { return requestParam; } -// public static List> getEmployeeList(List declarePOList) { -// List> employeeList = new ArrayList<>(); -// for (EmployeeDeclarePO employeeDeclarePO : declarePOList) { -// Map employeeMap = new HashMap<>(32); -// employeeMap.put("xm", employeeDeclarePO.getEmployeeName()); -// employeeMap.put("zzlx", CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()); -// employeeMap.put("zzhm", employeeDeclarePO.getCardNum()); -// employeeMap.put("lxdh", employeeDeclarePO.getMobile()); -// employeeMap.put("nsrzt", EmploymentStatusEnum.NORMAL.getDefaultLabel()); -// employeeMap.put("sfgy", EmploymentTypeEnum.EMPLOYEE.getDefaultLabel()); -// employeeMap.put("rzsgrq", SalaryDateUtil.DATE_FORMATTER.format(employeeDeclarePO.getEmploymentDate())); -// employeeMap.put("xb", GenderEnum.MALE.getValue().equals(employeeDeclarePO.getGender()) ? GenderEnum.MALE.getDefaultLabel() : GenderEnum.FEMALE.getDefaultLabel()); -// employeeMap.put("csny", SalaryDateUtil.DATE_FORMATTER.format(employeeDeclarePO.getBirthday())); -// employeeMap.put("gj", "中国"); -// employeeMap.put("rydq", "境内"); -// boolean disability = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getDisability()); -// boolean martyrDependents = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getMartyrDependents()); -// employeeMap.computeIfAbsent("sfcj", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDisability()).getDefaultLabel()); -// employeeMap.computeIfAbsent("cjzh", e -> disability ? employeeDeclarePO.getDisabilityCardNo() : null); -// employeeMap.computeIfAbsent("sfls", e->SalaryOnOffEnum.parseByValue(employeeDeclarePO.getMartyrDependents()).getDefaultLabel()); -// employeeMap.computeIfAbsent("lszh", e-> martyrDependents ? employeeDeclarePO.getMartyrDependentsCardNo() : null); -// employeeMap.computeIfAbsent("sfgl", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getLonelyOld()).getDefaultLabel()); -// employeeMap.computeIfAbsent("sfzdw", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDeductExpenses()).getDefaultLabel()); -// employeeList.add(employeeMap); -// } -// return employeeList; -// } -// + public static List> getEmployeeList(List declarePOList) { + List> employeeList = new ArrayList<>(); + for (EmployeeDeclarePO employeeDeclarePO : declarePOList) { + Map employeeMap = new HashMap<>(32); + employeeMap.put("xm", employeeDeclarePO.getEmployeeName()); + employeeMap.put("zzlx", CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()); + employeeMap.put("zzhm", employeeDeclarePO.getCardNum()); + employeeMap.put("lxdh", employeeDeclarePO.getMobile()); + employeeMap.put("nsrzt", EmploymentStatusEnum.NORMAL.getDefaultLabel()); + employeeMap.put("sfgy", EmploymentTypeEnum.EMPLOYEE.getDefaultLabel()); + employeeMap.put("rzsgrq", SalaryDateUtil.getFormatYYYYMM(employeeDeclarePO.getEmploymentDate())); + employeeMap.put("xb", GenderEnum.MALE.getValue().equals(employeeDeclarePO.getGender()) ? GenderEnum.MALE.getDefaultLabel() : GenderEnum.FEMALE.getDefaultLabel()); + employeeMap.put("csny", SalaryDateUtil.getFormatYYYYMM(employeeDeclarePO.getBirthday())); + employeeMap.put("gj", "中国"); + employeeMap.put("rydq", "境内"); + boolean disability = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getDisability()); + boolean martyrDependents = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getMartyrDependents()); + employeeMap.computeIfAbsent("sfcj", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDisability()).getDefaultLabel()); + employeeMap.computeIfAbsent("cjzh", e -> disability ? employeeDeclarePO.getDisabilityCardNo() : null); + employeeMap.computeIfAbsent("sfls", e->SalaryOnOffEnum.parseByValue(employeeDeclarePO.getMartyrDependents()).getDefaultLabel()); + employeeMap.computeIfAbsent("lszh", e-> martyrDependents ? employeeDeclarePO.getMartyrDependentsCardNo() : null); + employeeMap.computeIfAbsent("sfgl", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getLonelyOld()).getDefaultLabel()); + employeeMap.computeIfAbsent("sfzdw", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDeductExpenses()).getDefaultLabel()); + employeeList.add(employeeMap); + } + return employeeList; + } + // public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { // return AddUpDeduction.builder() // .id(IdGenerator.generate()) @@ -379,18 +390,18 @@ public class DataCollectionBO { // .tenantKey(requestPO.getTenantKey()) // .build(); // } -// -// public static AddUpDeductionRequestResultDTO buildRequestResultDTO(Long requestId, AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper) { -// return AddUpDeductionRequestResultDTO.builder() -// .requestId(requestId.toString()) -// .msg(String.format(SalaryI18nUtil.getI18nLabel(184070, "共成功获取数据%s条,失败%s条"), -// requestWrapper.getInsertList().size() + requestWrapper.getUpdateList().size(), -// requestWrapper.getFailPOList().size())) -// .result(requestWrapper.getFailPOList().size() > 0 ? "warning" : "success") -// .finish(true) -// .build(); -// } -// + + public static AddUpDeductionRequestResultDTO buildRequestResultDTO(Long requestId, AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper) { + return AddUpDeductionRequestResultDTO.builder() + .requestId(requestId.toString()) + .msg(String.format(SalaryI18nUtil.getI18nLabel(184070, "共成功获取数据%s条,失败%s条"), + requestWrapper.getInsertList().size() + requestWrapper.getUpdateList().size(), + requestWrapper.getFailPOList().size())) + .result(requestWrapper.getFailPOList().size() > 0 ? "warning" : "success") + .finish(true) + .build(); + } + // public static AddUpDeduction buildAddUpDeductionPO(AddUpDeductionSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { // return AddUpDeduction.builder() // .id(IdGenerator.generate()) diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java new file mode 100644 index 000000000..df82a8178 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRequestFailListDTO.java @@ -0,0 +1,57 @@ +package com.engine.salary.entity.datacollection.dto; + +import com.engine.salary.annotation.SalaryTableColumn; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +/** + * 数据采集-累计专项附加扣除-在线获取失败列表 + * + * @author chengliming + * @date 2022-11-07 15:01:25 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("数据采集-累计专项附加扣除-在线获取失败列表") +public class AddUpDeductionRequestFailListDTO { + + @SalaryTableColumn(text = "姓名", labelId = 85429, width = "100") + @ApiModelProperty("姓名") + private String employeeName; + + @ApiModelProperty("员工id") + private Long employeeId; + + @ApiModelProperty("id主键") + private String id; + + @ApiModelProperty("人员类型") + private String employeeType; + + @SalaryTableColumn(text = "个税扣缴义务人", labelId = 86184, width = "150") + @ApiModelProperty("个税扣缴义务人") + private String taxAgentName; + + @SalaryTableColumn(text = "工号", labelId = 86317, width = "100") + @ApiModelProperty("工号") + private String jobNum; + + @SalaryTableColumn(text = "部门", labelId = 86185, width = "100") + @ApiModelProperty("部门") + private String departmentName; + + @SalaryTableColumn(text = "身份证件号码", labelId = 102782, width = "150") + @ApiModelProperty("证件号码") + private String idNo; + + @SalaryTableColumn(text = "失败原因", labelId = 144832, width = "600") + @ApiModelProperty("失败原因") + private String failReason; +} diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java new file mode 100644 index 000000000..2be0f746d --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionRequestFailQueryParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.entity.datacollection.param; + +import com.engine.salary.common.BaseQueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + * 数据采集-累计专项附加扣除-在线获取失败记录查询参数 + * + * @author chengliming + * @date 2022-11-01 14:40:36 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("数据采集-累计专项附加扣除-在线获取失败记录查询参数") +public class AddUpDeductionRequestFailQueryParam extends BaseQueryParam { + + @ApiModelProperty("请求ID") + private Long requestId; + +} diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java new file mode 100644 index 000000000..8ef9bc47d --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java @@ -0,0 +1,72 @@ +package com.engine.salary.entity.datacollection.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 数据采集-累计专项附加扣除在线查询失败表 + *

Copyright: Copyright (c) 2023

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_add_up_deduction_req_fail") +//数据采集-累计专项附加扣除在线查询失败表") +public class AddUpDeductionRequestFailPO implements Serializable { + + private static final long serialVersionUID = -4950145856639514995L; + + //ID") + private Long id; + + //创建时间", ignore = true) + private LocalDateTime createTime; + + //修改时间", ignore = true) + private LocalDateTime updateTime; + + //创建人id", ignore = true) + private long creator; + + //是否删除", ignore = true) + private int deleteType; + + //租户KEY", ignore = true) + private String tenantKey; + + //查询请求ID") + private Long requestId; + + //外部查询请求ID") + private String outerRequestId; + + //员工Id") + private Long employeeId; + + //个税扣缴义务人ID") + private Long taxAgentId; + + //失败原因") + private String reason; + + //税款所属期") + private LocalDate taxYearMonth; + + /** + * @see com.weaver.hrm.salary.enums.salaryaccounting.EmployeeTypeEnum + */ + //人员类型") + private Integer employeeType; + +} diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java new file mode 100644 index 000000000..90a993052 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java @@ -0,0 +1,67 @@ +package com.engine.salary.entity.datacollection.po; + +import com.engine.salary.enums.datacollection.EnumAddUpDeductionRequestStatus; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * 数据采集-累计专项附加扣除在线查询表 + * + * @author chengliming + * @date: 2022-10-26 16:07:04 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_add_up_deduction_request") +//数据采集-累计专项附加扣除在线查询表") +public class AddUpDeductionRequestPO implements Serializable { + + private static final long serialVersionUID = 1452863635879051515L; + + //ID") + private long id; + + //创建时间", ignore = true) + private Date createTime; + + //修改时间", ignore = true) + private Date updateTime; + + //创建人id", ignore = true) + private long creator; + + //是否删除", ignore = true) + private int deleteType; + + //租户KEY", ignore = true) + private String tenantKey; + + //乐观锁版本", ignore = true) + private int lockVersion; + + //查询请求ID") + private Long requestId; + + //外部接口查询请求ID") + private String outerRequestId; + + /** + * @see EnumAddUpDeductionRequestStatus + */ + //请求处理状态") + private int requestStatus; + + //税款所属期") + private Date taxYearMonth; + + //个税扣缴义务人ID") + private Long taxAgentId; + +} diff --git a/src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java b/src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java new file mode 100644 index 000000000..c9ab8ac5a --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/DataCollectionBaseInfo.java @@ -0,0 +1,51 @@ +package com.engine.salary.entity.datacollection.po; + +import java.time.LocalDateTime; + +/** + * 数据采集-抽象接口-方便使用泛型封装方法(po继承类会导致加密aop报错,原因不知,所以这里使用接口抽象) + * + * @author chengliming + * @date: 2022-09-30 10:55:40 + */ +public interface DataCollectionBaseInfo { + + /** + * 获取id + * + * @return + */ + Long getId(); + + Long getModifier(); + + Long getEmployeeId(); + + Long getTaxAgentId(); + + Integer getDeleteType(); + + String getTenantKey(); + + LocalDateTime getCreateTime(); + + LocalDateTime getUpdateTime(); + + void setId(Long id); + + void setModifier(Long modifier); + + void setEmployeeId(Long employeeId); + + void setTaxAgentId(Long taxAgentId); + + void setDeleteType(Integer deleteType); + + void setTenantKey(String tenantKey); + + void setCreateTime(LocalDateTime createTime); + + void setUpdateTime(LocalDateTime updateTime); + + void setCreator(Long creator); +} diff --git a/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java b/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java index 4562612e1..fc5503724 100644 --- a/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java +++ b/src/com/engine/salary/entity/datacollection/response/QuerySpecialAmountResponse.java @@ -2,28 +2,28 @@ package com.engine.salary.entity.datacollection.response; import com.engine.salary.entity.taxpayment.response.BaseResponse; import lombok.Data; +import lombok.EqualsAndHashCode; /** * 人员专项附加扣除信息查询结果 - *

Copyright: Copyright (c) 2023

- *

Company: 泛微软件

* * @author qiantao * @version 1.0 **/ @Data +@EqualsAndHashCode(callSuper = true) public class QuerySpecialAmountResponse extends BaseResponse { /** * 返回数据 */ - private QuerySpecialAmountBody body; + private Body body; /** * 人员专项附加扣除信息查询结果body **/ @Data - public static class QuerySpecialAmountBody { + public static class Body { /** * 请求查询ID */ diff --git a/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java b/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java index a8c23d03b..b589d29c5 100644 --- a/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java +++ b/src/com/engine/salary/entity/employeedeclare/po/EmployeeDeclarePO.java @@ -219,4 +219,5 @@ public class EmployeeDeclarePO { private Collection ids; private Collection employeeIds; + private Collection taxAgentIds; } diff --git a/src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java b/src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java new file mode 100644 index 000000000..49cda3f90 --- /dev/null +++ b/src/com/engine/salary/enums/datacollection/EnumAddUpDeductionRequestStatus.java @@ -0,0 +1,52 @@ +package com.engine.salary.enums.datacollection; + +import java.util.HashMap; +import java.util.Map; + +/** + * 累计附加扣除请求外部接口处理状态 + * + * @author chengliming + * @date 2021-10-26 16:50:52 + */ +@SuppressWarnings("squid:S00115") +public enum EnumAddUpDeductionRequestStatus { + + /** + * 待处理(废弃) + */ + READY(10), + /** + * 处理中 + */ + RUNNING(20), + /** + * 已完成 + */ + COMPLETED(99), + ; + + private final Integer value; + + private static final Map VALUE_NAME_MAP; + + static { + final EnumAddUpDeductionRequestStatus[] values = EnumAddUpDeductionRequestStatus.values(); + VALUE_NAME_MAP = new HashMap<>(values.length); + for (EnumAddUpDeductionRequestStatus value : values) { + VALUE_NAME_MAP.put(value.getValue(), value.name()); + } + } + + EnumAddUpDeductionRequestStatus(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + public static String getName(int index) { + return VALUE_NAME_MAP.get(index); + } +} diff --git a/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml b/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml index e137ec1ab..5f8eab4af 100644 --- a/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml +++ b/src/com/engine/salary/mapper/employeedeclare/EmployeeDeclareMapper.xml @@ -202,6 +202,12 @@ #{id} + + AND tax_agent_id IN + + #{taxAgentId} + + ORDER BY id DESC diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 6f7a5f372..9e9e69876 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -3,8 +3,10 @@ package com.engine.salary.service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -183,7 +185,6 @@ public interface AddUpDeductionService { * 获取反馈失败记录 * * @param requestId - * @param tenantKey * @return */ List getAddUpDeductionRequestFailPOList(Long requestId); diff --git a/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java b/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java index dfb4be9c4..2b001a10c 100644 --- a/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java +++ b/src/com/engine/salary/service/impl/AbstractTaxPaymentService.java @@ -155,7 +155,7 @@ public abstract class AbstractTaxPaymentService extends Service implements TaxPa .orElse(null); String requestId = Optional.ofNullable(queryResponse) .map(QuerySpecialAmountResponse::getBody) - .map(QuerySpecialAmountResponse.QuerySpecialAmountBody::getRequestId) + .map(QuerySpecialAmountResponse.Body::getRequestId) .orElse(null); if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode) || StringUtils.isEmpty(requestId)) { log.info("getAsyncQueryResponse4Payment code error:{}", JSON.toJSONString(queryResponse)); diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index bb0242cf4..c8aeee357 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -1,6 +1,7 @@ package com.engine.salary.service.impl; import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.api.browser.util.ConditionFactory; @@ -11,35 +12,55 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpDeductionBiz; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.constant.SzyhApiConstant; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.datacollection.bo.DataCollectionBO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -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.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountFeedbackResponse; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountResponse; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; +import com.engine.salary.entity.extemp.po.ExtEmpPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; +import com.engine.salary.entity.taxagent.response.SzyhResponseHead; +import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO; +import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO; import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.datacollection.EnumAddUpDeductionRequestStatus; +import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum; +import com.engine.salary.enums.employeedeclare.DeclareStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; +import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; +import com.engine.salary.enums.taxdeclaration.EnumDeclareApiBusinessType; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; +import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; +import com.engine.salary.report.enums.EmployeeTypeEnum; import com.engine.salary.service.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; -import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; -import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; @@ -48,9 +69,13 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import dm.jdbc.util.IdGenerator; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -61,6 +86,9 @@ import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.*; import java.util.*; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; @@ -73,6 +101,7 @@ import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TEN * @author qiantao * @version 1.0 **/ +@Slf4j public class AddUpDeductionServiceImpl extends Service implements AddUpDeductionService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -108,6 +137,30 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user); } + private TaxDeclarationApiConfigService getTaxDeclarationApiConfigService(User user) { + return ServiceUtil.getService(TaxDeclarationApiConfigServiceImpl.class, user); + } + + private TaxAgentTaxReturnService getTaxAgentTaxReturnService(User user) { + return ServiceUtil.getService(TaxAgentTaxReturnServiceImpl.class, user); + } + + private SalaryArchiveService getSalaryArchiveService(User user) { + return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user); + } + + public TaxDeclarationApiBillingService getTaxDeclarationApiBillingService(User user) { + return ServiceUtil.getService(TaxDeclarationApiBillingServiceImpl.class, user); + } + + private EmployeeDeclareMapper getEmployeeDeclareMapper() { + return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class); + } + + private ExtEmpService getExtEmpService(User user) { + return ServiceUtil.getService(ExtEmpServiceImpl.class, user); + } + @Override public Map getSearchCondition(Map params) { Map apidatas = new HashMap(); @@ -410,7 +463,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction throw new SalaryRunTimeException("该数据不存在!"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId)); if (!canEdit) { //没有编辑权限 throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!"); @@ -440,7 +493,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction //税款所属期 String declareMonthStr = addUpDeductionRecordParam.getDeclareMonth(); - if (declareMonthStr .equals("")) { + if (declareMonthStr.equals("")) { throw new SalaryRunTimeException("税款所属期不能为空!"); } // 获取所有个税扣缴义务人 @@ -468,7 +521,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .updateTime(now) .creator((long) user.getUID()) .declareMonth(declareMonth).build(); - boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpDeductionRecordParam.getEmployeeId())); + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId(), addUpDeductionRecordParam.getEmployeeId())); if (!employeeSameId) { throw new SalaryRunTimeException("员工信息不存在"); } @@ -552,7 +605,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction throw new SalaryRunTimeException("数据不存在或已被删除!"); } // 判断是否在个税扣缴义务人范围内 - Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst(); if (!first.isPresent()) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内"); } @@ -587,7 +640,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) { // 设置了个税扣缴义务人 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId)); if (!canDelete) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); } @@ -636,12 +689,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public String autoAddAll(Date yearMonth, Boolean isAdmin) { String cacheKey = "addUpDeduction_autoAddAll_processing"; - Object objVal = Util_DataCache.getObjVal( cacheKey); - if(objVal != null){ + Object objVal = Util_DataCache.getObjVal(cacheKey); + if (objVal != null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(135788, "一键累计过于频繁,请稍后再试")); } try { - Util_DataCache.setObjVal(cacheKey,true ); + Util_DataCache.setObjVal(cacheKey, true); //如果是定时任务直接查询所有,isAdmin传true boolean isChief = Boolean.TRUE.equals(isAdmin) || getTaxAgentService(user).isChief((long) user.getUID()); @@ -969,7 +1022,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (getTaxAgentService(user).isOpenDevolution() && !isChief) { List taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId); List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); -// List lastList = getLastListByModifier(employeeId, tenantKey); +// List lastList = getLastListByModifier(employeeId); list = list.stream().filter(f -> // 作为管理员 taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) @@ -1200,4 +1253,506 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return list; } + @Override + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "税款所属期必传")); + // 获取接口配置 + TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true); + // 获取包装类 + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig); + // 获取报税信息 + List taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet()); + List failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList()); + SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "企业未通过验证,暂时无法获取累计专项附加扣除数据,请先在【个税扣缴义务人】菜单验证企业报税信息")); + Map result = new HashMap<>(1); + if (!failReturnPOList.isEmpty()) { + String failTaxAgentNames = failReturnPOList.stream().map(e -> requestWrapper.getTaxAgentMap().get(e.getTaxAgentId())).collect(Collectors.joining("、")); + result.put("msg", String.format(SalaryI18nUtil.getI18nLabel(183782, "%s未通过登记验证,无法在线获取数据"), failTaxAgentNames)); + } + // 获取请求 + List requestPOList = getAddUpDeductionRequestPOS(); + SalaryAssert.isEmpty(requestPOList, SalaryI18nUtil.getI18nLabel(153341, "获取中,稍后请点击【获取结果下载】")); + // 获取报送成功的人员名单 + Map> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth()); + // 开始请求接口获取数据 + List querySpecialAmountBodies = getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList); + // 持久化数据 + persistFeedbackData(param, querySpecialAmountBodies); + return result; + } + + private AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List requestPOList, TaxDeclarationApiConfigPO apiConfig) { + boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); + long employeeId = (long) user.getUID(); + boolean isChief = getTaxAgentService(user).isChief(employeeId); + List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAsChief(isOpenDevolution, isChief) : getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); + Set taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); + // 获取薪资档案 + List salaryArchiveList = getSalaryArchiveService(user).listByRunStatus(Arrays.asList( + SalaryArchiveStatusEnum.FIXED.getValue(), + SalaryArchiveStatusEnum.SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) + ); + salaryArchiveList = salaryArchiveList.stream().filter(e -> taxAgentIdSet.contains(e.getTaxAgentId())).collect(Collectors.toList()); + AddUpDeductionOnlineRequestWrapper requestWrapper = new AddUpDeductionOnlineRequestWrapper(requestPOList, salaryArchiveList, taxAgents); + requestWrapper.setApiConfig(apiConfig); + return requestWrapper; + } + + private Map> getEmpDeclareMap(Collection taxAgentIds, Date declareMonth) { + List employeeDeclarePOS = getEmployeeDeclarePOList(taxAgentIds, declareMonth); + SalaryAssert.notEmpty(employeeDeclarePOS, SalaryI18nUtil.getI18nLabel(183783, "暂无人员报送状态为正常的数据,请先报送再获取累计专项附加扣除数据。")); + return employeeDeclarePOS.stream().collect(Collectors.groupingBy(EmployeeDeclarePO::getTaxAgentId)); + } + + private List getEmployeeDeclarePOList(Collection taxAgentIds, Date declareMonth) { + return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().declareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue()).taxCycle(declareMonth).taxAgentIds(taxAgentIds).build()); + } + + private List getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param, + AddUpDeductionOnlineRequestWrapper requestWrapper, + Map> taxAgentEmployeeDeclareMap, + List taxReturnPOList) { + List queryResponseList = new ArrayList<>(); + for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) { + if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) { + continue; + } + // 发起请求 + String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId()); + List declarePOList = taxAgentEmployeeDeclareMap.getOrDefault(returnPO.getTaxAgentId(), new ArrayList<>()); + if (declarePOList.isEmpty()) { + log.info("该主体下没有报送成功的人员,主体名称:{}", taxAgentName); + continue; + } + QuerySpecialAmountResponse queryResponse = getQuerySpecialAmountResponse(returnPO, taxAgentName, declarePOList, param, requestWrapper.getApiConfig()); + // 校验请求结果 + String responseCode = Optional.ofNullable(queryResponse) + .map(QuerySpecialAmountResponse::getHead) + .map(SzyhResponseHead::getCode) + .orElse(null); + String outerRequestId = Optional.ofNullable(queryResponse) + .map(QuerySpecialAmountResponse::getBody) + .map(QuerySpecialAmountResponse.Body::getRequestId) + .orElse(null); + if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode) || StringUtils.isEmpty(outerRequestId)) { + log.info("getQuerySpecialAmountBodies error:{}", JSON.toJSONString(queryResponse)); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试")); + } + queryResponse.getBody().setTaxAgentId(returnPO.getTaxAgentId()); + queryResponseList.add(queryResponse.getBody()); + } + return queryResponseList; + } + + private void persistFeedbackData(AddUpDeductionMonthTaxAgentParam param, List queryResponseList) { + long requestId = IdGenerator.generate(); + for (QuerySpecialAmountResponse.Body body : queryResponseList) { + AddUpDeductionRequestPO po = AddUpDeductionRequestPO.builder() + .id(IdGenerator.generate()) + .requestId(requestId) + .taxAgentId(body.getTaxAgentId()) + .requestStatus(EnumAddUpDeductionRequestStatus.RUNNING.getValue()) + .outerRequestId(body.getRequestId()) + .taxYearMonth(param.getDeclareMonth()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(DEFAULT_TENANT_KEY) + .createTime(new Date()) + .updateTime(new Date()) + .creator(user.getUID()) + .lockVersion(0) + .build(); + addUpDeductionRequestMapper.insert(po); + } + } + + private QuerySpecialAmountResponse getQuerySpecialAmountResponse(TaxAgentTaxReturnPO returnPO, + String taxAgentName, + List declarePOList, + AddUpDeductionMonthTaxAgentParam param, + TaxDeclarationApiConfigPO apiConfig) { + String url = apiConfig.getHost() + SzyhApiConstant.QUERY_SPECIAL_AMOUNT; + Map requestParam = DataCollectionBO.getApiBaseQueryParams(returnPO, taxAgentName, SalaryDateUtil.getFormatYYYYMM(param.getDeclareMonth())); + requestParam.put("rylb", DataCollectionBO.getEmployeeList(declarePOList)); + String reqJson = JsonUtil.toJsonString(requestParam); + log.info("getQuerySpecialAmountResponse params --- \n{}\n", reqJson); + Map params = new HashMap<>(1); + Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); + // 开始请求 + String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); + log.info("getQuerySpecialAmountResponse res --- {}", res); + return JsonUtil.parseObject(res, QuerySpecialAmountResponse.class); + } + + @Override + public AddUpDeductionRequestResultDTO onlineFeedback() { + TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true); + List requestPOList = getAddUpDeductionRequestPOS(); + // 校验请求是否合法 + Long requestId = checkRequestPOList(requestPOList); + // 前置数据封装为包装类 + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(requestPOList, apiConfig); + // 开始请求反馈数据 + AddUpDeductionRequestResultDTO resultDTO = getQuerySpecialAmountFeedback(requestWrapper); + // 判断是否需要继续轮询或者异常退出 + if (!resultDTO.getFinish()) { + return resultDTO; + } + // 更新请求状态为已完成 + updateRequestStatus(requestPOList, EnumAddUpDeductionRequestStatus.RUNNING.getValue(), EnumAddUpDeductionRequestStatus.COMPLETED.getValue()); + // 获取员工信息 + setEmployeeInfoMap(requestWrapper); + // 获取已存在的累计附加扣除数据 + setExistedDataMap(requestWrapper); + // 开始处理反馈结果 + TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper + = new TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper(requestPOList.get(0).getTaxYearMonth(), requestWrapper.getApiConfig(), EnumDeclareApiBusinessType.ADD_UP_DEDUCTION); + handleFeedbackData(requestWrapper, apiFlowUpdateWrapper); + // 持久化数据 + persistFeedbackData(requestWrapper); + // 更新流量统计数据 + getTaxDeclarationApiBillingService(user).updateApiFlowInfo(apiFlowUpdateWrapper); + // 返回结果 + return DataCollectionBO.buildRequestResultDTO(requestId, requestWrapper); + } + + @Override + public PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) { + Page page = new LambdaQueryChainWrapper<>(addUpDeductionRequestFailMapper) + .eq(AddUpDeductionRequestFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .eq(AddUpDeductionRequestFailPO::getTenantKey) + .eq(AddUpDeductionRequestFailPO::getRequestId, queryParam.getRequestId()) + .page(new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), queryParam.getTotal(), true)); + + // 获取薪资档案 + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null); + this.getEmployeeInfoMap(requestWrapper); + + List listDTOList = page.getRecords().stream() + .map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList()); + PageInfo listDTOPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), false); + listDTOPage.setRecords(listDTOList); + return listDTOPage; + } + + @Override + public List getAddUpDeductionRequestFailPOList(Long requestId) { + return new LambdaQueryChainWrapper<>(addUpDeductionRequestFailMapper) + .eq(AddUpDeductionRequestFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .eq(AddUpDeductionRequestFailPO::getTenantKey) + .eq(AddUpDeductionRequestFailPO::getRequestId, requestId) + .list(); + } + + @Override + public void exportOnlineFeedbackFail(Map map, Long requestId) { + List> rows = new ArrayList<>(); + // 表头 + List headers = new ArrayList<>(); + headers.add(SalaryI18nUtil.getI18nLabel(85429, "姓名")); + headers.add(SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人")); + headers.add(SalaryI18nUtil.getI18nLabel(86317, "工号")); + headers.add(SalaryI18nUtil.getI18nLabel(86185, "部门")); + headers.add(SalaryI18nUtil.getI18nLabel(106277, "身份证号码")); + headers.add(SalaryI18nUtil.getI18nLabel(144832, "失败原因")); + rows.add(headers); + // 获取薪资档案 + AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null); + // 获取身份信息map + this.getEmployeeInfoMap(requestWrapper); + // 获取数据 + List pos = getAddUpDeductionRequestFailPOList(requestId); + // 组装数据 + for (AddUpDeductionRequestFailPO po : pos) { + AddUpDeductionRequestFailListDTO failListDTO = requestWrapper.buildAddUpDeductionRequestFailListDTO(po); + List row = new ArrayList<>(); + row.add(failListDTO.getEmployeeName()); + row.add(failListDTO.getTaxAgentName()); + row.add(failListDTO.getJobNum()); + row.add(failListDTO.getDepartmentName()); + row.add(failListDTO.getIdNo()); + row.add(failListDTO.getFailReason()); + rows.add(row); + } + // 生成表格 + ExcelUtil.genWorkbookV2(rows,""); + } + + + + private void getEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper wrapper) { + // 身份证号 + List employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId,Collectors.toList()); + List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); + Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getEmployeeId); + wrapper.setUserInfoUserIdMap(simpleUserInfoMap); + // 人员信息 + List simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL); + Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); + wrapper.setSimpleEmployeeMap(simpleEmployeeMap); + // 外部人员信息 + List extEmployeePOS = getExtEmpService(user).listCanUse(wrapper.getCurrentEmployeeId()); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getId, e -> e); + wrapper.setExtEmployeePOMap(extEmployeePOMap); + } + + private List getAddUpDeductionRequestPOS() { + return new LambdaQueryChainWrapper<>(addUpDeductionRequestMapper) + .eq(AddUpDeductionRequestPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .eq(AddUpDeductionRequestPO::getTenantKey) + .in(AddUpDeductionRequestPO::getRequestStatus, EnumAddUpDeductionRequestStatus.RUNNING.getValue()) + .list(); + } + + private void handleFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper, TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper) { + requestWrapper.getRequestFeedBackMap().forEach((outerRequestId, feedbacks) -> feedbacks.forEach(feedback -> { + DataCollectionEmployee simpleUserInfo = requestWrapper.getUserInfoIdNoMap().get(feedback.getZzhm()); + Long extEmpId = requestWrapper.getExtEmployeeIdCardMap().get(feedback.getZzhm()); + Long employeeId = Optional.ofNullable(simpleUserInfo) + .map(DataCollectionEmployee::getUser) + .map(IdEntity::getId) + .orElse(extEmpId); + AddUpDeductionRequestPO requestPO = requestWrapper.getRequestPoMap().get(outerRequestId); + + // 流量使用情况 + TaxDeclarationApiFlowRecordPO flowRecordPO = TaxApiFlowBO.buildTaxDeclarationApiFlowRecordPO(apiFlowUpdateWrapper, requestPO.getTaxAgentId(), employeeId); + + if (employeeId == null || StringUtils.isNotEmpty(feedback.getSbyy())) { + // 处理失败数据 + AddUpDeductionRequestFailPO failPO = DataCollectionBO.buildAddUpDeductionRequestFailPO(requestWrapper, requestPO, employeeId); + failPO.setReason(employeeId == null + ? String.format("该人员报送成功的身份证号与人事档案下的身份证号不一致,报送人员信息:[%s]|[%s]", feedback.getXm(), feedback.getZzhm()) + : feedback.getSbyy()); + failPO.setEmployeeType(simpleUserInfo != null ? EmployeeTypeEnum.ORGANIZATION.getValue() : + extEmpId != null ? EmployeeTypeEnum.EXT_EMPLOYEE.getValue() : 2); + requestWrapper.getFailPOList().add(failPO); + flowRecordPO.setEmployeeId(Optional.ofNullable(employeeId).orElse(0L)); + flowRecordPO.setResultStatus(TaxAgentTaxReturnStatusEnum.FAIL.getValue()); + } else { + // 处理成功数据 + AddUpDeduction po = DataCollectionBO.buildAddUpDeductionPO(feedback); + Long poId = requestWrapper.getExistedDataMap().get(requestPO.getTaxAgentId() + "-" + employeeId); + if (Objects.nonNull(poId)) { + po.setId(poId); + requestWrapper.getUpdateList().add(po); + } else { + setBaseInfo2PO(requestWrapper, employeeId, requestPO, po); + requestWrapper.getInsertList().add(po); + } + } + apiFlowUpdateWrapper.getApiFlowDetailPOList().add(flowRecordPO); + })); + } + + private Long checkRequestPOList(List requestPOList) { + Map> statusRequestMap = SalaryEntityUtil.group2Map(requestPOList, AddUpDeductionRequestPO::getRequestStatus); + if (CollectionUtils.isEmpty(statusRequestMap.get(EnumAddUpDeductionRequestStatus.RUNNING.getValue()))) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153343, "请先点击【在线获取】按钮,选择税款所属期进行获取数据。")); + } + Set requestIds = SalaryEntityUtil.properties(requestPOList, AddUpDeductionRequestPO::getRequestId); + if (requestIds.size() != 1) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153344, "当前同时存在多个任务,请联系管理员进行处理。")); + } + return requestPOList.get(0).getRequestId(); + } + + private void setEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper requestWrapper) { + // 内部员工(详细信息) + List simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG); + Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); + requestWrapper.setSimpleEmployeeMap(simpleEmployeeMap); + // 内部员工(身份证信息) + List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId,Collectors.toList()); + List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); + Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo); + requestWrapper.setUserInfoIdNoMap(simpleUserInfoMap); + // 外部员工信息 + List extEmployeePOS = getExtEmpService(user).listCanUse(requestWrapper.getCurrentEmployeeId(), requestWrapper.getTenantKey()); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getCardNum, ExtEmpPO::getId); + requestWrapper.setExtEmployeeIdCardMap(extEmployeePOMap); + } + + private void setExistedDataMap(AddUpDeductionOnlineRequestWrapper requestWrapper) { + Set taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId); + List poList = new LambdaQueryChainWrapper<>(addUpDeductionMapper) + .select(AddUpDeduction::getId, AddUpDeduction::getTaxAgentId, AddUpDeduction::getEmployeeId) + .eq(AddUpDeduction::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .eq(AddUpDeduction::getTenantKey, requestWrapper.getTenantKey()) + .eq(AddUpDeduction::getDeclareMonth, requestWrapper.getRequestPOList().get(0).getTaxYearMonth()) + .in(AddUpDeduction::getTaxAgentId, taxAgentIds) + .list(); + requestWrapper.setExistedDataMap(SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId(), AddUpDeduction::getId)); + } + + private AddUpDeductionRequestResultDTO getQuerySpecialAmountFeedback(AddUpDeductionOnlineRequestWrapper requestWrapper) { + for (AddUpDeductionRequestPO requestPO : requestWrapper.getRequestPOList()) { + QuerySpecialAmountFeedbackResponse response = getQuerySpecialAmountFeedbackResponse(requestWrapper.getApiConfig(), requestPO); + // 校验请求结果 + String responseCode = Optional.ofNullable(response).map(QuerySpecialAmountFeedbackResponse::getHead).map(SzyhResponseHead::getCode).orElse(null); + String msg = Optional.ofNullable(response).map(QuerySpecialAmountFeedbackResponse::getHead).map(SzyhResponseHead::getMsg).orElse(null); + if (SzyhApiConstant.HANDLING_CODE.equals(responseCode)) { + // 如果接口仍在处理中,则继续轮询 + return AddUpDeductionRequestResultDTO.builder().finish(false).build(); + } + // 获取返回的人员信息列表 + if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode)) { + log.info("getQuerySpecialAmountFeedback not success error:{}", JSON.toJSONString(response)); + throw new SalaryRunTimeException(msg); + } + List feedbacks = Optional.of(response) + .map(QuerySpecialAmountFeedbackResponse::getBody) + .map(QuerySpecialAmountFeedbackResponse.Body::getRyxxlb) + .orElse(new ArrayList<>()); + if (feedbacks.isEmpty()) { + log.info("getQuerySpecialAmountFeedback empty data error:{}", JSON.toJSONString(response)); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(175338, "税局接口错误,未返回有效数据")); + } + requestWrapper.getRequestFeedBackMap().put(requestPO.getOuterRequestId(), feedbacks); + requestWrapper.getRequestPoMap().put(requestPO.getOuterRequestId(), requestPO); + } + return AddUpDeductionRequestResultDTO.builder().finish(true).build(); + } + + private void persistFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper) { + if (!requestWrapper.getInsertList().isEmpty()) { + List> insertPartition = Lists.partition(requestWrapper.getInsertList(), 1000); + insertPartition.forEach(list -> { + list = dataSecurityService.encryptBatch(list, AddUpDeduction.class, requestWrapper.getTenantKey()); + addUpDeductionMapper.insertData(list); + }); + } + if (!requestWrapper.getUpdateList().isEmpty()) { + List> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 1000); + updatePartition.forEach(list -> { + list = dataSecurityService.encryptBatch(list, AddUpDeduction.class, requestWrapper.getTenantKey()); + addUpDeductionMapper.updateData(list); + }); + } + if (!requestWrapper.getFailPOList().isEmpty()) { + List> failPartition = Lists.partition(requestWrapper.getFailPOList(), 1000); + failPartition.forEach(list -> addUpDeductionRequestFailMapper.batchInsert(list)); + } + } + + private void setBaseInfo2PO(AddUpDeductionOnlineRequestWrapper wrapper, Long employeeId, AddUpDeductionRequestPO requestPO, AddUpDeduction po) { + po.setId(IdGenerator.generate()); + po.setDeclareMonth(wrapper.getRequestPOList().get(0).getTaxYearMonth()); + po.setTaxAgentId(requestPO.getTaxAgentId()); + po.setEmployeeId(employeeId); + po.setCreateTime(new Date()); + po.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); +// po.setModifier(wrapper.getCurrentEmployeeId()); + po.setTenantKey(wrapper.getTenantKey()); + po.setCreator(wrapper.getCurrentEmployeeId()); + } + + public void updateRequestStatus(List requestPOList, Integer oldStatus, Integer newStatus) { + for (AddUpDeductionRequestPO requestPO : requestPOList) { + boolean update = new LambdaUpdateChainWrapper<>(addUpDeductionRequestMapper) + .set(AddUpDeductionRequestPO::getRequestStatus, newStatus) + .set(AddUpDeductionRequestPO::getUpdateTime, LocalDateTime.now()) + .set(AddUpDeductionRequestPO::getLockVersion, requestPO.getLockVersion() + 1) + .eq(AddUpDeductionRequestPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .eq(AddUpDeductionRequestPO::getRequestStatus, oldStatus) + .eq(AddUpDeductionRequestPO::getId, requestPO.getId()) + .eq(AddUpDeductionRequestPO::getLockVersion, requestPO.getLockVersion()) + .update(); + SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试")); + } + } + + public QuerySpecialAmountFeedbackResponse getQuerySpecialAmountFeedbackResponse(TaxDeclarationApiConfigPO apiConfig, AddUpDeductionRequestPO requestPO) { + String url = apiConfig.getHost() + SzyhApiConstant.GET_QUERY_SPECIAL_AMOUNT_FEEDBACK; + Map params = new HashMap<>(1); + params.put("requestId", requestPO.getOuterRequestId()); + Map header = SingnatureData.initHeader(Collections.emptyMap(), apiConfig.getAppKey(), apiConfig.getAppSecret()); + String res = HttpUtil.getRequest(url, header, params); + log.info("GET_QUERY_SPECIAL_AMOUNT_FEEDBACK res = {}", res); + return JsonUtil.parseObject(res, QuerySpecialAmountFeedbackResponse.class); + } + + @Data + public static class AddUpDeductionOnlineRequestWrapper { + private String tenantKey; + private Long currentEmployeeId; + // 单次请求对应的反馈数据map + private Map> requestFeedBackMap; + private Map requestPoMap; + // 查询薪资档案(定薪、待停薪、停薪) + private List salaryArchiveList; + private Map taxAgentMap; + // 员工信息map(身份证号 -> 员工ID) + private Map userInfoIdNoMap; + // 员工信息map(员工ID -> 身份证) + private Map userInfoUserIdMap; + // 员工详细信息map(key = 员工ID) + private Map simpleEmployeeMap; + // 获取当前库中累计附加扣除的数据 + private Map existedDataMap; + // 需要新增的数据 + private List insertList; + // 需要更新的数据 + private List updateList; + // 失败数据(分页) + private List failDTOList; + // 失败数据(持久化) + private List failPOList; + // 请求详细信息列表 + private List requestPOList; + // 外部人员(身份证 -> id) + private Map extEmployeeIdCardMap; + // 外部人员(id -> 实体) + private Map extEmployeePOMap; + // api配置 + private TaxDeclarationApiConfigPO apiConfig; + + public AddUpDeductionOnlineRequestWrapper(List requestPOList, + List salaryArchiveList, + List taxAgents) { + this.requestFeedBackMap = new HashMap<>(); + this.requestPoMap = new HashMap<>(); + this.insertList = new ArrayList<>(); + this.updateList = new ArrayList<>(); + this.failDTOList = new ArrayList<>(); + this.failPOList = new ArrayList<>(); + this.salaryArchiveList = salaryArchiveList; + this.requestPOList = requestPOList; + this.tenantKey = tenantKey; + this.currentEmployeeId = currentEmployeeId; + this.taxAgentMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); + } + + public AddUpDeductionRequestFailListDTO buildAddUpDeductionRequestFailListDTO(AddUpDeductionRequestFailPO failPO) { + DataCollectionEmployee userInfo = this.userInfoUserIdMap.get(failPO.getEmployeeId()); + ExtEmpPO extEmployeePO = this.extEmployeePOMap.get(failPO.getEmployeeId()); + DataCollectionEmployee simpleEmployee = this.simpleEmployeeMap.get(failPO.getEmployeeId()); + String departmentName = Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getDepartmentName).orElse(""); + + AddUpDeductionRequestFailListDTO listDTO = AddUpDeductionRequestFailListDTO.builder() + .id(failPO.getId().toString()) + .employeeId(failPO.getEmployeeId()) + .employeeType(EmployeeTypeEnum.parseByValue(failPO.getEmployeeType()).toString()) + .employeeName(Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getUsername) + .orElse(Optional.ofNullable(extEmployeePO).map(ExtEmpPO::getUsername) + .orElse(""))) + .jobNum(Optional.ofNullable(simpleEmployee).map(DataCollectionEmployee::getWorkcode).orElse("")) + .idNo(Optional.ofNullable(userInfo).map(DataCollectionEmployee::getIdNo) + .orElse(Optional.ofNullable(extEmployeePO).map(ExtEmpPO::getIdNo) + .orElse(""))) + .departmentName(Optional.ofNullable(departmentName).orElse("")) + .failReason(failPO.getReason()) + .taxAgentName(this.taxAgentMap.get(failPO.getTaxAgentId())) + .build(); + Pattern pattern = Pattern.compile("\\[+[\\u4e00-\\u9fa5]*+]+\\|+\\[+[0-9]*+]"); + Matcher matcher = pattern.matcher(Optional.ofNullable(failPO.getReason()).orElse("")); + if (matcher.find()) { + String[] split = failPO.getReason().split("\\|"); + listDTO.setEmployeeName(split[0].substring(split[0].indexOf('[') + 1, split[0].indexOf(']'))); + listDTO.setIdNo(split[1].substring(split[1].indexOf('[') + 1, split[1].indexOf(']'))); + } + return listDTO; + } + } + } From 96bfdf05ed56c30a58e3558b00a6871147259561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 4 Sep 2023 14:20:42 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E4=B8=93=E9=A1=B9=E9=99=84=E5=8A=A0=E6=89=A3?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sqlupgrade/DM/sql202309040303.sql | 40 ++ resource/sqlupgrade/GS/sql202309040303.sql | 40 ++ resource/sqlupgrade/JC/sql202309040303.sql | 40 ++ resource/sqlupgrade/Mysql/sql202309040303.sql | 39 ++ .../sqlupgrade/Oracle/sql202309040303.sql | 39 ++ resource/sqlupgrade/PG/sql202309040303.sql | 40 ++ .../sqlupgrade/SQLServer/sql202309040303.sql | 39 ++ resource/sqlupgrade/ST/sql202309040303.sql | 40 ++ .../datacollection/bo/DataCollectionBO.java | 73 ++-- .../po/AddUpDeductionRequestFailPO.java | 16 +- .../po/AddUpDeductionRequestPO.java | 36 +- .../AddUpDeductionRequestFailMapper.java | 80 ++++ .../AddUpDeductionRequestFailMapper.xml | 384 +++++++++++++++++ .../AddUpDeductionRequestMapper.java | 80 ++++ .../AddUpDeductionRequestMapper.xml | 388 ++++++++++++++++++ .../salary/service/SalaryArchiveService.java | 2 + .../impl/AddUpDeductionServiceImpl.java | 106 +++-- .../impl/SalaryArchiveServiceImpl.java | 5 + .../salary/web/AddUpDeductionController.java | 100 ++--- .../salary/wrapper/AddUpDeductionWrapper.java | 83 ++-- 20 files changed, 1466 insertions(+), 204 deletions(-) create mode 100644 resource/sqlupgrade/DM/sql202309040303.sql create mode 100644 resource/sqlupgrade/GS/sql202309040303.sql create mode 100644 resource/sqlupgrade/JC/sql202309040303.sql create mode 100644 resource/sqlupgrade/Mysql/sql202309040303.sql create mode 100644 resource/sqlupgrade/Oracle/sql202309040303.sql create mode 100644 resource/sqlupgrade/PG/sql202309040303.sql create mode 100644 resource/sqlupgrade/SQLServer/sql202309040303.sql create mode 100644 resource/sqlupgrade/ST/sql202309040303.sql create mode 100644 src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java create mode 100644 src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml create mode 100644 src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java create mode 100644 src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml diff --git a/resource/sqlupgrade/DM/sql202309040303.sql b/resource/sqlupgrade/DM/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/GS/sql202309040303.sql b/resource/sqlupgrade/GS/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/JC/sql202309040303.sql b/resource/sqlupgrade/JC/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/Mysql/sql202309040303.sql b/resource/sqlupgrade/Mysql/sql202309040303.sql new file mode 100644 index 000000000..09de22bfa --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key comment 'ID' , + create_time datetime comment 'ʱ' , + update_time datetime comment '޸ʱ' , + creator bigint comment 'id' , + delete_type int default 0 comment 'Ƿɾ' , + tenant_key varchar(10) comment '⻧KEY' , + request_id bigint not null comment 'ѯID' , + request_status tinyint(1) default 1 not null comment '״̬10 20 99' , + tax_year_month datetime not null comment '˰' , + outer_request_id varchar(50) not null comment 'ⲿӿڲѯID' , + tax_agent_id bigint not null comment '˰۽Id' +) +; + +alter table hrsa_add_up_deduction_request add lock_version int +; + +alter table hrsa_add_up_deduction_request modify column lock_version int default 0 +; + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key comment 'ID' , + create_time datetime comment 'ʱ' , + update_time datetime comment '޸ʱ' , + creator bigint comment 'id' , + delete_type int default 0 comment 'Ƿɾ' , + tenant_key varchar(10) comment '⻧KEY' , + request_id bigint not null comment 'ѯID' , + employee_id bigint not null comment 'ԱID' , + employee_type int not null comment 'Ա' , + tax_agent_id bigint not null comment '˰۽ID' , + reason varchar(255) not null comment 'ʧԭ' , + tax_year_month datetime not null comment '˰' , + outer_request_id varchar(50) not null comment 'ⲿӿڲѯid' +) +; \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309040303.sql b/resource/sqlupgrade/Oracle/sql202309040303.sql new file mode 100644 index 000000000..1e666275e --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +) +/ + +alter table hrsa_add_up_deduction_request add lock_version int +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0 +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +) +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309040303.sql b/resource/sqlupgrade/PG/sql202309040303.sql new file mode 100644 index 000000000..eefe81ecd --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key , + create_time timestamp, + update_time timestamp, + creator bigint, + delete_type int default 0, + tenant_key varchar(10), + request_id bigint not null, + request_status smallint default 1 not null, + tax_year_month timestamp not null, + outer_request_id varchar(50) not null, + tax_agent_id bigint not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request alter column lock_version set default 0; +/ + + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key , + create_time timestamp, + update_time timestamp, + creator bigint, + delete_type int default 0, + tenant_key varchar(10), + request_id bigint not null, + employee_id bigint not null, + employee_type int not null, + tax_agent_id bigint not null, + reason varchar(255) not null, + tax_year_month timestamp not null, + outer_request_id varchar(50) not null +); +/ \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309040303.sql b/resource/sqlupgrade/SQLServer/sql202309040303.sql new file mode 100644 index 000000000..bdfa19c5f --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + request_id bigint not null, + request_status tinyint default 1 not null, + tax_year_month datetime not null, + outer_request_id nvarchar(50) not null, + tax_agent_id bigint not null +) +GO + +alter table hrsa_add_up_deduction_request add lock_version int +GO + +alter table hrsa_add_up_deduction_request add constraint df_lock_version_71db6820 default 0 for lock_version +GO + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + request_id bigint not null, + employee_id bigint not null, + employee_type int not null, + tax_agent_id bigint not null, + reason nvarchar(255) not null, + tax_year_month datetime not null, + outer_request_id nvarchar(50) not null +) +GO \ No newline at end of file diff --git a/resource/sqlupgrade/ST/sql202309040303.sql b/resource/sqlupgrade/ST/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java index ad132635e..ace90158f 100644 --- a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java +++ b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java @@ -1,6 +1,10 @@ package com.engine.salary.entity.datacollection.bo; +import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountFeedbackResponse; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.engine.salary.enums.SalaryOnOffEnum; @@ -8,6 +12,7 @@ import com.engine.salary.enums.employeedeclare.CardTypeEnum; import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum; import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum; import com.engine.salary.enums.employeedeclare.GenderEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum; import com.engine.salary.service.impl.AddUpDeductionServiceImpl; import com.engine.salary.util.SalaryDateUtil; @@ -17,10 +22,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @Description: 数据采集 @@ -357,39 +359,40 @@ public class DataCollectionBO { return employeeList; } -// public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { -// return AddUpDeduction.builder() -// .id(IdGenerator.generate()) -// .addUpChildEducation(feedback.getLjznjyzc().toString()) -// .addUpContinuingEducation(feedback.getLjjxjyzc().toString()) -// .addUpHousingRent(feedback.getLjzfzjzc().toString()) -// .addUpInfantCare(feedback.getLjyyezhzc().toString()) -// .addUpHousingLoanInterest(feedback.getLjzfdklxzc().toString()) -// .addUpSupportElderly(feedback.getLjsylrzc().toString()) -// .addUpIllnessMedical("0") + public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { + return AddUpDeduction.builder() + .id(IdGenerator.generate()) + .addUpChildEducation(feedback.getLjznjyzc().toString()) + .addUpContinuingEducation(feedback.getLjjxjyzc().toString()) + .addUpHousingRent(feedback.getLjzfzjzc().toString()) + .addUpInfantCare(feedback.getLjyyezhzc().toString()) + .addUpHousingLoanInterest(feedback.getLjzfdklxzc().toString()) + .addUpSupportElderly(feedback.getLjsylrzc().toString()) + .addUpIllnessMedical("0") // .dataSource(EnumAddUpDeductionDataSource.ONLINE.getValue()) // .lastUpdateTime(LocalDateTime.now()) -// .updateTime(LocalDateTime.now()) -// .build(); -// } -// -// public static AddUpDeductionRequestFailPO buildAddUpDeductionRequestFailPO(AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, -// AddUpDeductionRequestPO requestPO, -// Long employeeId) { -// return AddUpDeductionRequestFailPO.builder() -// .id(IdGenerator.generate()) -// .requestId(requestPO.getRequestId()) -// .outerRequestId(requestPO.getOuterRequestId()) -// .taxYearMonth(requestPO.getTaxYearMonth()) -// .taxAgentId(requestPO.getTaxAgentId()) -// .employeeId(Optional.ofNullable(employeeId).orElse(0L)) -// .createTime(LocalDateTime.now()) -// .updateTime(LocalDateTime.now()) -// .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) -// .creator(requestWrapper.getCurrentEmployeeId()) -// .tenantKey(requestPO.getTenantKey()) -// .build(); -// } + .updateTime(new Date()) + .build(); + } + + public static AddUpDeductionRequestFailPO buildAddUpDeductionRequestFailPO(AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, + AddUpDeductionRequestPO requestPO, + Long employeeId) { + Date now = new Date(); + return AddUpDeductionRequestFailPO.builder() + .id(IdGenerator.generate()) + .requestId(requestPO.getRequestId()) + .outerRequestId(requestPO.getOuterRequestId()) + .taxYearMonth(requestPO.getTaxYearMonth()) + .taxAgentId(requestPO.getTaxAgentId()) + .employeeId(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .creator(requestWrapper.getCurrentEmployeeId()) + .tenantKey(requestPO.getTenantKey()) + .build(); + } public static AddUpDeductionRequestResultDTO buildRequestResultDTO(Long requestId, AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper) { return AddUpDeductionRequestResultDTO.builder() diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java index 8ef9bc47d..7b0883452 100644 --- a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java @@ -1,13 +1,14 @@ package com.engine.salary.entity.datacollection.po; +import com.engine.salary.report.enums.EmployeeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; -import java.time.LocalDate; -import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Date; /** * 数据采集-累计专项附加扣除在线查询失败表 @@ -31,10 +32,10 @@ public class AddUpDeductionRequestFailPO implements Serializable { private Long id; //创建时间", ignore = true) - private LocalDateTime createTime; + private Date createTime; //修改时间", ignore = true) - private LocalDateTime updateTime; + private Date updateTime; //创建人id", ignore = true) private long creator; @@ -61,12 +62,15 @@ public class AddUpDeductionRequestFailPO implements Serializable { private String reason; //税款所属期") - private LocalDate taxYearMonth; + private Date taxYearMonth; /** - * @see com.weaver.hrm.salary.enums.salaryaccounting.EmployeeTypeEnum + * @see EmployeeTypeEnum */ //人员类型") private Integer employeeType; + + private Collection ids; + } diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java index 90a993052..6768edf3f 100644 --- a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +import java.util.Collection; import java.util.Date; /** @@ -19,49 +20,56 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor -//hrsa_add_up_deduction_request") -//数据采集-累计专项附加扣除在线查询表") +//hrsa_add_up_deduction_request +//数据采集-累计专项附加扣除在线查询表 public class AddUpDeductionRequestPO implements Serializable { private static final long serialVersionUID = 1452863635879051515L; - //ID") + //ID private long id; - //创建时间", ignore = true) + //创建时间" private Date createTime; - //修改时间", ignore = true) + //修改时间" private Date updateTime; - //创建人id", ignore = true) + //创建人id" private long creator; - //是否删除", ignore = true) + //是否删除" private int deleteType; - //租户KEY", ignore = true) + //租户KEY" private String tenantKey; - //乐观锁版本", ignore = true) + //乐观锁版本" private int lockVersion; - //查询请求ID") + //查询请求ID private Long requestId; - //外部接口查询请求ID") + //外部接口查询请求ID private String outerRequestId; /** * @see EnumAddUpDeductionRequestStatus */ - //请求处理状态") + //请求处理状态 private int requestStatus; - //税款所属期") + //税款所属期 private Date taxYearMonth; - //个税扣缴义务人ID") + //个税扣缴义务人ID private Long taxAgentId; + + + private Collection ids; + private Collection requestStatuss; + private Integer oldStatus; + private Integer oldLockVersion; + } diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java new file mode 100644 index 000000000..1a2287833 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java @@ -0,0 +1,80 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AddUpDeductionRequestFailMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + AddUpDeductionRequestFailPO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param addUpDeductionReqFail 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 批量插入 + * + * @param list + */ + void batchInsert(@Param("collection") Collection list); + + /** + * 修改,修改所有字段 + * + * @param addUpDeductionReqFail 修改的记录 + * @return 返回影响行数 + */ + int update(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 修改,忽略null字段 + * + * @param addUpDeductionReqFail 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 删除记录 + * + * @param addUpDeductionReqFail 待删除的记录 + * @return 返回影响行数 + */ + int delete(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 批量删除记录 + * @param ids 主键id集合 + */ + void deleteByIds(@Param("ids") Collection ids); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml new file mode 100644 index 000000000..e0e740698 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.employee_id + , t.employee_type + , t.id + , t.outer_request_id + , t.reason + , t.request_id + , t.tax_agent_id + , t.tax_year_month + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_add_up_deduction_req_fail + + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + employee_type, + + + id, + + + outer_request_id, + + + reason, + + + request_id, + + + tax_agent_id, + + + tax_year_month, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{employeeType}, + + + #{id}, + + + #{outerRequestId}, + + + #{reason}, + + + #{requestId}, + + + #{taxAgentId}, + + + #{taxYearMonth}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + + + select + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + from dual + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + + + UPDATE hrsa_add_up_deduction_req_fail + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + employee_type=#{employeeType}, + outer_request_id=#{outerRequestId}, + reason=#{reason}, + request_id=#{requestId}, + tax_agent_id=#{taxAgentId}, + tax_year_month=#{taxYearMonth}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_req_fail + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + employee_type=#{employeeType}, + + + outer_request_id=#{outerRequestId}, + + + reason=#{reason}, + + + request_id=#{requestId}, + + + tax_agent_id=#{taxAgentId}, + + + tax_year_month=#{taxYearMonth}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_req_fail + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_add_up_deduction_req_fail + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java new file mode 100644 index 000000000..5df335a15 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java @@ -0,0 +1,80 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AddUpDeductionRequestMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(AddUpDeductionRequestPO addUpDeductionRequest); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + AddUpDeductionRequestPO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param addUpDeductionRequest 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 批量插入 + * + * @param addUpDeductionRequest + */ + void batchInsert(@Param("collection") List addUpDeductionRequest); + + /** + * 修改,修改所有字段 + * + * @param addUpDeductionRequest 修改的记录 + * @return 返回影响行数 + */ + int update(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 修改,忽略null字段 + * + * @param addUpDeductionRequest 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 删除记录 + * + * @param addUpDeductionRequest 待删除的记录 + * @return 返回影响行数 + */ + int delete(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 批量删除记录 + * @param ids 主键id集合 + */ + void deleteByIds(@Param("ids") Collection ids); + + int updateRequestStatusLockVersion(AddUpDeductionRequestPO build); +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml new file mode 100644 index 000000000..b25dca50d --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.id + , t.lock_version + , t.outer_request_id + , t.request_id + , t.request_status + , t.tax_agent_id + , t.tax_year_month + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_add_up_deduction_request + + + + create_time, + + + creator, + + + delete_type, + + + id, + + + lock_version, + + + outer_request_id, + + + request_id, + + + request_status, + + + tax_agent_id, + + + tax_year_month, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{id}, + + + #{lockVersion}, + + + #{outerRequestId}, + + + #{requestId}, + + + #{requestStatus}, + + + #{taxAgentId}, + + + #{taxYearMonth}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + + INSERT INTO hrsa_add_up_deduction_request + ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + VALUES + ( + + #{item.createTime}, + #{item.creator}, + #{item.deleteType}, + #{item.id}, + #{item.lockVersion}, + #{item.outerRequestId}, + #{item.requestId}, + #{item.requestStatus}, + #{item.taxAgentId}, + #{item.taxYearMonth}, + #{item.tenantKey}, + #{item.updateTime} + + ) + + + + + INSERT INTO hrsa_add_up_deduction_request ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + + select + #{item.createTime,jdbcType=DATE}, + #{item.creator,jdbcType=DOUBLE}, + #{item.deleteType,jdbcType=INTEGER}, + #{item.id,jdbcType=DOUBLE}, + #{item.lockVersion,jdbcType=INTEGER}, + #{item.outerRequestId,jdbcType=DOUBLE}, + #{item.requestId,jdbcType=DOUBLE}, + #{item.requestStatus,jdbcType=INTEGER}, + #{item.taxAgentId,jdbcType=DOUBLE}, + #{item.taxYearMonth,jdbcType=DATE}, + #{item.tenantKey,jdbcType=VARCHAR}, + #{item.updateTime,jdbcType=DATE} + from dual + + + + + + + INSERT INTO hrsa_add_up_deduction_request ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + VALUES + ( + #{item.createTime}, + #{item.creator}, + #{item.deleteType}, + #{item.id}, + #{item.lockVersion}, + #{item.outerRequestId}, + #{item.requestId}, + #{item.requestStatus}, + #{item.taxAgentId}, + #{item.taxYearMonth}, + #{item.tenantKey}, + #{item.updateTime} + ) + + + + + + UPDATE hrsa_add_up_deduction_request + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + lock_version=#{lockVersion}, + outer_request_id=#{outerRequestId}, + request_id=#{requestId}, + request_status=#{requestStatus}, + tax_agent_id=#{taxAgentId}, + tax_year_month=#{taxYearMonth}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_request + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + lock_version=#{lockVersion}, + + + outer_request_id=#{outerRequestId}, + + + request_id=#{requestId}, + + + request_status=#{requestStatus}, + + + tax_agent_id=#{taxAgentId}, + + + tax_year_month=#{taxYearMonth}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_request + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_add_up_deduction_request + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + UPDATE hrsa_add_up_deduction_request + + request_status=#{requestStatus}, + lock_version=#{lockVersion}, + update_time=#{updateTime}, + + WHERE delete_type = 0 + AND request_status=#{oldStatus} + AND lock_version=#{oldLockVersion} + AND id = #{id} + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryArchiveService.java b/src/com/engine/salary/service/SalaryArchiveService.java index c240adcf3..dbeb2d865 100644 --- a/src/com/engine/salary/service/SalaryArchiveService.java +++ b/src/com/engine/salary/service/SalaryArchiveService.java @@ -240,4 +240,6 @@ public interface SalaryArchiveService { * @return */ List listPayEndDateIsNull(List employeeIds); + + List listByRunStatus(List asList); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index c8aeee357..70157b459 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -52,6 +52,8 @@ import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; import com.engine.salary.enums.taxdeclaration.EnumDeclareApiBusinessType; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionRequestFailMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionRequestMapper; import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.report.enums.EmployeeTypeEnum; @@ -75,7 +77,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -86,7 +87,6 @@ import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.*; import java.util.*; -import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -157,6 +157,14 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class); } + private AddUpDeductionRequestMapper getAddUpDeductionRequestMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionRequestMapper.class); + } + + private AddUpDeductionRequestFailMapper getAddUpDeductionRequestFailMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionRequestFailMapper.class); + } + private ExtEmpService getExtEmpService(User user) { return ServiceUtil.getService(ExtEmpServiceImpl.class, user); } @@ -1285,8 +1293,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); long employeeId = (long) user.getUID(); boolean isChief = getTaxAgentService(user).isChief(employeeId); - List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAsChief(isOpenDevolution, isChief) : getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); - Set taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); + List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List) getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); + List taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList()); // 获取薪资档案 List salaryArchiveList = getSalaryArchiveService(user).listByRunStatus(Arrays.asList( SalaryArchiveStatusEnum.FIXED.getValue(), @@ -1363,7 +1371,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .creator(user.getUID()) .lockVersion(0) .build(); - addUpDeductionRequestMapper.insert(po); + getAddUpDeductionRequestMapper().insertIgnoreNull(po); } } @@ -1407,7 +1415,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction setExistedDataMap(requestWrapper); // 开始处理反馈结果 TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper - = new TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper(requestPOList.get(0).getTaxYearMonth(), requestWrapper.getApiConfig(), EnumDeclareApiBusinessType.ADD_UP_DEDUCTION); + = new TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper(requestPOList.get(0).getTaxYearMonth(), requestWrapper.getApiConfig(), EnumDeclareApiBusinessType.ADD_UP_DEDUCTION, (long) user.getUID()); handleFeedbackData(requestWrapper, apiFlowUpdateWrapper); // 持久化数据 persistFeedbackData(requestWrapper); @@ -1419,30 +1427,22 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) { - Page page = new LambdaQueryChainWrapper<>(addUpDeductionRequestFailMapper) - .eq(AddUpDeductionRequestFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestFailPO::getTenantKey) - .eq(AddUpDeductionRequestFailPO::getRequestId, queryParam.getRequestId()) - .page(new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), queryParam.getTotal(), true)); - + List addUpDeductionRequestFailPOS = getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(queryParam.getRequestId()).build()); + List list = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), addUpDeductionRequestFailPOS); // 获取薪资档案 AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null); this.getEmployeeInfoMap(requestWrapper); - List listDTOList = page.getRecords().stream() - .map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList()); - PageInfo listDTOPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), false); - listDTOPage.setRecords(listDTOList); - return listDTOPage; + List listDTOList = list.stream().map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList()); + + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), listDTOList, AddUpDeductionRequestFailListDTO.class); + page.setTotal(addUpDeductionRequestFailPOS.size()); + return page; } @Override public List getAddUpDeductionRequestFailPOList(Long requestId) { - return new LambdaQueryChainWrapper<>(addUpDeductionRequestFailMapper) - .eq(AddUpDeductionRequestFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestFailPO::getTenantKey) - .eq(AddUpDeductionRequestFailPO::getRequestId, requestId) - .list(); + return getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(requestId).build()); } @Override @@ -1476,14 +1476,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction rows.add(row); } // 生成表格 - ExcelUtil.genWorkbookV2(rows,""); + ExcelUtil.genWorkbookV2(rows, ""); } - private void getEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper wrapper) { // 身份证号 - List employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId,Collectors.toList()); + List employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getEmployeeId); wrapper.setUserInfoUserIdMap(simpleUserInfoMap); @@ -1492,17 +1491,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); wrapper.setSimpleEmployeeMap(simpleEmployeeMap); // 外部人员信息 - List extEmployeePOS = getExtEmpService(user).listCanUse(wrapper.getCurrentEmployeeId()); + List extEmployeePOS = getExtEmpService(user).listAll(); Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getId, e -> e); wrapper.setExtEmployeePOMap(extEmployeePOMap); } private List getAddUpDeductionRequestPOS() { - return new LambdaQueryChainWrapper<>(addUpDeductionRequestMapper) - .eq(AddUpDeductionRequestPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestPO::getTenantKey) - .in(AddUpDeductionRequestPO::getRequestStatus, EnumAddUpDeductionRequestStatus.RUNNING.getValue()) - .list(); + return getAddUpDeductionRequestMapper().listSome(AddUpDeductionRequestPO.builder().requestStatus(EnumAddUpDeductionRequestStatus.RUNNING.getValue()).build()); } private void handleFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper, TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper) { @@ -1510,8 +1505,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction DataCollectionEmployee simpleUserInfo = requestWrapper.getUserInfoIdNoMap().get(feedback.getZzhm()); Long extEmpId = requestWrapper.getExtEmployeeIdCardMap().get(feedback.getZzhm()); Long employeeId = Optional.ofNullable(simpleUserInfo) - .map(DataCollectionEmployee::getUser) - .map(IdEntity::getId) + .map(DataCollectionEmployee::getEmployeeId) .orElse(extEmpId); AddUpDeductionRequestPO requestPO = requestWrapper.getRequestPoMap().get(outerRequestId); @@ -1563,25 +1557,19 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); requestWrapper.setSimpleEmployeeMap(simpleEmployeeMap); // 内部员工(身份证信息) - List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId,Collectors.toList()); + List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo); requestWrapper.setUserInfoIdNoMap(simpleUserInfoMap); // 外部员工信息 - List extEmployeePOS = getExtEmpService(user).listCanUse(requestWrapper.getCurrentEmployeeId(), requestWrapper.getTenantKey()); - Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getCardNum, ExtEmpPO::getId); + List extEmployeePOS = getExtEmpService(user).listAll(); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getIdNo, ExtEmpPO::getId); requestWrapper.setExtEmployeeIdCardMap(extEmployeePOMap); } private void setExistedDataMap(AddUpDeductionOnlineRequestWrapper requestWrapper) { - Set taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId); - List poList = new LambdaQueryChainWrapper<>(addUpDeductionMapper) - .select(AddUpDeduction::getId, AddUpDeduction::getTaxAgentId, AddUpDeduction::getEmployeeId) - .eq(AddUpDeduction::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeduction::getTenantKey, requestWrapper.getTenantKey()) - .eq(AddUpDeduction::getDeclareMonth, requestWrapper.getRequestPOList().get(0).getTaxYearMonth()) - .in(AddUpDeduction::getTaxAgentId, taxAgentIds) - .list(); + List taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId, Collectors.toList()); + List poList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().declareMonth(requestWrapper.getRequestPOList().get(0).getTaxYearMonth()).taxAgentIds(taxAgentIds).build()); requestWrapper.setExistedDataMap(SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId(), AddUpDeduction::getId)); } @@ -1618,20 +1606,20 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (!requestWrapper.getInsertList().isEmpty()) { List> insertPartition = Lists.partition(requestWrapper.getInsertList(), 1000); insertPartition.forEach(list -> { - list = dataSecurityService.encryptBatch(list, AddUpDeduction.class, requestWrapper.getTenantKey()); - addUpDeductionMapper.insertData(list); + list = encryptUtil.encryptList(list, AddUpDeduction.class); + getAddUpDeductionMapper().insertData(list); }); } if (!requestWrapper.getUpdateList().isEmpty()) { List> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 1000); updatePartition.forEach(list -> { - list = dataSecurityService.encryptBatch(list, AddUpDeduction.class, requestWrapper.getTenantKey()); - addUpDeductionMapper.updateData(list); + list = encryptUtil.encryptList(list, AddUpDeduction.class); + getAddUpDeductionMapper().updateData(list); }); } if (!requestWrapper.getFailPOList().isEmpty()) { List> failPartition = Lists.partition(requestWrapper.getFailPOList(), 1000); - failPartition.forEach(list -> addUpDeductionRequestFailMapper.batchInsert(list)); + failPartition.forEach(list -> getAddUpDeductionRequestFailMapper().batchInsert(list)); } } @@ -1649,16 +1637,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction public void updateRequestStatus(List requestPOList, Integer oldStatus, Integer newStatus) { for (AddUpDeductionRequestPO requestPO : requestPOList) { - boolean update = new LambdaUpdateChainWrapper<>(addUpDeductionRequestMapper) - .set(AddUpDeductionRequestPO::getRequestStatus, newStatus) - .set(AddUpDeductionRequestPO::getUpdateTime, LocalDateTime.now()) - .set(AddUpDeductionRequestPO::getLockVersion, requestPO.getLockVersion() + 1) - .eq(AddUpDeductionRequestPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestPO::getRequestStatus, oldStatus) - .eq(AddUpDeductionRequestPO::getId, requestPO.getId()) - .eq(AddUpDeductionRequestPO::getLockVersion, requestPO.getLockVersion()) - .update(); - SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试")); + int i = getAddUpDeductionRequestMapper().updateRequestStatusLockVersion(AddUpDeductionRequestPO.builder() + .requestStatus(newStatus) + .lockVersion(requestPO.getLockVersion() + 1) + .updateTime(new Date()) + .oldStatus(oldStatus) + .id(requestPO.getId()) + .oldLockVersion(oldStatus) + .build() + ); +// SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试")); } } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 29530bfb3..d055ca9b2 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1292,4 +1292,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds); } + + @Override + public List listByRunStatus(List list) { + return getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(list).build()); + } } diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index ef2754c5e..3cec335d0 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -7,18 +7,18 @@ import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; 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.AddUpDeductionWrapper; -import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.jetbrains.annotations.Nullable; -import org.springframework.web.bind.annotation.RequestParam; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -37,7 +37,10 @@ import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -385,12 +388,9 @@ public class AddUpDeductionController { @Path("/online/request") @POST @Produces(MediaType.APPLICATION_JSON) - public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionMonthTaxAgentParam param) { - Map result = addUpDeductionWrapper.onlineRequest(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); - if (Objects.nonNull(result.get("msg"))) { - return WeaResult.fail(result.get("msg").toString()); - } - return WeaResult.success(null); + public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionMonthTaxAgentParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineRequest, param); } /** @@ -401,8 +401,9 @@ public class AddUpDeductionController { @Path("/online/feedback") @GET @Produces(MediaType.APPLICATION_JSON) - public String onlineFeedback() { - return WeaResult.success(addUpDeductionWrapper.onlineFeedback(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + public String onlineFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::onlineFeedback); } /** @@ -413,45 +414,48 @@ public class AddUpDeductionController { @Path("/online/feedback/fail") @POST @Produces(MediaType.APPLICATION_JSON) - public String onlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionRequestFailQueryParam queryParam) { - return WeaResult.success(addUpDeductionWrapper.onlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), queryParam)); + public String onlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRequestFailQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineFeedbackFail, queryParam); } - /** - * 在线获取结果导出 - * - * @return WeaResult 接口返回信息 - */ - @Path("/online/feedback/fail/export") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String exportOnlineFeedbackFail(@RequestParam Long requestId) { - return WeaResult.success(addUpDeductionWrapper.exportOnlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), requestId)); - } +// /** +// * 在线获取结果导出 +// * +// * @return WeaResult 接口返回信息 +// */ +// @Path("/online/feedback/fail/export") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public String exportOnlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam Long requestId) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::exportOnlineFeedbackFail, queryParam); +// return WeaResult.success(addUpDeductionWrapper.exportOnlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), requestId)); +// } - /** - * 在线获取表单 - * - * @return WeaResult 返回结果 - */ - @Path("/online/request/form") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String getForm() { - return WeaResult.success(addUpDeductionWrapper.getRequestForm()); - } +// /** +// * 在线获取表单 +// * +// * @return WeaResult 返回结果 +// */ +// @Path("/online/request/form") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public String getForm() { +// return WeaResult.success(addUpDeductionWrapper.getRequestForm()); +// } - /** - * 自动计算次月 - * - * @param queryParam 查询条件 - * @return WeaResult 返回结果 - */ - @Path("/autoCalculate") - @POST - @Produces(MediaType.APPLICATION_JSON) - public String autoCalculate(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionQueryParam queryParam) { - addUpDeductionWrapper.autoCalculate(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); - return WeaResult.success(null); - } +// /** +// * 自动计算次月 +// * +// * @param queryParam 查询条件 +// * @return WeaResult 返回结果 +// */ +// @Path("/autoCalculate") +// @POST +// @Produces(MediaType.APPLICATION_JSON) +// public String autoCalculate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionQueryParam queryParam) { +// addUpDeductionWrapper.autoCalculate(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); +// return WeaResult.success(null); +// } } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index 3ac0dfe17..dbd0abf80 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -5,10 +5,9 @@ import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -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.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; @@ -180,50 +179,50 @@ public class AddUpDeductionWrapper extends Service { return getAddUpDeductionService(user).autoAddAll(yearMonth, null); } - public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param, Long currentEmployeeId, String currentTenantKey) { - return addUpDeductionService.onlineRequest(param, currentEmployeeId, currentTenantKey); + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + return getAddUpDeductionService(user).onlineRequest(param); } - public AddUpDeductionRequestResultDTO onlineFeedback(Long currentEmployeeId, String currentTenantKey) { - return addUpDeductionService.onlineFeedback(currentEmployeeId, currentTenantKey); + public AddUpDeductionRequestResultDTO onlineFeedback() { + return getAddUpDeductionService(user).onlineFeedback(); } - public WeaTable onlineFeedbackFail(Long currentEmployeeId, String currentTenantKey, AddUpDeductionRequestFailQueryParam queryParam) { + public PageInfo onlineFeedbackFail( AddUpDeductionRequestFailQueryParam queryParam) { if (queryParam.getRequestId() == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 153345, "在线获取的请求ID不可为空")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153345, "在线获取的请求ID不可为空")); } - Page page = addUpDeductionService.onlineFeedbackFail(currentEmployeeId, currentTenantKey, queryParam); - return SalaryFormatUtil.getInstance().buildTable(AddUpDeductionRequestFailListDTO.class, page); + PageInfo page = getAddUpDeductionService(user).onlineFeedbackFail( queryParam); + return page; } - public Map exportOnlineFeedbackFail(Long employeeId, String tenantKey, Long requestId) { - List poList = addUpDeductionService.getAddUpDeductionRequestFailPOList(requestId, tenantKey); - if (CollectionUtils.isEmpty(poList)) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95795, "数据不存在") + "[id:%s]", requestId)); - } - // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail"); - map.put("sheetName", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 183778, "在线获取专项附加扣除失败数据")); - LocalRunnable localRunnable = new LocalRunnable() { - @Override - public void execute() { - try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - addUpDeductionService.exportOnlineFeedbackFail(map, requestId, employeeId, tenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - } - }; - ThreadPoolUtil.execute(localRunnable); - return map; - } - - public WeaForm getRequestForm() { - WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); - WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); - item.setRequired(true); - weaForm.getItems().put("declareMonth", item); - return weaForm; - } +// public Map exportOnlineFeedbackFail( Long requestId) { +// List poList = getAddUpDeductionService(user).getAddUpDeductionRequestFailPOList(requestId); +// if (CollectionUtils.isEmpty(poList)) { +// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 95795, "数据不存在") + "[id:%s]", requestId)); +// } +// // 构建异步导出参数 +// Map map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail"); +// map.put("sheetName", SalaryI18nUtil.getI18nLabel( 183778, "在线获取专项附加扣除失败数据")); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// try { +// DSTenantKeyThreadVar.tenantKey.set(tenantKey); +// getAddUpDeductionService(user).exportOnlineFeedbackFail(map, requestId); +// } finally { +// DSTenantKeyThreadVar.tenantKey.remove(); +// } +// } +// }; +// ThreadPoolUtil.execute(localRunnable); +// return map; +// } +// +// public WeaForm getRequestForm() { +// WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); +// WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); +// item.setRequired(true); +// weaForm.getItems().put("declareMonth", item); +// return weaForm; +// } } From 9867728d2ed52c7be9e9d477ee6946a31838a016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 4 Sep 2023 16:18:02 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E4=B8=93=E9=A1=B9=E9=99=84=E5=8A=A0=E6=89=A3?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacollection/bo/DataCollectionBO.java | 4 ++-- .../param/AddUpDeductionMonthTaxAgentParam.java | 2 ++ .../po/AddUpDeductionRequestFailPO.java | 4 ++-- .../po/AddUpDeductionRequestPO.java | 10 +++++----- .../entity/taxagent/po/TaxAgentTaxReturnPO.java | 1 + .../service/impl/AddUpDeductionServiceImpl.java | 17 +++++++++-------- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java index ace90158f..46cd04e6d 100644 --- a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java +++ b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java @@ -350,8 +350,8 @@ public class DataCollectionBO { boolean martyrDependents = SalaryOnOffEnum.ON.getValue().equals(employeeDeclarePO.getMartyrDependents()); employeeMap.computeIfAbsent("sfcj", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDisability()).getDefaultLabel()); employeeMap.computeIfAbsent("cjzh", e -> disability ? employeeDeclarePO.getDisabilityCardNo() : null); - employeeMap.computeIfAbsent("sfls", e->SalaryOnOffEnum.parseByValue(employeeDeclarePO.getMartyrDependents()).getDefaultLabel()); - employeeMap.computeIfAbsent("lszh", e-> martyrDependents ? employeeDeclarePO.getMartyrDependentsCardNo() : null); + employeeMap.computeIfAbsent("sfls", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getMartyrDependents()).getDefaultLabel()); + employeeMap.computeIfAbsent("lszh", e -> martyrDependents ? employeeDeclarePO.getMartyrDependentsCardNo() : null); employeeMap.computeIfAbsent("sfgl", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getLonelyOld()).getDefaultLabel()); employeeMap.computeIfAbsent("sfzdw", e -> SalaryOnOffEnum.parseByValue(employeeDeclarePO.getDeductExpenses()).getDefaultLabel()); employeeList.add(employeeMap); diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java index 843ecd238..b22d0fd84 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionMonthTaxAgentParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.datacollection.param; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -17,6 +18,7 @@ import java.util.Date; public class AddUpDeductionMonthTaxAgentParam { @ApiModelProperty("税款所属期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date declareMonth; @ApiModelProperty("个税扣缴义务人的主键id") diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java index 7b0883452..a5baf15ca 100644 --- a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java @@ -38,10 +38,10 @@ public class AddUpDeductionRequestFailPO implements Serializable { private Date updateTime; //创建人id", ignore = true) - private long creator; + private Long creator; //是否删除", ignore = true) - private int deleteType; + private Integer deleteType; //租户KEY", ignore = true) private String tenantKey; diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java index 6768edf3f..6894a68ed 100644 --- a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java @@ -27,7 +27,7 @@ public class AddUpDeductionRequestPO implements Serializable { private static final long serialVersionUID = 1452863635879051515L; //ID - private long id; + private Long id; //创建时间" private Date createTime; @@ -36,16 +36,16 @@ public class AddUpDeductionRequestPO implements Serializable { private Date updateTime; //创建人id" - private long creator; + private Long creator; //是否删除" - private int deleteType; + private Integer deleteType; //租户KEY" private String tenantKey; //乐观锁版本" - private int lockVersion; + private Integer lockVersion; //查询请求ID private Long requestId; @@ -57,7 +57,7 @@ public class AddUpDeductionRequestPO implements Serializable { * @see EnumAddUpDeductionRequestStatus */ //请求处理状态 - private int requestStatus; + private Integer requestStatus; //税款所属期 private Date taxYearMonth; diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java index b338e53b6..717a5e960 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentTaxReturnPO.java @@ -145,6 +145,7 @@ public class TaxAgentTaxReturnPO implements Serializable { //查询条件 + private Collection ids; private Collection taxAgentIds; private Collection taxCodes; } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 70157b459..e89b31d36 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -1303,7 +1303,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) ); salaryArchiveList = salaryArchiveList.stream().filter(e -> taxAgentIdSet.contains(e.getTaxAgentId())).collect(Collectors.toList()); - AddUpDeductionOnlineRequestWrapper requestWrapper = new AddUpDeductionOnlineRequestWrapper(requestPOList, salaryArchiveList, taxAgents); + AddUpDeductionOnlineRequestWrapper requestWrapper = new AddUpDeductionOnlineRequestWrapper(requestPOList, salaryArchiveList, taxAgents, (long) user.getUID()); requestWrapper.setApiConfig(apiConfig); return requestWrapper; } @@ -1368,7 +1368,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .tenantKey(DEFAULT_TENANT_KEY) .createTime(new Date()) .updateTime(new Date()) - .creator(user.getUID()) + .creator((long) user.getUID()) .lockVersion(0) .build(); getAddUpDeductionRequestMapper().insertIgnoreNull(po); @@ -1604,21 +1604,21 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction private void persistFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper) { if (!requestWrapper.getInsertList().isEmpty()) { - List> insertPartition = Lists.partition(requestWrapper.getInsertList(), 1000); + List> insertPartition = Lists.partition(requestWrapper.getInsertList(), 100); insertPartition.forEach(list -> { list = encryptUtil.encryptList(list, AddUpDeduction.class); getAddUpDeductionMapper().insertData(list); }); } if (!requestWrapper.getUpdateList().isEmpty()) { - List> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 1000); + List> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 100); updatePartition.forEach(list -> { list = encryptUtil.encryptList(list, AddUpDeduction.class); getAddUpDeductionMapper().updateData(list); }); } if (!requestWrapper.getFailPOList().isEmpty()) { - List> failPartition = Lists.partition(requestWrapper.getFailPOList(), 1000); + List> failPartition = Lists.partition(requestWrapper.getFailPOList(), 100); failPartition.forEach(list -> getAddUpDeductionRequestFailMapper().batchInsert(list)); } } @@ -1643,7 +1643,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .updateTime(new Date()) .oldStatus(oldStatus) .id(requestPO.getId()) - .oldLockVersion(oldStatus) + .oldLockVersion(requestPO.getLockVersion()) .build() ); // SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试")); @@ -1697,7 +1697,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction public AddUpDeductionOnlineRequestWrapper(List requestPOList, List salaryArchiveList, - List taxAgents) { + List taxAgents, + Long currentEmployeeId) { this.requestFeedBackMap = new HashMap<>(); this.requestPoMap = new HashMap<>(); this.insertList = new ArrayList<>(); @@ -1706,7 +1707,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction this.failPOList = new ArrayList<>(); this.salaryArchiveList = salaryArchiveList; this.requestPOList = requestPOList; - this.tenantKey = tenantKey; + this.tenantKey = DEFAULT_TENANT_KEY; this.currentEmployeeId = currentEmployeeId; this.taxAgentMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); } From f245bd2f49c8715cd42c9a2a2425464c2329ab85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 5 Sep 2023 11:04:53 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BE=80=E6=9C=9F?= =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sqlupgrade/DM/sql202309050103.sql | 3 + resource/sqlupgrade/DM/sql202309050203.sql | 9 + resource/sqlupgrade/GS/sql202309050103.sql | 3 + resource/sqlupgrade/GS/sql202309050203.sql | 9 + resource/sqlupgrade/JC/sql202309050103.sql | 3 + resource/sqlupgrade/JC/sql202309050203.sql | 9 + resource/sqlupgrade/Mysql/sql202309050103.sql | 1 + resource/sqlupgrade/Mysql/sql202309050203.sql | 6 + .../sqlupgrade/Oracle/sql202309050103.sql | 2 + .../sqlupgrade/Oracle/sql202309050203.sql | 6 + resource/sqlupgrade/PG/sql202309050103.sql | 2 + resource/sqlupgrade/PG/sql202309050203.sql | 6 + .../sqlupgrade/SQLServer/sql202309050103.sql | 2 + .../sqlupgrade/SQLServer/sql202309050203.sql | 6 + resource/sqlupgrade/ST/sql202309050103.sql | 3 + resource/sqlupgrade/ST/sql202309050203.sql | 9 + .../salary/constant/SzyhApiConstant.java | 4 + .../entity/datacollection/AddUpSituation.java | 36 ++ .../po/SpecialAddDeductionPO.java | 1 + .../response/GetCompanyIncomesResponse.java | 395 ++++++++++++++++++ .../salary/service/AddUpDeductionService.java | 3 +- .../salary/service/AddUpSituationService.java | 8 + .../impl/AddUpDeductionServiceImpl.java | 4 +- .../impl/AddUpSituationServiceImpl.java | 279 +++++++++++-- .../salary/web/AddUpDeductionController.java | 53 ++- .../salary/web/AddUpSituationController.java | 13 + .../salary/wrapper/AddUpDeductionWrapper.java | 36 +- .../salary/wrapper/AddUpSituationWrapper.java | 9 +- 28 files changed, 829 insertions(+), 91 deletions(-) create mode 100644 resource/sqlupgrade/DM/sql202309050103.sql create mode 100644 resource/sqlupgrade/DM/sql202309050203.sql create mode 100644 resource/sqlupgrade/GS/sql202309050103.sql create mode 100644 resource/sqlupgrade/GS/sql202309050203.sql create mode 100644 resource/sqlupgrade/JC/sql202309050103.sql create mode 100644 resource/sqlupgrade/JC/sql202309050203.sql create mode 100644 resource/sqlupgrade/Mysql/sql202309050103.sql create mode 100644 resource/sqlupgrade/Mysql/sql202309050203.sql create mode 100644 resource/sqlupgrade/Oracle/sql202309050103.sql create mode 100644 resource/sqlupgrade/Oracle/sql202309050203.sql create mode 100644 resource/sqlupgrade/PG/sql202309050103.sql create mode 100644 resource/sqlupgrade/PG/sql202309050203.sql create mode 100644 resource/sqlupgrade/SQLServer/sql202309050103.sql create mode 100644 resource/sqlupgrade/SQLServer/sql202309050203.sql create mode 100644 resource/sqlupgrade/ST/sql202309050103.sql create mode 100644 resource/sqlupgrade/ST/sql202309050203.sql create mode 100644 src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java diff --git a/resource/sqlupgrade/DM/sql202309050103.sql b/resource/sqlupgrade/DM/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309050103.sql @@ -0,0 +1,3 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/DM/sql202309050203.sql b/resource/sqlupgrade/DM/sql202309050203.sql new file mode 100644 index 000000000..77982e200 --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309050203.sql @@ -0,0 +1,9 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + diff --git a/resource/sqlupgrade/GS/sql202309050103.sql b/resource/sqlupgrade/GS/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309050103.sql @@ -0,0 +1,3 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/GS/sql202309050203.sql b/resource/sqlupgrade/GS/sql202309050203.sql new file mode 100644 index 000000000..77982e200 --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309050203.sql @@ -0,0 +1,9 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + diff --git a/resource/sqlupgrade/JC/sql202309050103.sql b/resource/sqlupgrade/JC/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309050103.sql @@ -0,0 +1,3 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/JC/sql202309050203.sql b/resource/sqlupgrade/JC/sql202309050203.sql new file mode 100644 index 000000000..77982e200 --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309050203.sql @@ -0,0 +1,9 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + diff --git a/resource/sqlupgrade/Mysql/sql202309050103.sql b/resource/sqlupgrade/Mysql/sql202309050103.sql new file mode 100644 index 000000000..67dd54d95 --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309050103.sql @@ -0,0 +1 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); \ No newline at end of file diff --git a/resource/sqlupgrade/Mysql/sql202309050203.sql b/resource/sqlupgrade/Mysql/sql202309050203.sql new file mode 100644 index 000000000..449c25f07 --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309050203.sql @@ -0,0 +1,6 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar(255) +; +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255) +; +alter table hrsa_add_up_situation add tax_adjustment varchar(255) +; \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309050103.sql b/resource/sqlupgrade/Oracle/sql202309050103.sql new file mode 100644 index 000000000..c010cb4ef --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309050103.sql @@ -0,0 +1,2 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5) +/ \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309050203.sql b/resource/sqlupgrade/Oracle/sql202309050203.sql new file mode 100644 index 000000000..14347cd8b --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309050203.sql @@ -0,0 +1,6 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255) +/ +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255) +/ +alter table hrsa_add_up_situation add tax_adjustment varchar2(255) +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309050103.sql b/resource/sqlupgrade/PG/sql202309050103.sql new file mode 100644 index 000000000..442635f18 --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309050103.sql @@ -0,0 +1,2 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309050203.sql b/resource/sqlupgrade/PG/sql202309050203.sql new file mode 100644 index 000000000..4b9085caa --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309050203.sql @@ -0,0 +1,6 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar(255); +/ +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255); +/ +alter table hrsa_add_up_situation add tax_adjustment varchar(255); +/ \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309050103.sql b/resource/sqlupgrade/SQLServer/sql202309050103.sql new file mode 100644 index 000000000..362f2654c --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309050103.sql @@ -0,0 +1,2 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +GO \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309050203.sql b/resource/sqlupgrade/SQLServer/sql202309050203.sql new file mode 100644 index 000000000..ea69e5604 --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309050203.sql @@ -0,0 +1,6 @@ +alter table hrsa_add_up_situation add add_up_taxable_income nvarchar(255) +GO +alter table hrsa_add_up_situation add actual_add_up_advance_tax nvarchar(255) +GO +alter table hrsa_add_up_situation add tax_adjustment nvarchar(255) +GO \ No newline at end of file diff --git a/resource/sqlupgrade/ST/sql202309050103.sql b/resource/sqlupgrade/ST/sql202309050103.sql new file mode 100644 index 000000000..e9e5dfeee --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309050103.sql @@ -0,0 +1,3 @@ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-05 16:30:11','yyyy-MM-dd HH24:mi:ss'), 0, 'all_teams', 703433961629614119, 5); +/ + diff --git a/resource/sqlupgrade/ST/sql202309050203.sql b/resource/sqlupgrade/ST/sql202309050203.sql new file mode 100644 index 000000000..77982e200 --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309050203.sql @@ -0,0 +1,9 @@ +alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255); +/ + +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); +/ + +alter table hrsa_add_up_situation add tax_adjustment varchar2(255); +/ + diff --git a/src/com/engine/salary/constant/SzyhApiConstant.java b/src/com/engine/salary/constant/SzyhApiConstant.java index 698f662f8..b4e04552a 100644 --- a/src/com/engine/salary/constant/SzyhApiConstant.java +++ b/src/com/engine/salary/constant/SzyhApiConstant.java @@ -137,6 +137,10 @@ public class SzyhApiConstant { * 刷新缴款状态 */ public static final String GET_SYNC_WITHHOLDING_FEEDBACK = "gateway/iit/payment/getSyncWithholdingFeedback"; + /** + * 企业申报数据明细查询 + */ + public static final String GET_COMPANY_INCOMES = "gateway/iit/report/getCompanyIncomes"; /** diff --git a/src/com/engine/salary/entity/datacollection/AddUpSituation.java b/src/com/engine/salary/entity/datacollection/AddUpSituation.java index eeae5d130..aefe36a4d 100644 --- a/src/com/engine/salary/entity/datacollection/AddUpSituation.java +++ b/src/com/engine/salary/entity/datacollection/AddUpSituation.java @@ -4,6 +4,7 @@ import com.engine.salary.annotation.Encrypt; import com.engine.salary.annotation.SalaryFormulaVar; import com.engine.salary.annotation.SalaryTable; import com.engine.salary.annotation.SalaryTableOperate; +import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -49,6 +50,12 @@ public class AddUpSituation { */ private Integer year; + /** + * 人员类型 + * @see DataCollectionEmployeeTypeEnum + */ + private Integer employeeType; + /** * 累计收入额 */ @@ -82,6 +89,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计子女教育", labelId = 86321, dataType = "number") @Encrypt + @Deprecated private String addUpChildEducation; /** @@ -89,6 +97,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计继续教育", labelId = 86323, dataType = "number") @Encrypt + @Deprecated private String addUpContinuingEducation; /** @@ -96,6 +105,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计住房贷款利息", labelId = 86324, dataType = "number") @Encrypt + @Deprecated private String addUpHousingLoanInterest; /** @@ -103,6 +113,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计住房租金", labelId = 86325, dataType = "number") @Encrypt + @Deprecated private String addUpHousingRent; /** @@ -110,6 +121,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计赡养老人", labelId = 86326, dataType = "number") @Encrypt + @Deprecated private String addUpSupportElderly; /** @@ -117,6 +129,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计大病医疗", labelId = 105142, dataType = "number") @Encrypt + @Deprecated private String addUpIllnessMedical; /** @@ -124,6 +137,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计婴幼儿照护", labelId = 117732, dataType = "number") @Encrypt + @Deprecated private String addUpInfantCare; /** @@ -131,6 +145,7 @@ public class AddUpSituation { */ @SalaryFormulaVar(defaultLabel = "累计个人养老金", labelId = 117732, dataType = "number") @Encrypt + @Deprecated private String addUpPrivatePension; /** @@ -175,6 +190,27 @@ public class AddUpSituation { @Encrypt private String addUpAdvanceTax; + /** + * 累计已预扣预缴税额 + */ + @SalaryFormulaVar(defaultLabel = "实际累计已预扣预缴税额", labelId = 233557, dataType = "number") + @Encrypt + private String actualAddUpAdvanceTax; + + /** + * 累计已预扣预缴税额 + */ + @SalaryFormulaVar(defaultLabel = "个税调差", labelId = 233559, dataType = "number") + @Encrypt + private String taxAdjustment; + + /** + * 累计应纳税所得额 + */ + @SalaryFormulaVar(defaultLabel = "累计应纳税所得额", labelId = 85371, dataType = "number") + @Encrypt + private String addUpTaxableIncome; + /** * 创建时间 */ diff --git a/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java b/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java index 9aaaa7363..01c11be8e 100644 --- a/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java +++ b/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java @@ -17,6 +17,7 @@ import java.util.Date; @AllArgsConstructor @NoArgsConstructor @Accessors(chain = true) +//hrsa_special_add_deduction public class SpecialAddDeductionPO { private Long id; diff --git a/src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java b/src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java new file mode 100644 index 000000000..0e71b0da8 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/response/GetCompanyIncomesResponse.java @@ -0,0 +1,395 @@ +package com.engine.salary.entity.datacollection.response; + +import com.engine.salary.entity.taxpayment.response.BaseResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * 人员专项附加扣除信息查询结果 + * + * @author chengliming + * @date 2022-10-27 10:00 AM + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class GetCompanyIncomesResponse extends BaseResponse { + + /** + * 返回数据 + */ + private Body body; + + /** + * 人员专项附加扣除信息查询结果body + **/ + @Data + public static class Body { + /** + * 明细 + */ + private List sfmx; + + /** + * 合计 + */ + private Sum sfhj; + } + + @Data + public static class Detail { + /** + * 是否明细申报 + **/ + private String sfmxsb; + /** + * 纳税人姓名 + **/ + private String xm; + /** + * 纳税识别号 + **/ + private String nsrsbh; + /** + * 证件类型 + **/ + private String zjlx; + /** + * 证件号码 + **/ + private String zjhm; + /** + * 非居民个人 + **/ + private String sffjm; + /** + * 所得项目名称 + **/ + private String sdxmmc; + /** + * 收入额 + **/ + private String sre; + /** + * 费用 + **/ + private String fy; + /** + * 免税收入 + **/ + private String mssr; + /** + * 财产原值 + **/ + private String ccyz; + /** + * 投资抵扣 + **/ + private String tzdk; + /** + * 允许扣除的费用 + **/ + private String yxkcsf; + /** + * 减计比例 + **/ + private String jjbl; + /** + * 减除费用 + **/ + private String jcfy; + /** + * 基本养老保险 + **/ + private String jbylaobxf; + /** + * 基本医疗保险费 + **/ + private String jbylbxf; + /** + * 失业保险费 + **/ + private String sybxf; + /** + * 住房公积金 + **/ + private String zfgjj; + /** + * 年金 + **/ + private String nj; + /** + * 商业健康保险 + **/ + private String syjkbx; + /** + * 税延养老保险 + **/ + private String syylbx; + /** + * 其它扣除 + **/ + private String qt; + /** + * 准予扣除的捐赠额 + **/ + private String zykcjze; + /** + * 累计收入额 + **/ + private String ljsre; + /** + * 累计减除费用 + **/ + private String ljjcfy; + /** + * 累计专项扣除 + **/ + private String ljzxkc; + /** + * 累计子女教育 + **/ + private String ljznjy; + /** + * 累计赡养老人 + **/ + private String ljsylr; + /** + * 累计住房贷款利息 + **/ + private String ljzfdklx; + /** + * 累计住房租金 + **/ + private String ljzfzj; + /** + * 累计继续教育 + **/ + private String ljjxjy; + /** + * 累计3岁以下婴幼儿照护支出 + **/ + private String ljyyezhzc; + /** + * 累计其它扣除 + **/ + private String ljqtkc; + /** + * 累计准予扣除的捐赠额 + **/ + private String ljzykcjze; + /** + * 累计个人养老金 + **/ + private String ljgrylj; + /** + * 应纳税所得额 + **/ + private String ynssde; + /** + * 税率 + **/ + private String sl; + /** + * 协定税率 + **/ + private String xdsl; + /** + * 速算扣除数 + **/ + private String sskcs; + /** + * 应纳税额 + **/ + private String ynse; + /** + * 减免税额 + **/ + private String jmse; + /** + * 已扣缴税额 + **/ + private String ykjse; + /** + * 应补退税额 + **/ + private String ybtse; + /** + * 备注 + **/ + private String bz; + /** + * 分摊年度数 + **/ + private String ftnds; + /** + * 年减除费用 + **/ + private String njcfy; + /** + * 应扣缴税额 + **/ + private String kjse; + /** + * 证券账户号 + **/ + private String zqzhh; + /** + * 股票代码 + **/ + private String gpdm; + /** + * 股票名称 + **/ + private String gpmc; + /** + * 每股计税价格 + **/ + private String mgjsjg; + /** + * 转让股数 + **/ + private String zrgs; + /** + * 限售股原值 + **/ + private String xsgyz; + /** + * 合理税费 + **/ + private String hlsf; + /** + * 扣除及减除项目合计 + **/ + private String kcjjcxmhj; + } + + /** + * 合计 + */ + @Data + public static class Sum { + /** + * 收入额合计 + */ + private String srehj; + /** + * 免税收入合计 + */ + private String mssrhj; + /** + * 财产原值合计 + */ + private String ccyzhj; + /** + * 投资抵扣合计 + */ + private String tzdkhj; + /** + * 允许扣除的税费合计 + */ + private String yxkcsfhj; + /** + * 基本养老保险费合计 + */ + private String jbylaobxfhj; + /** + * 基本医疗保险费合计 + */ + private String jbylbxfhj; + /** + * 失业保险费合计 + */ + private String sybxfhj; + /** + * 住房公积金合计 + */ + private String zfgjjhj; + /** + * 年金合计 + */ + private String njhj; + /** + * 商业健康保险合计 + */ + private String syjkbxhj; + /** + * 税延养老保险合计 + */ + private String syylbxhj; + /** + * 其他扣除合计 + */ + private String qthj; + /** + * 准予扣除的捐赠额合计 + */ + private String zykcjzehj; + /** + * 累计收入额合计 + */ + private String ljsrehj; + /** + * 累计专项扣除合计 + */ + private String ljzxkchj; + /** + * 累计子女教育合计 + */ + private String ljznjyhj; + /** + * 累计赡养老人合计 + */ + private String ljsylrhj; + /** + * 累计住房贷款利息合计 + */ + private String ljzfdklxhj; + /** + * 累计住房租金合计 + */ + private String ljzfzjhj; + /** + * 累计继续教育合计 + */ + private String ljjxjyhj; + /** + * 累计3岁以下婴幼儿照护支出合计 + */ + private String ljyyezhzchj; + /** + * 累计其他扣除合计 + */ + private String ljqtkchj; + /** + * 累计准予扣除的捐赠额合计 + */ + private String ljzykcjzehj; + /** + * 累计个人养老金合计 + */ + private String ljgryljhj; + /** + * 应纳税所得额合计 + */ + private String ynssdehj; + /** + * 应纳税额合计 + */ + private String ynsehj; + /** + * 减免税额合计 + */ + private String jmsehj; + /** + * 已扣缴税额合计 + */ + private String ykjsehj; + /** + * 应补退税额合计 + */ + private String ybtsehj; + } + +} diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 9e9e69876..126002890 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -192,9 +192,8 @@ public interface AddUpDeductionService { /** * 导出反馈失败记录 * - * @param map * @param requestId */ - void exportOnlineFeedbackFail(Map map, Long requestId); + XSSFWorkbook exportOnlineFeedbackFail(Long requestId); } diff --git a/src/com/engine/salary/service/AddUpSituationService.java b/src/com/engine/salary/service/AddUpSituationService.java index 2406e16be..ccfc26231 100644 --- a/src/com/engine/salary/service/AddUpSituationService.java +++ b/src/com/engine/salary/service/AddUpSituationService.java @@ -112,4 +112,12 @@ public interface AddUpSituationService { * @date 2022/10/31 14:00 */ AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam); + + /** + * 在线获取实际累计已预扣预缴税额 + * + * @param param + * @return + */ + Map onlineRequest(AddUpDeductionMonthTaxAgentParam param); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index e89b31d36..d25f8f864 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -1446,7 +1446,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } @Override - public void exportOnlineFeedbackFail(Map map, Long requestId) { + public XSSFWorkbook exportOnlineFeedbackFail( Long requestId) { List> rows = new ArrayList<>(); // 表头 List headers = new ArrayList<>(); @@ -1476,7 +1476,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction rows.add(row); } // 生成表格 - ExcelUtil.genWorkbookV2(rows, ""); + return ExcelUtil.genWorkbookV2(rows, "在线获取专项附加扣除失败数据"); } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 5a81ad857..c0e108de2 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.api.browser.util.ConditionFactory; @@ -8,33 +9,38 @@ import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpSituationBiz; +import com.engine.salary.constant.SzyhApiConstant; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.datacollection.bo.DataCollectionBO; import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO; import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpSituationDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; +import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import com.engine.salary.entity.datacollection.response.GetCompanyIncomesResponse; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; +import com.engine.salary.entity.taxagent.response.SzyhResponseHead; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO; import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.employeedeclare.DeclareStatusEnum; +import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; +import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpSituationMapper; +import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; -import com.engine.salary.service.AddUpDeductionService; -import com.engine.salary.service.AddUpSituationService; -import com.engine.salary.service.SalaryEmployeeService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; -import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; -import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; @@ -43,8 +49,10 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -61,6 +69,7 @@ import java.util.stream.Collectors; import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; +@Slf4j public class AddUpSituationServiceImpl extends Service implements AddUpSituationService { private EncryptUtil encryptUtil = new EncryptUtil(); @@ -84,12 +93,28 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private TaxDeclarationApiConfigService getTaxDeclarationApiConfigService(User user) { + return ServiceUtil.getService(TaxDeclarationApiConfigServiceImpl.class, user); + } + + private TaxAgentTaxReturnService getTaxAgentTaxReturnService(User user) { + return ServiceUtil.getService(TaxAgentTaxReturnServiceImpl.class, user); + } + + private SalaryArchiveService getSalaryArchiveService(User user) { + return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user); + } + AddUpSituationBiz biz = new AddUpSituationBiz(); private SalarySysConfMapper getSalarySysConfMapper() { return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } + private EmployeeDeclareMapper getEmployeeDeclareMapper() { + return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class); + } + @Override public Map getSearchCondition() { Map apidatas = new HashMap(); @@ -274,7 +299,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // excel标题 final List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计收入额", "累计减除费用", "累计社保个人合计", "累计公积金个人合计", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", - "累计大病医疗", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护","累计个人养老金"); + "累计大病医疗", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护", "累计个人养老金"); //排序配置 OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); @@ -340,7 +365,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation //excel标题 List title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用", "累计社保个人合计", "累计公积金个人合计", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计企业(职业)年金及其他福利", - "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护","累计个人养老金"); + "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护", "累计个人养老金"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); //查询详细信息 @@ -609,7 +634,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 获取已经核算的数据(获取税款所属期下一个月的数据) YearMonth nextTaxYearMonth = SalaryDateUtil.String2YearMonth(taxYearMonthStr); String nextTaxYearMonthStr = taxYearMonthStr; - if( !Objects.equals(nextTaxYearMonth.getMonthValue(),12) ){ + if (!Objects.equals(nextTaxYearMonth.getMonthValue(), 12)) { nextTaxYearMonth = nextTaxYearMonth.plusMonths(1); nextTaxYearMonthStr = nextTaxYearMonth.format(SalaryDateUtil.MONTH_FORMATTER); } @@ -693,7 +718,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation errorMessageMap.put("message", rowIndex + "员工信息不存在或者存在多个员工"); errorData.add(errorMessageMap); errorSum += 1; - }else { + } else { Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null; po.setEmployeeId(employeeId); } @@ -744,7 +769,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // } // 判断是否有核算过 - if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12") ) { + if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())).findFirst(); boolean isExist = list.stream().anyMatch(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())); if (optionalAcctEmp.isPresent() && isExist) { @@ -846,8 +871,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } /** - * @description 编辑数据 * @return void + * @description 编辑数据 * @author Harryxzy * @date 2022/10/27 21:32 */ @@ -860,12 +885,12 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 获取所有个税扣缴义务人 Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); AddUpSituation byId = biz.getById(addUpSituationParam.getId()); - if(byId == null){ + if (byId == null) { throw new SalaryRunTimeException("该数据不存在!"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); - if(!canEdit){ + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId)); + if (!canEdit) { //没有编辑权限 throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!"); } @@ -873,14 +898,14 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 获取已经核算的数据(获取税款所属期下一个月的数据) YearMonth nextTaxYearMonth = SalaryDateUtil.String2YearMonth(taxYearMonthStr); String nextTaxYearMonthStr = taxYearMonthStr; - if( !Objects.equals(nextTaxYearMonth.getMonthValue(),12) ){ + if (!Objects.equals(nextTaxYearMonth.getMonthValue(), 12)) { nextTaxYearMonth = nextTaxYearMonth.plusMonths(1); nextTaxYearMonthStr = nextTaxYearMonth.format(SalaryDateUtil.MONTH_FORMATTER); } List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeDataByTaxYearMonth(nextTaxYearMonthStr); // 判断是否有核算过 - if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { + if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpSituationParam.getEmployeeId()) && f.getTaxAgentId().equals(addUpSituationParam.getTaxAgentId())).findFirst(); if (optionalAcctEmp.isPresent()) { throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!"); @@ -903,8 +928,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } /** - * @description 新建数据 * @return void + * @description 新建数据 * @author Harryxzy * @date 2022/10/27 22:04 */ @@ -947,8 +972,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation //筛选导入人员信息可以在人力资源池中匹配到的人员信息 - boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpSituationParam.getEmployeeId())); - if(!employeeSameId){ + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId(), addUpSituationParam.getEmployeeId())); + if (!employeeSameId) { throw new SalaryRunTimeException("员工信息不存在"); } po.setEmployeeId(addUpSituationParam.getEmployeeId()); @@ -967,7 +992,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } } - // fixme 分权判断,若员工离职后,不在扣缴义务人范围内,会有异常 + // fixme 分权判断,若员工离职后,不在扣缴义务人范围内,会有异常 // if (openDevolution) { // Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst(); // if (!optionalTaxAgentEmp.isPresent()) { @@ -1055,15 +1080,15 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(format); // 判断是否有核算过 List deleteList = new ArrayList<>(); - for(int i=0; i first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); - if(!first.isPresent()){ + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst(); + if (!first.isPresent()) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内"); } // 判断用户是否存在 @@ -1089,23 +1114,23 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation AddUpSituationBiz biz = new AddUpSituationBiz(); Date declareMonthDate = new Date(); try { - declareMonthDate = (sdf.parse(declareMonthStr+"-01")); - }catch (Exception e){ + declareMonthDate = (sdf.parse(declareMonthStr + "-01")); + } catch (Exception e) { throw new SalaryRunTimeException("日期异常"); } AddUpSituation queryParam = null; - if(deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()){ + if (deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()) { // 设置了个税扣缴义务人 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); - if(!canDelete){ + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId)); + if (!canDelete) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); } ArrayList tai = new ArrayList<>(); tai.add(taxAgentId); - queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(tai).build(); - }else { + queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(tai).build(); + } else { queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(taxAgentIds).build(); } @@ -1115,7 +1140,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation String format = salaryMonthDate.plusMonths(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM")); // 获取已经核算的数据 List employees = getAddUpDeductionService(user).getAccountedEmployeeData(format); - for(AddUpSituation item : list){ + for (AddUpSituation item : list) { if (CollectionUtils.isNotEmpty(employees)) { Optional optionalAcctEmp = employees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst(); if (optionalAcctEmp.isPresent()) { @@ -1137,11 +1162,11 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation ids.add(addUpSituationParam.getId()); AddUpSituationQueryParam build = AddUpSituationQueryParam.builder().ids(ids).build(); List list = biz.recordList(build); - if(list == null || list.size()==0){ + if (list == null || list.size() == 0) { throw new SalaryRunTimeException("该数据不存在!"); } String taxAgentName = list.get(0).getTaxAgentName(); - if(!taxAgentNames.contains(taxAgentName)){ + if (!taxAgentNames.contains(taxAgentName)) { throw new SalaryRunTimeException("您无权查看该数据!"); } return list.get(0); @@ -1150,10 +1175,182 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public void batchSave(List list) { if (CollectionUtils.isNotEmpty(list)) { - list = encryptUtil.encryptList(list,AddUpSituation.class); + list = encryptUtil.encryptList(list, AddUpSituation.class); List> partition = Lists.partition(list, 50); partition.forEach(getAddUpSituationMapper()::insertData); } } + + @Override + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "税款所属期必传")); + // 获取接口配置 + TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true); + // 获取包装类 + AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig); + // 获取报税信息 + List taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet()); + List failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList()); + SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "企业未通过验证,暂时无法获取累计专项附加扣除数据,请先在【个税扣缴义务人】菜单验证企业报税信息")); + Map result = new HashMap<>(1); + if (!failReturnPOList.isEmpty()) { + String failTaxAgentNames = failReturnPOList.stream().map(e -> requestWrapper.getTaxAgentMap().get(e.getTaxAgentId())).collect(Collectors.joining("、")); + result.put("msg", String.format(SalaryI18nUtil.getI18nLabel(183782, "%s未通过登记验证,无法在线获取数据"), failTaxAgentNames)); + } + // 获取报送成功的人员名单 + Map> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth()); + // 开始请求接口获取数据 + getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList); + return result; + } + + private void getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param, + AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, + Map> taxAgentEmployeeDeclareMap, + List taxReturnPOList) { + List updateList = new ArrayList<>(); + List insertList = new ArrayList<>(); + for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) { + if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) { + continue; + } + // 发起请求 + String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId()); + List declarePOList = taxAgentEmployeeDeclareMap.getOrDefault(returnPO.getTaxAgentId(), new ArrayList<>()); + if (declarePOList.isEmpty()) { + log.info("该主体下没有报送成功的人员,主体名称:{}", taxAgentName); + continue; + } + List poList = getAddUpSituationMapper().listSome((AddUpSituation.builder().taxYearMonth(param.getDeclareMonth()).taxAgentId(returnPO.getTaxAgentId()).build())); + Map poMap = SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId()); + + // 内部员工(身份证信息) + List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); + List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); + Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo); + + for (int i = 1; true; i++) { + GetCompanyIncomesResponse queryResponse = getCompanyIncomes(returnPO, taxAgentName, param, requestWrapper.getApiConfig(), i); + // 校验请求结果 + String responseCode = Optional.ofNullable(queryResponse) + .map(GetCompanyIncomesResponse::getHead) + .map(SzyhResponseHead::getCode) + .orElse(null); + List details = Optional.ofNullable(queryResponse) + .map(GetCompanyIncomesResponse::getBody) + .map(GetCompanyIncomesResponse.Body::getSfmx) + .orElse(null); + if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode)) { + log.info("getCompanyIncomes error:{}", JSON.toJSONString(queryResponse)); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试")); + } + if (CollectionUtils.isEmpty(details)) { + break; + } + Date now = new Date(); + for (GetCompanyIncomesResponse.Detail detail : details) { + DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(detail.getZjhm()); + Long employeeId = Optional.ofNullable(simpleUserInfo) + .map(DataCollectionEmployee::getEmployeeId) + .orElse(0L); + if (poMap.containsKey(returnPO.getTaxAgentId() + "-" + employeeId)) { + AddUpSituation po = poMap.get(returnPO.getTaxAgentId() + "-" + employeeId); + po.setUpdateTime(now); + po.setActualAddUpAdvanceTax(detail.getKjse()); + po.setTaxAdjustment(SalaryEntityUtil.string2BigDecimalDefault0(detail.getKjse()).subtract(SalaryEntityUtil.string2BigDecimalDefault0(po.getAddUpAdvanceTax())).toString()); + updateList.add(po); + } else { + AddUpSituation po = new AddUpSituation(); +// po.setId(IdGenerator.generate()); + po.setCreateTime(now); + po.setUpdateTime(now); + po.setCreator(requestWrapper.getCurrentEmployeeId()); + po.setDeleteType(NumberUtils.INTEGER_ZERO); + po.setTenantKey(requestWrapper.getTenantKey()); + po.setYear(param.getDeclareMonth().getYear()); + po.setTaxYearMonth(param.getDeclareMonth()); + po.setEmployeeType(0); + po.setTaxAgentId(returnPO.getTaxAgentId()); + po.setEmployeeId(employeeId); + po.setAddUpIncome("0"); + po.setAddUpSubtraction("0"); + po.setAddUpSocialSecurityTotal("0"); + po.setAddUpAccumulationFundTotal("0"); + po.setAddUpEnterpriseAndOther("0"); + po.setAddUpOtherDeduction("0"); + po.setAddUpTaxExemptIncome("0"); + po.setAddUpAllowedDonation("0"); + po.setAddUpTaxSavings("0"); + po.setAddUpAdvanceTax("0"); + po.setAddUpTaxableIncome("0"); + po.setActualAddUpAdvanceTax(detail.getKjse()); + po.setTaxAdjustment(detail.getKjse()); + insertList.add(po); + } + } + } + } + if (!insertList.isEmpty()) { + List> insertPartition = Lists.partition(insertList, 50); + insertPartition.forEach(list -> { + list = encryptUtil.encryptList(list, AddUpSituation.class); + getAddUpSituationMapper().insertData(list); + }); + } + if (!updateList.isEmpty()) { + List> updatePartition = Lists.partition(updateList, 50); + updatePartition.forEach(list -> { + list = encryptUtil.encryptList(list, AddUpSituation.class); + getAddUpSituationMapper().updateData(list); + }); + } + } + + private GetCompanyIncomesResponse getCompanyIncomes(TaxAgentTaxReturnPO returnPO, + String taxAgentName, + AddUpDeductionMonthTaxAgentParam param, + TaxDeclarationApiConfigPO apiConfig, + Integer pageNo) { + String url = apiConfig.getHost() + SzyhApiConstant.GET_COMPANY_INCOMES; + Map requestParam = DataCollectionBO.getApiBaseQueryParams(returnPO, taxAgentName, SalaryDateUtil.getFormatYYYYMM(param.getDeclareMonth())); + requestParam.put("pageSize", 1000); + requestParam.put("pageNo", pageNo); + requestParam.put("reportType", 1); + String reqJson = JsonUtil.toJsonString(requestParam); + log.info("getCompanyIncomes params --- \n{}\n", reqJson); + Map params = new HashMap<>(1); + Map header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret()); + // 开始请求 + String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE); + log.info("getCompanyIncomes res --- {}", res); + return JsonUtil.parseObject(res, GetCompanyIncomesResponse.class); + } + + private AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List requestPOList, TaxDeclarationApiConfigPO apiConfig) { + boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); + boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); + List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List) getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()); + Set taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); + // 获取薪资档案 + List salaryArchiveList = getSalaryArchiveService(user).listByRunStatus(Arrays.asList( + SalaryArchiveStatusEnum.FIXED.getValue(), + SalaryArchiveStatusEnum.SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue(), + SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue())); + salaryArchiveList = salaryArchiveList.stream().filter(e -> taxAgentIdSet.contains(e.getTaxAgentId())).collect(Collectors.toList()); + AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper = new AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper(requestPOList, salaryArchiveList, taxAgents, (long) user.getUID()); + requestWrapper.setApiConfig(apiConfig); + return requestWrapper; + } + + private Map> getEmpDeclareMap(Collection taxAgentIds, Date declareMonth) { + List employeeDeclarePOS = getEmployeeDeclarePOList(taxAgentIds, declareMonth); + SalaryAssert.notEmpty(employeeDeclarePOS, SalaryI18nUtil.getI18nLabel(183783, "暂无人员报送状态为正常的数据,请先报送再获取累计专项附加扣除数据。")); + return employeeDeclarePOS.stream().collect(Collectors.groupingBy(EmployeeDeclarePO::getTaxAgentId)); + } + + private List getEmployeeDeclarePOList(Collection taxAgentIds, Date declareMonth) { + return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().declareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue()).taxCycle(declareMonth).taxAgentIds(taxAgentIds).build()); + } } diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index 3cec335d0..821d24e59 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -24,10 +24,7 @@ import weaver.hrm.User; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -419,19 +416,41 @@ public class AddUpDeductionController { return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineFeedbackFail, queryParam); } -// /** -// * 在线获取结果导出 -// * -// * @return WeaResult 接口返回信息 -// */ -// @Path("/online/feedback/fail/export") -// @GET -// @Produces(MediaType.APPLICATION_JSON) -// public String exportOnlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam Long requestId) { -// User user = HrmUserVarify.getUser(request, response); -// return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::exportOnlineFeedbackFail, queryParam); -// return WeaResult.success(addUpDeductionWrapper.exportOnlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), requestId)); -// } + /** + * 在线获取结果导出 + * + * @return WeaResult 接口返回信息 + */ + @GET + @Path("/online/feedback/fail/export") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportOnlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "requestId") Long requestId) { + try { + User user = HrmUserVarify.getUser(request, response); + + + XSSFWorkbook workbook = getAddUpDeductionWrapper(user).exportOnlineFeedbackFail(requestId); + + String fileName = "在线获取专项附加扣除失败数据" + LocalDate.now(); + + try { + fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error(e.getMessage(), e); + } + + StreamingOutput output = outputStream -> { + workbook.write(outputStream); + outputStream.flush(); + }; + response.setContentType("application/octet-stream"); + return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); + + } catch (Exception e) { + log.error("往期累计情况导入模板导出异常", e); + throw e; + } + } // /** // * 在线获取表单 diff --git a/src/com/engine/salary/web/AddUpSituationController.java b/src/com/engine/salary/web/AddUpSituationController.java index 0c31aa578..1823c81b3 100644 --- a/src/com/engine/salary/web/AddUpSituationController.java +++ b/src/com/engine/salary/web/AddUpSituationController.java @@ -354,4 +354,17 @@ public class AddUpSituationController { } + /** + * 在线获取实际累计已预扣预缴税额 + * + * @param param 前端请求参数 + * @return WeaResult 接口返回信息 + */ + @POST + @Path("/online/actualAddUpAdvanceTax") + @Produces(MediaType.APPLICATION_JSON) + public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionMonthTaxAgentParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpSituationWrapper(user)::onlineRequest, param); + } } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index dbd0abf80..614763634 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -8,6 +8,7 @@ import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; import com.engine.salary.entity.datacollection.param.*; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; @@ -187,37 +188,22 @@ public class AddUpDeductionWrapper extends Service { return getAddUpDeductionService(user).onlineFeedback(); } - public PageInfo onlineFeedbackFail( AddUpDeductionRequestFailQueryParam queryParam) { + public PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) { if (queryParam.getRequestId() == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153345, "在线获取的请求ID不可为空")); } - PageInfo page = getAddUpDeductionService(user).onlineFeedbackFail( queryParam); + PageInfo page = getAddUpDeductionService(user).onlineFeedbackFail(queryParam); return page; } -// public Map exportOnlineFeedbackFail( Long requestId) { -// List poList = getAddUpDeductionService(user).getAddUpDeductionRequestFailPOList(requestId); -// if (CollectionUtils.isEmpty(poList)) { -// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 95795, "数据不存在") + "[id:%s]", requestId)); -// } -// // 构建异步导出参数 -// Map map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail"); -// map.put("sheetName", SalaryI18nUtil.getI18nLabel( 183778, "在线获取专项附加扣除失败数据")); -// LocalRunnable localRunnable = new LocalRunnable() { -// @Override -// public void execute() { -// try { -// DSTenantKeyThreadVar.tenantKey.set(tenantKey); -// getAddUpDeductionService(user).exportOnlineFeedbackFail(map, requestId); -// } finally { -// DSTenantKeyThreadVar.tenantKey.remove(); -// } -// } -// }; -// ThreadPoolUtil.execute(localRunnable); -// return map; -// } -// + public XSSFWorkbook exportOnlineFeedbackFail(Long requestId) { + List poList = getAddUpDeductionService(user).getAddUpDeductionRequestFailPOList(requestId); + if (CollectionUtils.isEmpty(poList)) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(95795, "数据不存在") + "[id:%s]", requestId)); + } + return getAddUpDeductionService(user).exportOnlineFeedbackFail(requestId); + } + // public WeaForm getRequestForm() { // WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); // WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); diff --git a/src/com/engine/salary/wrapper/AddUpSituationWrapper.java b/src/com/engine/salary/wrapper/AddUpSituationWrapper.java index 9e76f49b2..015dcb91f 100644 --- a/src/com/engine/salary/wrapper/AddUpSituationWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpSituationWrapper.java @@ -5,10 +5,7 @@ import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO; import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpSituationDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationParam; -import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpSituationService; import com.engine.salary.service.impl.AddUpSituationServiceImpl; @@ -169,4 +166,8 @@ public class AddUpSituationWrapper extends Service { public AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam) { return getAddUpSituationService(user).getAddUpSituation(addUpSituationParam); } + + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + return getAddUpSituationService(user).onlineRequest(param); + } } From 6059174e7c9ffb5a6371a99a8a1ffab578899d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 6 Sep 2023 09:40:50 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=BE=80=E6=9C=9F=E7=B4=AF=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E5=9C=A8=E7=BA=BF=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sqlupgrade/DM/sql202309050203.sql | 21 +++ resource/sqlupgrade/GS/sql202309050203.sql | 21 +++ resource/sqlupgrade/JC/sql202309050203.sql | 21 +++ resource/sqlupgrade/Mysql/sql202309050203.sql | 15 +- .../sqlupgrade/Oracle/sql202309050203.sql | 17 ++ resource/sqlupgrade/PG/sql202309050203.sql | 25 ++- .../sqlupgrade/SQLServer/sql202309050203.sql | 19 +++ resource/sqlupgrade/ST/sql202309050203.sql | 21 +++ .../entity/datacollection/AddUpSituation.java | 20 +-- .../salaryacct/po/SalaryAcctTaxAgentPO.java | 16 +- .../salaryacct/SalaryAcctTaxAgentMapper.java | 26 +++ .../salaryacct/SalaryAcctTaxAgentMapper.xml | 42 +++++ .../service/SalaryAcctRecordService.java | 7 + .../service/SalaryAcctTaxAgentService.java | 43 +++-- .../salary/service/TaxDeclarationService.java | 11 ++ .../impl/SalaryAcctRecordServiceImpl.java | 155 +++++++++++++++++- .../impl/SalaryAcctTaxAgentServiceImpl.java | 111 +++++-------- .../impl/SalarySobInitServiceImpl.java | 6 + .../impl/TaxDeclarationServiceImpl.java | 8 + .../impl/TaxDeclareRecordServiceImpl.java | 5 +- 20 files changed, 500 insertions(+), 110 deletions(-) create mode 100644 src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java create mode 100644 src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml diff --git a/resource/sqlupgrade/DM/sql202309050203.sql b/resource/sqlupgrade/DM/sql202309050203.sql index 77982e200..4603c0e75 100644 --- a/resource/sqlupgrade/DM/sql202309050203.sql +++ b/resource/sqlupgrade/DM/sql202309050203.sql @@ -7,3 +7,24 @@ alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); alter table hrsa_add_up_situation add tax_adjustment varchar2(255); / +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/resource/sqlupgrade/GS/sql202309050203.sql b/resource/sqlupgrade/GS/sql202309050203.sql index 77982e200..4603c0e75 100644 --- a/resource/sqlupgrade/GS/sql202309050203.sql +++ b/resource/sqlupgrade/GS/sql202309050203.sql @@ -7,3 +7,24 @@ alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); alter table hrsa_add_up_situation add tax_adjustment varchar2(255); / +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/resource/sqlupgrade/JC/sql202309050203.sql b/resource/sqlupgrade/JC/sql202309050203.sql index 77982e200..4603c0e75 100644 --- a/resource/sqlupgrade/JC/sql202309050203.sql +++ b/resource/sqlupgrade/JC/sql202309050203.sql @@ -7,3 +7,24 @@ alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); alter table hrsa_add_up_situation add tax_adjustment varchar2(255); / +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/resource/sqlupgrade/Mysql/sql202309050203.sql b/resource/sqlupgrade/Mysql/sql202309050203.sql index 449c25f07..c5fce8081 100644 --- a/resource/sqlupgrade/Mysql/sql202309050203.sql +++ b/resource/sqlupgrade/Mysql/sql202309050203.sql @@ -3,4 +3,17 @@ alter table hrsa_add_up_situation add add_up_taxable_income varchar(255) alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255) ; alter table hrsa_add_up_situation add tax_adjustment varchar(255) -; \ No newline at end of file +; + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12'); + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12'); + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12'); + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309050203.sql b/resource/sqlupgrade/Oracle/sql202309050203.sql index 14347cd8b..62458bdf3 100644 --- a/resource/sqlupgrade/Oracle/sql202309050203.sql +++ b/resource/sqlupgrade/Oracle/sql202309050203.sql @@ -3,4 +3,21 @@ alter table hrsa_add_up_situation add add_up_taxable_income varchar2(255) alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255) / alter table hrsa_add_up_situation add tax_adjustment varchar2(255) +/ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +/ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6) +/ + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')) +/ +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')) +/ +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')) +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658 +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658 / \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309050203.sql b/resource/sqlupgrade/PG/sql202309050203.sql index 4b9085caa..50cbec61f 100644 --- a/resource/sqlupgrade/PG/sql202309050203.sql +++ b/resource/sqlupgrade/PG/sql202309050203.sql @@ -1,6 +1,25 @@ -alter table hrsa_add_up_situation add add_up_taxable_income varchar(255); +alter table hrsa_add_up_situation add add_up_taxable_income varchar(255) / -alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255); +alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar(255) / -alter table hrsa_add_up_situation add tax_adjustment varchar(255); +alter table hrsa_add_up_situation add tax_adjustment varchar(255) +/ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +/ +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6) +/ + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658 +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658 / \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309050203.sql b/resource/sqlupgrade/SQLServer/sql202309050203.sql index ea69e5604..7e102b81a 100644 --- a/resource/sqlupgrade/SQLServer/sql202309050203.sql +++ b/resource/sqlupgrade/SQLServer/sql202309050203.sql @@ -3,4 +3,23 @@ GO alter table hrsa_add_up_situation add actual_add_up_advance_tax nvarchar(255) GO alter table hrsa_add_up_situation add tax_adjustment nvarchar(255) +GO + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5) +GO + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6) +GO + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +GO +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +GO +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, '2023-09-05 14:41:12', '2023-09-05 14:41:12') +GO + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658 +GO + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658 GO \ No newline at end of file diff --git a/resource/sqlupgrade/ST/sql202309050203.sql b/resource/sqlupgrade/ST/sql202309050203.sql index 77982e200..4603c0e75 100644 --- a/resource/sqlupgrade/ST/sql202309050203.sql +++ b/resource/sqlupgrade/ST/sql202309050203.sql @@ -7,3 +7,24 @@ alter table hrsa_add_up_situation add actual_add_up_advance_tax varchar2(255); alter table hrsa_add_up_situation add tax_adjustment varchar2(255); / +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312885, 1, 674916065864646661, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 5); +/ + +INSERT INTO hrsa_salary_sob_default_item(id, income_category, sys_salary_item_id, can_edit, can_delete, creator, create_time, update_time, delete_type, tenant_key, sob_default_item_group_id, sorted_index) VALUES (706066600446312886, 1, 674916065864646658, 1, 0, 0, '2022-03-14 11:32:30', '2022-03-18 16:59:24', 0, 'all_teams', 703433961629614119, 6); +/ + +INSERT INTO hrsa_formula(id, name, description, module, use_for, reference_type, return_type, validate_type, extend_param, formula, formulaRunScript, creator, delete_type, create_time, update_time) VALUES (1693896072589, 'ǰۼƼ˰ϼ', 'ע', 'salary', 'salaryitem', 'formula', 'number', 'number', '{"isCustomFunction":"0","sqlReturnKey":"","openDecrypt":"0","datasource":{"datasourceId":""}}', '{нĿ.£Σ˰}+{ۼ.ۼƼ˰}', 'salaryItem_taxDeduction+addUpSituation_addUpTaxSavings', 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072606, '£Σ˰', 1693896072589, 'salaryItem_taxDeduction', '{нĿ.£Σ˰}', 'number', 'salaryItem', 0, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +INSERT INTO hrsa_formula_var(id, name, formula_id, field_id, field_name, field_type, source, order_index, creator, delete_type, create_time, update_time) VALUES (1693896072611, 'ۼƼ˰', 1693896072589, 'addUpSituation_addUpTaxSavings', '{ۼ.ۼƼ˰}', 'number', 'addUpSituation', 1, 27, 0, to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss'), to_date('2022-05-10 16:03:02','yyyy-MM-dd HH24:mi:ss')); +/ + +update hrsa_sys_salary_item set value_type = 2 ,formula_id =1693896072589 where id = 674916065864646658; +/ + +update hrsa_salary_item set value_type =2 ,formula_id =1693896072589 where sys_salary_item_id = 674916065864646658; +/ + diff --git a/src/com/engine/salary/entity/datacollection/AddUpSituation.java b/src/com/engine/salary/entity/datacollection/AddUpSituation.java index aefe36a4d..5771dabf0 100644 --- a/src/com/engine/salary/entity/datacollection/AddUpSituation.java +++ b/src/com/engine/salary/entity/datacollection/AddUpSituation.java @@ -87,7 +87,7 @@ public class AddUpSituation { /** * 累计子女教育 */ - @SalaryFormulaVar(defaultLabel = "累计子女教育", labelId = 86321, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计子女教育", labelId = 86321, dataType = "number") @Encrypt @Deprecated private String addUpChildEducation; @@ -95,7 +95,7 @@ public class AddUpSituation { /** * 累计继续教育 */ - @SalaryFormulaVar(defaultLabel = "累计继续教育", labelId = 86323, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计继续教育", labelId = 86323, dataType = "number") @Encrypt @Deprecated private String addUpContinuingEducation; @@ -103,7 +103,7 @@ public class AddUpSituation { /** * 累计住房贷款利息 */ - @SalaryFormulaVar(defaultLabel = "累计住房贷款利息", labelId = 86324, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计住房贷款利息", labelId = 86324, dataType = "number") @Encrypt @Deprecated private String addUpHousingLoanInterest; @@ -111,7 +111,7 @@ public class AddUpSituation { /** * 累计住房租金 */ - @SalaryFormulaVar(defaultLabel = "累计住房租金", labelId = 86325, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计住房租金", labelId = 86325, dataType = "number") @Encrypt @Deprecated private String addUpHousingRent; @@ -119,7 +119,7 @@ public class AddUpSituation { /** * 累计赡养老人 */ - @SalaryFormulaVar(defaultLabel = "累计赡养老人", labelId = 86326, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计赡养老人", labelId = 86326, dataType = "number") @Encrypt @Deprecated private String addUpSupportElderly; @@ -127,7 +127,7 @@ public class AddUpSituation { /** * 累计大病医疗 */ - @SalaryFormulaVar(defaultLabel = "累计大病医疗", labelId = 105142, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计大病医疗", labelId = 105142, dataType = "number") @Encrypt @Deprecated private String addUpIllnessMedical; @@ -135,7 +135,7 @@ public class AddUpSituation { /** * 累计婴幼儿照护 */ - @SalaryFormulaVar(defaultLabel = "累计婴幼儿照护", labelId = 117732, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计婴幼儿照护", labelId = 117732, dataType = "number") @Encrypt @Deprecated private String addUpInfantCare; @@ -143,7 +143,7 @@ public class AddUpSituation { /** * 累计婴幼儿照护 */ - @SalaryFormulaVar(defaultLabel = "累计个人养老金", labelId = 117732, dataType = "number") +// @SalaryFormulaVar(defaultLabel = "累计个人养老金", labelId = 117732, dataType = "number") @Encrypt @Deprecated private String addUpPrivatePension; @@ -191,14 +191,14 @@ public class AddUpSituation { private String addUpAdvanceTax; /** - * 累计已预扣预缴税额 + * 实际累计已预扣预缴税额 */ @SalaryFormulaVar(defaultLabel = "实际累计已预扣预缴税额", labelId = 233557, dataType = "number") @Encrypt private String actualAddUpAdvanceTax; /** - * 累计已预扣预缴税额 + * 个税调差 */ @SalaryFormulaVar(defaultLabel = "个税调差", labelId = 233559, dataType = "number") @Encrypt diff --git a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java index 4a7dd7da6..d12a5a5ac 100644 --- a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java +++ b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java @@ -1,9 +1,11 @@ package com.engine.salary.entity.salaryacct.po; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; -import java.time.LocalDateTime; import java.util.Date; /** @@ -15,7 +17,10 @@ import java.util.Date; * @version 1.0 **/ @Data +@Builder @Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor // "hrsa_acct_tax_agent") public class SalaryAcctTaxAgentPO { @@ -67,10 +72,15 @@ public class SalaryAcctTaxAgentPO { /** * 创建时间 */ - private LocalDateTime createTime; + private Date createTime; /** * 更新时间 */ - private LocalDateTime updateTime; + private Date updateTime; + + + + private Date startMonth; + private Date endMonth; } diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java new file mode 100644 index 000000000..ce3c104a4 --- /dev/null +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.java @@ -0,0 +1,26 @@ +package com.engine.salary.mapper.salaryacct; + +import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + * @description: 薪资核算记录对应的个税扣缴义务人 + * @author: xiajun + * @modified By: xiajun + * @date: Created in 2022/11/22 1:47 PM + * @version:v1.0 + */ +public interface SalaryAcctTaxAgentMapper { + + /** + * 获取核算记录和扣缴义务人对应关系 + * @param salaryAcctIds + * @return + */ + List listAcctTaxAgent(@Param("salaryAcctRecordIds") Collection salaryAcctIds); + + List listByTaxCycleRange(SalaryAcctTaxAgentPO queryWrapper); +} diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml new file mode 100644 index 000000000..e9ed7eb66 --- /dev/null +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctTaxAgentMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryAcctRecordService.java b/src/com/engine/salary/service/SalaryAcctRecordService.java index 4e7c8eb2e..51eb656e1 100644 --- a/src/com/engine/salary/service/SalaryAcctRecordService.java +++ b/src/com/engine/salary/service/SalaryAcctRecordService.java @@ -124,6 +124,13 @@ public interface SalaryAcctRecordService { */ Long save(SalaryAcctRecordSaveParam saveParam); + /** + * 保存之前检查一下是否可以新建核算 + * + * @param salaryAcctTaxAgents + */ + void checkBeforeSave(SalaryAcctRecordPO salaryAcctRecord, List salaryAcctTaxAgents); + /** * 更新薪资核算记录的状态 * diff --git a/src/com/engine/salary/service/SalaryAcctTaxAgentService.java b/src/com/engine/salary/service/SalaryAcctTaxAgentService.java index be75f76bf..e2796aa4a 100644 --- a/src/com/engine/salary/service/SalaryAcctTaxAgentService.java +++ b/src/com/engine/salary/service/SalaryAcctTaxAgentService.java @@ -1,7 +1,6 @@ package com.engine.salary.service; import com.engine.salary.common.YearMonthRange; -import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; import java.util.Collection; @@ -33,25 +32,25 @@ public interface SalaryAcctTaxAgentService { */ List listByTaxCycleRange(YearMonthRange taxCycleRange); - /** - * 根据薪资核算人员初始化 - * - * @param salaryAcctEmployees - * @return - */ - List initBySalaryAcctEmployees(List salaryAcctEmployees); - - /** - * 批量保存 - * - * @param salaryAcctTaxAgents - */ - void batchSave(List salaryAcctTaxAgents); - - /** - * 根据薪资核算记录id删除关联的个税扣缴义务人 - * - * @param salaryAcctRecordIds - */ - void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds); +// /** +// * 根据薪资核算人员初始化 +// * +// * @param salaryAcctEmployees +// * @return +// */ +// List initBySalaryAcctEmployees(List salaryAcctEmployees); +// +// /** +// * 批量保存 +// * +// * @param salaryAcctTaxAgents +// */ +// void batchSave(List salaryAcctTaxAgents); +// +// /** +// * 根据薪资核算记录id删除关联的个税扣缴义务人 +// * +// * @param salaryAcctRecordIds +// */ +// void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds); } diff --git a/src/com/engine/salary/service/TaxDeclarationService.java b/src/com/engine/salary/service/TaxDeclarationService.java index 4e7d0e3ce..2731904a5 100644 --- a/src/com/engine/salary/service/TaxDeclarationService.java +++ b/src/com/engine/salary/service/TaxDeclarationService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.common.YearMonthRange; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; @@ -59,4 +60,14 @@ public interface TaxDeclarationService { void deleteByTaxDeclareRecordIds(Collection taxDeclareRecordIds); void saveBatch(List taxDeclarations); + + + /** + * 根据税款所属期查询个税申报表 + * + * @param yearMonthRange + * @return + */ + List listByTaxCycleRange(YearMonthRange yearMonthRange); + } diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 9b4b123f6..94dd92579 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -4,6 +4,7 @@ import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.common.YearMonthRange; import com.engine.salary.entity.salaryBill.po.SalarySendPO; import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO; import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam; @@ -14,6 +15,8 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; import com.engine.salary.exception.SalaryRunTimeException; @@ -32,6 +35,8 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; @@ -78,6 +83,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private SalaryAcctTaxAgentService getSalaryAcctTaxAgentService(User user) { + return ServiceUtil.getService(SalaryAcctTaxAgentServiceImpl.class, user); + } + // private SalaryCheckResultService salaryCheckResultService; // // private SalaryCheckResultDetailService salaryCheckResultDetailService; @@ -271,9 +280,11 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe public Long save(SalaryAcctRecordSaveParam saveParam) { ValidUtil.doValidator(saveParam); //检查 - checkBeforeSave(saveParam); +// checkBeforeSave(saveParam); + SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId()); + // 查询税款所属期 SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(saveParam.getSalarySobId(), saveParam.getSalaryMonth()); // 薪资所属月所在年的日期范围(第一天~最后一天) @@ -293,12 +304,20 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe // 转换成po SalaryAcctRecordPO salaryAcctRecordPO = SalaryAcctRecordBO.convert2PO(saveParam, salarySobCycleDTO, (int) acctTimes, (long) user.getUID()); + + //检查 + // 检查是否能够新建核算 + SalaryAcctTaxAgentPO build = SalaryAcctTaxAgentPO.builder().incomeCategory(salarySobPO.getIncomeCategory()).taxAgentId(salarySobPO.getTaxAgentId()).taxCycle(salaryAcctRecordPO.getTaxCycle()).build(); + List salaryAcctTaxAgents = new ArrayList<>(); + salaryAcctTaxAgents.add(build); + checkBeforeSave(salaryAcctRecordPO, salaryAcctTaxAgents); + // 保存薪资核算记录 getSalaryAcctRecordMapper().insertIgnoreNull(salaryAcctRecordPO); // 初始化薪资核算人员 getSalaryAcctEmployeeService(user).initBySalaryAcctRecord(salaryAcctRecordPO); // 记录日志 -// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId(), tenantKey); +// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId()); // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId("" + salaryAcctRecordPO.getId()); // loggerContext.setTargetName(targetName); @@ -438,6 +457,136 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe } + + /** + * 保存之前检查一下是否可以新建核算 + * + * @param salaryAcctTaxAgents + */ + @Override + public void checkBeforeSave(SalaryAcctRecordPO salaryAcctRecord, List salaryAcctTaxAgents) { + // 查询薪资账套 + SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecord.getSalarySobId()); + IncomeCategoryEnum incomeCategoryEnums = IncomeCategoryEnum.parseByValue(salarySobPO.getIncomeCategory()); + if (incomeCategoryEnums == IncomeCategoryEnum.ONETIME_ANNUAL_BONUS) { + // 如果当前是单独核算年终奖,无需校验其他所得项目的薪资核算记录 + checkBeforeSaveAnnual(salaryAcctTaxAgents); + } else { + checkBeforeSaveCommon(salaryAcctTaxAgents); + } + } + + private void checkBeforeSaveAnnual(List salaryAcctTaxAgents) { + salaryAcctTaxAgents = salaryAcctTaxAgents.stream() + .filter(e -> Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(salaryAcctTaxAgents)) { + return; + } + // 查询本次薪资核算记录的税款所属期所在年度的薪资核算记录 + Set sameYearSet = Sets.newHashSet(); + List otherSalaryAcctTaxAgents = Lists.newArrayList(); + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + Date taxCycle = salaryAcctTaxAgent.getTaxCycle(); + if (!sameYearSet.contains(taxCycle.getYear())) { + sameYearSet.add(taxCycle.getYear()); + // 税款所属期所在年度的1月~12月 + YearMonthRange taxCycleRange = new YearMonthRange() + .setStartMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(1))) + .setEndMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(12))); + // 税款所属期所在年度所有的薪资核算记录 + otherSalaryAcctTaxAgents.addAll(getSalaryAcctTaxAgentService(user).listByTaxCycleRange(taxCycleRange)); + } + } + // 排除掉所得项目不是全年一次性奖金收入的薪资核算记录 + otherSalaryAcctTaxAgents = otherSalaryAcctTaxAgents.stream() + .filter(e -> Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + // 全年一次性奖金收入一年内只能申报一次,所以税款所属期必须相同 + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + SalaryAcctTaxAgentPO diffTaxCycleSalaryAcctTaxAgent = otherSalaryAcctTaxAgents.stream() + .filter(e -> Objects.equals(salaryAcctTaxAgent.getTaxAgentId(), e.getTaxAgentId()) + && !Objects.equals(salaryAcctTaxAgent.getTaxCycle(), e.getTaxCycle())) + .findAny() + .orElse(null); + if (diffTaxCycleSalaryAcctTaxAgent != null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160502, "全年一次性奖金收入一年内只能申报一次,所以税款所属期必须相同")); + } + } + } + + private void checkBeforeSaveCommon(List salaryAcctTaxAgents) { + // 排除掉所得项目为全年一次性奖金收入的薪资核算记录 + salaryAcctTaxAgents = salaryAcctTaxAgents.stream() + .filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + Set sameYearSet = Sets.newHashSet(); + List sameYearTaxDeclarations = Lists.newArrayList(); + List sameYearSalaryAcctTaxAgents = Lists.newArrayList(); + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + Date taxCycle = salaryAcctTaxAgent.getTaxCycle(); + if (!sameYearSet.contains(taxCycle.getYear())) { + sameYearSet.add(taxCycle.getYear()); + // 税款所属期所在年度的1月~12月 + YearMonthRange taxCycleRange = new YearMonthRange() + .setStartMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(1))) + .setEndMonth(SalaryDateUtil.toDateStartOfMonth(SalaryDateUtil.localDate2YearMonth(taxCycle).withMonth(12))); + // 税款所属期所在年度所有的个税申报表 + sameYearTaxDeclarations.addAll(getTaxDeclarationService(user).listByTaxCycleRange(taxCycleRange)); + // 税款所属期所在年度所有的薪资核算记录 + sameYearSalaryAcctTaxAgents.addAll(getSalaryAcctTaxAgentService(user).listByTaxCycleRange(taxCycleRange)); + } + } + // 排除掉所得项目为全年一次性奖金收入的个税申报表和薪资核算记录 + sameYearTaxDeclarations = sameYearTaxDeclarations.stream() + .filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + sameYearSalaryAcctTaxAgents = sameYearSalaryAcctTaxAgents.stream() + .filter(e -> !Objects.equals(e.getIncomeCategory(), IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue())) + .collect(Collectors.toList()); + + // 查询个税扣缴义务人 + Set taxAgentIds = SalaryEntityUtil.properties(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxAgentId); + List taxAgents = getTaxAgentService(user).listByIds(taxAgentIds); + Map taxAgentMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); + + Set declareTaxAgents = SalaryEntityUtil.properties(sameYearTaxDeclarations, e -> e.getTaxAgentId() + "-" + e.getTaxCycle()); + Map> sameYearSalaryAcctTaxAgentMap = SalaryEntityUtil + .group2Map(sameYearSalaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxAgentId); + for (SalaryAcctTaxAgentPO salaryAcctTaxAgent : salaryAcctTaxAgents) { + List salaryAcctTaxAgentList = sameYearSalaryAcctTaxAgentMap.getOrDefault(salaryAcctTaxAgent.getTaxAgentId(), Collections.emptyList()) + .stream() + .filter(e -> !Objects.equals(salaryAcctTaxAgent.getSalaryAcctRecordId(), e.getSalaryAcctRecordId())) + .collect(Collectors.toList()); + if (CollectionUtils.isEmpty(salaryAcctTaxAgentList)) { + continue; + } + // 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算 + SalaryAcctTaxAgentPO notDeclareSalaryAcctTaxAgent = salaryAcctTaxAgentList.stream() + .filter(e -> salaryAcctTaxAgent.getTaxCycle().compareTo(e.getTaxCycle()) > 0 + && !declareTaxAgents.contains(e.getTaxAgentId() + "-" + e.getTaxCycle())) + .findAny() + .orElse(null); + if (Objects.nonNull(notDeclareSalaryAcctTaxAgent)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160504, "个税扣缴义务人「{0}」的税款所属期「{1}」的个税还未申报,请先申报后再来新建税款所属期「{2}」的薪资核算") + .replace("{0}", taxAgentMap.get(notDeclareSalaryAcctTaxAgent.getTaxAgentId())) + .replace("{1}", SalaryDateUtil.getFormatYYYYMM(notDeclareSalaryAcctTaxAgent.getTaxCycle())) + .replace("{2}", SalaryDateUtil.getFormatYYYYMM(salaryAcctTaxAgent.getTaxCycle()))); + } + // 如果某个月(税款所属期)已经核算了,不可以新建之前月份的薪资核算 + SalaryAcctTaxAgentPO calculatedSalaryAcctTaxAgent = salaryAcctTaxAgentList.stream() + .filter(e -> salaryAcctTaxAgent.getTaxCycle().compareTo(e.getTaxCycle()) < 0) + .findAny() + .orElse(null); + if (Objects.nonNull(calculatedSalaryAcctTaxAgent)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160506, "个税扣缴义务人「{0}」已经存在薪资所属月「{1}」的薪资核算记录了,无法新建薪资所属月「{2}」的薪资核算") + .replace("{0}", taxAgentMap.get(calculatedSalaryAcctTaxAgent.getTaxAgentId())) + .replace("{1}", SalaryDateUtil.getFormatYYYYMM(calculatedSalaryAcctTaxAgent.getSalaryMonth())) + .replace("{2}", SalaryDateUtil.getFormatYYYYMM(salaryAcctTaxAgent.getSalaryMonth()))); + } + } + } + private List listByCreateDate(LocalDateRange taxCycleRebootYearRange, Set salarySobIds) { return getSalaryAcctRecordMapper().listByCreateDate(taxCycleRebootYearRange, salarySobIds); } @@ -594,7 +743,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe // salaryAcctRecordPO.setUpdateTime(new Date()); // getSalaryAcctRecordMapper().updateIgnoreNull(salaryAcctRecordPO); // 记录日志 -// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId(), tenantKey); +// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId()); // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId("" + salaryAcctRecordPO.getId()); // loggerContext.setTargetName(targetName); diff --git a/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java index 49acd5b52..8bd4fe4f1 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctTaxAgentServiceImpl.java @@ -1,65 +1,45 @@ -//package com.engine.salary.service.impl; -// -//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -//import com.baomidou.mybatisplus.core.toolkit.Wrappers; -//import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -//import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; -//import com.engine.core.impl.Service; -//import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; -//import com.engine.salary.service.SalaryAcctTaxAgentService; -//import com.google.common.collect.Lists; -//import com.google.common.collect.Sets; -//import com.weaver.common.distribution.genid.IdGenerator; -//import com.weaver.common.hr.util.Util; -//import com.weaver.hrm.salary.common.YearMonthRange; -//import com.weaver.hrm.salary.dao.SalaryAcctTaxAgentMapper; -//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctEmployeePO; -//import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum; -//import org.apache.commons.collections4.CollectionUtils; -//import org.springframework.transaction.annotation.Transactional; -// -//import java.time.LocalDateTime; -//import java.util.*; -// -///** -// * @description: -// * @author: xiajun -// * @modified By: xiajun -// * @date: 2022/7/29 9:45 -// * @version:v1.0 -// */ -//public class SalaryAcctTaxAgentServiceImpl extends Service implements SalaryAcctTaxAgentService { -// -// private SalaryAcctTaxAgentMapper salaryAcctTaxAgentMapper; -// +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.common.YearMonthRange; +import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; +import com.engine.salary.mapper.salaryacct.SalaryAcctTaxAgentMapper; +import com.engine.salary.service.SalaryAcctTaxAgentService; +import com.engine.salary.util.db.MapperProxyFactory; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +public class SalaryAcctTaxAgentServiceImpl extends Service implements SalaryAcctTaxAgentService { + + private SalaryAcctTaxAgentMapper getSalaryAcctTaxAgentMapper() { + return MapperProxyFactory.getProxy(SalaryAcctTaxAgentMapper.class); + } + @Override + public List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds) { + if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { + return Collections.emptyList(); + } + return getSalaryAcctTaxAgentMapper().listAcctTaxAgent(salaryAcctRecordIds); + } + + @Override + public List listByTaxCycleRange(YearMonthRange taxCycleRange) { + SalaryAcctTaxAgentPO queryWrapper = new SalaryAcctTaxAgentPO(); + if (Objects.nonNull(taxCycleRange.getStartMonth())) { + queryWrapper.setStartMonth(taxCycleRange.getStartMonth()); + } + if (Objects.nonNull(taxCycleRange.getEndMonth())) { + queryWrapper.setEndMonth(taxCycleRange.getEndMonth()); + } + return getSalaryAcctTaxAgentMapper().listByTaxCycleRange(queryWrapper); + } + // @Override -// public List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds, String tenantKey) { -// if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { -// return Collections.emptyList(); -// } -// return new LambdaQueryChainWrapper<>(salaryAcctTaxAgentMapper) -// .eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey) -// .eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) -// .in(SalaryAcctTaxAgentPO::getSalaryAcctRecordId, salaryAcctRecordIds) -// .list(); -// } -// -// @Override -// public List listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey) { -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); -// queryWrapper.eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey); -// queryWrapper.eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); -// if (Objects.nonNull(taxCycleRange.getStartMonth())) { -// queryWrapper.ge(SalaryAcctTaxAgentPO::getTaxCycle, taxCycleRange.getStartMonth().toString()); -// } -// if (Objects.nonNull(taxCycleRange.getEndMonth())) { -// queryWrapper.le(SalaryAcctTaxAgentPO::getTaxCycle, taxCycleRange.getEndMonth().toString()); -// } -// return salaryAcctTaxAgentMapper.selectList(queryWrapper); -// } -// -// @Override -// public List initBySalaryAcctEmployees(List salaryAcctEmployees, Long employeeId, String tenantKey) { +// public List initBySalaryAcctEmployees(List salaryAcctEmployees) { // if (CollectionUtils.isEmpty(salaryAcctEmployees)) { // return Collections.emptyList(); // } @@ -89,19 +69,18 @@ // } // // @Override -// @Transactional(rollbackFor = Exception.class) -// public void batchSave(List salaryAcctTaxAgents, String tenantKey) { +// public void batchSave(List salaryAcctTaxAgents) { // if (CollectionUtils.isNotEmpty(salaryAcctTaxAgents)) { // saveBatch(salaryAcctTaxAgents); // } // } // // @Override -// public void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds, String tenantKey) { +// public void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds) { // if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { // return; // } -// new LambdaUpdateChainWrapper<>(salaryAcctTaxAgentMapper) +// new LambdaUpdateChainWrapper<>(getSalaryAcctTaxAgentMapper()) // .eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey) // .eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) // .in(SalaryAcctTaxAgentPO::getSalaryAcctRecordId, salaryAcctRecordIds) @@ -109,4 +88,4 @@ // .set(SalaryAcctTaxAgentPO::getUpdateTime, LocalDateTime.now()) // .update(); // } -//} +} diff --git a/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java index d5414a8fe..d1ded8b46 100644 --- a/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java @@ -335,6 +335,12 @@ public class SalarySobInitServiceImpl extends AbstractSalarySobInitService { if (Objects.equals(declaredField.getName(), "addUpAdvanceTax")) { salarySobItem = salarySobItemMap.get("addUpTaxPayable"); } + if (Objects.equals(declaredField.getName(), "addUpTaxExemptIncome")) { + salarySobItem = salarySobItemMap.get("addUpTaxFreeIncome"); + } + if (Objects.equals(declaredField.getName(), "addUpTaxSavings")) { + salarySobItem = salarySobItemMap.get("addUpTaxDeduction"); + } if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class) || Objects.isNull(salarySobItem)) { continue; } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index 20ed01799..f778da6fd 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -3,6 +3,7 @@ package com.engine.salary.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.common.YearMonthRange; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; @@ -357,4 +358,11 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration getTaxDeclarationMapper().batchInsert(taxDeclarations); } } + + @Override + public List listByTaxCycleRange(YearMonthRange yearMonthRange) { + return getTaxDeclarationMapper().listSome(TaxDeclarationPO.builder() + .salaryMonths(LocalDateRange.builder().fromDate(yearMonthRange.getStartMonth()).endDate(yearMonthRange.getEndMonth()).build()) + .build()); + } } diff --git a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java index 6991bdeea..efbd618c6 100644 --- a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java @@ -122,8 +122,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } - private SalaryAcctTaxAgentService salaryAcctTaxAgentService; - + private SalaryAcctTaxAgentService getSalaryAcctTaxAgentService(User user) { + return ServiceUtil.getService(SalaryAcctTaxAgentServiceImpl.class, user); + } private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) { return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user); } From d7b9485d1802de8bdd993885390f25003faa7a82 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 6 Sep 2023 10:17:20 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E6=A0=B8=E7=AE=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E9=97=B4=E8=A1=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=88=86=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 47e0741f7..69b12aa04 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -504,7 +504,12 @@ public class SIAccountBiz extends Service { //TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition()); String billMonth = param.getBillMonth(); try { - List list = getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(ids, billMonth, param.getPaymentOrganization()); +// List list = getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(ids, billMonth, param.getPaymentOrganization()); + List list = new ArrayList<>(); + List> partitionDetailTempInfo = Lists.partition((List) ids, 100); + partitionDetailTempInfo.forEach(part -> list.addAll( + getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(part, billMonth, param.getPaymentOrganization()))); + encryptUtil.decryptList(list, InsuranceAccountDetailTempPO.class); Integer paymentStatus = 0; log.info("核算明细临时表 hrsa_bill_detail_temp待处理数量:{}", list.size());