Merge branch 'release/2.19.1.2501.01' into feature/重置排序

This commit is contained in:
钱涛 2025-03-27 16:36:31 +08:00
commit 5ce2834772
23 changed files with 247 additions and 95 deletions

View File

@ -96,15 +96,18 @@ public class CheckStopSalaryAction implements Action {
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentName + "个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
if( importDataMap.get("最后发薪日期") == null || StringUtils.isBlank(importDataMap.get("最后发薪日期").toString())){
requestInfo.getRequestManager().setMessage("缺少最后发薪日期字段!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), "缺少最后发薪日期字段!");
return FAILURE_AND_CONTINUE;
}else if(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()) == null){
requestInfo.getRequestManager().setMessage("最后发薪日期格式错误格式为yyyy-MM-dd");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), "最后发薪日期格式错误格式为yyyy-MM-dd" + importDataMap.get("最后发薪日期").toString());
return FAILURE_AND_CONTINUE;
}
@ -115,15 +118,17 @@ public class CheckStopSalaryAction implements Action {
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).deleteType(NumberUtils.INTEGER_ZERO).build());
if(CollectionUtils.isEmpty(salaryArchiveList)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
if(salaryArchiveList.size() > 1){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("停薪校验异常", e);
log.error("停薪检查异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}

View File

@ -107,15 +107,18 @@ public class StopSalaryAction implements Action {
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentName + "个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
if( importDataMap.get("最后发薪日期") == null || StringUtils.isBlank(importDataMap.get("最后发薪日期").toString())){
requestInfo.getRequestManager().setMessage("缺少最后发薪日期字段!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), "缺少最后发薪日期字段!");
return FAILURE_AND_CONTINUE;
}else if(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()) == null){
requestInfo.getRequestManager().setMessage("最后发薪日期格式错误格式为yyyy-MM-dd");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), "最后发薪日期格式错误格式为yyyy-MM-dd" + importDataMap.get("最后发薪日期").toString());
return FAILURE_AND_CONTINUE;
}
@ -123,10 +126,12 @@ public class StopSalaryAction implements Action {
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).deleteType(NumberUtils.INTEGER_ZERO).build());
if(CollectionUtils.isEmpty(salaryArchiveList)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
if(salaryArchiveList.size() > 1){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
// 设置最后发薪日期

View File

@ -439,11 +439,11 @@ public class SIAccountBiz extends Service {
public List<Long> listCanPayEmpIds(Long paymentOrganization, String billMonth) {
List<Long> listCanPayEmpIds = new ArrayList<>();
//社保档案中可进行缴纳的人员
List<Long> socialCanPayEmpIds = getSocialSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
List<Long> socialCanPayEmpIds = getSocialSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth, 0);
//公积金档案中可进行缴纳的人员
List<Long> fundCanPayEmpIds = getFundSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
List<Long> fundCanPayEmpIds = getFundSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth, 0);
//其他福利档案中可进行缴纳的人员
List<Long> otherCanPayEmpIds = getOtherSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
List<Long> otherCanPayEmpIds = getOtherSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth, 0);
if (socialCanPayEmpIds != null && socialCanPayEmpIds.size() > 0) {
listCanPayEmpIds.addAll(socialCanPayEmpIds);
}

View File

@ -0,0 +1,57 @@
package com.engine.salary.entity.extemp.dto;
import com.engine.hrmelog.annotation.ElogTransform;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 外部人员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_external_employee
@ElogTransform( name = "非系统人员")
public class ExtEmpDTO {
@ElogTransform(name = "主键id")
private Long id;
/**
* 姓名
*/
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
private String username;
/**
* 部门
*/
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
private String departmentName;
/**
* 分部
*/
@TableTitle(title = "分部", dataIndex = "subcompanyName", key = "subcompanyName")
private String subcompanyName;
/**
* 入职日期
*/
@TableTitle(title = "入职日期", dataIndex = "companystartdate", key = "companystartdate")
private String companystartdate;
/**
* 工号
*/
@TableTitle(title = "工号", dataIndex = "workcode", key = "workcode")
private String workcode;
}

View File

@ -28,6 +28,8 @@ public interface SIAccountDetailTempMapper {
*/
void batchDelByEmpIdsAndMonthAndPayOrg(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
void batchDelByMonthAndPayOrg(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
/**
* 批量保存
* @param accounts

View File

@ -139,6 +139,14 @@
</foreach>
</delete>
<update id="batchDelByMonthAndPayOrg">
UPDATE hrsa_bill_detail_temp
SET delete_type = 1
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND payment_organization = #{paymentOrganization}
</update>
<insert id="batchSaveAccountTempDetails">
INSERT INTO hrsa_bill_detail_temp

View File

@ -67,7 +67,7 @@ public interface FundSchemeMapper {
* @param paymentOrganization
* @return
*/
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth, @Param("nonPayment") Integer nonPayment);
List<InsuranceArchivesFundSchemePO> listAll();

View File

@ -266,6 +266,7 @@
AND fund_scheme_id is not null
AND fund_start_time is not null AND fund_start_time <![CDATA[ <= ]]> #{billMonth}
AND (fund_end_time is null OR fund_end_time <![CDATA[ >= ]]> #{billMonth} OR fund_end_time ='')
AND non_payment = #{nonPayment}
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -66,7 +66,7 @@ public interface OtherSchemeMapper {
* @param paymentOrganization
* @return
*/
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth, @Param("nonPayment") Integer nonPayment);
List<InsuranceArchivesOtherSchemePO> listAll();

View File

@ -249,6 +249,7 @@
AND other_scheme_id is not null
AND other_start_time is not null AND other_start_time <![CDATA[ <= ]]> #{billMonth}
AND (other_end_time is null OR other_end_time <![CDATA[ >= ]]> #{billMonth} OR other_end_time ='')
AND non_payment = #{nonPayment}
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -92,7 +92,7 @@ public interface SocialSchemeMapper {
* @param paymentOrganization
* @return
*/
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth, @Param("nonPayment")Integer nonPayment);
List<InsuranceArchivesSocialSchemePO> listAll();

View File

@ -909,6 +909,7 @@
AND social_scheme_id is not null
AND social_start_time is not null AND social_start_time <![CDATA[ <= ]]> #{billMonth}
AND (social_end_time is null OR social_end_time <![CDATA[ >= ]]> #{billMonth} OR social_end_time ='')
AND non_payment = #{nonPayment}
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -25,6 +25,9 @@ public class SalaryStatisticsEmployeeSalaryQueryParam extends BaseQueryParam {
// 关键字
private String keyword;
//人员ids
private List<Long> employeeIds;
// 起始年月
private String startDateStr;
private Date startDate;

View File

@ -13,6 +13,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
import com.engine.salary.report.common.constant.SalaryConstant;
@ -248,12 +249,23 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listAll();
Map<Long, Integer> salaryAcctRecordMap = SalaryEntityUtil.convert2Map(salaryAcctRecordPOS, SalaryAcctRecordPO::getId, SalaryAcctRecordPO::getAcctTimes);
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
Map<Long, String> itemDataTypeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId, SalaryItemPO::getDataType);
Map<Long, List<SalaryAcctResultPO>> acctResultValueList = SalaryEntityUtil.group2Map(salaryStatisticsEmployeeDetailResult.getSalaryAcctResultValueList(), SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, Map<String, String>> acctResultValueMap = new HashMap<>();
Map<Long, Map<String, Object>> acctResultValueMap = new HashMap<>();
acctResultValueList.forEach((k, v) -> {
Map<String, String> map = new HashMap();
Map<String, Object> map = new HashMap();
v.forEach(l -> {
map.put(l.getSalaryItemId() + "", l.getResultValue());
String dataType = itemDataTypeMap.getOrDefault(l.getSalaryItemId(), "string");
SalaryDataTypeEnum typeEnum = SalaryDataTypeEnum.parseByValue(dataType);
String resultValue = l.getResultValue();
if (typeEnum == SalaryDataTypeEnum.NUMBER && NumberUtil.isNumber(resultValue)) {
map.put(l.getSalaryItemId() + "", Double.valueOf(resultValue));
} else {
map.put(l.getSalaryItemId() + "", resultValue);
}
});
acctResultValueMap.put(k, map);
});
@ -265,7 +277,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
Map<String, Object> map;
for (SalaryAcctEmployeePO se : salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList()) {
map = Maps.newHashMap();
Map<String, String> resultValueMap = Optional.ofNullable(acctResultValueMap.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> resultValueMap = Optional.ofNullable(acctResultValueMap.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> finalMap = map;
resultValueMap.forEach((k, v) -> {
finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v);
@ -332,6 +344,13 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<Long> employeeIds = employeeList.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmp -> employeeIds.contains(acctEmp.getEmployeeId())).collect(Collectors.toList());
}
//人员浏览按钮筛选
List<Long> employeeIds = queryParam.getEmployeeIds();
if(CollectionUtils.isNotEmpty(employeeIds)){
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmp -> employeeIds.contains(acctEmp.getEmployeeId())).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(salaryAcctEmployeeList)) {
return new PageInfo<>();
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -17,7 +18,7 @@ public interface ExtEmpService {
List<ExtEmpPO> list(ExtEmpQueryParam param);
PageInfo<ExtEmpPO> listPage (ExtEmpQueryParam param);
PageInfo<ExtEmpDTO> listPage (ExtEmpQueryParam param);
void save(ExtEmpSaveParam po);

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -78,9 +79,21 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
}
@Override
public PageInfo<ExtEmpPO> listPage(ExtEmpQueryParam param) {
public PageInfo<ExtEmpDTO> listPage(ExtEmpQueryParam param) {
List<ExtEmpPO> extEmpPOS = list(param);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), extEmpPOS, ExtEmpPO.class);
List<ExtEmpDTO> list = extEmpPOS.stream().map(po -> {
return ExtEmpDTO.builder()
.id(po.getId())
.username(po.getUsername())
.departmentName(po.getDepartmentName())
.subcompanyName(po.getSubcompanyName())
.companystartdate(po.getCompanystartdate())
.workcode(po.getWorkcode())
.build();
}).collect(Collectors.toList());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), list, ExtEmpDTO.class);
}

View File

@ -5073,7 +5073,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
// Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization);
List<InsuranceAccountDetailPO> historyDetailData = new ArrayList<>();
List<DataCollectionEmployee> employeeList = new ArrayList<>();
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(ids);
if (!isFirstFlag) {
// 不是首次核算需要把社保历史数据取出
List<List<Long>> partition = Lists.partition(ids, 100);
@ -5081,8 +5081,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
historyDetailData.addAll(getInsuranceAccountDetailMapper().list(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).build()));
historyDetailData.addAll(getInsuranceAccountDetailMapper().extList(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).build()));
});
} else {
employeeList = getSalaryEmployeeService(user).listByIds(ids);
}
Map<Long, InsuranceAccountDetailPO> historyDetailDataMap = SalaryEntityUtil.convert2Map(historyDetailData, InsuranceAccountDetailPO::getEmployeeId);
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
@ -5104,7 +5102,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
if (isFirstFlag) {
InsuranceAccountDetailPO historyDetail = historyDetailDataMap.get(k);
if (isFirstFlag || historyDetail == null) {
// 初次核算
DataCollectionEmployee employee = employeeMap.get(k);
if (employee != null) {
@ -5119,18 +5119,15 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
insuranceAccountDetailPO.setStatus(employee.getStatus());
}
} else {
InsuranceAccountDetailPO historyDetail = historyDetailDataMap.get(k);
if (historyDetail != null) {
insuranceAccountDetailPO.setSubcompanyName(historyDetail.getSubcompanyName());
insuranceAccountDetailPO.setSubcompanyId(historyDetail.getSubcompanyId());
insuranceAccountDetailPO.setDepartmentName(historyDetail.getDepartmentName());
insuranceAccountDetailPO.setDepartmentId(historyDetail.getDepartmentId());
insuranceAccountDetailPO.setJobtitleName(historyDetail.getJobtitleName());
insuranceAccountDetailPO.setJobtitleId(historyDetail.getJobtitleId());
insuranceAccountDetailPO.setJobcall(historyDetail.getJobcall());
insuranceAccountDetailPO.setJobcallId(historyDetail.getJobcallId());
insuranceAccountDetailPO.setStatus(historyDetail.getStatus());
}
insuranceAccountDetailPO.setSubcompanyName(historyDetail.getSubcompanyName());
insuranceAccountDetailPO.setSubcompanyId(historyDetail.getSubcompanyId());
insuranceAccountDetailPO.setDepartmentName(historyDetail.getDepartmentName());
insuranceAccountDetailPO.setDepartmentId(historyDetail.getDepartmentId());
insuranceAccountDetailPO.setJobtitleName(historyDetail.getJobtitleName());
insuranceAccountDetailPO.setJobtitleId(historyDetail.getJobtitleId());
insuranceAccountDetailPO.setJobcall(historyDetail.getJobcall());
insuranceAccountDetailPO.setJobcallId(historyDetail.getJobcallId());
insuranceAccountDetailPO.setStatus(historyDetail.getStatus());
}
//核算社保
@ -5160,10 +5157,12 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
//临时表入库前先对可能存在的历史数据进行删除
List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
partition.forEach(part -> {
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
});
// List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
// partition.forEach(part -> {
// getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
// });
// 根据人员id删会少删不再参与社保核算的人
getSIAccountDetailTempMapper().batchDelByMonthAndPayOrg(billMonth, paymentOrganization);
//临时表数据入库
if (CollectionUtils.isNotEmpty(list)) {
encryptUtil.encryptList(list, InsuranceAccountDetailTempPO.class);
@ -5714,12 +5713,12 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
*/
public List<Long> listCanPayEmpIds(Long paymentOrganization, String billMonth) {
List<Long> listCanPayEmpIds = new ArrayList<>();
//社保档案中可进行缴纳的人员
List<Long> socialCanPayEmpIds = getSocialSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
//公积金档案中可进行缴纳的人员
List<Long> fundCanPayEmpIds = getFundSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
//其他福利档案中可进行缴纳的人员
List<Long> otherCanPayEmpIds = getOtherSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
//社保档案中可进行缴纳的人员 未勾选暂不缴纳
List<Long> socialCanPayEmpIds = getSocialSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth, 0);
//公积金档案中可进行缴纳的人员未勾选暂不缴纳
List<Long> fundCanPayEmpIds = getFundSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth, 0);
//其他福利档案中可进行缴纳的人员未勾选暂不缴纳
List<Long> otherCanPayEmpIds = getOtherSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth, 0);
if (socialCanPayEmpIds != null && socialCanPayEmpIds.size() > 0) {
listCanPayEmpIds.addAll(socialCanPayEmpIds);
}
@ -5747,16 +5746,23 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
log.info("核算明细临时表 hrsa_bill_detail_temp待处理数量{}", list.size());
List<List<Long>> partitionIds = Lists.partition((List<Long>) ids, 100);
log.info("bill_detail入库前删除数据数量{}", ids.size());
for (List<Long> part : partitionIds) {
getInsuranceAccountDetailMapper().batchDelAccountDetails(part, billMonth, param.getPaymentOrganization(), paymentStatus);
getInsuranceAccountDetailMapper().batchDelAccountDetails(Collections.emptyList(), billMonth, param.getPaymentOrganization(), paymentStatus);
//删除账单月份+个税扣缴义务人+人员id下的调差数据
getInsuranceCompensationMapper().deleteByBillMonthPayOrgEmpIds(InsuranceCompensationPO.builder()
.billMonth(billMonth)
.paymentOrganization(param.getPaymentOrganization())
.employeeIds(part)
.build());
}
//删除账单月份+个税扣缴义务人+人员id下的调差数据
getInsuranceCompensationMapper().deleteByBillMonthPayOrgEmpIds(InsuranceCompensationPO.builder()
.billMonth(billMonth)
.paymentOrganization(param.getPaymentOrganization())
.build());
// for (List<Long> part : partitionIds) {
// getInsuranceAccountDetailMapper().batchDelAccountDetails(part, billMonth, param.getPaymentOrganization(), paymentStatus);
//
// //删除账单月份+个税扣缴义务人+人员id下的调差数据
// getInsuranceCompensationMapper().deleteByBillMonthPayOrgEmpIds(InsuranceCompensationPO.builder()
// .billMonth(billMonth)
// .paymentOrganization(param.getPaymentOrganization())
// .employeeIds(part)
// .build());
// }
//生成bill_detail入库数据
List<InsuranceAccountDetailPO> collect = list.stream().map(item -> {

View File

@ -77,6 +77,8 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.stream.Collectors;
import static com.engine.salary.sys.constant.SalarySysConstant.SALARY_ACCT_SYNC_TYPE;
/**
* 薪资核算结果
* <p>Copyright: Copyright (c) 2022</p>
@ -194,6 +196,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
private VariableItemService getVariableItemService(User user) {
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
}
private SalaryApprovalRuleService getSalaryApprovalRuleService(User user) {
return ServiceUtil.getService(SalaryApprovalRuleServiceImpl.class, user);
}
@ -876,6 +879,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 12.4是否采用系统算税
TaxDeclarationFunctionEnum taxDeclarationFunction = getSalarySysConfService(user).getTaxDeclaration();
// 12.5多线程运算运算结果存放在临时表中
//是否同步计算
boolean isSync = "0".equals(getSalarySysConfService(user).getValueByCode(SALARY_ACCT_SYNC_TYPE));
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
.setSalaryAcctRecordPO(salaryAcctRecordPO)
@ -897,13 +902,17 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
.setVariableItems(variableItemPOS)
.setTaxDeclarationFunction(taxDeclarationFunction);
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculate", localRunnable);
if (isSync) {
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
} else {
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculate", localRunnable);
}
}
// 13等待所有子线程执行完毕
childMonitor.await();
@ -932,7 +941,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), true);
//更新薪资核算记录最后操作日期
getSalaryAcctRecordService(user).updateDate(salaryAcctRecordPO.getId(),new Date());
getSalaryAcctRecordService(user).updateDate(salaryAcctRecordPO.getId(), new Date());
stopWatch.stop();
log.info(stopWatch.prettyPrint());
@ -940,6 +949,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 记录日志
// 查询操作日志的targetName
String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(calculateParam.getSalaryAcctRecordId());
Collection<Long> ids = calculateParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {
targetName += ids;
}
LoggerContext<SalaryCheckResultPO> loggerContext = new LoggerContext<>();
loggerContext.setUser(user);
loggerContext.setTargetId(String.valueOf(calculateParam.getSalaryAcctRecordId()));

View File

@ -71,6 +71,11 @@ public class SalarySysConstant {
*/
public static final String SALARY_ACCT_EMPLOYEE_RULE = "salaryAcctEmployeeRule";
/**
* 是否采用线程池同步异步/1异步 0同步
*/
public static final String SALARY_ACCT_SYNC_TYPE = "SALARY_ACCT_SYNC_TYPE";
/**
* 工资单二次验证方式
*/

View File

@ -42,6 +42,11 @@ import java.util.stream.Collectors;
@Slf4j
public class AutoSyncEmpArchiveStartDateJob extends BaseCronJob {
private String syncInsuranceArchive;
private String syncSalaryArchive;
private String allStayAddToPay;
private String allGotoFixed;
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
@ -55,12 +60,6 @@ public class AutoSyncEmpArchiveStartDateJob extends BaseCronJob {
return ServiceUtil.getService(SIArchivesServiceImpl.class, user);
}
private String syncInsuranceArchive;
private String syncSalaryArchive;
private String allStayAddToPay;
private String allGotoFixed;
private SalaryArchiveBiz getSalaryArchiveMapper = new SalaryArchiveBiz();
private SocialSchemeMapper getSocialSchemeMapper() {

View File

@ -31,6 +31,13 @@ import java.util.*;
*/
public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
private String syncInsuranceArchive;
private String syncSalaryArchive;
private String allStayAddToPay;
private String allGotoFixed;
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class,user);
}
@ -73,39 +80,43 @@ public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
}
cal.add(Calendar.MONTH, preMonthValue);
Map<Long, String> resignationMap = getSalaryEmployeeService(user).getResignationMapByDate(SalaryDateUtil.getFormatDate(cal.getTime()));
// 获取离职人员中没有设置最后发薪日期的薪资档案
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listPayEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
Date now = new Date();
List<SalaryArchivePO> needUpdateSalaryArchiveList = new ArrayList<>();
for(SalaryArchivePO archive : salaryArchivePOS){
String dismissDate = resignationMap.get(archive.getEmployeeId());
if (StringUtils.isNotBlank(dismissDate)) {
archive.setPayEndDate(SalaryDateUtil.dateStrToLocalDate(dismissDate));
archive.setUpdateTime(now);
needUpdateSalaryArchiveList.add(archive);
if (StringUtils.isBlank(syncSalaryArchive) || !StringUtils.equals(syncSalaryArchive, "false")) {
// 获取离职人员中没有设置最后发薪日期的薪资档案
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listPayEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
Date now = new Date();
List<SalaryArchivePO> needUpdateSalaryArchiveList = new ArrayList<>();
for(SalaryArchivePO archive : salaryArchivePOS){
String dismissDate = resignationMap.get(archive.getEmployeeId());
if (StringUtils.isNotBlank(dismissDate)) {
archive.setPayEndDate(SalaryDateUtil.dateStrToLocalDate(dismissDate));
archive.setUpdateTime(now);
needUpdateSalaryArchiveList.add(archive);
}
}
if (CollectionUtils.isNotEmpty(needUpdateSalaryArchiveList)) {
getSalaryArchiveMapper.batchUpdate(needUpdateSalaryArchiveList);
}
}
if (CollectionUtils.isNotEmpty(needUpdateSalaryArchiveList)) {
getSalaryArchiveMapper.batchUpdate(needUpdateSalaryArchiveList);
}
// 获取离职人员中没有设置最后缴纳月的社保福利档案
if (StringUtils.isBlank(syncInsuranceArchive) || !StringUtils.equals(syncInsuranceArchive, "false")) {
// 获取离职人员中没有设置最后缴纳月的社保福利档案
// List<InsuranceArchivesBaseInfoPO> needSyncList = siArchivesBiz.listEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
List<InsuranceArchivesBaseInfoPO> needSyncList = getSIArchivesService(user).listEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
// 设置社保公积金最后缴纳月
for(InsuranceArchivesBaseInfoPO po : needSyncList){
String dismissDate = resignationMap.get(po.getEmployeeId());
if (StringUtils.isNotEmpty(dismissDate)) {
dismissDate = StringUtils.substring(dismissDate,0,7);
// 更新社保最后缴纳月
Long socialArchivesId = po.getSocialArchivesId();
getSocialSchemeMapper().updateEndTime(socialArchivesId, dismissDate);
// 更新公积金最后缴纳月
Long fundArchivesId = po.getFundArchivesId();
getFundSchemeMapper().updateEndTime(fundArchivesId, dismissDate);
// 更新企业年金及其他福利最后缴纳月
Long otherArchivesId = po.getOtherArchivesId();
getOtherSchemeMapper().updateEndTime(otherArchivesId, dismissDate);
List<InsuranceArchivesBaseInfoPO> needSyncList = getSIArchivesService(user).listEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
// 设置社保公积金最后缴纳月
for(InsuranceArchivesBaseInfoPO po : needSyncList){
String dismissDate = resignationMap.get(po.getEmployeeId());
if (StringUtils.isNotEmpty(dismissDate)) {
dismissDate = StringUtils.substring(dismissDate,0,7);
// 更新社保最后缴纳月
Long socialArchivesId = po.getSocialArchivesId();
getSocialSchemeMapper().updateEndTime(socialArchivesId, dismissDate);
// 更新公积金最后缴纳月
Long fundArchivesId = po.getFundArchivesId();
getFundSchemeMapper().updateEndTime(fundArchivesId, dismissDate);
// 更新企业年金及其他福利最后缴纳月
Long otherArchivesId = po.getOtherArchivesId();
getOtherSchemeMapper().updateEndTime(otherArchivesId, dismissDate);
}
}
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -48,7 +49,7 @@ public class ExtEmpController {
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ExtEmpQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<ExtEmpQueryParam, PageInfo<ExtEmpPO>>(user).run(getExtEmpWrapper(user)::listPage, param);
return new ResponseResult<ExtEmpQueryParam, PageInfo<ExtEmpDTO>>(user).run(getExtEmpWrapper(user)::listPage, param);
}
@POST

View File

@ -2,6 +2,7 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -30,7 +31,7 @@ public class ExtEmpWrapper extends Service {
}
public PageInfo<ExtEmpPO> listPage(ExtEmpQueryParam param) {
public PageInfo<ExtEmpDTO> listPage(ExtEmpQueryParam param) {
return getExtEmpService(user).listPage(param);
}