Compare commits

...

11 Commits

23 changed files with 837 additions and 30 deletions

Binary file not shown.

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

@ -869,7 +869,7 @@ public class SalaryBillBO {
if ("text".equals(wmClassify)) {
wmTextFieldIds = (List<String>) salaryBillWatermark.getWmSetting().getOrDefault("wmSelectedFieldIds", Collections.emptyList());
List<String> empFields = Arrays.asList(HRM_Name, HRM_Num, HRM_Mobile, HRM_Email, HRM_CurrentOperatorId, HRM_Department);
List<String> empFields = Arrays.asList(HRM_Name, HRM_Num, HRM_Mobile, HRM_Email, HRM_CurrentOperatorId, HRM_Department, HRM_SecondDepartment);
if (wmTextFieldIds.contains(HRM_SecondDepartment)) {
// 需要查分部
salaryBillWatermark.getWmSetting().put("needQuerySubDepart", true);

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

@ -144,7 +144,7 @@ public class SalarySobItemAggregateBO {
.canEdit(openFormulaForcedEditing || Objects.equals(salaryItemPO.getCanEdit(), 1))
.canDelete(openFormulaForcedEditing || salaryItemPO.getCanDelete() == null || Objects.equals(salaryItemPO.getCanDelete(), 1))
.width(salaryItemPO.getWidth())
.defaultValue(salaryItemPO.getDefaultValue())
.defaultValue(salarySobItemPO.getDefaultValue())
.build());
}
}

View File

@ -11,6 +11,7 @@
e.workcode,
e.certificatenum as idNo,
e.accounttype as accountType,
e.sex as sex,
'false' as extEmp
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
@ -21,6 +22,7 @@
<select id="getEmployeeByIds" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.sex as sex,
e.certificatenum as idNo,
e.status as status,
e.workcode as workcode,
@ -41,6 +43,7 @@
<select id="getEmployeeByIdsIncludeAccountType" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.sex as sex,
e.certificatenum as idNo,
e.status as status,
e.workcode as workcode,
@ -123,6 +126,7 @@
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.sex as sex,
e.certificatenum as idNo,
e.workcode as workcode,
d.departmentname as departmentName,
@ -229,6 +233,7 @@
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.sex as sex,
e.certificatenum as idNo,
e.workcode as workcode,
d.departmentname as departmentName,
@ -283,6 +288,7 @@
e.lastname as username,
e.status as status,
e.workcode as workcode,
e.sex as sex,
e.certificatenum as idNo,
e.companystartdate as companystartdate,
e.mobile as mobile,
@ -304,6 +310,7 @@
e.status as status,
e.workcode as workcode,
e.certificatenum as idNo,
e.sex as sex,
e.companystartdate as companystartdate,
e.mobile as mobile,
e.accounttype as accountType,
@ -324,6 +331,7 @@
e.status as status,
e.workcode as workcode,
e.certificatenum as idNo,
e.sex as sex,
e.companystartdate as companystartdate,
e.mobile as mobile,
e.departmentid as departmentId,
@ -487,6 +495,7 @@
e.lastname as username,
e.status as status,
e.certificatenum as idNo,
e.sex as sex,
e.workcode as workcode,
e.companystartdate as companystartdate,
e.mobile as mobile,
@ -562,6 +571,7 @@
e.lastname as username,
e.status as status,
e.certificatenum as idNo,
e.sex as sex,
e.workcode as workcode,
d.departmentname as departmentName,
d.id as departmentId,

View File

@ -410,6 +410,9 @@
<if test="approvalStatus != null">
approval_status=#{approvalStatus},
</if>
<if test="runStatus != null">
run_status=#{runStatus},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>

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);
@ -2021,7 +2198,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
@Override
public void socialSecurityBenefitsRecalculate(InsuranceAccountBatchPO param) {
public void socialSecurityBenefitsRecalculate(InsuranceAccountBatchPO insuranceAccountBatchParam) {
//fixme 重新核算的校验逻辑 1先取台账对应扣缴义务人下的所有账套 2取账套下所有核算记录 3判断核算记录有没有使用对应月份的福利台账
// int num = getSiAccountBiz(user).checkIfBusinessaccounting(param);
// int num = checkIfBusinessAccounting(param);
@ -2029,11 +2206,63 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
// if (num > 0) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "已被薪酬核算给核算过,无法重新核算!"));
// }
param.setBillStatus(0);
insuranceAccountBatchParam.setBillStatus(0);
// getSiAccountBiz(user).updateById(param);
updateById(param);
updateById(insuranceAccountBatchParam);
InsuranceAccountBatchPO po = getInsuranceAccountBatchMapper().getById(insuranceAccountBatchParam.getId());
if (po == null) {
return;
}
// 核算
AccountParam param = new AccountParam();
param.setBillMonth(po.getBillMonth());
param.setFlag(false);
param.setPaymentOrganization(po.getPaymentOrganization());
ValidUtil.doValidator(param);
try {
List<Long> employeeIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(param.getPaymentOrganization());
if (CollectionUtils.isEmpty(employeeIds)) {
List<InsuranceAccountDetailPO> list = Lists.newArrayList(getInsuranceAccountDetailMapper().queryNormalListByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
getInsuranceAccountDetailMapper().deleteById(f.getId());
});
}
}
SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel(0, "没有需要核算的人员"));
//福利核算进度
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth() + "_" + param.getPaymentOrganization());
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.isStatus() && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
return;
}
// 初始化进度
ProgressDTO initProgress = new ProgressDTO()
.setTitle(SalaryI18nUtil.getI18nLabel(0, "核算中"))
.setTitleLabelId(97515L)
.setTotalQuantity(2000)
.setCalculatedQuantity(NumberUtils.INTEGER_ZERO)
.setProgress(BigDecimal.ZERO)
.setStatus(true)
.setMessage(StringUtils.EMPTY);
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth() + "_" + param.getPaymentOrganization(), initProgress);
siAccounting(param);
} catch (Exception e) {
// 回滚
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
list = encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
getInsuranceAccountBatchMapper().deleteById(f.getId());
});
}
throw new SalaryRunTimeException(e.getMessage());
}
//记录操作日志
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getById(param.getId());
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getById(insuranceAccountBatchParam.getId());
encryptUtil.decrypt(targetPO, InsuranceAccountBatchPO.class);
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
LoggerContext<InsuranceAccountBatchPO> loggerContext = new LoggerContext<>();
@ -5380,14 +5609,20 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
.setStatus(true)
.setMessage(StringUtils.EMPTY);
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth() + "_" + param.getPaymentOrganization(), initProgress);
ExecutorService taskExecutor = Executors.newCachedThreadPool();
taskExecutor.execute(() -> {
if (param.isFlag()) {
siAccounting(param);
if (param.isFileFlag()) {
siFile(param.getBillMonth(), param.getPaymentOrganization());
}
});
} else {
ExecutorService taskExecutor = Executors.newCachedThreadPool();
taskExecutor.execute(() -> {
siAccounting(param);
if (param.isFileFlag()) {
siFile(param.getBillMonth(), param.getPaymentOrganization());
}
});
}
} catch (Exception e) {
// 回滚
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
@ -7537,5 +7772,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

@ -2881,12 +2881,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (otherPaymentBaseString != null) {
updateOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString);
}
if (!welBaseDiffSign) {
otherPaymentBaseString = adaptWelBaseLimit(updateOtherInfo.getOtherSchemeId(), updateOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
if (otherPaymentBaseString != null) {
updateOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString);
}
}
} else {
StringBuilder errorMsg = new StringBuilder("");
if (!checkWelBaseLimit(updateOtherInfo.getOtherSchemeId(),updateOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "其他福利个人: " + errorMsg;
}
if ( (!welBaseDiffSign) && (!checkWelBaseLimit(updateOtherInfo.getOtherSchemeId(),updateOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "其他福利公司: " + errorMsg;
}
}
//需要拆分个人和公司福利基数时
if (welBaseDiffSign) {
@ -2952,12 +2962,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (otherPaymentBaseString != null) {
insertOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString);
}
if (!welBaseDiffSign) {
otherPaymentBaseString = adaptWelBaseLimit(insertOtherInfo.getOtherSchemeId(), insertOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
if (otherPaymentBaseString != null) {
insertOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString);
}
}
} else {
StringBuilder errorMsg = new StringBuilder("");
if (!checkWelBaseLimit(insertOtherInfo.getOtherSchemeId(),insertOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "其他福利个人:" + errorMsg;
}
if ( (!welBaseDiffSign) && (!checkWelBaseLimit(insertOtherInfo.getOtherSchemeId(),insertOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "其他福利公司:" + errorMsg;
}
}
//需要拆分个人和公司福利基数时
if (welBaseDiffSign) {
@ -3092,12 +3112,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (fundPaymentBaseString != null) {
updateFundInfo.setFundPaymentBaseString(fundPaymentBaseString);
}
if (!welBaseDiffSign) {
fundPaymentBaseString = adaptWelBaseLimit(updateFundInfo.getFundSchemeId(), updateFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
if (fundPaymentBaseString != null) {
updateFundInfo.setFundPaymentBaseString(fundPaymentBaseString);
}
}
} else {
StringBuilder errorMsg = new StringBuilder("");
if (!checkWelBaseLimit(updateFundInfo.getFundSchemeId(),updateFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "公积金个人" + errorMsg;
}
if ( (!welBaseDiffSign) && (!checkWelBaseLimit(updateFundInfo.getFundSchemeId(),updateFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "公积金公司" + errorMsg;
}
}
//需要拆分个人和公司福利基数时
@ -3168,12 +3198,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (fundPaymentBaseString != null) {
insertFundInfo.setFundPaymentBaseString(fundPaymentBaseString);
}
if (!welBaseDiffSign) {
fundPaymentBaseString = adaptWelBaseLimit(insertFundInfo.getFundSchemeId(), insertFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
if (fundPaymentBaseString != null) {
insertFundInfo.setFundPaymentBaseString(fundPaymentBaseString);
}
}
} else {
StringBuilder errorMsg = new StringBuilder("");
if (!checkWelBaseLimit(insertFundInfo.getFundSchemeId(),insertFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "公积金个人:" + errorMsg;
}
if ((!welBaseDiffSign) && (!checkWelBaseLimit(insertFundInfo.getFundSchemeId(),insertFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "公积金公司:" + errorMsg;
}
}
//需要拆分个人和公司福利基数时
@ -3315,12 +3355,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (socialPaymentBaseString != null) {
updateSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString);
}
if (!welBaseDiffSign) {
socialPaymentBaseString = adaptWelBaseLimit(updateSocialInfo.getSocialSchemeId(), updateSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
if (socialPaymentBaseString != null) {
updateSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString);
}
}
} else {
StringBuilder errorMsg = new StringBuilder("");
if (!checkWelBaseLimit(updateSocialInfo.getSocialSchemeId(),updateSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "社保个人:" + errorMsg;
}
if ((!welBaseDiffSign) && (!checkWelBaseLimit(updateSocialInfo.getSocialSchemeId(),updateSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "社保公司:" + errorMsg;
}
}
//需要拆分个人和公司福利基数时
@ -3390,12 +3440,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (socialPaymentBaseString != null) {
insertSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString);
}
if (!welBaseDiffSign) {
socialPaymentBaseString = adaptWelBaseLimit(insertSocialInfo.getSocialSchemeId(), insertSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
if (socialPaymentBaseString != null) {
insertSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString);
}
}
} else {
StringBuilder errorMsg = new StringBuilder("");
if (!checkWelBaseLimit(insertSocialInfo.getSocialSchemeId(),insertSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "社保个人:" + errorMsg;
}
if ((!welBaseDiffSign) && (!checkWelBaseLimit(insertSocialInfo.getSocialSchemeId(),insertSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"));
combineErrorMsg = "社保公司:" + errorMsg;
}
}
//需要拆分个人和公司福利基数时
if (welBaseDiffSign) {

View File

@ -1432,6 +1432,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
Boolean otherCheckBase = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg);
Boolean socialCheckBase2 = true;
Boolean fundCheckBase2 = true;
Boolean otherCheckBase2 = true;
if (!welBaseDiffSign) {
socialCheckBase2 = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg);
fundCheckBase2 = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg);
otherCheckBase2 = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg);
}
Boolean socialCheckComBase = true;
Boolean fundCheckComBase = true;
Boolean otherCheckComBase = true;
@ -1440,17 +1448,17 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
fundCheckComBase = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg);
otherCheckComBase = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg);
}
if (socialCheckBase && fundCheckBase && otherCheckBase && socialCheckComBase && fundCheckComBase && otherCheckComBase) {
if (socialCheckBase && fundCheckBase && otherCheckBase && socialCheckBase2 && fundCheckBase2 && otherCheckBase2 && socialCheckComBase && fundCheckComBase && otherCheckComBase) {
insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO);
} else {
String checkMessage = "该条数据中";
if (!socialCheckBase || !socialCheckComBase) {
if (!socialCheckBase || !socialCheckBase2 || !socialCheckComBase) {
checkMessage = checkMessage + "社保福利基数、";
}
if (!fundCheckBase || !fundCheckComBase) {
if (!fundCheckBase || !fundCheckBase2 || !fundCheckComBase) {
checkMessage = checkMessage + "公积金福利基数、";
}
if (!otherCheckBase || !otherCheckComBase) {
if (!otherCheckBase || !otherCheckBase2 || !otherCheckComBase) {
checkMessage = checkMessage + "其他福利基数、";
}
checkMessage = checkMessage.substring(0, checkMessage.length() - 1);
@ -1470,6 +1478,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(newSocialPaymentBaseString);
insuranceArchivesFundSchemePO.setFundPaymentBaseString(newFundPaymentBaseString);
insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(newOtherPaymentBaseString);
if (!welBaseDiffSign) {
newSocialPaymentBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
newFundPaymentBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
newOtherPaymentBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());
insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(newSocialPaymentBaseString);
insuranceArchivesFundSchemePO.setFundPaymentBaseString(newFundPaymentBaseString);
insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(newOtherPaymentBaseString);
}
if (welBaseDiffSign) {
String newSocialPaymentComBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue());

View File

@ -405,11 +405,13 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (openSum != null && StringUtils.isNotBlank(openSum.getConfValue()) && OpenEnum.parseByValue(openSum.getConfValue()) == OpenEnum.OPEN) {
total = true;
Map<String, Object> sumRow = getSalaryAcctResultService(user).sumRow(queryParam);
sumRow.forEach((k, v) -> {
if (NumberUtils.isCreatable(v.toString())) {
sumRow.put(k, new BigDecimal(v.toString()));
}
});
if (sumRow != null) {
sumRow.forEach((k, v) -> {
if (NumberUtils.isCreatable(v.toString())) {
sumRow.put(k, new BigDecimal(v.toString()));
}
});
}
if (sumRow != null) {
sumRow.put("taxAgentName", "总计");
resultMapList.add(sumRow);

View File

@ -10,6 +10,7 @@ import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.entity.salaryBill.po.SalarySendPO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctBatParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
@ -36,6 +37,7 @@ import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.engine.salary.wrapper.SalaryAcctResultWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -116,6 +118,9 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryAcctResultWrapper getSalaryAcctResultWrapper(User user) {
return ServiceUtil.getService(SalaryAcctResultWrapper.class, user);
}
@Override
public SalaryAcctRecordPO getById(Long id) {
@ -506,6 +511,21 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
});
}
public void updateRunStatusByIds(Collection<Long> ids, String runStatus) {
// 查询薪资核算记录
List<SalaryAcctRecordPO> salaryAcctRecordPOS = listByIds(ids);
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 更新薪资核算记录的状态
Date now = new Date();
salaryAcctRecordPOS.forEach(salaryAcctRecordPO -> {
salaryAcctRecordPO.setRunStatus(runStatus);
salaryAcctRecordPO.setUpdateTime(now);
getSalaryAcctRecordMapper().updateIgnoreNull(salaryAcctRecordPO);
});
}
@Override
public void deleteByIds(Collection<Long> ids) {
// 查询薪资核算记录
@ -879,7 +899,20 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
List<Long> salaryAcctRecordIds = param.getSalaryAcctRecordIds();
for (int i = 0; i < salaryAcctRecordIds.size(); i++) {
Long recordId = salaryAcctRecordIds.get(i);
reCalculate(recordId);
SalaryAcctRecordPO salaryAcctRecordPO = getById(recordId);
if (salaryAcctRecordPO != null && salaryAcctRecordPO.getStatus().equals(SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())) {
// 未归档直接重新核算
} else {
reCalculate(recordId);
}
}
// 更新核算状态
updateRunStatusByIds(salaryAcctRecordIds, "核算中");
// 重新核算
salaryAcctRecordIds.forEach(salaryAcctRecordId -> {
getSalaryAcctResultWrapper(user).calculate4Sync(SalaryAcctCalculateParam.builder().salaryAcctRecordId(salaryAcctRecordId).build());
});
}
}

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);