diff --git a/src/com/engine/salary/entity/ly/po/UfGjjInfo.java b/src/com/engine/salary/entity/ly/po/UfGjjInfo.java
index 4ad35c11d..cda71065a 100644
--- a/src/com/engine/salary/entity/ly/po/UfGjjInfo.java
+++ b/src/com/engine/salary/entity/ly/po/UfGjjInfo.java
@@ -18,6 +18,8 @@ import lombok.NoArgsConstructor;
public class UfGjjInfo {
private Long id;
+ private String dyxzzq;
+
// 分部
private Long fb;
diff --git a/src/com/engine/salary/entity/ly/po/UfSbInfo.java b/src/com/engine/salary/entity/ly/po/UfSbInfo.java
index 6f4f98d82..5057d0c70 100644
--- a/src/com/engine/salary/entity/ly/po/UfSbInfo.java
+++ b/src/com/engine/salary/entity/ly/po/UfSbInfo.java
@@ -18,6 +18,9 @@ import lombok.NoArgsConstructor;
public class UfSbInfo {
private Long id;
+ // 对应薪资周期
+ private String dyxzzq;
+
// 分部
private Integer fb;
diff --git a/src/com/engine/salary/mapper/ly/UfSbgjjMapper.xml b/src/com/engine/salary/mapper/ly/UfSbgjjMapper.xml
index 8deae532d..6b793a04a 100644
--- a/src/com/engine/salary/mapper/ly/UfSbgjjMapper.xml
+++ b/src/com/engine/salary/mapper/ly/UfSbgjjMapper.xml
@@ -35,6 +35,7 @@
+
@@ -71,6 +72,7 @@
, t.ylbxgrjn1
, t.znxmlb
, t.znxmmc
+ , t.dyxzzq
@@ -108,6 +110,7 @@
+
@@ -127,6 +130,7 @@
, t.yg
, t.znxmlb
, t.znxmmc
+ , t.dyxzzq
diff --git a/src/com/engine/salary/service/impl/LySalaryReportServiceImpl.java b/src/com/engine/salary/service/impl/LySalaryReportServiceImpl.java
index 882f3e9ac..4ef4a708e 100644
--- a/src/com/engine/salary/service/impl/LySalaryReportServiceImpl.java
+++ b/src/com/engine/salary/service/impl/LySalaryReportServiceImpl.java
@@ -492,6 +492,8 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
}
// 主键id
map.put("id", e.getId());
+ // 薪资所属月
+ map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(e.getSalaryMonth()));
//人员id
map.put("employeeId", e.getEmployeeId());
map.put("userName", fieldValueMap.get("username"));
@@ -532,6 +534,7 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
itemSum.put("employeeId", CollectionUtils.isEmpty(value) ? "" : value.get(0).get("employeeId"));
itemSum.put("subcompanyId", CollectionUtils.isEmpty(value) ? "" : value.get(0).get("subcompanyId") == null ? "0" : value.get(0).get("subcompanyId"));
itemSum.put("departmentId", CollectionUtils.isEmpty(value) ? "" : value.get(0).get("departmentId") == null ? "0" : value.get(0).get("departmentId"));
+ itemSum.put("salaryMonth", CollectionUtils.isEmpty(value) ? "" : value.get(0).get("salaryMonth") == null ? " " : value.get(0).get("salaryMonth"));
if (ffgsztItemId != null) {
Map map = value.get(0);
String rylb = map.get(ffgsztItemId.toString()) == null ? "" : map.get(ffgsztItemId.toString()).toString();
@@ -2124,8 +2127,23 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
}
// 获取当月导入社保数据
-// List ufSbInfos = getLyUfSbgjjMapper().listSbInfoByFyssq(salaryMonth);
- List ufSbInfos = getLyUfSbgjjMapper().listSbInfoByDyxzzq(salaryMonth);
+ List ufSbInfos = getLyUfSbgjjMapper().listSbInfoByFyssq(salaryMonth);
+ // 根据人员id汇总
+ Map> ufGroupByYg = SalaryEntityUtil.group2Map(ufSbInfos, UfSbInfo::getYg);
+ ufSbInfos = ufSbInfos.stream().filter(uf -> {
+ List list = ufGroupByYg.get(uf.getYg());
+ if (CollectionUtils.isNotEmpty(list) && list.size() > 1) {
+ return !(uf.getSbgrjnhj() == null || uf.getSbgrjnhj().compareTo(Double.valueOf("0")) == 0);
+ }
+ return true;
+ }).collect(Collectors.toList());
+ List dateList = ufSbInfos.stream().map(UfSbInfo::getDyxzzq)
+ .distinct()
+ .map(date -> SalaryDateUtil.dateStrToLocalYearMonth(date))
+ .filter(date -> date != null).distinct()
+ .sorted(Comparator.comparing(Date::getTime))
+ .collect(Collectors.toList());
+// List ufSbInfos = getLyUfSbgjjMapper().listSbInfoByDyxzzq(salaryMonth);
ufSbInfos = ufSbInfos.stream().map(info -> {
if (info.getGmgsqc() == null) {
info.setGmgsqc("");
@@ -2186,28 +2204,35 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
// 查询核算账套
List salarySobList = getSalarySobService(user).listAll();
List salarySobIds = salarySobList.stream().map(SalarySobPO::getId).collect(Collectors.toList());
- LocalDateRange dateRange = LocalDateRange.builder().fromDate(salaryMonthDate).endDate(salaryMonthDate).build();
- // 获取核算记录
- List salaryAcctRecordList = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, dateRange);
- salaryAcctRecordList = salaryAcctRecordList.stream().filter(salaryAcctRecordPO -> salaryAcctRecordPO.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
- List salaryAcctRecordIds = salaryAcctRecordList.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
- LinkedHashMap> acctSbSumByGsMap = new LinkedHashMap<>();
+ // 查询所有薪资所属月下核算数据
+ List salaryAcctRecordIds = new ArrayList<>();
+ Map>> resultGroupByKey = new HashMap<>();
+ if (CollectionUtils.isNotEmpty(dateList)) {
+ LocalDateRange dateRange = LocalDateRange.builder().fromDate(dateList.get(0)).endDate(dateList.get(dateList.size()-1)).build();
+ // 获取核算记录
+ List salaryAcctRecordList = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, dateRange);
+ salaryAcctRecordList = salaryAcctRecordList.stream().filter(salaryAcctRecordPO -> salaryAcctRecordPO.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()).collect(Collectors.toList());
+ salaryAcctRecordIds = salaryAcctRecordList.stream().map(SalaryAcctRecordPO::getId).collect(Collectors.toList());
+ }
+
if (CollectionUtils.isNotEmpty(salaryAcctRecordIds)) {
List salaryAcctEmpList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(salaryAcctRecordIds);
// 查新薪资核算结果
List acctResultPOList = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndSalaryItemIds(salaryAcctRecordIds, salaryItemIdList);
List