From f2fdbca8f7b696399f3616db4e0e75abaf4b09f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com>
Date: Mon, 7 Nov 2022 11:31:21 +0800
Subject: [PATCH 01/33] =?UTF-8?q?=E8=84=B1=E6=95=8F=E8=A1=A8=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impl/SalaryAcctReportServiceImpl.java | 19 ++++++++++++++++++-
.../sys/constant/SalarySysConstant.java | 5 +++++
.../sys/entity/param/AppSettingSaveParam.java | 9 +++++++++
.../salary/sys/entity/vo/AppSettingVO.java | 7 +++++++
.../sys/service/SalarySysConfService.java | 5 +++++
.../impl/SalarySysConfServiceImpl.java | 13 ++++++++++++-
6 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/src/com/engine/salary/service/impl/SalaryAcctReportServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctReportServiceImpl.java
index 334221f35..e02c2aeac 100644
--- a/src/com/engine/salary/service/impl/SalaryAcctReportServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryAcctReportServiceImpl.java
@@ -1,19 +1,27 @@
package com.engine.salary.service.impl;
+import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.encrypt.report.SalaryAcctResultReportPOEncrypt;
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
import com.engine.salary.mapper.report.SalaryAcctResultReportMapper;
import com.engine.salary.service.SalaryAcctReportService;
+import com.engine.salary.sys.entity.po.SalarySysConfPO;
+import com.engine.salary.sys.enums.OpenEnum;
+import com.engine.salary.sys.service.SalarySysConfService;
+import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
+import weaver.hrm.User;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
+import static com.engine.salary.sys.constant.SalarySysConstant.DISPLAY_EMP_INFO_REPORT;
+
/**
* 薪资报表
*
Copyright: Copyright (c) 2022
@@ -28,6 +36,11 @@ public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctRe
return MapperProxyFactory.getProxy(SalaryAcctResultReportMapper.class);
}
+
+ private SalarySysConfService getSalarySysConfService(User user) {
+ return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
+ }
+
/**
* 薪酬解密方法
*
@@ -61,7 +74,11 @@ public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctRe
@Override
public void batchSave(Collection pos) {
if (CollectionUtils.isNotEmpty(pos)) {
- SalaryAcctResultReportPOEncrypt.encryptList(pos);
+ SalarySysConfPO disPlay = getSalarySysConfService(user).getOneByCode(DISPLAY_EMP_INFO_REPORT);
+ //默认不显示,关闭状态
+ if (disPlay == null || OpenEnum.OFF.getValue().equals(disPlay.getConfValue())) {
+ SalaryAcctResultReportPOEncrypt.encryptList(pos);
+ }
// List> partition = Lists.partition((List) pos, 100);
// partition.forEach(getSalaryAcctResultReportMapper()::batchInsert);
diff --git a/src/com/engine/salary/sys/constant/SalarySysConstant.java b/src/com/engine/salary/sys/constant/SalarySysConstant.java
index 4800e1e61..30f352cbf 100644
--- a/src/com/engine/salary/sys/constant/SalarySysConstant.java
+++ b/src/com/engine/salary/sys/constant/SalarySysConstant.java
@@ -32,6 +32,11 @@ public class SalarySysConstant {
*/
public static final String OPEN_ACCT_RESULT_SUM = "OPEN_ACCT_RESULT_SUM";
+ /**
+ * 是否显示脱敏表人员信息
+ */
+ public static final String DISPLAY_EMP_INFO_REPORT = "DISPLAY_EMP_INFO_REPORT";
+
/**
* 应用设置是否开启加密
*/
diff --git a/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java b/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java
index e235ad139..12c36115b 100644
--- a/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java
+++ b/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java
@@ -1,6 +1,7 @@
package com.engine.salary.sys.entity.param;
import com.engine.salary.sys.enums.OpenEnum;
+import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -32,6 +33,7 @@ public class AppSettingSaveParam {
*
* @see OpenEnum
*/
+ @DataCheck(require = true,message = "是否开启核算结果合计列?")
private String openAcctResultSum;
/**
@@ -39,4 +41,11 @@ public class AppSettingSaveParam {
*/
private String isOpenEncrypt;
+ /**
+ * 是否显示脱敏表人员信息
+ * @see OpenEnum
+ */
+ @DataCheck(require = true,message = "是否显示脱敏表人员信息?")
+ private String displayEmpInfoReport;
+
}
diff --git a/src/com/engine/salary/sys/entity/vo/AppSettingVO.java b/src/com/engine/salary/sys/entity/vo/AppSettingVO.java
index cfa2dbc77..d95b33af4 100644
--- a/src/com/engine/salary/sys/entity/vo/AppSettingVO.java
+++ b/src/com/engine/salary/sys/entity/vo/AppSettingVO.java
@@ -40,4 +40,11 @@ public class AppSettingVO {
private String isOpenEncrypt;
+
+ /**
+ * 是否显示脱敏表人员信息
+ * @see OpenEnum
+ */
+ private String displayEmpInfoReport;
+
}
diff --git a/src/com/engine/salary/sys/service/SalarySysConfService.java b/src/com/engine/salary/sys/service/SalarySysConfService.java
index de1fd16ae..30e97581d 100644
--- a/src/com/engine/salary/sys/service/SalarySysConfService.java
+++ b/src/com/engine/salary/sys/service/SalarySysConfService.java
@@ -67,5 +67,10 @@ public interface SalarySysConfService {
*/
Map saveEncryptSetting(AppSettingSaveParam appSettingSaveParam);
+ /**
+ * 加密进度
+ * @param progressId
+ * @return
+ */
Map getEncryptProgress(String progressId);
}
diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
index efd8e42c0..14b971945 100644
--- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
+++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
@@ -298,6 +298,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
public void saveAppSetting(AppSettingSaveParam param) {
String openAcctResultSum = param.getOpenAcctResultSum();
saveSettingByType(openAcctResultSum, OPEN_ACCT_RESULT_SUM, "开启核算结果合并", "app");
+ saveSettingByType(param.getDisplayEmpInfoReport(), DISPLAY_EMP_INFO_REPORT, "是否显示脱敏表人员信息", "app");
}
@Override
@@ -410,6 +411,9 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
case OPEN_APPLICATION_ENCRYPT:
appSettingVO.setIsOpenEncrypt(salarySysConfPO.getConfValue());
break;
+ case DISPLAY_EMP_INFO_REPORT:
+ appSettingVO.setDisplayEmpInfoReport(salarySysConfPO.getConfValue());
+ break;
default:
break;
}
@@ -417,7 +421,14 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
}
//默认加密开启
if (StringUtils.isEmpty(appSettingVO.getIsOpenEncrypt())) {
- appSettingVO.setIsOpenEncrypt("1");
+ appSettingVO.setIsOpenEncrypt(OpenEnum.OPEN.getValue());
+ }
+
+ /**
+ * 默认不显示
+ */
+ if (StringUtils.isEmpty(appSettingVO.getDisplayEmpInfoReport())) {
+ appSettingVO.setDisplayEmpInfoReport(OpenEnum.OFF.getValue());
}
return appSettingVO;
}
From 2da0455c46da79847d9f8c0c9aeb953ca218e57e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com>
Date: Mon, 7 Nov 2022 15:11:24 +0800
Subject: [PATCH 02/33] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=96=AA=E8=B5=84?=
=?UTF-8?q?=E6=A1=A3=E6=A1=88=E4=B8=AA=E7=A8=8E=E6=89=A3=E7=BC=B4=E4=B9=89?=
=?UTF-8?q?=E5=8A=A1=E4=BA=BA=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=20=E5=A4=84=E7=90=86=E5=8E=86=E5=8F=B2=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=94=B9=E4=B8=BA=E5=BC=82=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impl/SalaryArchiveServiceImpl.java | 60 ++++++++++---------
.../salary/wrapper/SalaryArchiveWrapper.java | 49 +--------------
2 files changed, 36 insertions(+), 73 deletions(-)
diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
index 30d2d2d85..a0e5dc2fe 100644
--- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
@@ -1,6 +1,6 @@
package com.engine.salary.service.impl;
-import com.api.formmode.mybatis.util.SqlProxyHandle;
+import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.*;
@@ -26,9 +26,9 @@ import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
-import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.service.*;
import com.engine.salary.sys.entity.vo.OrderRuleVO;
+import com.engine.salary.sys.enums.OpenEnum;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
@@ -118,11 +118,6 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user);
}
-
- private SalarySysConfMapper getSalarySysConfMapper() {
- return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
- }
-
@Override
public SalaryArchivePO getById(Long salaryArchiveId) {
return salaryArchiveMapper.getById(salaryArchiveId);
@@ -131,10 +126,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
@Override
public List listSome(SalaryArchivePO po) {
Collection ids = po.getIds();
- if(CollectionUtils.isNotEmpty(ids)){
+ if (CollectionUtils.isNotEmpty(ids)) {
List list = new ArrayList<>();
List> partition = Lists.partition((List) ids, 1000);
- partition.forEach(idss->{
+ partition.forEach(idss -> {
po.setIds(idss);
list.addAll(getSalaryArchiveMapper().listSome(po));
});
@@ -142,10 +137,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
Collection employeeIds = po.getEmployeeIds();
- if(CollectionUtils.isNotEmpty(employeeIds)){
+ if (CollectionUtils.isNotEmpty(employeeIds)) {
List list = new ArrayList<>();
List> partition = Lists.partition((List) employeeIds, 1000);
- partition.forEach(emps->{
+ partition.forEach(emps -> {
po.setEmployeeIds(emps);
list.addAll(getSalaryArchiveMapper().listSome(po));
});
@@ -160,13 +155,24 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
public PageInfo listPage(SalaryArchiveQueryParam queryParam) {
long currentEmployeeId = user.getUID();
-
- // 1.历史数据处理
- handleHistory(currentEmployeeId);
- // 2.待停薪自动处理
- handleSuspendData(currentEmployeeId);
- // 3.增量数据处理
- handleChangeData(currentEmployeeId);
+ /**
+ * 异步处理档案数据
+ */
+ String handleable = Util.null2String(Util_DataCache.getObjVal("salaryArchiveHandleable"));
+ if (StringUtils.isBlank(handleable) || OpenEnum.OPEN.getValue().equals(handleable)) {
+ new Thread() {
+ public void run() {
+ Util_DataCache.setObjVal("salaryArchiveHandleable", "0");
+ // 1.历史数据处理
+ handleHistory(currentEmployeeId);
+ // 2.待停薪自动处理
+ handleSuspendData(currentEmployeeId);
+ // 3.增量数据处理
+ handleChangeData(currentEmployeeId);
+ Util_DataCache.setObjVal("salaryArchiveHandleable", "1");
+ }
+ }.start();
+ }
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
@@ -1107,9 +1113,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
List oldList = listSome(SalaryArchivePO.builder()
- .ids(ids)
- .runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
- .build());
+ .ids(ids)
+ .runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
+ .build());
if (CollectionUtils.isEmpty(oldList)) {
@@ -1192,9 +1198,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
List oldList = listSome(SalaryArchivePO.builder()
- .ids(ids)
- .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
- .build());
+ .ids(ids)
+ .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
+ .build());
if (CollectionUtils.isEmpty(oldList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "档案不存在!"));
@@ -1241,9 +1247,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
List oldList = listSome(SalaryArchivePO.builder()
- .ids(ids)
- .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
- .build());
+ .ids(ids)
+ .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
+ .build());
List unableList = oldList.stream().filter(f -> Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().after(new Date())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(unableList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115789, "最后发薪日必须晚于今天"));
diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java
index 596808e3a..d50b8de03 100644
--- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java
+++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java
@@ -15,7 +15,6 @@ import com.engine.salary.entity.salaryarchive.param.*;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
-import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
@@ -323,16 +322,8 @@ public class SalaryArchiveWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100465, "薪资档案员工信息不存在"));
}
- // 获取当前已生效个税扣缴义务人
- List taxAgentList = getSalaryArchiveService(user).getCurrentEffectiveTaxAgentList(Collections.singletonList(salaryArchiveId));
- // 获取所有个税扣缴义务人
- Collection taxAgentLists = getTaxAgentService(user).findAll();
- String taxAgent = "";
- if (CollectionUtils.isNotEmpty(taxAgentList)) {
- SalaryArchiveTaxAgentPO salaryArchiveTaxAgent = taxAgentList.get(0);
- Optional taxAgentOptional = taxAgentLists.stream().filter(f -> f.getId().equals(salaryArchiveTaxAgent.getTaxAgentId())).findFirst();
- taxAgent = taxAgentOptional.isPresent() ? taxAgentOptional.get().getName() : taxAgent;
- }
+ Long taxAgentId = po.getTaxAgentId();
+ TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxAgentId);
// 1.基本信息表单
Map baseInfo = new HashMap<>();
@@ -343,7 +334,7 @@ public class SalaryArchiveWrapper extends Service {
.position(employee.getJobtitleName() == null ? "" : employee.getJobtitleName())
.hiredate(employee.getCompanystartdate())
.mobile(employee.getMobile())
- .taxAgent(taxAgent)
+ .taxAgent(taxAgent.getName())
.build();
baseInfo.put("employee", build);
@@ -422,31 +413,6 @@ public class SalaryArchiveWrapper extends Service {
return importTypes;
}
-// /**
-// * 导出薪资档案
-// *
-// * @param queryParam
-// * @param employeeId
-// * @param tenantKey
-// * @return
-// */
-// public Map exportList(SalaryArchiveQueryParam queryParam, Long employeeId, String tenantKey) {
-// // 构建异步导出参数
-// Map map = salaryBatchService.buildeExportParam("exportSalaryArchive");
-// String username = UserContext.getCurrentUser().getUsername();
-// String eteamsId = TenantRpcContext.getEteamsId();
-// taskExecutor.execute(() -> {
-// try {
-// DSTenantKeyThreadVar.tenantKey.set(tenantKey);
-// getSalaryArchiveService(user).exportList(map, username, eteamsId, queryParam, employeeId, tenantKey);
-// } finally {
-// DSTenantKeyThreadVar.tenantKey.remove();
-// }
-// });
-//
-// return map;
-// }
-//
/**
* 下载导入模板
@@ -561,15 +527,6 @@ public class SalaryArchiveWrapper extends Service {
return getSalaryArchiveExcelService(user).processInit(importData);
}
-
-// public Map importSalaryArchiveSalaryItemAdjust(SalaryArchiveImportActionParam importData) {
-// importData.setListType("FIXED");
-// importData.setImportType("salaryItemAdjust");
-// importData.setAddData(true);
-// return getSalaryArchiveExcelService(user).processInit(importData);
-// }
-
-
/**
* 停薪
*
From 457fe51239d3318810862e1ad850091e5849a985 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com>
Date: Mon, 7 Nov 2022 17:05:50 +0800
Subject: [PATCH 03/33] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=96=AA=E8=B5=84?=
=?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=87=8D=E5=A4=8D=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../salary/service/SalaryArchiveService.java | 4 ++++
.../impl/SalaryArchiveServiceImpl.java | 24 +++++++++++++++++++
.../salary/web/SalaryArchiveController.java | 11 +++++++++
.../salary/wrapper/SalaryArchiveWrapper.java | 3 +++
4 files changed, 42 insertions(+)
diff --git a/src/com/engine/salary/service/SalaryArchiveService.java b/src/com/engine/salary/service/SalaryArchiveService.java
index c2ee80e3b..296a31fb7 100644
--- a/src/com/engine/salary/service/SalaryArchiveService.java
+++ b/src/com/engine/salary/service/SalaryArchiveService.java
@@ -215,4 +215,8 @@ public interface SalaryArchiveService {
String cancelStop(Collection ids);
+ /**
+ * 处理异常数据
+ */
+ Map handleRepeatData();
}
diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
index a0e5dc2fe..9eccd455f 100644
--- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java
@@ -62,6 +62,7 @@ import weaver.hrm.User;
import java.io.InputStream;
import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -1292,4 +1293,27 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return StringUtils.EMPTY;
}
+ @Override
+ public Map handleRepeatData() {
+ Map result = new HashMap<>();
+
+ //获取所有薪资档案
+ List list = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build());
+ AtomicInteger num = new AtomicInteger();
+ if (CollectionUtils.isNotEmpty(list)) {
+ Map> maps = SalaryEntityUtil.group2Map(list, k -> k.getTaxAgentId() + "-" + k.getEmployeeId());
+ maps.forEach((key, pos) -> {
+ if (pos.size() > 1) {
+ for (int i = 1; i < pos.size(); i++) {
+ SalaryArchivePO salaryArchivePO = pos.get(i);
+ getSalaryArchiveMapper().delete(salaryArchivePO);
+ num.getAndIncrement();
+ }
+ }
+ });
+ }
+ result.put("共处理", num.get());
+ return result;
+ }
+
}
diff --git a/src/com/engine/salary/web/SalaryArchiveController.java b/src/com/engine/salary/web/SalaryArchiveController.java
index a7724f325..f5fbfcaae 100644
--- a/src/com/engine/salary/web/SalaryArchiveController.java
+++ b/src/com/engine/salary/web/SalaryArchiveController.java
@@ -896,4 +896,15 @@ public class SalaryArchiveController {
/******** 个税扣缴义务人调整记录 end ***********************************************************************************************/
+
+
+
+ @GET
+ @Path("/handleRepeatData")
+ @Produces(MediaType.APPLICATION_JSON)
+ public String SingleTaxAgentAdjustRecordList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
+ User user = HrmUserVarify.getUser(request, response);
+ return new ResponseResult>(user).run(getSalaryArchiveWrapper(user)::handleRepeatData);
+ }
+
}
diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java
index d50b8de03..bd230481c 100644
--- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java
+++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java
@@ -538,4 +538,7 @@ public class SalaryArchiveWrapper extends Service {
}
+ public Map handleRepeatData() {
+ return getSalaryArchiveService(user).handleRepeatData();
+ }
}
From defa7dacc3ad54b8852aead2176890863fd1b2fc Mon Sep 17 00:00:00 2001
From: sy
Date: Mon, 7 Nov 2022 17:15:42 +0800
Subject: [PATCH 04/33] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?=
=?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=E5=85=A8=E9=87=8F=E5=A2=9E?=
=?UTF-8?q?=E5=91=98=E3=80=81=E5=85=A8=E9=87=8F=E5=87=8F=E5=91=98=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E4=B8=AA=E7=A8=8E=E6=89=A3=E7=BC=B4=E4=B9=89=E5=8A=A1?=
=?UTF-8?q?=E4=BA=BA=E7=AD=9B=E9=80=89=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/impl/SIArchivesServiceImpl.java | 24 +++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java
index 8bc1b33e7..a94740c06 100644
--- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java
@@ -186,8 +186,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
private void handleHistoryData(long currentEmployeeId) {
//如果触发历史数据处理,则进行一次全量增员
if (siArchivesBiz.createOldInsuranceBaseInfo(currentEmployeeId)) {
- //全量增员
- allStayAddToPay();
+
+ //批量增员
+ List allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
+ Collection stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()))
+ .map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
+ if (stayAddIds.size() > 0) {
+ stayAddToPay(stayAddIds);
+ }
}
}
@@ -742,9 +748,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
*/
@Override
public Map allStayDelToStop() {
+ long currentEmployeeId = user.getUID();
List allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
if (allBaseInfoList.size() > 0) {
- Collection stayDelIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()))
+ //筛选当前人员可管辖(个税扣缴义务人)范围
+ Collection taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
+ List paymentOrganizationList = taxAgentList.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
+
+ Collection stayDelIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) && paymentOrganizationList.contains(f.getPaymentOrganization()))
.map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
if (stayDelIds.size() > 0) {
return stayDelToStop(stayDelIds);
@@ -914,9 +925,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
*/
@Override
public Map allStayAddToPay() {
+ long currentEmployeeId = user.getUID();
List allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
if (allBaseInfoList.size() > 0) {
- Collection stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()))
+ //筛选当前人员可管辖(个税扣缴义务人)范围
+ Collection taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
+ List paymentOrganizationList = taxAgentList.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
+
+ Collection stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()) && paymentOrganizationList.contains(f.getPaymentOrganization()))
.map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
if (stayAddIds.size() > 0) {
return stayAddToPay(stayAddIds);
From 21ccf6cbcb3f2b9b21d636c49b0a2486a3e99522 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com>
Date: Tue, 8 Nov 2022 11:10:56 +0800
Subject: [PATCH 05/33] =?UTF-8?q?sql=E8=A7=A3=E5=AF=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/impl/FormulaRunServiceImpl.java | 19 ++++++++++++++++---
.../impl/SalaryAcctCalculateServiceImpl.java | 14 +++++++++++++-
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java
index 3f7e13f67..79190007f 100644
--- a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java
+++ b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java
@@ -1,12 +1,14 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
+import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.enums.salaryformula.ReferenceTypeEnum;
import com.engine.salary.formlua.entity.parameter.DataType;
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;
@@ -56,6 +58,8 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
String extendParam = expressFormula.getExtendParam();
String sqlReturnKey = "";
String datasourceId = "";
+ String openDecrypt = "";
+ String result = "";
try {
JsonNode jsonNode = objectMapper.readTree(extendParam);
//返回值配置
@@ -71,6 +75,11 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
datasourceId = datasourceIdNode.asText();
}
}
+ //是否需要解密
+ JsonNode decrypt = jsonNode.get("openDecrypt");
+ if (decrypt != null) {
+ openDecrypt = decrypt.asText().trim();
+ }
} catch (JsonProcessingException e) {
log.error("express execute fail, sql extendParam parse fail", e);
}
@@ -89,18 +98,22 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
RecordSetDataSource rs = new RecordSetDataSource(datasourceId);
if (rs.executeSql(sql)) {
if (rs.next()) {
- return rs.getString(sqlReturnKey);
+ result = rs.getString(sqlReturnKey);
}
}
} else {
RecordSet rs = new RecordSet();
if (rs.execute(sql)) {
if (rs.next()) {
- return rs.getString(sqlReturnKey);
+ result = rs.getString(sqlReturnKey);
}
}
}
- return StringUtils.EMPTY;
+
+ if (OpenEnum.OPEN.getValue().equals(openDecrypt)) {
+ result = AESEncryptUtil.decrypt(openDecrypt);
+ }
+ return result;
}
private Object runFormula(ExpressFormula expressFormula, List formulaVars) throws Exception {
diff --git a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java
index c272b65f9..c793713d9 100644
--- a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java
@@ -198,7 +198,19 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId)) {
// 转换成薪资核算结果po
SalaryAcctResultTempPO salaryAcctResultTempPO = new SalaryAcctResultTempPO()
- .setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId()).setSalaryAcctEmpId(salaryAcctEmployeePO.getId()).setEmployeeId(salaryAcctEmployeePO.getEmployeeId()).setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId()).setSalarySobId(salaryAcctEmployeePO.getSalarySobId()).setSalaryItemId(salaryItemPO.getId()).setResultValue(resultValue).setCalculateKey(salaryAcctCalculateBO.getCalculateKey()).setCreator((long) user.getUID()).setCreateTime(now).setUpdateTime(now).setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).setDeleteType(0);
+ .setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId())
+ .setSalaryAcctEmpId(salaryAcctEmployeePO.getId())
+ .setEmployeeId(salaryAcctEmployeePO.getEmployeeId())
+ .setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId())
+ .setSalarySobId(salaryAcctEmployeePO.getSalarySobId())
+ .setSalaryItemId(salaryItemPO.getId())
+ .setResultValue(resultValue)
+ .setCalculateKey(salaryAcctCalculateBO.getCalculateKey())
+ .setCreator((long) user.getUID())
+ .setCreateTime(now)
+ .setUpdateTime(now)
+ .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
+ .setDeleteType(0);
salaryAcctResultTempPOS.add(salaryAcctResultTempPO);
}
}
From 1fb96be58b6dfb993c4b12eb68f12c921aad9abd Mon Sep 17 00:00:00 2001
From: Harryxzy
Date: Tue, 8 Nov 2022 11:22:56 +0800
Subject: [PATCH 06/33] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5?=
=?UTF-8?q?=E5=BC=80=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
resource/sql/Oracle常见问题.txt | 2 +
.../impl/SalaryAcctRecordServiceImpl.java | 66 ++++++++++++-------
.../sys/constant/SalarySysConstant.java | 5 ++
.../sys/entity/param/AppSettingSaveParam.java | 5 ++
.../sys/enums/TaxDeclarationFunctionEnum.java | 4 +-
.../sys/service/SalarySysConfService.java | 6 ++
.../impl/SalarySysConfServiceImpl.java | 20 +++++-
.../web/SalarySystemConfigController.java | 6 +-
8 files changed, 83 insertions(+), 31 deletions(-)
diff --git a/resource/sql/Oracle常见问题.txt b/resource/sql/Oracle常见问题.txt
index 8725b72ea..e7550cf71 100644
--- a/resource/sql/Oracle常见问题.txt
+++ b/resource/sql/Oracle常见问题.txt
@@ -9,9 +9,11 @@ Oracle数据库中常见报错问题
-- 删除原表HRSA_SALARY_TEMPLATE数据
delete from HRSA_SALARY_TEMPLATE;
+ alter TABLE HRSA_SALARY_TEMPLATE MODIFY SALARY_ITEM_SETTING NULL;
alter table HRSA_SALARY_TEMPLATE modify salary_item_setting long;
alter table HRSA_SALARY_TEMPLATE modify salary_item_setting CLOB;
insert into HRSA_SALARY_TEMPLATE select * from HRSA_SALARY_TEMPLAT_TEMPT ;
+ alter TABLE HRSA_SALARY_TEMPLATE MODIFY SALARY_ITEM_SETTING NOT NULL;
drop table HRSA_SALARY_TEMPLAT_TEMPT;
diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java
index da52c4415..0bc998079 100644
--- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java
@@ -16,6 +16,8 @@ import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
import com.engine.salary.service.*;
+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;
@@ -65,6 +67,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(SalarySendServiceImpl.class, user);
}
+ private SalarySysConfService getSalarySysConfService(User user){
+ return ServiceUtil.getService(SalarySysConfServiceImpl.class,user);
+ }
+
// private SalaryCheckResultService salaryCheckResultService;
//
// private SalaryCheckResultDetailService salaryCheckResultDetailService;
@@ -85,6 +91,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
}
+
@Override
public SalaryAcctRecordPO getById(Long id) {
return getSalaryAcctRecordMapper().getById(id);
@@ -296,17 +303,8 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
//获取账套下的所有核算结果
List salaryAcctRecords = listByTaxCycle(taxCycleYearRange,salarySobIds);
- // 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算
- SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
- .filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
- && e.getTaxCycle().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
- .findAny()
- .orElse(null);
- if (Objects.nonNull(notDeclaredSalaryAcctRecordPO)) {
- throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98751, "税款所属期{0}的薪资核算结果还未申报,不能新建税款所属期{1}的薪资核算")
- .replace("{0}", SalaryDateUtil.localDate2YearMonth(notDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
- .replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
- }
+ // 是否关闭个税申报功能
+ Boolean haveClosedTaxDeclaration = getSalarySysConfService(user).haveClosedTaxDeclaration();
// 如果某个月(税款所属期)已经归档了,不可以新建之前月份的薪资核算
SalaryAcctRecordPO hasArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
@@ -318,17 +316,33 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
}
- // 如果某个月(税款所属期)已经申报了,不可以新建本月以及之前月份的薪资核算
- SalaryAcctRecordPO hasDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
- .filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
- && e.getTaxCycle().compareTo(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))) >= 0)
- .findAny()
- .orElse(null);
- if (Objects.nonNull(hasDeclaredSalaryAcctRecordPO)) {
- throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98753, "税款所属期{0}的薪资核算结果已经申报,不能新建税款所属期{1}的薪资核算")
- .replace("{0}", SalaryDateUtil.localDate2YearMonth(hasDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
- .replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
+
+ if(!haveClosedTaxDeclaration){
+ // 开启了个税申报功能
+ // 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算
+ SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
+ .filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
+ && e.getTaxCycle().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
+ .findAny()
+ .orElse(null);
+ if (Objects.nonNull(notDeclaredSalaryAcctRecordPO)) {
+ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98751, "税款所属期{0}的薪资核算结果还未申报,不能新建税款所属期{1}的薪资核算")
+ .replace("{0}", SalaryDateUtil.localDate2YearMonth(notDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
+ .replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
+ }
+ // 如果某个月(税款所属期)已经申报了,不可以新建本月以及之前月份的薪资核算
+ SalaryAcctRecordPO hasDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
+ .filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
+ && e.getTaxCycle().compareTo(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))) >= 0)
+ .findAny()
+ .orElse(null);
+ if (Objects.nonNull(hasDeclaredSalaryAcctRecordPO)) {
+ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98753, "税款所属期{0}的薪资核算结果已经申报,不能新建税款所属期{1}的薪资核算")
+ .replace("{0}", SalaryDateUtil.localDate2YearMonth(hasDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
+ .replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
+ }
}
+
}
@@ -454,7 +468,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "薪资所属月为空"));
}
// 查询税款所在年的该个税扣缴义务人所有薪资核算记录
- //获取账套所属个税扣缴义务人的核算记录
+ // 获取账套所属个税扣缴义务人的核算记录
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
Long taxAgentId = salarySobPO.getTaxAgentId();
//查询扣缴义务人下的所有账套
@@ -474,8 +488,12 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
}
//撤回工资单
getSalarySendService(user).revokeSalaryBill(salaryAcctRecordId);
- //删除个税申报表(个税申报表、个税申报表详情、往期累计情况)
- getTaxDeclarationService(user).delete(salaryAcctRecordPO);
+ Boolean haveClosedTaxDeclaration = getSalarySysConfService(user).haveClosedTaxDeclaration();
+ if(!haveClosedTaxDeclaration){
+ // 开启了个税申报功能
+ // 删除个税申报表(个税申报表、个税申报表详情、往期累计情况)
+ getTaxDeclarationService(user).delete(salaryAcctRecordPO);
+ }
// 更新薪资核算记录的状态
salaryAcctRecordPO.setStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue());
salaryAcctRecordPO.setUpdateTime(new Date());
diff --git a/src/com/engine/salary/sys/constant/SalarySysConstant.java b/src/com/engine/salary/sys/constant/SalarySysConstant.java
index 4800e1e61..82c432564 100644
--- a/src/com/engine/salary/sys/constant/SalarySysConstant.java
+++ b/src/com/engine/salary/sys/constant/SalarySysConstant.java
@@ -45,4 +45,9 @@ public class SalarySysConstant {
*/
public static final String AES_ENCRYPT_IN_PROGRESS = "AES_ENCRYPT_IN_PROGRESS";
public static final String ENCRYPT_IN_PROGRESS = "ENCRYPT_PROGRESS_";
+
+ /**
+ * 需要申报功能
+ */
+ public static final String TAX_DECLARATION_FUNCTION = "taxDeclarationFunction";
}
diff --git a/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java b/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java
index e235ad139..a5edb437f 100644
--- a/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java
+++ b/src/com/engine/salary/sys/entity/param/AppSettingSaveParam.java
@@ -39,4 +39,9 @@ public class AppSettingSaveParam {
*/
private String isOpenEncrypt;
+ /**
+ * 是否关闭个税申报
+ */
+ private String operateTaxDeclaration;
+
}
diff --git a/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java b/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java
index c76be7f95..6852e0c3b 100644
--- a/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java
+++ b/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java
@@ -12,8 +12,8 @@ import org.apache.commons.lang3.StringUtils;
* @version 1.0
**/
public enum TaxDeclarationFunctionEnum implements BaseEnum {
- OPEN("OPEN", "开启", 1),
- CLOSURE("CLOSURE", "关闭", 1),
+ OPEN("OPEN", "开启申报功能", 1),
+ CLOSURE("CLOSURE", "关闭申报功能", 1),
REBOOT("REBOOT", "重启", 1);
private String value;
diff --git a/src/com/engine/salary/sys/service/SalarySysConfService.java b/src/com/engine/salary/sys/service/SalarySysConfService.java
index de1fd16ae..31d497b70 100644
--- a/src/com/engine/salary/sys/service/SalarySysConfService.java
+++ b/src/com/engine/salary/sys/service/SalarySysConfService.java
@@ -29,6 +29,12 @@ public interface SalarySysConfService {
*/
boolean operateTaxDeclarationFunction(TaxDeclarationFunctionEnum flag);
+ /**
+ * 是否关闭了个税申报功能
+ * @return BOOLEAN
+ */
+ public Boolean haveClosedTaxDeclaration();
+
SalarySysConfPO getOneByCode(String code);
List listSome(SalarySysConfPO build);
diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
index efd8e42c0..b9824b03c 100644
--- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
+++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
@@ -138,9 +138,9 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
@Override
public boolean operateTaxDeclarationFunction(TaxDeclarationFunctionEnum flag) {
Date date = new Date();
- SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode("taxDeclarationFunction");
+ SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode(TAX_DECLARATION_FUNCTION);
if (taxDeclarationFunction == null) {
- taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey("taxDeclarationFunction").confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build();
+ taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey(TAX_DECLARATION_FUNCTION).confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build();
getSalarySysConfMapper().insertIgnoreNull(taxDeclarationFunction);
} else {
TaxDeclarationFunctionEnum oldFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue());
@@ -165,6 +165,22 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return true;
}
+ /**
+ * @description 是否关闭需要申报功能
+ * @return Boolean
+ * @author Harryxzy
+ * @date 2022/11/7 17:05
+ */
+ public Boolean haveClosedTaxDeclaration(){
+ SalarySysConfPO taxDeclarationFunction = salarySysConfService.getOneByCode(TAX_DECLARATION_FUNCTION);
+ if(taxDeclarationFunction != null && taxDeclarationFunction.getConfValue().equals(TaxDeclarationFunctionEnum.CLOSURE.getValue())){
+ // 关闭
+ return true;
+ }
+ return false;
+ }
+
+
@Override
public SalarySysConfPO getOneByCode(String code) {
return getSalarySysConfMapper().getOneByCode(code);
diff --git a/src/com/engine/salary/web/SalarySystemConfigController.java b/src/com/engine/salary/web/SalarySystemConfigController.java
index 2b20dc209..5c03047de 100644
--- a/src/com/engine/salary/web/SalarySystemConfigController.java
+++ b/src/com/engine/salary/web/SalarySystemConfigController.java
@@ -51,16 +51,16 @@ public class SalarySystemConfigController {
*
* @param request
* @param response
- * @param flag
+ * @param param
* @return
*/
@POST
@Path("/operateTaxDeclarationFunction")
@Produces(MediaType.APPLICATION_JSON)
- public String operateTaxDeclarationFunction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody String flag) {
+ public String operateTaxDeclarationFunction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AppSettingSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
- return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::operateTaxDeclarationFunction, TaxDeclarationFunctionEnum.parseByValue(flag));
+ return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::operateTaxDeclarationFunction, TaxDeclarationFunctionEnum.parseByValue(param.getOperateTaxDeclaration()));
}
/**
From 0630fb7b7d9252f45edd028a5df4cf79066eb32c Mon Sep 17 00:00:00 2001
From: Harryxzy
Date: Tue, 8 Nov 2022 13:58:21 +0800
Subject: [PATCH 07/33] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5?=
=?UTF-8?q?=E5=BC=80=E5=85=B3-=E6=9F=A5=E8=AF=A2=E6=98=AF=E5=90=A6?=
=?UTF-8?q?=E5=BC=80=E5=90=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/com/engine/salary/sys/entity/vo/AppSettingVO.java | 5 +++++
.../salary/sys/service/impl/SalarySysConfServiceImpl.java | 3 +++
2 files changed, 8 insertions(+)
diff --git a/src/com/engine/salary/sys/entity/vo/AppSettingVO.java b/src/com/engine/salary/sys/entity/vo/AppSettingVO.java
index cfa2dbc77..d690bc178 100644
--- a/src/com/engine/salary/sys/entity/vo/AppSettingVO.java
+++ b/src/com/engine/salary/sys/entity/vo/AppSettingVO.java
@@ -39,5 +39,10 @@ public class AppSettingVO {
*/
private String isOpenEncrypt;
+ /**
+ * 是否开启个税申报功能
+ */
+ private String isOpenTaxDeclaration;
+
}
diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
index b9824b03c..a4d1c84e3 100644
--- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
+++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
@@ -426,6 +426,9 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
case OPEN_APPLICATION_ENCRYPT:
appSettingVO.setIsOpenEncrypt(salarySysConfPO.getConfValue());
break;
+ case TAX_DECLARATION_FUNCTION:
+ appSettingVO.setIsOpenTaxDeclaration(salarySysConfPO.getConfValue());
+ break;
default:
break;
}
From 8a704a9f5b7bda6a776a079c23c33c56332910b3 Mon Sep 17 00:00:00 2001
From: Harryxzy
Date: Tue, 8 Nov 2022 16:27:29 +0800
Subject: [PATCH 08/33] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5?=
=?UTF-8?q?=E5=BC=80=E5=85=B3-=E6=B7=BB=E5=8A=A0=E6=96=B0=E5=BB=BA?=
=?UTF-8?q?=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../impl/SalaryAcctRecordServiceImpl.java | 48 ++++++++++++++-----
.../sys/enums/TaxDeclarationFunctionEnum.java | 6 +--
.../impl/SalarySysConfServiceImpl.java | 4 ++
3 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java
index 0bc998079..a11055e28 100644
--- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java
@@ -305,20 +305,44 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
// 是否关闭个税申报功能
Boolean haveClosedTaxDeclaration = getSalarySysConfService(user).haveClosedTaxDeclaration();
- // 如果某个月(税款所属期)已经归档了,不可以新建之前月份的薪资核算
- SalaryAcctRecordPO hasArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
- .filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
- && e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
- .findAny()
- .orElse(null);
- if (Objects.nonNull(hasArchivedSalaryAcctRecordPO)) {
- throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98752, "税款所属期{0}的薪资核算结果已经归档,不能新建税款所属期{1}的薪资核算")
- .replace("{0}", SalaryDateUtil.localDate2YearMonth(hasArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
- .replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
- }
+ if(haveClosedTaxDeclaration){
+ // 关闭了个税申报功能
+ // 如果某个月(薪资所属期)还未归档,不可以新建之后月份的薪资核算
+ SalaryAcctRecordPO notArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
+ .filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())
+ && e.getSalaryMonth().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getSalaryMonth().atDay(1))))
+ .findAny()
+ .orElse(null);
+ if(Objects.nonNull(notArchivedSalaryAcctRecordPO)){
+ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98754, "薪资所属期{0}的薪资核算结果还未归档,不能新建薪资所属期{1}的薪资核算")
+ .replace("{0}",SalaryDateUtil.localDate2YearMonth(notArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
+ .replace("{1}",salarySobCycleDTO.getTaxCycle().toString()));
+ }
+ // 如果有某个月(薪资所属期)已经归档了,不可以新建之前月份的薪资核算
+ SalaryAcctRecordPO havaSalaryAcctRecordPO = salaryAcctRecords.stream()
+ .filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
+ && e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getSalaryMonth().atDay(1))))
+ .findAny()
+ .orElse(null);
+ if(Objects.nonNull(havaSalaryAcctRecordPO)){
+ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98755, "薪资所属期{0}的薪资核算结果已经归档,不能新建薪资所属期{1}的薪资核算")
+ .replace("{0}",SalaryDateUtil.localDate2YearMonth(havaSalaryAcctRecordPO.getSalaryMonth()).toString())
+ .replace("{1}",salarySobCycleDTO.getSalaryMonth().toString()));
+ }
- if(!haveClosedTaxDeclaration){
+ }else {
// 开启了个税申报功能
+ // 如果某个月(税款所属期)已经归档了,不可以新建之前月份的薪资核算
+ SalaryAcctRecordPO hasArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
+ .filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
+ && e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
+ .findAny()
+ .orElse(null);
+ if (Objects.nonNull(hasArchivedSalaryAcctRecordPO)) {
+ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98752, "税款所属期{0}的薪资核算结果已经归档,不能新建税款所属期{1}的薪资核算")
+ .replace("{0}", SalaryDateUtil.localDate2YearMonth(hasArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
+ .replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
+ }
// 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算
SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
.filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
diff --git a/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java b/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java
index 6852e0c3b..325c5463e 100644
--- a/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java
+++ b/src/com/engine/salary/sys/enums/TaxDeclarationFunctionEnum.java
@@ -12,9 +12,9 @@ import org.apache.commons.lang3.StringUtils;
* @version 1.0
**/
public enum TaxDeclarationFunctionEnum implements BaseEnum {
- OPEN("OPEN", "开启申报功能", 1),
- CLOSURE("CLOSURE", "关闭申报功能", 1),
- REBOOT("REBOOT", "重启", 1);
+ OPEN("1", "开启申报功能", 1),
+ CLOSURE("0", "关闭申报功能", 1),
+ REBOOT("2", "重启", 1);
private String value;
diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
index a4d1c84e3..05ff72671 100644
--- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
+++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java
@@ -438,6 +438,10 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
if (StringUtils.isEmpty(appSettingVO.getIsOpenEncrypt())) {
appSettingVO.setIsOpenEncrypt("1");
}
+ // 默认开启报税功能
+ if(StringUtils.isEmpty(appSettingVO.getIsOpenTaxDeclaration())){
+ appSettingVO.setIsOpenTaxDeclaration("1");
+ }
return appSettingVO;
}
From b66fe2b593c90937bb1f9aaecea3e5019361e995 Mon Sep 17 00:00:00 2001
From: sy
Date: Wed, 9 Nov 2022 09:53:13 +0800
Subject: [PATCH 09/33] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?=
=?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=E5=AF=BC=E5=85=A5=EF=BC=8C?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E7=A4=BE=E4=BF=9D=E3=80=81=E5=85=AC?=
=?UTF-8?q?=E7=A7=AF=E9=87=91=E3=80=81=E5=85=B6=E4=BB=96=E7=A6=8F=E5=88=A9?=
=?UTF-8?q?=E6=96=B9=E6=A1=88=E8=AE=BE=E7=BD=AE=E6=98=AF=E5=90=A6=E4=B8=BA?=
=?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E7=A6=8F=E5=88=A9=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/impl/SISchemeServiceImpl.java | 32 +++++++++++++++++--
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java
index 3875365e0..1a1ab9cdc 100644
--- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java
@@ -899,6 +899,15 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "社保方案不存在"));
excelComments.add(errorMessageMap);
isError = true;
+ } else if (StringUtils.isNotBlank((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")))
+ && schemeNameIdMap.get((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) != null
+ && !getInsuranceSchemeMapper().getById(schemeNameIdMap.get((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")))).getWelfareType().equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue())) {
+
+ Map errorMessageMap = Maps.newHashMap();
+ errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "社保方案不属于社保福利类型"));
+ excelComments.add(errorMessageMap);
+ isError = true;
+
} else {
insuranceArchivesSocialSchemePO = buildSocialPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
}
@@ -907,15 +916,32 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100323, "公积金方案不存在"));
excelComments.add(errorMessageMap);
isError = true;
- } else {
+ } else if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")))
+ && schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))) != null
+ && !getInsuranceSchemeMapper().getById(schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")))).getWelfareType().equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue())) {
+
+ Map errorMessageMap = Maps.newHashMap();
+ errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "公积金方案不属于公积金福利类型"));
+ excelComments.add(errorMessageMap);
+ isError = true;
+
+ }else {
insuranceArchivesFundSchemePO = buildFundPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
}
- if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) && schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) == null) {
+ if (StringUtils.isNotBlank((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) && schemeNameIdMap.get((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) == null) {
Map errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100324, "其他福利方案不存在"));
excelComments.add(errorMessageMap);
isError = true;
- } else {
+ } else if (StringUtils.isNotBlank((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))
+ && schemeNameIdMap.get((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) != null
+ && !getInsuranceSchemeMapper().getById(schemeNameIdMap.get((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))).getWelfareType().equals(WelfareTypeEnum.OTHER.getValue())) {
+
+ Map errorMessageMap = Maps.newHashMap();
+ errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "其他福利方案不属于其他福利类型"));
+ excelComments.add(errorMessageMap);
+ isError = true;
+ }else {
insuranceArchivesOtherSchemePO = buildOtherPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
}
/**************校验申报基数**************/
From 775580f994a045bbb3621362a773bc2715a22c66 Mon Sep 17 00:00:00 2001
From: Harryxzy
Date: Wed, 9 Nov 2022 10:20:46 +0800
Subject: [PATCH 10/33] ---
---
.../salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java
index 4e8062365..41bba094d 100644
--- a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java
+++ b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveExcelBO.java
@@ -123,6 +123,7 @@ public class SalaryArchiveExcelBO extends Service {
salaryArchiveErr = SalaryI18nUtil.getI18nLabel(101723, "该员工的薪资档案记录有误,请检查");
numberErr = SalaryI18nUtil.getI18nLabel(100581, "请输入数字");
+
}
/**
From 5e69d07b7c902d067d65a7d5582e570898752984 Mon Sep 17 00:00:00 2001
From: fcli
Date: Mon, 31 Oct 2022 16:19:42 +0800
Subject: [PATCH 11/33] =?UTF-8?q?feat:=20=E4=B8=93=E9=A1=B9=E9=99=84?=
=?UTF-8?q?=E5=8A=A0=E6=89=A3=E9=99=A4=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../salary/biz/SpecialAddDeductionBiz.java | 208 ++++++++++++++++++
.../SpecialAddDeductionEncrypt.java | 66 ++++++
.../po/SpecialAddDeductionPO.java | 93 ++++++++
.../SpecialAddDeductionMapper.java | 16 ++
.../SpecialAddDeductionMapper.xml | 197 +++++++++++++++++
5 files changed, 580 insertions(+)
create mode 100644 src/com/engine/salary/biz/SpecialAddDeductionBiz.java
create mode 100644 src/com/engine/salary/encrypt/datacollection/SpecialAddDeductionEncrypt.java
create mode 100644 src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java
create mode 100644 src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java
create mode 100644 src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml
diff --git a/src/com/engine/salary/biz/SpecialAddDeductionBiz.java b/src/com/engine/salary/biz/SpecialAddDeductionBiz.java
new file mode 100644
index 000000000..b9b8cc9d0
--- /dev/null
+++ b/src/com/engine/salary/biz/SpecialAddDeductionBiz.java
@@ -0,0 +1,208 @@
+package com.engine.salary.biz;
+
+import com.engine.salary.encrypt.datacollection.OtherDeductionPOEncrypt;
+import com.engine.salary.encrypt.datacollection.OtherDeductionRecordDTOEncrypt;
+import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
+import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
+import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
+import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
+import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
+import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.ibatis.session.SqlSession;
+import weaver.conn.mybatis.MyBatisFactory;
+import weaver.general.BaseBean;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class SpecialAddDeductionBiz extends BaseBean {
+
+
+
+ /**
+ * 条件查询
+ *
+ * @param param
+ * @return
+ */
+ public List listSome(SpecialAddDeductionPO param) {
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
+ List list = mapper.insertSelective(param);
+ return OtherDeductionPOEncrypt.decryptOtherDeductionPOList(otherDeductionPOS);
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+
+ /**
+ * 根据id获取
+ *
+ * @param id
+ * @return
+ */
+ public OtherDeductionPO getById(Long id) {
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
+ OtherDeductionPO byId = mapper.getById(id);
+ return OtherDeductionPOEncrypt.decryptOtherDeductionPO(byId);
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ /**
+ * 详情列表
+ *
+ * @param param
+ * @return
+ */
+ public List recordList(OtherDeductionQueryParam param) {
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
+ List otherDeductionRecordDTOS = mapper.recordList(param);
+ return OtherDeductionRecordDTOEncrypt.decryptOtherDeductionRecordDTOList(otherDeductionRecordDTOS);
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ /**
+ * 批量插入
+ *
+ * @param param
+ * @return
+ */
+ public void batchSave(List param) {
+ if(CollectionUtils.isEmpty(param)){
+ return;
+ }
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
+ OtherDeductionPOEncrypt.encryptOtherDeductionPOList(param);
+ List> partition = Lists.partition(param, 100);
+ partition.forEach(mapper::insertData);
+ sqlSession.commit();
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+ /**
+ * 批量插入
+ *
+ * @param param
+ * @return
+ */
+ public void batchUpdate(List param) {
+ if(CollectionUtils.isEmpty(param)){
+ return;
+ }
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
+ OtherDeductionPOEncrypt.encryptOtherDeductionPOList(param);
+ List> partition = Lists.partition(param, 100);
+ partition.forEach(mapper::updateData);
+ sqlSession.commit();
+ } finally {
+ sqlSession.close();
+ }
+ }
+
+
+
+
+
+
+ /**
+ * 处理导入数据
+ *
+ * @param pos
+ */
+ public void handleImportData(List pos) {
+ if (CollectionUtils.isEmpty(pos)) {
+ return;
+ }
+ OtherDeductionPO po = pos.get(0);
+ // 多条相同人的则以第一条为准,如果逆序排列(用于重复的则以最后一条为准)Collections.reverse(pos);
+ // 去重(通过记录的唯一条件(申报月份,人员id,个税扣缴义务人id)拼接)
+ List finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
+ // 查询已有数据
+ List list = listSome(OtherDeductionPO.builder().declareMonth(po.getDeclareMonth()).build());
+ // 待修改的 本地已存在则更新【交集】
+ List updateList = list.stream().map(m -> {
+ Optional optional = finalPos.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
+ OtherDeductionPO temp = null;
+ if (optional.isPresent()) {
+ temp = optional.get();
+ // 换成本地库的id
+ temp.setId(m.getId());
+ }
+ return temp;
+ }).filter(Objects::nonNull).collect(Collectors.toList());
+ // 待新增的 导入比本地多,则新增【差集(导入 - local)】
+ List saveList = finalPos.stream().map(m -> {
+ Optional optional = list.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
+ OtherDeductionPO temp = null;
+ if (!optional.isPresent()) {
+ temp = m;
+ }
+ return temp;
+ }).filter(Objects::nonNull).collect(Collectors.toList());
+
+ // 修改
+ if (CollectionUtils.isNotEmpty(updateList)) {
+ batchUpdate(updateList);
+ }
+ // 保存
+ if (CollectionUtils.isNotEmpty(saveList)) {
+ batchSave(saveList);
+ }
+ // 记录操作日志
+// saveList.addAll(updateList);
+//
+// if (CollectionUtils.isNotEmpty(saveList)) {
+// LoggerContext loggerContext = new LoggerContext();
+// loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
+// loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
+// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
+// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
+// loggerContext.setNewValueList(saveList);
+// loggerContext.setTenant_key(message.getTenantKey());
+// loggerContext.setOperator(message.getUserId().toString());
+// loggerContext.setOperatorName(message.getOpreator());
+// loggerContext.setClientIp(message.getClientIp());
+// addUpDeductionLoggerTemplate.write(loggerContext);
+// }
+ }
+
+
+ /**
+ * @description 批量删除
+ * @return void
+ * @author Harryxzy
+ * @date 2022/10/27 16:07
+ */
+ public void batchDeleteByIDS(List deleteIds) {
+ if (CollectionUtils.isEmpty(deleteIds)) {
+ return;
+ }
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
+ List> partition = Lists.partition(deleteIds, 100);
+ partition.forEach(mapper::deleteData);
+ sqlSession.commit();
+ } finally {
+ sqlSession.close();
+ }
+ }
+}
diff --git a/src/com/engine/salary/encrypt/datacollection/SpecialAddDeductionEncrypt.java b/src/com/engine/salary/encrypt/datacollection/SpecialAddDeductionEncrypt.java
new file mode 100644
index 000000000..a9935875f
--- /dev/null
+++ b/src/com/engine/salary/encrypt/datacollection/SpecialAddDeductionEncrypt.java
@@ -0,0 +1,66 @@
+package com.engine.salary.encrypt.datacollection;
+
+import com.engine.salary.encrypt.AESEncryptUtil;
+import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * hrsa_special_add_deduction: 加解密
+ * 字段:
+ * children_education
+ * continuing_education
+ * housing_loan_interest
+ * housing_rent
+ * supporting_elder
+ * serious_illness_treatment
+ * infant_care
+ */
+public class SpecialAddDeductionEncrypt {
+ public static SpecialAddDeductionPO encryptSpecialAddDeduction(SpecialAddDeductionPO po) {
+ if (po == null) {
+ return po;
+ }
+ po.setChildrenEducation(AESEncryptUtil.encrypt(po.getChildrenEducation()));
+ po.setContinuingEducation(AESEncryptUtil.encrypt(po.getContinuingEducation()));
+ po.setHousingLoanInterest(AESEncryptUtil.encrypt(po.getHousingLoanInterest()));
+ po.setHousingRent(AESEncryptUtil.encrypt(po.getHousingRent()));
+ po.setSupportingElder(AESEncryptUtil.encrypt(po.getSupportingElder()));
+ po.setSeriousIllnessTreatment(AESEncryptUtil.encrypt(po.getSeriousIllnessTreatment()));
+ po.setInfantCare(AESEncryptUtil.encrypt(po.getInfantCare()));
+ return po;
+ }
+
+ public static SpecialAddDeductionPO decryptSpecialAddDeduction(SpecialAddDeductionPO po) {
+ if (po == null) {
+ return po;
+ }
+ po.setChildrenEducation(AESEncryptUtil.decrypt(po.getChildrenEducation()));
+ po.setContinuingEducation(AESEncryptUtil.decrypt(po.getContinuingEducation()));
+ po.setHousingLoanInterest(AESEncryptUtil.decrypt(po.getHousingLoanInterest()));
+ po.setHousingRent(AESEncryptUtil.decrypt(po.getHousingRent()));
+ po.setSupportingElder(AESEncryptUtil.decrypt(po.getSupportingElder()));
+ po.setSeriousIllnessTreatment(AESEncryptUtil.decrypt(po.getSeriousIllnessTreatment()));
+ po.setInfantCare(AESEncryptUtil.decrypt(po.getInfantCare()));
+ return po;
+ }
+
+ public static List encryptSpecialAddDeductionPOList(List list) {
+ if (null == list || list.isEmpty()) {
+ return list;
+ }
+ return list.stream()
+ .map(SpecialAddDeductionEncrypt::encryptSpecialAddDeduction)
+ .collect(Collectors.toList());
+ }
+
+ public static List decryptSpecialAddDeductionPOList(List list) {
+ if (null == list || list.isEmpty()) {
+ return list;
+ }
+ return list.stream()
+ .map(SpecialAddDeductionEncrypt::decryptSpecialAddDeduction)
+ .collect(Collectors.toList());
+ }
+}
diff --git a/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java b/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java
new file mode 100644
index 000000000..e169f7342
--- /dev/null
+++ b/src/com/engine/salary/entity/datacollection/po/SpecialAddDeductionPO.java
@@ -0,0 +1,93 @@
+package com.engine.salary.entity.datacollection.po;
+
+import java.util.Date;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 数据采集-专项附加扣除表
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class SpecialAddDeductionPO {
+ private Long id;
+
+ /**
+ * 人员信息表的主键id
+ */
+ private Long employeeId;
+
+ /**
+ * 个税扣缴义务人的主键id
+ */
+ private Long taxAgentId;
+
+ /**
+ * 申报年月
+ */
+ private Date declareMonth;
+
+ /**
+ * 子女教育
+ */
+ private String childrenEducation;
+
+ /**
+ * 继续教育
+ */
+ private String continuingEducation;
+
+ /**
+ * 住房贷款利息
+ */
+ private String housingLoanInterest;
+
+ /**
+ * 住房租金
+ */
+ private String housingRent;
+
+ /**
+ * 赡养老人
+ */
+ private String supportingElder;
+
+ /**
+ * 大病医疗
+ */
+ private String seriousIllnessTreatment;
+
+ /**
+ * 婴幼儿照护
+ */
+ private String infantCare;
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+ /**
+ * 更新时间
+ */
+ private Date updateTime;
+
+ /**
+ * 创建人
+ */
+ private Long creator;
+
+ /**
+ * 是否已删除。0:未删除、1:已删除
+ */
+ private Integer deleteType;
+
+ /**
+ * 租户ID
+ */
+ private String tenantKey;
+}
\ No newline at end of file
diff --git a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java
new file mode 100644
index 000000000..8d1bf1143
--- /dev/null
+++ b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.java
@@ -0,0 +1,16 @@
+package com.engine.salary.mapper.datacollection;
+
+import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
+import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
+
+import java.util.List;
+
+public interface SpecialAddDeductionMapper {
+ int insertSelective(SpecialAddDeductionPO record);
+
+ SpecialAddDeductionPO getById(Long id);
+
+ int updateByPrimaryKeySelective(SpecialAddDeductionPO record);
+
+ List selectAllByPO(SpecialAddDeductionPO param);
+}
\ No newline at end of file
diff --git a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml
new file mode 100644
index 000000000..44916d521
--- /dev/null
+++ b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, employee_id, tax_agent_id, declare_month, children_education, continuing_education,
+ housing_loan_interest, housing_rent, supporting_elder, serious_illness_treatment,
+ infant_care, create_time, update_time, creator, delete_type, tenant_key
+
+
+
+
+ insert into hrsa_special_add_deduction
+
+
+ employee_id,
+
+
+ tax_agent_id,
+
+
+ declare_month,
+
+
+ children_education,
+
+
+ continuing_education,
+
+
+ housing_loan_interest,
+
+
+ housing_rent,
+
+
+ supporting_elder,
+
+
+ serious_illness_treatment,
+
+
+ infant_care,
+
+
+ create_time,
+
+
+ update_time,
+
+
+ creator,
+
+
+ delete_type,
+
+
+ tenant_key,
+
+
+
+
+ #{employeeId,jdbcType=BIGINT},
+
+
+ #{taxAgentId,jdbcType=BIGINT},
+
+
+ #{declareMonth,jdbcType=TIMESTAMP},
+
+
+ #{childrenEducation,jdbcType=VARCHAR},
+
+
+ #{continuingEducation,jdbcType=VARCHAR},
+
+
+ #{housingLoanInterest,jdbcType=VARCHAR},
+
+
+ #{housingRent,jdbcType=VARCHAR},
+
+
+ #{supportingElder,jdbcType=VARCHAR},
+
+
+ #{seriousIllnessTreatment,jdbcType=VARCHAR},
+
+
+ #{infantCare,jdbcType=VARCHAR},
+
+
+ #{createTime,jdbcType=TIMESTAMP},
+
+
+ #{updateTime,jdbcType=TIMESTAMP},
+
+
+ #{creator,jdbcType=BIGINT},
+
+
+ #{deleteType,jdbcType=INTEGER},
+
+
+ #{tenantKey,jdbcType=VARCHAR},
+
+
+
+
+
+ update hrsa_special_add_deduction
+
+
+ employee_id = #{employeeId,jdbcType=BIGINT},
+
+
+ tax_agent_id = #{taxAgentId,jdbcType=BIGINT},
+
+
+ declare_month = #{declareMonth,jdbcType=TIMESTAMP},
+
+
+ children_education = #{childrenEducation,jdbcType=VARCHAR},
+
+
+ continuing_education = #{continuingEducation,jdbcType=VARCHAR},
+
+
+ housing_loan_interest = #{housingLoanInterest,jdbcType=VARCHAR},
+
+
+ housing_rent = #{housingRent,jdbcType=VARCHAR},
+
+
+ supporting_elder = #{supportingElder,jdbcType=VARCHAR},
+
+
+ serious_illness_treatment = #{seriousIllnessTreatment,jdbcType=VARCHAR},
+
+
+ infant_care = #{infantCare,jdbcType=VARCHAR},
+
+
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+
+
+ update_time = #{updateTime,jdbcType=TIMESTAMP},
+
+
+ creator = #{creator,jdbcType=BIGINT},
+
+
+ delete_type = #{deleteType,jdbcType=INTEGER},
+
+
+ tenant_key = #{tenantKey,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
+
+
\ No newline at end of file
From 171f726bd372f65bc5a58e5d841f6f9952e936b6 Mon Sep 17 00:00:00 2001
From: fcli
Date: Wed, 2 Nov 2022 17:27:07 +0800
Subject: [PATCH 12/33] =?UTF-8?q?feat:=20=E4=B8=93=E9=A1=B9=E9=99=84?=
=?UTF-8?q?=E5=8A=A0=E6=89=A3=E9=99=A4=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../salary/biz/SpecialAddDeductionBiz.java | 190 ++--
.../SpecialAddDeductionMapper.xml | 792 ++++++++++++-----
.../impl/SpecialAddDeductionServiceImpl.java | 810 ++++++++++++++++++
3 files changed, 1477 insertions(+), 315 deletions(-)
create mode 100644 src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java
diff --git a/src/com/engine/salary/biz/SpecialAddDeductionBiz.java b/src/com/engine/salary/biz/SpecialAddDeductionBiz.java
index b9b8cc9d0..c505a964e 100644
--- a/src/com/engine/salary/biz/SpecialAddDeductionBiz.java
+++ b/src/com/engine/salary/biz/SpecialAddDeductionBiz.java
@@ -1,12 +1,9 @@
package com.engine.salary.biz;
-import com.engine.salary.encrypt.datacollection.OtherDeductionPOEncrypt;
-import com.engine.salary.encrypt.datacollection.OtherDeductionRecordDTOEncrypt;
-import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
-import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
-import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
+import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
+import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
+import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
-import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
@@ -18,58 +15,53 @@ import java.util.*;
import java.util.stream.Collectors;
public class SpecialAddDeductionBiz extends BaseBean {
-
-
-
- /**
- * 条件查询
- *
- * @param param
- * @return
- */
- public List listSome(SpecialAddDeductionPO param) {
- SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
- try {
- SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
- List list = mapper.insertSelective(param);
- return OtherDeductionPOEncrypt.decryptOtherDeductionPOList(otherDeductionPOS);
- } finally {
- sqlSession.close();
- }
- }
-
-
/**
* 根据id获取
*
* @param id
* @return
*/
- public OtherDeductionPO getById(Long id) {
- SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
- try {
- OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
- OtherDeductionPO byId = mapper.getById(id);
- return OtherDeductionPOEncrypt.decryptOtherDeductionPO(byId);
- } finally {
- sqlSession.close();
+ public SpecialAddDeductionPO getById(Long id) {
+ try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
+ SpecialAddDeductionPO byId = mapper.getById(id);
+ return SpecialAddDeductionEncrypt.decrypt(byId);
}
}
+ public List listDTOByParam(SpecialAddDeductionQueryParam param) {
+ try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
+ List specialAddDeductionRecordDTOS = mapper.listDtoByParam(param);
+ return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionRecordDTOS);
+ }
+ }
+
+ public List listByDeclareMonthAndTaxAgentIds(Date declareMonth, List taxAgentIds) {
+ try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
+ List pos = mapper.listByDeclareMonthAndTaxAgentIds(declareMonth, taxAgentIds);
+ return SpecialAddDeductionEncrypt.decrypt(pos);
+ }
+ }
+
+
/**
- * 详情列表
+ * 批量插入
*
* @param param
* @return
*/
- public List recordList(OtherDeductionQueryParam param) {
- SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
- try {
- OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
- List otherDeductionRecordDTOS = mapper.recordList(param);
- return OtherDeductionRecordDTOEncrypt.decryptOtherDeductionRecordDTOList(otherDeductionRecordDTOS);
- } finally {
- sqlSession.close();
+ public void batchSave(List param) {
+ if (CollectionUtils.isEmpty(param)) {
+ return;
+ }
+ try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
+ SpecialAddDeductionEncrypt.encrypt(param);
+ List> partition = Lists.partition(param, 100);
+ partition.forEach(mapper::batchInsert);
+ sqlSession.commit();
}
}
@@ -79,84 +71,55 @@ public class SpecialAddDeductionBiz extends BaseBean {
* @param param
* @return
*/
- public void batchSave(List param) {
- if(CollectionUtils.isEmpty(param)){
+ public void batchUpdate(List param) {
+ if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
- OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
- OtherDeductionPOEncrypt.encryptOtherDeductionPOList(param);
- List> partition = Lists.partition(param, 100);
- partition.forEach(mapper::insertData);
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
+ SpecialAddDeductionEncrypt.encrypt(param);
+ List> partition = Lists.partition(param, 100);
+ partition.forEach(mapper::updateBatchSelective);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
- /**
- * 批量插入
- *
- * @param param
- * @return
- */
- public void batchUpdate(List param) {
- if(CollectionUtils.isEmpty(param)){
- return;
- }
- SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
- try {
- OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
- OtherDeductionPOEncrypt.encryptOtherDeductionPOList(param);
- List> partition = Lists.partition(param, 100);
- partition.forEach(mapper::updateData);
- sqlSession.commit();
- } finally {
- sqlSession.close();
- }
- }
-
-
-
-
-
/**
* 处理导入数据
*
* @param pos
*/
- public void handleImportData(List pos) {
+ public void handleImportData(List pos) {
if (CollectionUtils.isEmpty(pos)) {
return;
}
- OtherDeductionPO po = pos.get(0);
+ SpecialAddDeductionPO po = pos.get(0);
// 多条相同人的则以第一条为准,如果逆序排列(用于重复的则以最后一条为准)Collections.reverse(pos);
// 去重(通过记录的唯一条件(申报月份,人员id,个税扣缴义务人id)拼接)
- List finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
+ List finalPos = pos.stream()
+ .collect(Collectors.collectingAndThen(
+ Collectors.toCollection(() ->
+ new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))),
+ ArrayList::new)
+ );
// 查询已有数据
- List list = listSome(OtherDeductionPO.builder().declareMonth(po.getDeclareMonth()).build());
+ List list = listByDeclareMonthAndTaxAgentIds(po.getDeclareMonth(), null);
// 待修改的 本地已存在则更新【交集】
- List updateList = list.stream().map(m -> {
- Optional optional = finalPos.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
- OtherDeductionPO temp = null;
- if (optional.isPresent()) {
- temp = optional.get();
- // 换成本地库的id
- temp.setId(m.getId());
- }
- return temp;
- }).filter(Objects::nonNull).collect(Collectors.toList());
+ List updateList = list.stream()
+ .map(m -> finalPos.stream()
+ .filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId()))
+ .findFirst()
+ .map(t -> t.setId(m.getId()))
+ .orElse(null)
+ ).filter(Objects::nonNull).collect(Collectors.toList());
// 待新增的 导入比本地多,则新增【差集(导入 - local)】
- List saveList = finalPos.stream().map(m -> {
- Optional optional = list.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
- OtherDeductionPO temp = null;
- if (!optional.isPresent()) {
- temp = m;
- }
- return temp;
- }).filter(Objects::nonNull).collect(Collectors.toList());
+ List saveList = finalPos.stream()
+ .filter(m -> list.stream().noneMatch(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId()))
+ ).filter(Objects::nonNull).collect(Collectors.toList());
// 修改
if (CollectionUtils.isNotEmpty(updateList)) {
@@ -166,43 +129,22 @@ public class SpecialAddDeductionBiz extends BaseBean {
if (CollectionUtils.isNotEmpty(saveList)) {
batchSave(saveList);
}
- // 记录操作日志
-// saveList.addAll(updateList);
-//
-// if (CollectionUtils.isNotEmpty(saveList)) {
-// LoggerContext loggerContext = new LoggerContext();
-// loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
-// loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
-// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
-// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
-// loggerContext.setNewValueList(saveList);
-// loggerContext.setTenant_key(message.getTenantKey());
-// loggerContext.setOperator(message.getUserId().toString());
-// loggerContext.setOperatorName(message.getOpreator());
-// loggerContext.setClientIp(message.getClientIp());
-// addUpDeductionLoggerTemplate.write(loggerContext);
-// }
}
/**
- * @description 批量删除
* @return void
- * @author Harryxzy
- * @date 2022/10/27 16:07
+ * @description 批量删除
*/
- public void batchDeleteByIDS(List deleteIds) {
+ public void batchDeleteByIds(List deleteIds) {
if (CollectionUtils.isEmpty(deleteIds)) {
return;
}
- SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
- try {
- OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
+ try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
+ SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
List> partition = Lists.partition(deleteIds, 100);
- partition.forEach(mapper::deleteData);
+ partition.forEach(mapper::deleteByIds);
sqlSession.commit();
- } finally {
- sqlSession.close();
}
}
}
diff --git a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml
index 44916d521..01cdbc987 100644
--- a/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml
+++ b/src/com/engine/salary/mapper/datacollection/SpecialAddDeductionMapper.xml
@@ -1,197 +1,607 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- id, employee_id, tax_agent_id, declare_month, children_education, continuing_education,
- housing_loan_interest, housing_rent, supporting_elder, serious_illness_treatment,
- infant_care, create_time, update_time, creator, delete_type, tenant_key
-
-
-
-
- insert into hrsa_special_add_deduction
-
-
- employee_id,
-
-
- tax_agent_id,
-
-
- declare_month,
-
-
- children_education,
-
-
- continuing_education,
-
-
- housing_loan_interest,
-
-
- housing_rent,
-
-
- supporting_elder,
-
-
- serious_illness_treatment,
-
-
- infant_care,
-
-
- create_time,
-
-
- update_time,
-
-
- creator,
-
-
- delete_type,
-
-
- tenant_key,
-
-
-
-
- #{employeeId,jdbcType=BIGINT},
-
-
- #{taxAgentId,jdbcType=BIGINT},
-
-
- #{declareMonth,jdbcType=TIMESTAMP},
-
-
- #{childrenEducation,jdbcType=VARCHAR},
-
-
- #{continuingEducation,jdbcType=VARCHAR},
-
-
- #{housingLoanInterest,jdbcType=VARCHAR},
-
-
- #{housingRent,jdbcType=VARCHAR},
-
-
- #{supportingElder,jdbcType=VARCHAR},
-
-
- #{seriousIllnessTreatment,jdbcType=VARCHAR},
-
-
- #{infantCare,jdbcType=VARCHAR},
-
-
- #{createTime,jdbcType=TIMESTAMP},
-
-
- #{updateTime,jdbcType=TIMESTAMP},
-
-
- #{creator,jdbcType=BIGINT},
-
-
- #{deleteType,jdbcType=INTEGER},
-
-
- #{tenantKey,jdbcType=VARCHAR},
-
-
-
-
-
- update hrsa_special_add_deduction
-
-
- employee_id = #{employeeId,jdbcType=BIGINT},
-
-
- tax_agent_id = #{taxAgentId,jdbcType=BIGINT},
-
-
- declare_month = #{declareMonth,jdbcType=TIMESTAMP},
-
-
- children_education = #{childrenEducation,jdbcType=VARCHAR},
-
-
- continuing_education = #{continuingEducation,jdbcType=VARCHAR},
-
-
- housing_loan_interest = #{housingLoanInterest,jdbcType=VARCHAR},
-
-
- housing_rent = #{housingRent,jdbcType=VARCHAR},
-
-
- supporting_elder = #{supportingElder,jdbcType=VARCHAR},
-
-
- serious_illness_treatment = #{seriousIllnessTreatment,jdbcType=VARCHAR},
-
-
- infant_care = #{infantCare,jdbcType=VARCHAR},
-
-
- create_time = #{createTime,jdbcType=TIMESTAMP},
-
-
- update_time = #{updateTime,jdbcType=TIMESTAMP},
-
-
- creator = #{creator,jdbcType=BIGINT},
-
-
- delete_type = #{deleteType,jdbcType=INTEGER},
-
-
- tenant_key = #{tenantKey,jdbcType=VARCHAR},
-
-
- where id = #{id,jdbcType=BIGINT}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ t1.id,
+ t1.declare_month,
+ t1.employee_id,
+ t2.id AS tax_agent_id,
+ t2.name AS tax_agent_name,
+ e.lastname as username,
+ e.certificatenum as idNo,
+ d.departmentname AS departmentName,
+ e.mobile,
+ e.workcode as job_num,
+ e.companystartdate as hiredate,
+ t1.children_education,
+ t1.continuing_education,
+ t1.housing_loan_interest,
+ t1.housing_rent,
+ t1.serious_illness_treatment,
+ t1.supporting_elder,
+ t1.infant_care
+
+
+
+
+ AND t1.id IN
+
+ #{id}
+
+
+
+ AND t1.employee_id = #{param.employeeId}
+
+
+
+ AND
+ (
+ e.lastname like CONCAT('%',#{param.keyword},'%')
+ OR d.departmentname like CONCAT('%',#{param.keyword},'%')
+ OR e.workcode like CONCAT('%',#{param.keyword},'%')
+ )
+
+
+
+
+ AND t1.declare_month = #{param.declareMonthDate[0]}
+
+
+ AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
+
+
+
+
+ AND e.lastname like CONCAT('%',#{param.username},'%')
+
+
+
+ AND t1.tax_agent_id = #{param.taxAgentId}
+
+
+ AND t1.tax_agent_id IN
+
+ #{id}
+
+
+
+
+ AND d.id IN
+
+ #{id}
+
+
+
+
+ AND e.workcode like CONCAT('%',#{param.jobNum},'%')
+
+
+
+ AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
+
+
+
+ AND e.mobile like CONCAT('%',#{param.mobile},'%')
+
+
+
+
+ AND t1.id IN
+
+ #{id}
+
+
+
+ AND t1.employee_id = #{param.employeeId}
+
+
+
+ AND
+ (
+ e.lastname like '%'||#{param.keyword}||'%'
+ OR d.departmentname like '%'||#{param.keyword}||'%'
+ OR e.workcode like '%'||#{param.keyword}||'%'
+ )
+
+
+
+
+ AND t1.declare_month = #{param.declareMonthDate[0]}
+
+
+ AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
+
+
+
+
+ AND e.lastname like '%'||#{param.username}||'%'
+
+
+
+ AND t1.tax_agent_id = #{param.taxAgentId}
+
+
+ AND t1.tax_agent_id IN
+
+ #{id}
+
+
+
+ AND d.id IN
+
+ #{id}
+
+
+
+
+ AND e.workcode like '%'||#{param.jobNum}||'%'
+
+
+
+ AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
+
+
+
+ AND e.mobile like '%'||#{param.mobile}||'%'
+
+
+
+
+ AND t1.id IN
+
+ #{id}
+
+
+
+ AND t1.employee_id = #{param.employeeId}
+
+
+
+ AND
+ (
+ e.lastname like '%'+#{param.keyword}+'%'
+ OR d.departmentname like '%'+#{param.keyword}+'%'
+ OR e.workcode like '%'+#{param.keyword}+'%'
+ )
+
+
+
+
+ AND t1.declare_month = #{param.declareMonthDate[0]}
+
+
+ AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
+
+
+
+
+ AND e.lastname like '%'+#{param.username}+'%'
+
+
+
+ AND t1.tax_agent_id = #{param.taxAgentId}
+
+
+ AND t1.tax_agent_id IN
+
+ #{id}
+
+
+
+ AND d.id IN
+
+ #{id}
+
+
+
+
+ AND e.workcode like '%'+#{param.jobNum}+'%'
+
+
+
+ AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
+
+
+
+ AND e.mobile like '%'+#{param.mobile}+'%'
+
+
+
+
+
+
+
+
+
+
+ insert into hrsa_special_add_deduction
+
+
+ employee_id,
+
+
+ tax_agent_id,
+
+
+ declare_month,
+
+
+ children_education,
+
+
+ continuing_education,
+
+
+ housing_loan_interest,
+
+
+ housing_rent,
+
+
+ supporting_elder,
+
+
+ serious_illness_treatment,
+
+
+ infant_care,
+
+
+ create_time,
+
+
+ update_time,
+
+
+ creator,
+
+ delete_type,
+
+ tenant_key,
+
+
+
+
+ #{employeeId,jdbcType=BIGINT},
+
+
+ #{taxAgentId,jdbcType=BIGINT},
+
+
+ #{declareMonth,jdbcType=TIMESTAMP},
+
+
+ #{childrenEducation,jdbcType=VARCHAR},
+
+
+ #{continuingEducation,jdbcType=VARCHAR},
+
+
+ #{housingLoanInterest,jdbcType=VARCHAR},
+
+
+ #{housingRent,jdbcType=VARCHAR},
+
+
+ #{supportingElder,jdbcType=VARCHAR},
+
+
+ #{seriousIllnessTreatment,jdbcType=VARCHAR},
+
+
+ #{infantCare,jdbcType=VARCHAR},
+
+
+ #{createTime,jdbcType=TIMESTAMP},
+
+
+ #{updateTime,jdbcType=TIMESTAMP},
+
+
+ #{creator,jdbcType=BIGINT},
+
+ 0,
+
+ #{tenantKey,jdbcType=VARCHAR},
+
+
+
+
+
+ update hrsa_special_add_deduction
+
+
+ employee_id = #{employeeId,jdbcType=BIGINT},
+
+
+ tax_agent_id = #{taxAgentId,jdbcType=BIGINT},
+
+
+ declare_month = #{declareMonth,jdbcType=TIMESTAMP},
+
+
+ children_education = #{childrenEducation,jdbcType=VARCHAR},
+
+
+ continuing_education = #{continuingEducation,jdbcType=VARCHAR},
+
+
+ housing_loan_interest = #{housingLoanInterest,jdbcType=VARCHAR},
+
+
+ housing_rent = #{housingRent,jdbcType=VARCHAR},
+
+
+ supporting_elder = #{supportingElder,jdbcType=VARCHAR},
+
+
+ serious_illness_treatment = #{seriousIllnessTreatment,jdbcType=VARCHAR},
+
+
+ infant_care = #{infantCare,jdbcType=VARCHAR},
+
+
+ create_time = #{createTime,jdbcType=TIMESTAMP},
+
+
+ update_time = #{updateTime,jdbcType=TIMESTAMP},
+
+
+ creator = #{creator,jdbcType=BIGINT},
+
+
+ delete_type = #{deleteType,jdbcType=INTEGER},
+
+
+ tenant_key = #{tenantKey,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
+
+
+ update hrsa_special_add_deduction
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.employeeId,jdbcType=BIGINT}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.taxAgentId,jdbcType=BIGINT}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.declareMonth,jdbcType=TIMESTAMP}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.childrenEducation,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.continuingEducation,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.housingLoanInterest,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.housingRent,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.supportingElder,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.seriousIllnessTreatment,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.infantCare,jdbcType=VARCHAR}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.creator,jdbcType=BIGINT}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.deleteType,jdbcType=INTEGER}
+
+
+
+
+
+
+ when id = #{item.id,jdbcType=BIGINT} then #{item.tenantKey,jdbcType=VARCHAR}
+
+
+
+
+ where id in
+
+ #{item.id,jdbcType=BIGINT}
+
+
+
+
+
+ insert into hrsa_special_add_deduction
+ (employee_id, tax_agent_id, declare_month, children_education, continuing_education,
+ housing_loan_interest, housing_rent, supporting_elder, serious_illness_treatment,
+ infant_care, create_time, update_time, creator, delete_type, tenant_key)
+ values
+
+ (#{item.employeeId,jdbcType=BIGINT}, #{item.taxAgentId,jdbcType=BIGINT},
+ #{item.declareMonth,jdbcType=TIMESTAMP},
+ #{item.childrenEducation,jdbcType=VARCHAR}, #{item.continuingEducation,jdbcType=VARCHAR},
+ #{item.housingLoanInterest,jdbcType=VARCHAR}, #{item.housingRent,jdbcType=VARCHAR},
+ #{item.supportingElder,jdbcType=VARCHAR}, #{item.seriousIllnessTreatment,jdbcType=VARCHAR},
+ #{item.infantCare,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
+ #{item.updateTime,jdbcType=TIMESTAMP},
+ #{item.creator,jdbcType=BIGINT}, 0, #{item.tenantKey,jdbcType=VARCHAR})
+
+
+
+
+
+
+
+
+
+
+ update hrsa_special_add_deduction
+ set delete_type = 1
+ where id in (
+
+ #{id}
+
+ ) and delete_type = 0
+
\ No newline at end of file
diff --git a/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java b/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java
new file mode 100644
index 000000000..f658c66cb
--- /dev/null
+++ b/src/com/engine/salary/service/impl/SpecialAddDeductionServiceImpl.java
@@ -0,0 +1,810 @@
+package com.engine.salary.service.impl;
+
+import com.api.formmode.mybatis.util.SqlProxyHandle;
+import com.engine.common.util.ServiceUtil;
+import com.engine.core.impl.Service;
+import com.engine.salary.biz.EmployBiz;
+import com.engine.salary.biz.SpecialAddDeductionBiz;
+import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
+import com.engine.salary.entity.datacollection.DataCollectionEmployee;
+import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
+import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
+import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
+import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam;
+import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
+import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
+import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
+import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
+import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
+import com.engine.salary.entity.taxagent.po.TaxAgentPO;
+import com.engine.salary.enums.UserStatusEnum;
+import com.engine.salary.exception.SalaryRunTimeException;
+import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
+import com.engine.salary.mapper.sys.SalarySysConfMapper;
+import com.engine.salary.service.AddUpDeductionService;
+import com.engine.salary.service.SalaryEmployeeService;
+import com.engine.salary.service.SpecialAddDeductionService;
+import com.engine.salary.service.TaxAgentService;
+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.db.MapperProxyFactory;
+import com.engine.salary.util.excel.ExcelComment;
+import com.engine.salary.util.excel.ExcelParseHelper;
+import com.engine.salary.util.excel.ExcelUtil;
+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 org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Validate;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import weaver.file.ImageFileManager;
+import weaver.general.Util;
+import weaver.hrm.User;
+
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.time.YearMonth;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
+
+public class SpecialAddDeductionServiceImpl extends Service implements SpecialAddDeductionService {
+
+ private SpecialAddDeductionMapper getSpecialAddDeductionMapper() {
+ return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
+ }
+
+ private TaxAgentService getTaxAgentService(User user) {
+ return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
+ }
+
+ private AddUpDeductionService getAddUpDeductionService(User user) {
+ return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
+ }
+
+ private SalaryEmployeeService getSalaryEmployeeService(User user) {
+ return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
+ }
+
+ private SalarySysConfMapper getSalarySysConfMapper() {
+ return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
+ }
+
+ private SalarySysConfService getSalarySysConfService(User user) {
+ return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
+ }
+
+ @Override
+ public SpecialAddDeductionPO getById(Long id) {
+ return getSpecialAddDeductionMapper().getById(id);
+ }
+
+
+ @Override
+ public PageInfo listPage(SpecialAddDeductionQueryParam queryParam) {
+ //申报月份
+ List declareMonth = queryParam.getDeclareMonth();
+ if (CollectionUtils.isNotEmpty(declareMonth)) {
+ queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
+ queryParam.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
+ }
+
+ //排序配置
+ OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
+ queryParam.setOrderRule(orderRule);
+
+ long employeeId = user.getUID();
+
+ Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
+ if (needAuth) {
+ List taxAgentIdsAsAdmin = getTaxAgentService(user)
+ .listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
+ return new PageInfo<>(SpecialAddDeductionListDTO.class);
+ }
+ queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
+ }
+ SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
+ List list = getSpecialAddDeductionMapper().listByParam(queryParam);
+ SpecialAddDeductionEncrypt.decrypt(list);
+ return new PageInfo<>(list, SpecialAddDeductionListDTO.class);
+ }
+
+ @Override
+ public PageInfo recordListPage(SpecialAddDeductionQueryParam queryParam) {
+ long employeeId = user.getUID();
+
+ //申报月份
+ List declareMonth = queryParam.getDeclareMonth();
+ if (CollectionUtils.isNotEmpty(declareMonth)) {
+ queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
+ queryParam.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
+ }
+
+ Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
+ if (needAuth) {
+ List taxAgentIdsAsAdmin = getTaxAgentService(user)
+ .listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId)
+ .collect(Collectors.toList());
+ if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
+ return new PageInfo<>(SpecialAddDeductionRecordDTO.class);
+ }
+ queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
+ }
+ SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
+ List list = getSpecialAddDeductionMapper().listDtoByParam(queryParam);
+ SpecialAddDeductionEncrypt.decrypt(list);
+ return new PageInfo<>(list, SpecialAddDeductionRecordDTO.class);
+ }
+
+
+ @Override
+ public Map preview(SpecialAddDeductionImportParam importParam) {
+ Map apidatas = new HashMap();
+
+ //excel文件id
+ String imageId = Util.null2String(importParam.getImageId());
+ Validate.notBlank(imageId, "imageId为空");
+
+ InputStream fileInputStream = null;
+ try {
+ fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
+ List SpecialAddDeductions =
+ ExcelParseHelper.parse2Map(fileInputStream, SpecialAddDeductionListDTO.class, 0, 1, 11,
+ "SpecialAddDeductionTemplate.xlsx");
+ apidatas.put("preview", SpecialAddDeductions);
+ } finally {
+ IOUtils.closeQuietly(fileInputStream);
+ }
+ return apidatas;
+ }
+
+
+ public Map importData(SpecialAddDeductionImportParam importParam) {
+
+ Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
+
+ long currentEmployeeId = user.getUID();
+ Map apidatas = new HashMap();
+ EmployBiz employBiz = new EmployBiz();
+ SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
+
+ //查询对于人员信息导入筛选的全局配置
+ SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
+ String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
+
+ //检验参数
+ checkImportParam(importParam);
+
+ //excel文件id
+ String imageId = Util.null2String(importParam.getImageId());
+ Validate.notBlank(imageId, "imageId为空");
+ //税款所属期
+ String declareMonthStr = Util.null2String(importParam.getDeclareMonth());
+ //个税扣缴义务人
+ String taxAgentId = Util.null2String(importParam.getTaxAgentId());
+
+ InputStream fileInputStream = null;
+ try {
+ fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
+ List SpecialAddDeductions = ExcelParseHelper.parse2Map(fileInputStream, SpecialAddDeductionListDTO.class, 0, 1, 14, "SpecialAddDeductionTemplate.xlsx");
+
+ int total = SpecialAddDeductions.size();
+ int index = 0;
+ int successCount = 0;
+ int errorCount = 0;
+
+ //人员信息
+ List employees = employBiz.listEmployee();
+ // 获取所有个税扣缴义务人
+ Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
+ //税款所属期
+ Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01");
+ // 获取已经核算的数据
+ List salaryAcctEmployees = getAddUpDeductionService(user)
+ .getAccountedEmployeeData(declareMonthStr);
+ // 查询已有数据
+ List list = getSpecialAddDeductionMapper()
+ .listByDeclareMonthAndTaxAgentIds(declareMonth, null);
+
+ // 错误excel内容
+ List