汇通二期

This commit is contained in:
Harryxzy 2025-07-14 11:17:48 +08:00
parent 684d5bc9a8
commit d24f9bf0a6
14 changed files with 635 additions and 10 deletions

View File

@ -0,0 +1,164 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Cell;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.Row;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
public class batchEditSalaryAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private SalaryItemService getSalaryItemService(User user) {
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
// private String tableName;
private String ygid;
private String gskjywr;
private String sxrq;
private String tzyy;
private String salaryValue;
private String salaryItemId;
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> mainFieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
// 明细表数据
Row[] rows = requestInfo.getDetailTableInfo().getDetailTable(0).getRow();
if (rows == null || rows.length == 0) {
log.error("汇通批量调薪,明细表为空");
// 不执行action
return SUCCESS;
}
List<Map<String, String>> detailFieldMapList = new ArrayList<>();
for (Row r : rows) {
Cell[] c = r.getCell();// 每行数据再按列存储
// 指定列
HashMap<String, String> rowMap = new HashMap<>();
for (Cell c1 : c) {
String name = c1.getName();// 明细字段名称
String value = c1.getValue();// 明细字段的值
rowMap.put(name, value);
}
detailFieldMapList.add(rowMap);
}
String enable = mainFieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
User user = requestInfo.getRequestManager().getUser();
if (!NumberUtils.isCreatable(salaryItemId)) {
requestInfo.getRequestManager().setMessage("薪资项目id未正确设置");
return FAILURE_AND_CONTINUE;
}
SalaryItemPO salaryItem = getSalaryItemService(user).getById(Long.valueOf(salaryItemId));
if (salaryItem == null) {
requestInfo.getRequestManager().setMessage("薪资项目不存在");
return FAILURE_AND_CONTINUE;
}
// 封装参数
List<Map<String, Object>> importData = new ArrayList<>();
for (Map<String, String> singleDetailMap : detailFieldMapList) {
String employeeId = singleDetailMap.get(ygid);
String value = singleDetailMap.get(salaryValue);
String gskjywrName = "";
if (StringUtils.isNotBlank(gskjywr) && gskjywr.startsWith("detail_")) {
gskjywrName = singleDetailMap.get(gskjywr.replace("detail_", ""));
} else {
gskjywrName = mainFieldMap.get(gskjywr);
}
String sxrqValue = "";
if (StringUtils.isNotBlank(sxrq) && sxrq.startsWith("detail_")) {
sxrqValue = singleDetailMap.get(sxrq.replace("detail_", ""));
} else {
sxrqValue = mainFieldMap.get(sxrq);
}
String tzyyValue = "";
if (StringUtils.isNotBlank(tzyy) && tzyy.startsWith("detail_")) {
tzyyValue = singleDetailMap.get(tzyy.replace("detail_", ""));
} else {
tzyyValue = mainFieldMap.get(tzyy);
}
HashMap<String, Object> singleMap = new HashMap<>();
singleMap.put("员工id", employeeId);
singleMap.put("个税扣缴义务人", gskjywrName);
singleMap.put("生效日期", sxrqValue);
singleMap.put("调整原因", StringUtils.isBlank(tzyyValue) ? "调薪" : tzyyValue);
singleMap.put(salaryItem.getName(),value);
importData.add(singleMap);
}
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
//操作人
Map<String, Object> map = getSalaryArchiveWrapper(user).adjustmentSalaryArchive(build);
List errorNotice = (List) map.get("errorNotice");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("调薪存在异常 requestId:{} map:{}", requestInfo.getRequestid(), map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorNotice");
StringBuilder message = new StringBuilder("");
for (Map<String, String> comments : excelComments) {
message.append(comments.get("message")).append("\n");
}
requestInfo.getRequestManager().setMessage(message.toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("调薪异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -0,0 +1,43 @@
package com.engine.salary.entity.salaryacct.dto;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Harryxzy
* @ClassName HtSbqsListDTO
* @date 2024/10/29 15:45
* @description 汇通社保请示流程 增减人员类别
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HtSbqsChangeListDTO {
// 员工id
private Long employeeId;
// 姓名
@TableTitle(title = "姓名",dataIndex = "userName",key = "userName")
private String userName;
// 身份证号
@TableTitle(title = "身份证号",dataIndex = "idNo",key = "idNo")
private String idNo;
// 变动月份
@TableTitle(title = "变动月份",dataIndex = "changeDate",key = "changeDate")
private String changeDate;
// 个人缴纳值
@TableTitle(title = "个人缴纳值",dataIndex = "perValue",key = "perValue")
private String perValue;
// 单位缴纳值
@TableTitle(title = "单位缴纳值",dataIndex = "comValue",key = "comValue")
private String comValue;
}

View File

@ -45,5 +45,9 @@ public class HtjsApprovalParam extends BaseQueryParam {
boolean sum;
private Long insuranceId;
private boolean isIncrease;
}

View File

@ -0,0 +1,32 @@
package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @ClassName HtjsApprovalParam
* @author Harryxzy
* @date 2024/10/22 14:38
* @description 汇通建设 社保变动台账
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HtjsSIChangeParam extends BaseQueryParam {
// 薪资所属月
String salaryMonth;
// 薪资所属月
Date salaryMonthDate;
// 姓名
String userName;
}

View File

@ -22,6 +22,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.*;
@ -61,7 +62,7 @@ public class SalaryArchiveBO {
*
* @param salaryItems
*/
public static List<WeaTableColumn> buildSalaryArchiveTable(List<SalaryItemPO> salaryItems, boolean openSecondaryAccount) {
public static List<WeaTableColumn> buildSalaryArchiveTable(List<SalaryItemPO> salaryItems, boolean openSecondaryAccount, List<String> runStatusList) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();
WeaTableColumn idColumn = new WeaTableColumn("100px", "id", "id");
@ -85,7 +86,9 @@ public class SalaryArchiveBO {
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "起始发薪日期"), "payStartDate"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "最后发薪日期"), "payEndDate"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "入职日期"), "companystartdate").setDisplay(WeaBoolAttr.FALSE));
// columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "离职日期"), "dismissdate").setDisplay(WeaBoolAttr.FALSE));
if (CollectionUtils.isNotEmpty(runStatusList) && (runStatusList.contains(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) || runStatusList.contains(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()))) {
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "离职日期"), "lzrq").setDisplay(WeaBoolAttr.FALSE));
}
for (SalaryItemPO salaryItem : salaryItems) {
columns.add(new WeaTableColumn("100px", salaryItem.getName(), salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX));
}

View File

@ -571,7 +571,9 @@
t.other_com_json,t.social_per_sum,t.social_com_sum,
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
t.other_com_sum,t.per_sum,t.com_sum,t.payment_status,
t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string, t.payment_organization
t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string, t.payment_organization,
t.social_payment_com_base_string, t.fund_payment_com_base_string, t.other_payment_com_base_string,
t.social_scheme_id,t.fund_scheme_id,t.other_scheme_id,t.bill_status,t.resource_from
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0

View File

@ -1,6 +1,8 @@
package com.engine.salary.service;
import com.engine.salary.entity.salaryacct.dto.HtSbqsChangeListDTO;
import com.engine.salary.entity.salaryacct.dto.HtSbqsListDTO;
import com.engine.salary.entity.salaryacct.param.HtjsSIChangeParam;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
@ -212,6 +214,8 @@ public interface SIAccountService {
List<HtSbqsListDTO> welfareData4Htjs(String billMonth, Long socialSchemeId, Long fundSchemeId, Long otherSchemeId);
List<HtSbqsChangeListDTO> htjsSbqsChangeDataList(String billMonth, Long socialSchemeId, Long fundSchemeId, Long otherSchemeId, Long insuranceId, Boolean isIncrease);
/**
* 给套账提供字段名对应字段释义
*
@ -337,5 +341,7 @@ public interface SIAccountService {
void batFile(AccountBatParam param);
void batSocialSecurityBenefitsRecalculate(AccountBatParam batParam);
PageInfo<Map<String, Object>> htjsSIChangeList(HtjsSIChangeParam param);
}

View File

@ -1,10 +1,7 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
import com.engine.salary.entity.salaryacct.dto.HtSbqsListDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
import com.engine.salary.entity.salaryacct.dto.*;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.util.page.PageInfo;
@ -226,4 +223,8 @@ public interface SalaryAcctResultService {
Map<String, Object> htjsXczfsqList(HtjsApprovalParam param);
List<HtSbqsListDTO> htjsSbqsList(HtjsApprovalParam param);
PageInfo<HtSbqsChangeListDTO> htjsSbqsChangeDataList(HtjsApprovalParam param);
PageInfo<Map<String, Object>> htjsSIChangeList(HtjsSIChangeParam param);
}

View File

@ -22,7 +22,9 @@ import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.salaryacct.dto.HtSbqsChangeListDTO;
import com.engine.salary.entity.salaryacct.dto.HtSbqsListDTO;
import com.engine.salary.entity.salaryacct.param.HtjsSIChangeParam;
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.*;
import com.engine.salary.entity.siaccount.param.*;
@ -86,6 +88,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
import java.io.InputStream;
import java.math.BigDecimal;
@ -1393,6 +1396,109 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return htSbqsListDTOS;
}
@Override
public List<HtSbqsChangeListDTO> htjsSbqsChangeDataList(String billMonth, Long socialSchemeId, Long fundSchemeId, Long otherSchemeId, Long insuranceId, Boolean isIncrease) {
// 获取所有个税扣缴义务人
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = new ArrayList<>();
List<Integer> commonStatusList = Arrays.asList(PaymentStatusEnum.COMMON.getValue());
List<Integer> statusList = Arrays.asList(PaymentStatusEnum.REPAIR.getValue(), PaymentStatusEnum.BALANCE.getValue());
for (TaxAgentPO taxAgent : taxAgentList) {
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, taxAgent.getId());
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) {
continue;
}
List<InsuranceAccountDetailPO> insuranceAccountDetailList = getInsuranceAccountDetailMapper().queryList4Ht(billMonth, taxAgent.getId(), socialSchemeId, null, null, null, commonStatusList);
insuranceAccountDetailPOS.addAll(insuranceAccountDetailList);
// 获取这些人对应的补缴补差数据
List<Long> empList = insuranceAccountDetailList.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(empList)) {
insuranceAccountDetailPOS.addAll(getInsuranceAccountDetailMapper().queryList4Ht(billMonth, taxAgent.getId(), null, null, null, empList, statusList));
}
}
// 正常缴纳
List<InsuranceAccountDetailPO> commonInsuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue()))
.collect(Collectors.toList());
// 获取各福利项的缴纳人数
Map<String, Object> empInfoMap = getInsuranceApproEmpInfo4HtChangeData(commonInsuranceAccountDetailPOS, insuranceId);
List<Long> payedEmpList = (List<Long>)empInfoMap.get("payedEmpList");
payedEmpList = payedEmpList == null ? Collections.emptyList() : payedEmpList;
Map<Long, String> socialPerMap = (Map<Long, String>)empInfoMap.get("socialPerMap");
socialPerMap = socialPerMap == null ? new HashMap<>() : socialPerMap;
Map<Long, String> socialComMap = (Map<Long, String>)empInfoMap.get("socialComMap");
socialComMap = socialComMap == null ? new HashMap<>() : socialComMap;
// 获取上期社保数据
List<InsuranceAccountDetailPO> lastInsuranceAccountDetailPOS = new ArrayList<>();
for (TaxAgentPO taxAgent : taxAgentList) {
LocalDate localDate = SalaryDateUtil.dateToLocalDate(SalaryDateUtil.dateStrToLocalYearMonth(billMonth));
String lastMonth = SalaryDateUtil.getFormatYearMonth(localDate.minusMonths(1));
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(lastMonth, taxAgent.getId());
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) {
continue;
}
lastInsuranceAccountDetailPOS.addAll(getInsuranceAccountDetailMapper().queryList4Ht(lastMonth, taxAgent.getId(), socialSchemeId, null, null, null,commonStatusList));
}
//退差数据不参与薪资核算
lastInsuranceAccountDetailPOS = lastInsuranceAccountDetailPOS.stream()
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())
|| f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())
|| f.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue()) )
.collect(Collectors.toList());
Map<String, Object> lastEmpInfoMap = getInsuranceApproEmpInfo4HtChangeData(lastInsuranceAccountDetailPOS, insuranceId);
List<Long> lastPayedEmpList = (List<Long>)lastEmpInfoMap.get("payedEmpList");
lastPayedEmpList = lastPayedEmpList == null ? new ArrayList<>() : lastPayedEmpList;
Map<Long, String> lastSocialPerMap = (Map<Long, String>)lastEmpInfoMap.get("socialPerMap");
lastSocialPerMap = lastSocialPerMap == null ? new HashMap<>() : lastSocialPerMap;
Map<Long, String> lastSocialComMap = (Map<Long, String>)lastEmpInfoMap.get("socialComMap");
lastSocialComMap = lastSocialComMap == null ? new HashMap<>() : lastSocialComMap;
List<HtSbqsChangeListDTO> resultList = new ArrayList<>();
if (isIncrease) {
// 本月新增人员id
List<Long> finalLastPayedEmpList = lastPayedEmpList;
List<Long> increaseEmpIds = payedEmpList.stream().distinct().filter(empId -> !finalLastPayedEmpList.contains(empId)).collect(Collectors.toList());
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(increaseEmpIds);
for (DataCollectionEmployee emp : employeeList) {
HtSbqsChangeListDTO dto = HtSbqsChangeListDTO.builder()
.employeeId(emp.getEmployeeId())
.userName(emp.getUsername())
.idNo(emp.getIdNo())
.changeDate(billMonth)
.build();
dto.setPerValue(Utils.null2String(socialPerMap.get(emp.getEmployeeId())));
dto.setComValue(Utils.null2String(socialComMap.get(emp.getEmployeeId())));
resultList.add(dto);
}
} else {
// 本月减少人员id
List<Long> finalPayedEmpList = payedEmpList;
List<Long> decreaseEmpIds = lastPayedEmpList.stream().filter(empId -> !finalPayedEmpList.contains(empId)).collect(Collectors.toList());
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(decreaseEmpIds);
for (DataCollectionEmployee emp : employeeList) {
HtSbqsChangeListDTO dto = HtSbqsChangeListDTO.builder()
.employeeId(emp.getEmployeeId())
.userName(emp.getUsername())
.idNo(emp.getIdNo())
.changeDate(billMonth)
.build();
dto.setPerValue(Utils.null2String(lastSocialPerMap.get(emp.getEmployeeId())));
dto.setComValue(Utils.null2String(lastSocialComMap.get(emp.getEmployeeId())));
resultList.add(dto);
}
}
// 获取这些员工的社保缴纳数据
return resultList;
}
@Override
public Map<String, String> welfareColumns() {
List<ICategoryPO> listAll = getICategoryMapper().listAll().stream().filter(f -> f.getIsUse().equals(IsUseEnum.START.getValue())).collect(Collectors.toList());
@ -2005,6 +2111,77 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return resultMap;
}
public Map<String, Object> getInsuranceApproEmpInfo4HtChangeData(List<InsuranceAccountDetailPO> list, Long singleInsuranceId) {
Map<String, Object> resultMap = new HashMap<>();
if (CollectionUtils.isEmpty(list) || singleInsuranceId == null) {
return resultMap;
}
String singleInsuranceIdStr = singleInsuranceId.toString();
Map<Long, List<InsuranceAccountDetailPO>> employeeMap = list.stream().filter(item -> item.getEmployeeId() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId));
List<Long> payedEmpList = new ArrayList<>();
Map<Long, String> socialPerMap = new HashMap<>();
Map<Long, String> socialComMap = new HashMap<>();
for (Map.Entry<Long, List<InsuranceAccountDetailPO>> entry : employeeMap.entrySet()) {
Long k = entry.getKey();
List<InsuranceAccountDetailPO> v = entry.getValue();
for (InsuranceAccountDetailPO item : v) {
encryptUtil.decrypt(item, InsuranceAccountDetailPO.class);
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
if (socialJson != null) {
socialJson.forEach((insuranceId, num) -> {
if (singleInsuranceIdStr.equals(insuranceId)) {
if (socialPerMap.get(k) == null) {
socialPerMap.put(k, num);
} else {
String oldNum = socialPerMap.get(k);
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
BigDecimal insuanceNum = numDecimal.add(oldDecimal);
socialPerMap.put(k, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
payedEmpList.add(item.getEmployeeId());
}
}
});
}
}
if (StringUtils.isNotBlank(item.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
if (socialJson != null) {
socialJson.forEach((insuranceId, num) -> {
if (singleInsuranceIdStr.equals(insuranceId)) {
if (socialComMap.get(k) == null) {
socialComMap.put(k, num);
} else {
String oldNum = socialComMap.get(k);
BigDecimal insuanceNum = new BigDecimal("0");
BigDecimal oldDecimal = new BigDecimal(oldNum);
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
socialComMap.put(k, insuanceNum.toPlainString());
}
if (StringUtils.isNotBlank(num) && NumberUtils.isNumber(num) && new BigDecimal(num).compareTo(BigDecimal.ZERO) != 0) {
payedEmpList.add(item.getEmployeeId());
}
}
});
}
}
}
}
resultMap.put("payedEmpList", payedEmpList);
resultMap.put("socialPerMap", socialPerMap);
resultMap.put("socialComMap", socialComMap);
return resultMap;
}
@Override
public List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth) {
// InsuranceAccountInspectMapper siAccountInspectMapper = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);
@ -7537,5 +7714,102 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
/*****以上代码为SIAccountBiz中方法逻辑迁移旨在减少Biz类的使用*****/
@Override
public PageInfo<Map<String, Object>> htjsSIChangeList(HtjsSIChangeParam param) {
// 获取本月社保福利台账数据
List<InsuranceAccountBatchPO> insuranceAccountBatchPOS = getInsuranceAccountBatchMapper().listByBillMonth(SalaryDateUtil.getFormatYearMonth(param.getSalaryMonthDate()), null);
if (CollectionUtils.isEmpty(insuranceAccountBatchPOS)) {
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize());
}
// 没有归档的义务人
List<Long> notFiledTaxAgentIds = insuranceAccountBatchPOS.stream().filter(po -> po.getBillStatus().equals(BillStatusEnum.NOT_ARCHIVED.getValue())).map(InsuranceAccountBatchPO::getPaymentOrganization).collect(Collectors.toList());
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
InsuranceAccountDetailParam detailQueryParam = InsuranceAccountDetailParam.builder().paymentStatus(PaymentStatusEnum.COMMON.getValue()).billMonth(param.getSalaryMonth()).build();
detailQueryParam.setOrderRule(orderRule);
//系统人员福利台账明细
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().list(detailQueryParam);
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(notFiledTaxAgentIds)) {
// 过滤未归档的
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
.filter(f -> !notFiledTaxAgentIds.contains(f.getPaymentOrganization()))
.collect(Collectors.toList());
}
// 获取上月的社保福利台账数据
Date lastMonthDate = SalaryDateUtil.localDateToDate(SalaryDateUtil.dateToLocalDate(param.getSalaryMonthDate()).minusMonths(1));
List<InsuranceAccountBatchPO> lastInsuranceAccountBatchPOS = getInsuranceAccountBatchMapper().listByBillMonth(SalaryDateUtil.getFormatLocalDate(lastMonthDate), null);
// 没有归档的义务人
List<Long> lastNotFiledTaxAgentIds = lastInsuranceAccountBatchPOS.stream().filter(po -> po.getBillStatus().equals(BillStatusEnum.NOT_ARCHIVED.getValue())).map(InsuranceAccountBatchPO::getPaymentOrganization).collect(Collectors.toList());
detailQueryParam.setBillMonth(SalaryDateUtil.getFormatYearMonth(lastMonthDate));
//系统人员福利台账明细
List<InsuranceAccountDetailPO> lastInsuranceAccountDetailPOS = getInsuranceAccountDetailMapper().list(detailQueryParam);
lastInsuranceAccountDetailPOS = lastInsuranceAccountDetailPOS.stream()
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(notFiledTaxAgentIds)) {
// 过滤未归档的
lastInsuranceAccountDetailPOS = lastInsuranceAccountDetailPOS.stream()
.filter(f -> !notFiledTaxAgentIds.contains(f.getPaymentOrganization()) && !lastNotFiledTaxAgentIds.contains(f.getPaymentOrganization()))
.collect(Collectors.toList());
}
// 过滤出本月社保公积金其他方案发生变化的台账明细
Map<String, InsuranceAccountDetailPO> lastMonthDetailMap = SalaryEntityUtil.convert2Map(lastInsuranceAccountDetailPOS, po -> po.getPaymentOrganization() + "_split" + po.getEmployeeId());
List<InsuranceAccountDetailPO> changeDetail = new ArrayList<>();
for (InsuranceAccountDetailPO thisMonthPO : insuranceAccountDetailPOS) {
InsuranceAccountDetailPO lastMonthPO = lastMonthDetailMap.get(thisMonthPO.getPaymentOrganization() + "_split" + thisMonthPO.getEmployeeId());
if (lastMonthPO == null) {
changeDetail.add(thisMonthPO);
} else {
boolean socialEqual,fundEqual,otherEqual;
try {
socialEqual = (thisMonthPO.getSocialSchemeId() == null && lastMonthPO.getSocialSchemeId() == null) ? true :
thisMonthPO.getSocialSchemeId().equals(lastMonthPO.getSocialSchemeId());
fundEqual = (thisMonthPO.getFundSchemeId() == null && lastMonthPO.getFundSchemeId() == null) ? true :
thisMonthPO.getFundSchemeId().equals(lastMonthPO.getFundSchemeId());
otherEqual = (thisMonthPO.getOtherSchemeId() == null && lastMonthPO.getOtherSchemeId() == null) ? true :
thisMonthPO.getOtherSchemeId().equals(lastMonthPO.getOtherSchemeId());
} catch (Exception e) {
socialEqual = false;
fundEqual = false;
otherEqual = false;
}
if (socialEqual && fundEqual && otherEqual) {
// 方案全相等不处理
} else {
changeDetail.add(thisMonthPO);
}
}
}
if (CollectionUtils.isEmpty(changeDetail)) {
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize());
}
if (StringUtils.isNotEmpty(param.getUserName())) {
List<Long> employeeIds = changeDetail.stream().map(f -> f.getEmployeeId()).distinct().collect(Collectors.toList());
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(employeeIds);
List<Long> empIds = employeeList.stream().filter(f -> param.getUserName().contains(f.getUsername())).map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
changeDetail = changeDetail.stream().filter(f -> empIds.contains(f.getEmployeeId())).collect(Collectors.toList());
}
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(changeDetail, InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> changeDetailList = pageInfo.getList();
encryptUtil.decryptList(changeDetailList, InsuranceAccountDetailPO.class);
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(changeDetailList, Long.valueOf(user.getUID()), false);
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
pageInfos.setTotal(pageInfo.getTotal());
pageInfos.setPageNum(param.getCurrent());
pageInfos.setPageSize(param.getPageSize());
//动态列组装
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(changeDetailList, Long.valueOf(user.getUID()), SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, PaymentStatusEnum.COMMON.getValue());
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
pageInfos.setColumns(columns);
return pageInfos;
}
}

View File

@ -52,6 +52,7 @@ 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.page.Column;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
@ -1535,4 +1536,38 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// return getSIAccountService(user).welfareData4Htjs(param.getSalaryMonth(), null, null, param.getSchemeId());
// }
}
@Override
public PageInfo<HtSbqsChangeListDTO> htjsSbqsChangeDataList(HtjsApprovalParam param) {
if (param.getSchemeId() == null || StringUtils.isBlank(param.getSalaryMonth())) {
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize());
}
InsuranceSchemePO insuranceSchemePO = getInsuranceSchemeMapper().getById(param.getSchemeId());
if (insuranceSchemePO == null) {
throw new SalaryRunTimeException("社保福利方案不存在或已被删除");
}
List<HtSbqsChangeListDTO> changeList = getSIAccountService(user).htjsSbqsChangeDataList(param.getSalaryMonth(), param.getSchemeId(), param.getFundSchemeId(), param.getOtherSchemeId(), param.getInsuranceId(), param.isIncrease());
PageInfo<HtSbqsChangeListDTO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), changeList, HtSbqsChangeListDTO.class);
if (!param.isIncrease()) {
List<Column> cols = pageInfo.getColumns().stream().filter(col -> !col.getKey().equals("perValue") && !col.getKey().equals("comValue")).collect(Collectors.toList());
pageInfo.clearAndSetColumns(cols);
}
return pageInfo;
}
/**
* 汇通社保异动列表
* @param param
*/
@Override
public PageInfo<Map<String, Object>> htjsSIChangeList(HtjsSIChangeParam param) {
if (!SalaryDateUtil.checkYearMonth(param.getSalaryMonth())) {
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize());
}
Date salaryMonthDate = SalaryDateUtil.dateStrToLocalYearMonth(param.getSalaryMonth());
param.setSalaryMonthDate(salaryMonthDate);
return getSIAccountService(user).htjsSIChangeList(param);
}
}

View File

@ -65,9 +65,12 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
import java.io.InputStream;
import java.math.BigDecimal;
@ -497,6 +500,19 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// return map;
// }).collect(Collectors.toList());
Map<Long, TaxAgentPO> longTaxAgentPOMap = SalaryEntityUtil.convert2Map(taxAgentLists, TaxAgentPO::getId);
// 获取汇通离职日
BaseBean baseBean = new BaseBean();
List<Long> empIds = salaryArchives.stream().map(SalaryArchiveListDTO::getEmployeeId).distinct().collect(Collectors.toList());
String lzrqField = baseBean.getPropValue("htjsSalaryApproval", "lzrq_field_id");
RecordSet rs = new RecordSet();
Map<Long, String> lzrqMap = new HashMap<>();
List<List<Long>> partition = Lists.partition(empIds, 800);
partition.forEach(part -> {
rs.execute("select id," + lzrqField +" from cus_fielddata where scopeid=3 and id in (" + StringUtils.join(part, ",") + ")");
while (rs.next()) {
lzrqMap.put(Long.valueOf(rs.getInt("id")), rs.getString(lzrqField));
}
});
// 3.组装数据
List<Map<String, Object>> listMaps = new ArrayList<>();
salaryArchives.forEach(e -> {
@ -526,6 +542,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
map.put("payEndDate", SalaryDateUtil.getFormatLocalDate(e.getPayEndDate()));
map.put("companystartdate", e.getCompanystartdate());
map.put("dismissdate", e.getDismissdate());
map.put("lzrq", Utils.null2String(lzrqMap.get(e.getEmployeeId())));
// 薪资项目动态
Optional<Map<String, Object>> optionalItem = salaryArchiveItemData.stream().filter(f -> f.get("salaryArchiveId").toString().equals(e.getId().toString())).findFirst();
@ -557,6 +574,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
};
// 2.表头
List<Object> headerList = new ArrayList<>(Arrays.asList(header));
if (queryParam.getRunStatusList().contains(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()) || queryParam.getRunStatusList().contains(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) ) {
headerList.add(new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(0, "离职日期"), "", "", 0));
}
for (SalaryItemPO salaryItem : salaryItems) {
headerList.add(new WeaTableColumnGroup("150px", salaryItem.getName(), "", "", salaryItem.getPattern()));
}
@ -611,6 +631,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
row.add(Util.null2String(e.get("employeeStatus")));
row.add(Util.null2String(e.get("payStartDate")));
row.add(Util.null2String(e.get("payEndDate")));
if (queryParam.getRunStatusList().contains(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()) || queryParam.getRunStatusList().contains(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue()) ) {
row.add(Util.null2String(e.get("lzrq")));
}
// 薪资项目数据
for (SalaryItemPO salaryItem : salaryItems) {
try {

View File

@ -1109,7 +1109,7 @@ public class SalaryAcctController {
}
/**
* 薪酬支付申请list
* 保险请示list
* @param request
* @param response
* @param param
@ -1122,5 +1122,35 @@ public class SalaryAcctController {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsApprovalParam, List<HtSbqsListDTO>>(user).run(getSalaryAcctResultWrapper(user)::htjsSbqsList, param);
}
/**
* 保险请示增减数据穿透
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/htjs/sbqsDataPerspective")
@Produces(MediaType.APPLICATION_JSON)
public String htjsSbqsChangeDataList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HtjsApprovalParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsApprovalParam, PageInfo<HtSbqsChangeListDTO>>(user).run(getSalaryAcctResultWrapper(user)::htjsSbqsChangeDataList, param);
}
/**
* 社保变动台账
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/htjs/SIChangeList")
@Produces(MediaType.APPLICATION_JSON)
public String htjsSIChangeList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody HtjsSIChangeParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<HtjsSIChangeParam, PageInfo<Map<String, Object>>>(user).run(getSalaryAcctResultWrapper(user)::htjsSIChangeList, param);
}
/**********************************汇通建设送薪审批 end*********************************/
}

View File

@ -402,6 +402,14 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
return getSalaryAcctResultService(user).htjsSbqsList(param);
}
public PageInfo<HtSbqsChangeListDTO> htjsSbqsChangeDataList(HtjsApprovalParam param) {
return getSalaryAcctResultService(user).htjsSbqsChangeDataList(param);
}
public PageInfo<Map<String, Object>> htjsSIChangeList(HtjsSIChangeParam param) {
return getSalaryAcctResultService(user).htjsSIChangeList(param);
}
/**
* 薪资核算-校验
*

View File

@ -111,7 +111,7 @@ public class SalaryArchiveWrapper extends Service {
//动态列组装
List<WeaTableColumn> columns = SalaryArchiveBO.buildSalaryArchiveTable(salaryItems, openSecondaryAccount);
List<WeaTableColumn> columns = SalaryArchiveBO.buildSalaryArchiveTable(salaryItems, openSecondaryAccount, queryParam.getRunStatusList());
SalaryWeaTable<SalaryArchiveListDTO> table = new SalaryWeaTable<SalaryArchiveListDTO>(user, SalaryArchiveListDTO.class);
table.setColumns(columns);
@ -163,7 +163,7 @@ public class SalaryArchiveWrapper extends Service {
//动态列组装
List<WeaTableColumn> columns = SalaryArchiveBO.buildSalaryArchiveTable(salaryItems, openSecondaryAccount);
List<WeaTableColumn> columns = SalaryArchiveBO.buildSalaryArchiveTable(salaryItems, openSecondaryAccount, queryParam.getRunStatusList());
SalaryWeaTable<SalaryArchiveListDTO> table = new SalaryWeaTable<SalaryArchiveListDTO>(user, SalaryArchiveListDTO.class);
table.setColumns(columns);