Merge branch 'feature/231202_核算记录归档action' into custom/上海港湾

# Conflicts:
#	src/com/engine/salary/entity/salaryacct/bo/SalaryAcctRecordBO.java
#	src/com/engine/salary/wrapper/SalaryAcctRecordWrapper.java
This commit is contained in:
Harryxzy 2023-12-13 10:26:59 +08:00
commit 10d60295bb
47 changed files with 1681 additions and 314 deletions

View File

@ -2,9 +2,9 @@ Delete from LeftMenuInfo where id=100186;
/
Delete from LeftMenuConfig where infoid=100186;
/
call LMConfig_U_ByInfoInsert (2,100118,9);
select LMConfig_U_ByInfoInsert (2,100118,9);
/
call LMInfo_Insert (100186,541290,'','',2,100118,9,18);
select LMInfo_Insert (100186,541290,'','',2,100118,9,18);
/
update LeftMenuInfo set mobxrouteurl = '',iconClassName = '',fullrouteurl='/spa/hrmSalary/static/index.html#/main/hrmSalary/externalPersonManage' where id = 100186;
/

View File

@ -1,17 +1,14 @@
select @current_date:= date_format( now(),'%Y-%m-%d');
select @current_time:= date_format( now(),'%T');
INSERT INTO datashowset(SHOWNAME, SHOWCLASS, DATAFROM, DATASOURCEID, SQLTEXT, WSURL, WSOPERATION, XMLTEXT, INPARA,SHOWTYPE, KEYFIELD, PARENTFIELD, SHOWFIELD, DETAILPAGEURL, TYPENAME, SELECTTYPE, SHOWPAGEURL,BROWSERFROM, NAME, CUSTOMID, CUSTOMHREF, SQLTEXT1, SQLTEXT2, NAMEHEADER, DESCRIPTIONHEADER,WSWORKNAME, SEARCHBYID, CREATEDATE, CREATETIME, MODIFYDATE, MODIFYTIME, SEARCHBYNAME,onlylowestnode, characterset, uuid, isSupportPaging, ESBID, ESBSHOWID, mobiledetailpageurl,isPhyPage, subcompanyid, unconditionalQuery) VALUES ('salaryExtEmp', '1', '1', '', 'SELECT * FROM hrsa_external_employee where delete_type=0', '', '', '', '', '1','id', '', '', '', '', '', '', 2, '薪酬非系统人员', NULL, '', NULL, NULL, NULL, NULL, '', '', @current_date,@current_time, NULL, NULL, '', '', '0', uuid(), '', '', '', '', '1', 0, 1);
INSERT INTO datashowset(SHOWNAME, SHOWCLASS, DATAFROM, DATASOURCEID, SQLTEXT, WSURL, WSOPERATION, XMLTEXT, INPARA,SHOWTYPE, KEYFIELD, PARENTFIELD, SHOWFIELD, DETAILPAGEURL, TYPENAME, SELECTTYPE, SHOWPAGEURL,BROWSERFROM, NAME, CUSTOMID, CUSTOMHREF, SQLTEXT1, SQLTEXT2, NAMEHEADER, DESCRIPTIONHEADER,WSWORKNAME, SEARCHBYID, CREATEDATE, CREATETIME, MODIFYDATE, MODIFYTIME, SEARCHBYNAME,onlylowestnode, characterset, uuid, isSupportPaging, ESBID, ESBSHOWID, mobiledetailpageurl,isPhyPage, subcompanyid, unconditionalQuery) VALUES ('salaryExtEmp', '1', '1', '', 'SELECT * FROM hrsa_external_employee where delete_type=0', '', '', '', '', '1','id', '', '', '', '', '', '', 2, '薪酬非系统人员', NULL, '', NULL, NULL, NULL, NULL, '', '', '2020-01-01', '19:12:12', NULL, NULL, '', '', '0', uuid(), '', '', '', '', '1', 0, 1);
select @datashowset_id:= max(id)from datashowset;
INSERT INTO datashowcacheset(showname, subcompanyid, isopencache, Createdate, createtime, Updatedate, Updatetime)
VALUES ('salaryExtEmp', '0', 0, @current_date, @current_time, NULL, NULL);
VALUES ('salaryExtEmp', '0', 0, '2020-01-01', '19:12:12', NULL, NULL);
INSERT INTO datashowparam(MAINID, FIELDNAME, SEARCHNAME, TRANSQL, ISSHOWNAME, dsporder, uuid, width)
VALUES (@datashowset_id, '姓名', 'username', '', 1, 1, uuid(), NULL);
VALUES ((select max(id) from datashowparam), '姓名', 'username', '', 1, 1, uuid(), NULL);
INSERT INTO datashowparam(MAINID, FIELDNAME, SEARCHNAME, TRANSQL, ISSHOWNAME, dsporder, uuid, width)
VALUES (@datashowset_id, '手机号', 'mobile', '', 0, 2, uuid(), NULL);
VALUES ((select max(id) from datashowparam), '手机号', 'mobile', '', 0, 2, uuid(), NULL);
INSERT INTO datasearchparam(MAINID, FIELDNAME, SEARCHNAME, FIELDTYPE, WOKFLOWFIELDNAME, dsporder, uuid, isshowfield)
VALUES (@datashowset_id, '姓名', 'username', '2', '', 1, uuid(), '');
VALUES ((select max(id) from datasearchparam), '姓名', 'username', '2', '', 1, uuid(), '');
INSERT INTO datasearchparam(MAINID, FIELDNAME, SEARCHNAME, FIELDTYPE, WOKFLOWFIELDNAME, dsporder, uuid, isshowfield)
VALUES (@datashowset_id, '手机号', 'mobile', '2', '', 2, uuid(), '');
VALUES ((select max(id) from datasearchparam), '手机号', 'mobile', '2', '', 2, uuid(), '');

View File

@ -0,0 +1,70 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.impl.SalaryAcctRecordServiceImpl;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Harryxzy
* @ClassName FileSalaryAcctRecordAction
* @date 2023/12/13 9:17
* @description 薪资核算记录归档action
*/
@Slf4j
public class FileSalaryAcctRecordAction implements Action {
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String recordIdFieldName;
public String getRecordIdFieldName() {
return recordIdFieldName;
}
public void setRecordIdFieldName(String recordIdFieldName) {
this.recordIdFieldName = recordIdFieldName;
}
@Override
public String execute(RequestInfo requestInfo) {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String salaryAcctRecordId = fieldMap.get(recordIdFieldName);
if (StringUtils.isBlank(salaryAcctRecordId)) {
requestInfo.getRequestManager().setMessage("薪资核算记录不存在");
return FAILURE_AND_CONTINUE;
}
User user = new User();
user.setUid(1);
try {
getSalaryAcctRecordService(user).file(Long.valueOf(salaryAcctRecordId));
} catch (Exception e) {
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -22,7 +22,10 @@ import com.engine.salary.enums.siaccount.*;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siaccount.*;
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
@ -108,6 +111,18 @@ public class SIAccountBiz extends Service {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SocialSchemeMapper getSocialSchemeMapper() {
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
}
private FundSchemeMapper getFundSchemeMapper() {
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
}
private OtherSchemeMapper getOtherSchemeMapper() {
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
}
private SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
@ -260,7 +275,7 @@ public class SIAccountBiz extends Service {
public void accounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
//薪资核算进度暂未实现
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth());
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.isStatus() && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
return;
}
@ -309,7 +324,9 @@ public class SIAccountBiz extends Service {
.map(InsuranceArchivesBaseInfoPO::getEmployeeId)
.collect(Collectors.toList());
empIds = empIds.stream().filter(f->canAccountIds.contains(f)).collect(Collectors.toList());
//20231122逻辑优化过滤出不在起始缴纳月和最后缴纳月区间的人员
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(param.getPaymentOrganization(), param.getBillMonth());
empIds = empIds.stream().filter(f->canAccountIds.contains(f) && empIdsInPayMonthRange.contains(f)).collect(Collectors.toList());
//过滤不在扣缴义务人下的数据
// Collection<Long> employeeIdsInTaxAgent = getTaxAgentService().listEmployeeIdsInTaxAgent(param.getPaymentOrganization());
@ -399,8 +416,9 @@ public class SIAccountBiz extends Service {
log.info("福利核算进度完成!");
} catch (Exception e) {
log.error("account run fail", e);
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel(99642, "福利核算出错") + ": " + e.getMessage());
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());
@ -410,10 +428,36 @@ public class SIAccountBiz extends Service {
//薪资核算进度暂未实现
//salaryAcctProgressService.del(tenantKey + param.getBillMonth(), employeeId, tenantKey);
//logger.error("welfare account error:{}", e.getMessage(), e);
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel(99642, "福利核算出错") + ": " + e.getMessage());
}
}
/**
* 根据个税扣缴义务人和账单月获取三类福利档案中符合缴纳开始结束月区间的人员id
* @param paymentOrganization
* @param billMonth
* @return
*/
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);
if (socialCanPayEmpIds != null && socialCanPayEmpIds.size() > 0) {
listCanPayEmpIds.addAll(socialCanPayEmpIds);
}
if (fundCanPayEmpIds != null && fundCanPayEmpIds.size() > 0) {
listCanPayEmpIds.addAll(fundCanPayEmpIds);
}
if (otherCanPayEmpIds != null && otherCanPayEmpIds.size() > 0) {
listCanPayEmpIds.addAll(otherCanPayEmpIds);
}
//去重
listCanPayEmpIds = listCanPayEmpIds.stream().distinct().collect(Collectors.toList());
return listCanPayEmpIds;
}
public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque<Boolean> results,*/ String billMonth, List<Long> ids, Long employeeId, String tenantKey, Long paymentOrganization) {
/* try {*/
@ -1308,6 +1352,9 @@ public class SIAccountBiz extends Service {
if (filterList.size() != employeeIds.size()) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补缴人员中存在未设置福利档案人员或相关人员不在福利在缴人员中,不可新建补缴信息!"));
}
//20231122逻辑优化过滤出不在起始缴纳月和最后缴纳月区间的人员
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(param.getPaymentOrganization(), param.getBillMonth());
employeeIds = employeeIds.stream().filter(f -> empIdsInPayMonthRange.contains(f)).collect(Collectors.toList());
SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel(99920, "无核算人员"));
List<SupplementAccountBaseParam> baseList = new ArrayList<>();

View File

@ -1496,7 +1496,14 @@ public class SIArchivesBiz {
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialJson != null) {
map.putAll(socialJson);
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(socialItem.getSocialSchemeId());
socialJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
// map.putAll(socialJson);
}
map.put("socialAccount", socialItem.getSocialAccount());
map.put("socialStartTime", socialItem.getSocialStartTime());
@ -1508,7 +1515,14 @@ public class SIArchivesBiz {
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundJson != null) {
map.putAll(fundJson);
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(fundItem.getFundSchemeId());
fundJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
// map.putAll(fundJson);
}
map.put("supplementFundAccount", fundItem.getSupplementFundAccount());
map.put("fundStartTime", fundItem.getFundStartTime());
@ -1520,7 +1534,14 @@ public class SIArchivesBiz {
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (otherJson != null) {
map.putAll(otherJson);
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(otherItem.getOtherSchemeId());
otherJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
// map.putAll(otherJson);
}
map.put("otherStartTime", otherItem.getOtherStartTime());
map.put("otherEndTime", otherItem.getOtherEndTime());
@ -1534,6 +1555,16 @@ public class SIArchivesBiz {
}
}
public List<Long> payInsuranceIds(Long socialSchemeId) {
//查询该福利方案下开启缴纳的福利项
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialSchemeId);
List<Long> insuranceIdList = new ArrayList<>();
if (detailPOS != null && detailPOS.size() > 0) {
//开启缴纳的
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
}
return insuranceIdList;
}
/**
* 获取信息提示
*/

View File

@ -11,6 +11,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.ApprovalWorkflowStatusEnum;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
@ -46,8 +47,7 @@ public class SalaryAcctRecordBO {
List<SalarySobPO> salarySobs,
List<DataCollectionEmployee> employeeComInfos,
List<SalaryAcctEmployeeCountDTO> salaryAcctEmployeeCountDTOS,
List<SalarySendCheckDTO> salarySendCheckResult,
Map<String, String> workflowStatusMap) {
List<SalarySendCheckDTO> salarySendCheckResult) {
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
return Collections.emptyList();
}
@ -55,6 +55,7 @@ public class SalaryAcctRecordBO {
Map<Long, String> usernameMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername);
Map<Long, Long> empSizeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployeeCountDTOS, SalaryAcctEmployeeCountDTO::getSalaryAcctRecordId, SalaryAcctEmployeeCountDTO::getCountBySalaryAcctRecordId);
Map<Long, Boolean> salarySendMap = SalaryEntityUtil.convert2Map(salarySendCheckResult, SalarySendCheckDTO::getSalaryAcctId, SalarySendCheckDTO::isSendFinished);
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName);
return salaryAcctRecordPOS.stream()
.map(salaryAcctRecordPO -> {
// 获取审批流程状态
@ -89,6 +90,7 @@ public class SalaryAcctRecordBO {
return SalaryAcctRecordListDTO.builder()
.id(salaryAcctRecordPO.getId())
.salarySobName(Optional.ofNullable(salarySobPO).map(SalarySobPO::getName).orElse(StringUtils.EMPTY))
.taxAgentName(taxAgentMap.get(Optional.ofNullable(salarySobPO).map(SalarySobPO::getTaxAgentId).orElse(0L)))
.salaryMonth(SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()).toString())
.taxCycle(SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getTaxCycle()).toString())
.status(Optional.ofNullable(salaryAcctRecordStatusEnum)

View File

@ -23,7 +23,7 @@ import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.Column;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
@ -92,30 +92,70 @@ public class SalaryAcctResultBO {
* @param salarySobItemAggregateDTO
* @return
*/
public static List<Column> buildTableColumns4ComparisonResult(SalarySobItemAggregateDTO salarySobItemAggregateDTO, Set<Long> excludeSalaryItemIds) {
List<Column> columns = Lists.newArrayList();
public static List<WeaTableColumnGroup> buildTableColumns4ComparisonResult(SalarySobItemAggregateDTO salarySobItemAggregateDTO, Set<Long> excludeSalaryItemIds) {
List<WeaTableColumnGroup> columns = Lists.newArrayList();
// 员工信息字段
for (SalarySobEmpFieldDTO salarySobEmpFieldDTO : salarySobItemAggregateDTO.getEmpFields()) {
columns.add(new Column(salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId(), salarySobEmpFieldDTO.getFieldId()));
columns.add(new WeaTableColumnGroup("150", salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId(), salarySobEmpFieldDTO.getFieldId()));
}
// 薪资项目分组下的薪资项目
for (SalarySobItemGroupDTO salarySobItemGroupDTO : salarySobItemAggregateDTO.getItemGroups()) {
if (CollectionUtils.isEmpty(salarySobItemGroupDTO.getItems())) {
continue;
}
List<WeaTableColumnGroup> childrenColumns = Lists.newArrayList();
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
if (excludeSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
continue;
}
columns.add(new Column(salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), "" + salarySobItemDTO.getSalaryItemId()));
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), "" + salarySobItemDTO.getSalaryItemId()));
}
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup("150", salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
columns.add(weaTableColumnWapper);
}
// 没有分类的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) {
if (excludeSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
continue;
}
columns.add(new Column(salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), "" + salarySobItemDTO.getSalaryItemId()));
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), "" + salarySobItemDTO.getSalaryItemId()));
}
return columns;
}
/**
* 构建薪资核算结果列表的表头线下对比
*
* @param salarySobItemAggregateDTO
* @return
*/
public static List<WeaTableColumnGroup> buildTableColumns4ComparisonResultByGroup(SalarySobItemAggregateDTO salarySobItemAggregateDTO, Set<Long> excludeSalaryItemIds) {
List<WeaTableColumnGroup> columns = Lists.newArrayList();
// 员工信息字段
for (SalarySobEmpFieldDTO salarySobEmpFieldDTO : salarySobItemAggregateDTO.getEmpFields()) {
columns.add(new WeaTableColumnGroup("150", salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId(), salarySobEmpFieldDTO.getFieldId()));
}
// 薪资项目分组下的薪资项目
for (SalarySobItemGroupDTO salarySobItemGroupDTO : salarySobItemAggregateDTO.getItemGroups()) {
if (CollectionUtils.isEmpty(salarySobItemGroupDTO.getItems())) {
continue;
}
List<WeaTableColumnGroup> childrenColumns = Lists.newArrayList();
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
if (excludeSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
continue;
}
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), "" + salarySobItemDTO.getSalaryItemId()));
}
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup("150", salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
columns.add(weaTableColumnWapper);
}
// 没有分类的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) {
if (excludeSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
continue;
}
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), "" + salarySobItemDTO.getSalaryItemId()));
}
return columns;
}
@ -130,7 +170,7 @@ public class SalaryAcctResultBO {
List<WeaTableColumnGroup> columns = Lists.newArrayList();
// 员工信息字段
for (SalarySobEmpFieldDTO salarySobEmpFieldDTO : salarySobItemAggregateDTO.getEmpFields()) {
columns.add(new WeaTableColumnGroup("150", salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobEmpFieldDTO.getFieldName()), salarySobEmpFieldDTO.getFieldName(), salarySobEmpFieldDTO.getFieldId()));
}
// 薪资项目分组下的薪资项目
for (SalarySobItemGroupDTO salarySobItemGroupDTO : salarySobItemAggregateDTO.getItemGroups()) {
@ -140,29 +180,29 @@ public class SalaryAcctResultBO {
List<WeaTableColumnGroup> childrenColumns = Lists.newArrayList();
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
} else {
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
}
}
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup("150", salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemGroupDTO.getName()), salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
columns.add(weaTableColumnWapper);
}
// 没有分类的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
} else {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
}
}
// 回算的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getBackCalcItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
} else {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
}
}
@ -402,9 +442,9 @@ public class SalaryAcctResultBO {
sortItem(salarySobItemPOMap);
// 根据账套分组封装薪资项目的值
List<SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemByGroupDTO> itemsByGroup = new ArrayList<>();
for(SalarySobItemGroupPO groupPO : salarySobItemGroupPOS){
List<SalarySobItemPO> groupItems = salarySobItemPOMap.getOrDefault(groupPO.getId(),Collections.emptyList());
if(CollectionUtils.isNotEmpty(groupItems)){
for (SalarySobItemGroupPO groupPO : salarySobItemGroupPOS) {
List<SalarySobItemPO> groupItems = salarySobItemPOMap.getOrDefault(groupPO.getId(), Collections.emptyList());
if (CollectionUtils.isNotEmpty(groupItems)) {
List<SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemDTO> items = groupItems.stream()
.map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap))
.collect(Collectors.toList());
@ -412,12 +452,12 @@ public class SalaryAcctResultBO {
.salarySobItemGroupId(groupPO.getId())
.salarySobItemGroupName(groupPO.getName())
.salaryItems(items)
.sortedIndex(groupPO.getSortedIndex()).build() );
.sortedIndex(groupPO.getSortedIndex()).build());
}
}
// 未分类
List<SalarySobItemPO> noGroupItems = salarySobItemPOMap.getOrDefault(0L, Collections.emptyList());
if(CollectionUtils.isNotEmpty(noGroupItems)){
if (CollectionUtils.isNotEmpty(noGroupItems)) {
List<SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemDTO> items = noGroupItems.stream()
.map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap))
.collect(Collectors.toList());
@ -429,7 +469,6 @@ public class SalaryAcctResultBO {
}
// // 公式项的值不根据salaryItemPO的valueType判断是因为薪资项目的valueType属性改变后并不会同步更新薪资账套中的薪资项目的formulaId字段
// List<SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemDTO> formulaItems = salarySobItemPOS.stream()
// .filter(salarySobItemPO -> salarySobItemPO.getFormulaId() > 0)
@ -460,7 +499,7 @@ public class SalaryAcctResultBO {
}
public static List<SalarySobItemGroupPO> sortGroup(List<SalarySobItemGroupPO> salarySobItemGroupPOS) {
if(CollectionUtils.isEmpty(salarySobItemGroupPOS)){
if (CollectionUtils.isEmpty(salarySobItemGroupPOS)) {
return Collections.emptyList();
}
return salarySobItemGroupPOS.stream().sorted(Comparator.comparingInt(SalarySobItemGroupPO::getSortedIndex)).collect(Collectors.toList());
@ -468,10 +507,9 @@ public class SalaryAcctResultBO {
/**
* 薪资账套的薪资项目按照sortedIndex排序
*
*/
public static void sortItem(Map<Long, List<SalarySobItemPO>> salarySobItemPOMap) {
for(Map.Entry<Long, List<SalarySobItemPO>> entry : salarySobItemPOMap.entrySet()){
for (Map.Entry<Long, List<SalarySobItemPO>> entry : salarySobItemPOMap.entrySet()) {
List<SalarySobItemPO> items = entry.getValue();
if (CollectionUtils.isNotEmpty(items)) {
List<SalarySobItemPO> sortedValue = items.stream().sorted(Comparator.comparingInt(SalarySobItemPO::getSortedIndex)).collect(Collectors.toList());
@ -495,9 +533,9 @@ public class SalaryAcctResultBO {
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(Optional.ofNullable(salarySobItemPO).map(SalarySobItemPO::getValueType).orElse(0));
String itemFormulaContent;
if(Objects.equals(salaryValueTypeEnum.getValue(),SalaryValueTypeEnum.FORMULA.getValue())){
if (Objects.equals(salaryValueTypeEnum.getValue(), SalaryValueTypeEnum.FORMULA.getValue())) {
itemFormulaContent = Optional.ofNullable(formulaContentMap.get(salarySobItemPO.getSalaryItemId().toString())).map(SalaryAcctResultListColumnDTO::getFormulaContent).orElse("");
}else{
} else {
itemFormulaContent = salaryValueTypeEnum == null ? "" : salaryValueTypeEnum.getDefaultLabel();
}

View File

@ -36,6 +36,9 @@ public class SalaryAcctRecordListDTO {
//主键id
private Long id;
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
private String taxAgentName;
@TableTitle(title = "薪资账套", dataIndex = "salarySobName", key = "salarySobName")
private String salarySobName;

View File

@ -1,6 +1,6 @@
package com.engine.salary.entity.salaryacct.dto;
import com.engine.salary.util.page.Column;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.util.page.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -25,7 +25,7 @@ import java.util.Map;
public class SalaryComparisonResultListDTO {
//列表的表头
private List<Column> weaTableColumns;
private List<WeaTableColumnGroup> weaTableColumns;
//列表数据
private PageInfo<Map<String, Object>> data;

View File

@ -63,7 +63,7 @@ public class SalaryItemSaveParam {
private Integer roundingMode;
//保留小数位
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 6, message = "小数位最多为6")
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 8, message = "小数位最多为8")
private Integer pattern;
/**

View File

@ -14,6 +14,7 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -32,6 +33,7 @@ import java.util.stream.Collectors;
* @version 1.0
**/
@AllArgsConstructor
@NoArgsConstructor
public class SalarySobItemAggregateBO {
/**
@ -206,7 +208,7 @@ public class SalarySobItemAggregateBO {
* @param salarySobEmpFields 薪资账套的员工信息字段
* @return
*/
private List<SalarySobEmpFieldDTO> buildEmpField(Collection<SalarySobEmpFieldPO> salarySobEmpFields) {
public List<SalarySobEmpFieldDTO> buildEmpField(Collection<SalarySobEmpFieldPO> salarySobEmpFields) {
if (CollectionUtils.isEmpty(salarySobEmpFields)) {
return Collections.emptyList();
}

View File

@ -53,7 +53,7 @@ public class SalarySobItemFormDTO {
private Integer roundingMode;
//保留小数位")
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 6, message = "小数位最多为6")
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 8, message = "小数位最多为8")
private Integer pattern;
//取值方式")

View File

@ -17,4 +17,7 @@ public class SalarySobListQueryParam extends BaseQueryParam {
//薪资账套名称")
private String name;
// 薪资账套id
private Long taxAgentId;
}

View File

@ -0,0 +1,64 @@
package com.engine.salary.entity.siaccount.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author: sy
* @Description: 组装补差基本数据
* @Date: 2023/11/23
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BalanceAccountBaseParam {
//员工id")
private Long employeeId;
//账单月份")
private String billMonth;
/**
* 个税扣缴义务人id
*/
@DataCheck(require = true,message = "个税扣缴义务人不能为空")
private Long paymentOrganization;
/**
* 社保补缴金额_个人
*/
private String socialPerJson;
/**
* 社保补缴金额_单位
*/
private String socialComJson;
/**
* 公积金补缴金额_个人
*/
private String fundPerJson;
/**
* 公积金补缴金额_单位
*/
private String fundComJson;
/**
* 其他福利补缴金额_个人
*/
private String otherPerJson;
/**
* 其他福利补缴金额_单位
*/
private String otherComJson;
}

View File

@ -27,4 +27,6 @@ public class InsuranceAccountBatchParam extends BaseQueryParam {
private String endTime;
private List<Long> taxAgents;
private Long paymentOrganization;
}

View File

@ -13,7 +13,7 @@ public enum FilterEnum implements BaseEnum<String> {
BT("BT", "包含", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> a.contains(params.get(0));
return a -> a != null && a.contains(params.get(0));
}
},
EQ("EQ", "等于", 1) {
@ -23,7 +23,7 @@ public enum FilterEnum implements BaseEnum<String> {
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params.get(0))) {
return new BigDecimal(a).compareTo(new BigDecimal(params.get(0))) == 0;
} else {
return a.equals(params.get(0));
return a != null && a.equals(params.get(0));
}
};
}
@ -35,7 +35,7 @@ public enum FilterEnum implements BaseEnum<String> {
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params.get(0))) {
return new BigDecimal(a).compareTo(new BigDecimal(params.get(0))) != 0;
} else {
return !a.equals(params.get(0));
return a != null && !a.equals(params.get(0));
}
};
}

View File

@ -138,6 +138,10 @@
AND
t.bill_month between #{param.startTime} and #{param.endTime}
</if>
<if test="param.paymentOrganization != null">
AND
t.payment_organization = #{param.paymentOrganization}
</if>
<if test="param.taxAgents != null and param.taxAgents.size() > 0 ">
AND
t.payment_organization in

View File

@ -1319,7 +1319,8 @@
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_organization,
t.total, t.social_sum, t.fund_sum, t.other_sum
t.total, t.social_sum, t.fund_sum, t.other_sum,
t.social_scheme_id, t.fund_scheme_id, t.other_scheme_id
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0

View File

@ -61,6 +61,14 @@ public interface FundSchemeMapper {
*/
void batchSave(@Param("fundSchemePOS") List<InsuranceArchivesFundSchemePO> singletonList);
/**
* 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id
* 筛选条件为账单月是否在起始缴纳月和最后缴纳月之间
* @param paymentOrganization
* @return
*/
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);
List<InsuranceArchivesFundSchemePO> listAll();
int batchUpdate(@Param("collection") List<InsuranceArchivesFundSchemePO> pos);

View File

@ -248,6 +248,17 @@
</foreach>
</insert>
<!-- 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id -->
<select id="listCanPayEmpIds" resultType="long">
SELECT
t.employee_id
FROM hrsa_fund_archives t
WHERE delete_type = 0
AND payment_organization = #{paymentOrganization}
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})
</select>
<select id="listAll" resultMap="BaseResultMap">
SELECT

View File

@ -53,6 +53,14 @@ public interface OtherSchemeMapper {
*/
void batchSave(@Param("otherSchemePOS") List<InsuranceArchivesOtherSchemePO> singletonList);
/**
* 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id
* 筛选条件为账单月是否在起始缴纳月和最后缴纳月之间
* @param paymentOrganization
* @return
*/
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);
List<InsuranceArchivesOtherSchemePO> listAll();
int batchUpdate(@Param("collection") List<InsuranceArchivesOtherSchemePO> pos);

View File

@ -222,6 +222,18 @@
</foreach>
</insert>
<!-- 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id -->
<select id="listCanPayEmpIds" resultType="long">
SELECT
t.employee_id
FROM hrsa_other_archives t
WHERE delete_type = 0
AND payment_organization = #{paymentOrganization}
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})
</select>
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>

View File

@ -86,6 +86,14 @@ public interface SocialSchemeMapper {
*/
List<InsuranceArchivesSocialSchemePO> getSocialByPaymentOrganization(@Param("paymentOrganization")Long paymentOrganization);
/**
* 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id
* 筛选条件为账单月是否在起始缴纳月和最后缴纳月之间
* @param paymentOrganization
* @return
*/
List<Long> listCanPayEmpIds(@Param("paymentOrganization")Long paymentOrganization, @Param("billMonth")String billMonth);
List<InsuranceArchivesSocialSchemePO> listAll();
int batchUpdate(@Param("collection") List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePos);

View File

@ -892,6 +892,18 @@
AND payment_organization = #{paymentOrganization}
</select>
<!-- 根据个税扣缴义务人id获取目标账单月可以进行缴纳的人员id -->
<select id="listCanPayEmpIds" resultType="long">
SELECT
t.employee_id
FROM hrsa_social_archives t
WHERE delete_type = 0
AND payment_organization = #{paymentOrganization}
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})
</select>
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>

View File

@ -116,10 +116,10 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt
.maxRule(SalaryEntityUtil.toJSONString(saveParam.getMaxRule()))
.minRule(SalaryEntityUtil.toJSONString(saveParam.getMinRule()))
.medianRule(SalaryEntityUtil.toJSONString(saveParam.getMedianRule()))
.lastRule(SalaryEntityUtil.toJSONString(saveParam.getMedianRule()))
.oldRule(SalaryEntityUtil.toJSONString(saveParam.getMedianRule()))
.frequentRule(SalaryEntityUtil.toJSONString(saveParam.getMedianRule()))
.tileRule(SalaryEntityUtil.toJSONString(saveParam.getMedianRule()))
.lastRule(SalaryEntityUtil.toJSONString(saveParam.getLastRule()))
.oldRule(SalaryEntityUtil.toJSONString(saveParam.getOldRule()))
.frequentRule(SalaryEntityUtil.toJSONString(saveParam.getFrequentRule()))
.tileRule(SalaryEntityUtil.toJSONString(saveParam.getTileRule()))
.indexValue(max + 1)
.statReportId(saveParam.getStatReportId())
.unitType(saveParam.getUnitType() == null ? UnitTypeEnum.YUAN.getValue() : saveParam.getUnitType())

View File

@ -4,6 +4,7 @@ import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.util.page.PageInfo;
@ -302,5 +303,9 @@ public interface SIAccountService {
* @param insuranceAccountDetailParam
*/
Map<String, Object> listBalanceSum(InsuranceAccountDetailParam insuranceAccountDetailParam);
boolean checkBalance(InsuranceAccountDetailPO po);
boolean checkBalancePayInsurance(InsuranceAccountDetailPO po);
}

View File

@ -1,10 +1,20 @@
package com.engine.salary.service;
import com.engine.salary.entity.siaccount.param.BalanceAccountBaseParam;
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
import java.util.List;
import java.util.Map;
public interface SIBalanceService {
void del(InspectAccountParam param, Long employeeId);
/**
* 获取待编辑的补差费用相关福利项
*/
List<Map<String, String>> getPaymentGroup(BalanceAccountBaseParam param);
void addNewBalance(BalanceAccountBaseParam param);
}

View File

@ -240,4 +240,14 @@ public interface SalaryArchiveService {
* @return
*/
List<SalaryArchivePO> listPayEndDateIsNull(List<Long> employeeIds);
List<SalaryArchivePO> listByRunStatus(List<String> asList);
/**
* 同步所有档案起始发薪日期变为入职日期
*
* @return
*/
String syncPayStartDate();
}

View File

@ -37,10 +37,7 @@ 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.siaccount.*;
import com.engine.salary.enums.sicategory.DataTypeEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.sicategory.IsUseEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.InsuranceExportMapper;
import com.engine.salary.mapper.siaccount.ExcelInsuranceDetailMapper;
@ -208,6 +205,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return ServiceUtil.getService(SIExportServiceImpl.class, user);
}
private SIBalanceService getSIBalanceService(User user) {
return (SIBalanceService) ServiceUtil.getService(SIBalanceServiceImpl.class, user);
}
@Override
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long) user.getUID();
@ -1735,7 +1736,17 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
} else {
//拼装待更新数据
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
updateInsuranceAccountDetailList.add(handleInsuranceAccountDetail(list.get(0), map));
InsuranceAccountDetailPO updatePO = handleInsuranceAccountDetail(list.get(0), map);
//判断导入福利项是否符合福利方案设置缴纳项
if(!checkBalancePayInsurance(updatePO)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "导入数据中存在福利档案中未设置的福利项缴纳数值!"));
excelComments.add(errorMessageMap);
} else {
updateInsuranceAccountDetailList.add(updatePO);
}
}
}
@ -2760,7 +2771,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
String insuranceId = domkey[0].substring(3);
if (group.getTitle().contains("个人")) {
map.put("title", group.getTitle());
map.put("titleSign", getTotalSign(group.getTitle()));
map.put("paymentScope", "个人");
map.put("paymentScopeSign", "per");
map.put("insuranceName", item.getLabel());
map.put("insuranceId", insuranceId);
map.put("insuranceValue", dataMap.get(domkey[0]));
@ -2771,7 +2784,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
} else if (group.getTitle().contains("公司")) {
map.put("title", group.getTitle());
map.put("titleSign", getTotalSign(group.getTitle()));
map.put("paymentScope", "公司");
map.put("paymentScopeSign", "com");
map.put("insuranceName", item.getLabel());
map.put("insuranceId", insuranceId);
map.put("insuranceValue", dataMap.get(domkey[0]));
@ -2789,11 +2804,38 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<Map<String, String>> resultList = new ArrayList<>();
resultList.addAll(perList);
resultList.addAll(comList);
// resultMap.put("data", resultList);
//20231123逻辑变更对于补差的待编辑内容扩充其人员档案设置的福利项内容
if (insuranceAccountDetailPO.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
List<Map<String, String>> balancePaymentGroup = getSIBalanceService(user).getPaymentGroup(BalanceAccountBaseParam.builder()
.employeeId(insuranceAccountDetailPO.getEmployeeId())
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()).build());
if (balancePaymentGroup != null && balancePaymentGroup.size() > 0) {
//抽取已有福利项生成map
Map<String, Object> targetMap = new HashMap<>();
for (Map<String, String> resultItem : resultList) {
targetMap.put(resultItem.get("insuranceId") + "-" + resultItem.get("paymentScope"), resultItem);
}
//对比可进行缴纳福利项与上面的已有福利项生成map
for (Map<String, String> balancePayItem : balancePaymentGroup) {
if (targetMap.get(balancePayItem.get("insuranceId") + "-" + balancePayItem.get("paymentScope")) == null) {
balancePayItem.put("insuranceValue", "");
resultList.add(balancePayItem);
}
}
}
}
resultMap.put("data", resultList);
return resultMap;
}
public String getTotalSign(String total) {
if (StringUtils.isNotBlank(total)) {
return total.contains(SalaryI18nUtil.getI18nLabel(0,"社保")) ? "social" : (total.contains(SalaryI18nUtil.getI18nLabel(0,"公积金")) ? "fund" : "other" );
} else {
return "";
}
}
public void getPaymentGroup(String baseJson, String groupType, String welfareType, Map<String, String> dataMap, List<SearchConditionGroup> addGroups) {
if (StringUtils.isBlank(baseJson)) {
@ -3183,7 +3225,15 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
if (list.isEmpty()) {
//新增数据情况
InsuranceAccountDetailPO createPO = buildBalanceAccountDetail(paymentOrganization, insuranceCategoryPOS, singleAccount, billMonth, employeeId, currentEmployeeId);
if(checkBalance(createPO)) {
if(!checkBalancePayInsurance(createPO)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "补差数据中存在福利档案中未设置的福利项缴纳数值,请检查补差缴纳信息!"));
excelComments.add(errorMessageMap);
}
if(checkBalance(createPO) && !isError) {
createInsuranceAccountDetailList.add(createPO);
} else {
isError = true;
@ -3202,7 +3252,15 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//拼装待更新数据
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
InsuranceAccountDetailPO updatePO = handleInsuranceAccountDetail(list.get(0), map);
if(checkBalance(updatePO)) {
if(!checkBalancePayInsurance(updatePO)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "补差数据中存在福利档案中未设置的福利项缴纳数值,请检查补差缴纳信息!"));
excelComments.add(errorMessageMap);
}
if(checkBalance(updatePO) && !isError) {
updateInsuranceAccountDetailList.add(updatePO);
} else {
isError = true;
@ -3433,7 +3491,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
* @param po
* @return
*/
private boolean checkBalance(InsuranceAccountDetailPO po) {
@Override
public boolean checkBalance(InsuranceAccountDetailPO po) {
InsuranceAccountDetailPO commonAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
.billMonth(po.getBillMonth())
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
@ -3461,6 +3520,199 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
}
/**
* 检查补差数据中的福利缴纳费用相关福利项是否在正常缴纳中方案所设置可缴纳
* @param po
* @return
*/
@Override
public boolean checkBalancePayInsurance(InsuranceAccountDetailPO po) {
InsuranceAccountDetailPO commonAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
.billMonth(po.getBillMonth())
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
.employeeId(po.getEmployeeId())
.paymentOrganization(po.getPaymentOrganization())
.build());
if (commonAccountPO != null) {
encryptUtil.decrypt(commonAccountPO, InsuranceAccountDetailPO.class);
//判断社保缴纳福利项是否合规
boolean socialPayFlag = true;
Map<String, String> socialPerPayMap = JSON.parseObject(po.getSocialPerJson(), new HashMap<String, String>().getClass());
Map<String, String> socialComPayMap = JSON.parseObject(po.getSocialComJson(), new HashMap<String, String>().getClass());
//目标员工设置了方案时比较方案中缴纳的福利项和补差中设置有效值的福利项
if (commonAccountPO.getSocialSchemeId() != null) {
List<String> payInsuranceIdAndScopeList = payInsuranceIdAndScopeList(commonAccountPO.getSocialSchemeId());
if (socialPerPayMap != null) {
for (Map.Entry<String, String> entry : socialPerPayMap.entrySet()) {
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())
&& StringUtils.isNotBlank(entry.getValue())) {
socialPayFlag = false;
break;
}
}
}
if (socialPayFlag && socialComPayMap != null) {
for (Map.Entry<String, String> entry : socialComPayMap.entrySet()) {
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())
&& StringUtils.isNotBlank(entry.getValue())) {
socialPayFlag = false;
break;
}
}
}
} else {
//目标员工未设置方案时判断补差中是否设置有效值的福利项
if (socialPerPayMap != null) {
for (Map.Entry<String, String> entry : socialPerPayMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
socialPayFlag = false;
break;
}
}
}
if (socialPayFlag && socialComPayMap != null) {
for (Map.Entry<String, String> entry : socialComPayMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
socialPayFlag = false;
break;
}
}
}
}
//判断公积金缴纳福利项是否合规
boolean fundPayFlag = true;
Map<String, String> fundPerPayMap = JSON.parseObject(po.getFundPerJson(), new HashMap<String, String>().getClass());
Map<String, String> fundComPayMap = JSON.parseObject(po.getFundComJson(), new HashMap<String, String>().getClass());
//目标员工设置了方案时比较方案中缴纳的福利项和补差中设置有效值的福利项
if (commonAccountPO.getFundSchemeId() != null) {
List<String> payInsuranceIdAndScopeList = payInsuranceIdAndScopeList(commonAccountPO.getFundSchemeId());
if (fundPerPayMap != null) {
for (Map.Entry<String, String> entry : fundPerPayMap.entrySet()) {
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())
&& StringUtils.isNotBlank(entry.getValue())) {
fundPayFlag = false;
break;
}
}
}
if (fundPayFlag && fundComPayMap != null) {
for (Map.Entry<String, String> entry : fundComPayMap.entrySet()) {
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())
&& StringUtils.isNotBlank(entry.getValue())) {
fundPayFlag = false;
break;
}
}
}
} else {
//目标员工未设置方案时判断补差中是否设置有效值的福利项
if (fundPerPayMap != null) {
for (Map.Entry<String, String> entry : fundPerPayMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
fundPayFlag = false;
break;
}
}
}
if (fundPayFlag && fundComPayMap != null) {
for (Map.Entry<String, String> entry : fundComPayMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
fundPayFlag = false;
break;
}
}
}
}
//判断其他福利缴纳福利项是否合规
boolean otherPayFlag = true;
Map<String, String> otherPerPayMap = JSON.parseObject(po.getOtherPerJson(), new HashMap<String, String>().getClass());
Map<String, String> otherComPayMap = JSON.parseObject(po.getOtherComJson(), new HashMap<String, String>().getClass());
//目标员工设置了方案时比较方案中缴纳的福利项和补差中设置有效值的福利项
if (commonAccountPO.getOtherSchemeId() != null) {
List<String> payInsuranceIdAndScopeList = payInsuranceIdAndScopeList(commonAccountPO.getOtherSchemeId());
if (otherPerPayMap != null) {
for (Map.Entry<String, String> entry : otherPerPayMap.entrySet()) {
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())
&& StringUtils.isNotBlank(entry.getValue())) {
otherPayFlag = false;
break;
}
}
}
if (otherPayFlag && otherComPayMap != null) {
for (Map.Entry<String, String> entry : otherComPayMap.entrySet()) {
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())
&& StringUtils.isNotBlank(entry.getValue())) {
otherPayFlag = false;
break;
}
}
}
} else {
//目标员工未设置方案时判断补差中是否设置有效值的福利项
if(otherPerPayMap != null) {
for (Map.Entry<String, String> entry : otherPerPayMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
otherPayFlag = false;
break;
}
}
}
if (otherPayFlag && otherComPayMap != null) {
for (Map.Entry<String, String> entry : otherComPayMap.entrySet()) {
if (StringUtils.isNotBlank(entry.getValue())) {
otherPayFlag = false;
break;
}
}
}
}
//在社保公积金其他福利档案中未设置的福利项被补差设置有效数值时不允许更新
if (socialPayFlag && fundPayFlag && otherPayFlag) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public List<String> payInsuranceIdAndScopeList(Long schemeId) {
//查询该福利方案下开启缴纳的福利项
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(schemeId);
List<String> insuranceIdList = new ArrayList<>();
if (detailPOS != null && detailPOS.size() > 0) {
//开启缴纳的
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(m -> {
return m.getInsuranceId() .toString() + "-" + m.getPaymentScope().toString();
}).collect(Collectors.toList());
}
return insuranceIdList;
}
public InsuranceAccountDetailPO buildBalanceAccountDetail(Long paymentOrganization, List<ICategoryPO> insuranceCategoryPOS,
List<Map<String, Object>> singleAccount, String billMonth, Long employeeId, Long creator) {
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
@ -3500,7 +3752,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
accountBalanceFund(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
// 其他福利档案
accountBalanceOther(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
account((insuranceAccountDetailPO));
account(insuranceAccountDetailPO);
if (insuranceAccountDetailPO.getOtherSchemeId() == null) {
insuranceAccountDetailPO.setOtherSchemeId(0L);
}

View File

@ -1,19 +1,49 @@
package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.param.BalanceAccountBaseParam;
import com.engine.salary.entity.siaccount.param.EditAccountDetailParam;
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.siaccount.ResourceFromEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.sicategory.IsPaymentEnum;
import com.engine.salary.enums.sicategory.PaymentScopeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.SIBalanceService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@ -31,6 +61,32 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
private SocialSchemeMapper getSocialSchemeMapper() {
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
}
private FundSchemeMapper getFundSchemeMapper() {
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
}
private OtherSchemeMapper getOtherSchemeMapper() {
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
}
private ICategoryMapper getICategoryMapper() {
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private EncryptUtil encryptUtil = new EncryptUtil();
@Override
public void del(InspectAccountParam param, Long employeeId) {
@ -46,4 +102,375 @@ public class SIBalanceServiceImpl extends Service implements SIBalanceService {
//刷新bill_batch表中统计信息
getSIAccountService(user).refreshBillBatch(param.getPaymentOrganization(), param.getBillMonth());
}
/**
* 获取待编辑的补差费用相关福利项
*/
@Override
public List<Map<String, String>> getPaymentGroup(BalanceAccountBaseParam param) {
Long paymentOrganization = param.getPaymentOrganization();
Long employeeId = param.getEmployeeId();
InsuranceArchivesSocialSchemePO socialSchemePO = new InsuranceArchivesSocialSchemePO();
InsuranceArchivesFundSchemePO fundSchemePO = new InsuranceArchivesFundSchemePO();
InsuranceArchivesOtherSchemePO otherSchemePO = new InsuranceArchivesOtherSchemePO();
List<InsuranceArchivesSocialSchemePO> socialSchemePOList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(employeeId)
.paymentOrganization(paymentOrganization)
.build());
if (socialSchemePOList.size() > 0) {
encryptUtil.decryptList(socialSchemePOList, InsuranceArchivesSocialSchemePO.class);
socialSchemePO = socialSchemePOList.get(0);
}
List<InsuranceArchivesFundSchemePO> fundSchemePOList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(employeeId)
.paymentOrganization(paymentOrganization)
.build());
if (fundSchemePOList.size() > 0) {
encryptUtil.decryptList(fundSchemePOList, InsuranceArchivesFundSchemePO.class);
fundSchemePO = fundSchemePOList.get(0);
}
List<InsuranceArchivesOtherSchemePO> otherSchemePOList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(employeeId)
.paymentOrganization(paymentOrganization)
.build());
if (otherSchemePOList.size() > 0) {
encryptUtil.decryptList(otherSchemePOList, InsuranceArchivesOtherSchemePO.class);
otherSchemePO = otherSchemePOList.get(0);
}
List<ICategoryPO> allCategoryList = getICategoryMapper().listAll();
Map<Long, String> categoryNameMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getInsuranceName);
Map<Long, Integer> welfareTypeMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getWelfareType);
List<Map<String, String>> resultList = new ArrayList<>();
if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) {
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
// comMap.put("title", welfareTypeName + "公司" + "缴纳");
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
// perMap.put("title", welfareTypeName + "个人" + "缴纳");
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
if (fundSchemePO != null && StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString())) {
Map<String, String> fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
fundMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
// comMap.put("title", welfareTypeName + "公司" + "缴纳");
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
// perMap.put("title", welfareTypeName + "个人" + "缴纳");
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
if (otherSchemePO != null && StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString())) {
Map<String, String> otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
otherMap.forEach((k, v) -> {
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
// comMap.put("title", welfareTypeName + "公司" + "缴纳");
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
// perMap.put("title", welfareTypeName + "个人" + "缴纳");
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
return resultList;
}
@Override
public void addNewBalance(BalanceAccountBaseParam param) {
//入参判断
if (param.getPaymentOrganization() == null || StringUtils.isBlank(param.getBillMonth()) || param.getEmployeeId() == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误"));
}
Long employeeId = param.getEmployeeId();
String billMonth = param.getBillMonth();
Long creator = (long) user.getUID();
Long paymentOrganization = param.getPaymentOrganization();
InsuranceAccountDetailPO banlanceAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
.billMonth(billMonth)
.paymentStatus(PaymentStatusEnum.BALANCE.getValue())
.employeeId(employeeId)
.paymentOrganization(paymentOrganization)
.build());
if (banlanceAccountPO != null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补差数据已存在,不可重复新增!"));
}
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
insuranceAccountDetailPO.setId(IdGenerator.generate());
insuranceAccountDetailPO.setEmployeeId(employeeId);
insuranceAccountDetailPO.setBillMonth(billMonth);
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.IMPORT.getValue());
insuranceAccountDetailPO.setCreator(creator);
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
insuranceAccountDetailPO.setCreateTime(new Date());
insuranceAccountDetailPO.setUpdateTime(new Date());
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
insuranceAccountDetailPO.setSocialPayOrg(paymentOrganization);
insuranceAccountDetailPO.setFundPayOrg(paymentOrganization);
insuranceAccountDetailPO.setOtherPayOrg(paymentOrganization);
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(employeeId, paymentOrganization);
if (baseInfoPO != null) {
InsuranceArchivesSocialSchemePO socialSchemePO = getSocialSchemeMapper().getOneById(baseInfoPO.getSocialArchivesId());
InsuranceArchivesFundSchemePO fundSchemePO = getFundSchemeMapper().getOneById(baseInfoPO.getFundArchivesId());
if (socialSchemePO != null) {
insuranceAccountDetailPO.setSocialAccount(socialSchemePO.getSocialAccount());
}
if (fundSchemePO != null) {
insuranceAccountDetailPO.setFundAccount(fundSchemePO.getFundAccount());
insuranceAccountDetailPO.setSupplementFundAccount(fundSchemePO.getSupplementFundAccount());
}
}
insuranceAccountDetailPO.setSocialPerJson(param.getSocialPerJson());
insuranceAccountDetailPO.setSocialComJson(param.getSocialComJson());
insuranceAccountDetailPO.setFundPerJson(param.getFundPerJson());
insuranceAccountDetailPO.setFundComJson(param.getFundComJson());
insuranceAccountDetailPO.setOtherPerJson(param.getOtherPerJson());
insuranceAccountDetailPO.setOtherComJson(param.getOtherComJson());
// insuranceAccountDetailPO.setOtherSchemeId(0L);
// insuranceAccountDetailPO.setSocialSchemeId(0L);
// insuranceAccountDetailPO.setFundSchemeId(0L);
if (getSIAccountService(user).checkBalance(insuranceAccountDetailPO) && getSIAccountService(user).checkBalancePayInsurance(insuranceAccountDetailPO)) {
accountSocialByData(insuranceAccountDetailPO, param);
accountFundByData(insuranceAccountDetailPO, param);
// 其他福利档案
accountOtherByData(insuranceAccountDetailPO, param);
account(insuranceAccountDetailPO);
encryptUtil.encrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
getInsuranceAccountDetailMapper().batchSaveAccountDetails(Collections.singletonList(insuranceAccountDetailPO));
//刷新bill_batch表中统计信息
getSIAccountService(user).refreshBillBatch(paymentOrganization, billMonth);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补差数据中存在福利档案中未设置的福利项缴纳数值,请检查补差缴纳信息!"));
}
}
public List<String> payInsuranceIdAndScopeList(Long socialSchemeId) {
//查询该福利方案下开启缴纳的福利项
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialSchemeId);
List<String> insuranceIdList = new ArrayList<>();
if (detailPOS != null && detailPOS.size() > 0) {
//开启缴纳的
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(m -> {
return m.getInsuranceId() .toString() + "-" + m.getPaymentScope().toString();
}).collect(Collectors.toList());
}
return insuranceIdList;
}
public InsuranceAccountDetailPO account(InsuranceAccountDetailPO insuranceAccountDetailPO) {
//个人合计
BigDecimal socialPerson =
StringUtils.isBlank(insuranceAccountDetailPO.getSocialPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getSocialPerSum());
BigDecimal fundPerson =
StringUtils.isBlank(insuranceAccountDetailPO.getFundPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getFundPerSum());
BigDecimal otherPerson =
StringUtils.isBlank(insuranceAccountDetailPO.getOtherPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getOtherPerSum());
BigDecimal perSum = socialPerson.add(fundPerson).add(otherPerson);
insuranceAccountDetailPO.setPerSum(perSum.toPlainString());
//单位合计
BigDecimal socialCom =
StringUtils.isBlank(insuranceAccountDetailPO.getSocialComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getSocialComSum());
BigDecimal fundCom = StringUtils.isBlank(insuranceAccountDetailPO.getFundComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getFundComSum());
BigDecimal otherCom =
StringUtils.isBlank(insuranceAccountDetailPO.getOtherComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getOtherComSum());
BigDecimal comSum = socialCom.add(fundCom).add(otherCom);
insuranceAccountDetailPO.setComSum(comSum.toPlainString());
//社保合计
insuranceAccountDetailPO.setSocialSum(socialPerson.add(socialCom).toPlainString());
//公积金合计
insuranceAccountDetailPO.setFundSum(fundPerson.add(fundCom).toPlainString());
//其他福利合计
insuranceAccountDetailPO.setOtherSum(otherPerson.add(otherCom).toPlainString());
//合计
insuranceAccountDetailPO.setTotal(perSum.add(comSum).toPlainString());
return insuranceAccountDetailPO;
}
public void accountFundByData(InsuranceAccountDetailPO insuranceAccountDetailPO, BalanceAccountBaseParam baseParam) {
//公积金个人
if (StringUtils.isNotBlank(baseParam.getFundPerJson())) {
List<BigDecimal> fundPer = new ArrayList<>();
HashMap<String, String> fundPerson = JSON.parseObject(baseParam.getFundPerJson(), new HashMap<String, String>().getClass());
fundPerson.forEach((k, v) -> {
BigDecimal result = new BigDecimal(v);
fundPer.add(result);
});
insuranceAccountDetailPO.setFundPerJson(baseParam.getFundPerJson());
BigDecimal fundPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundPer) {
fundPerSum = fundPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setFundPerSum(fundPerSum.toPlainString());
}
//公积金单位
if (StringUtils.isNotBlank(baseParam.getFundComJson())) {
List<BigDecimal> fundCom = new ArrayList<>();
HashMap<String, String> fundComMap = JSON.parseObject(baseParam.getFundComJson(), new HashMap<String, String>().getClass());
fundComMap.forEach((k, v) -> {
BigDecimal result = new BigDecimal(v);
fundCom.add(result);
});
insuranceAccountDetailPO.setFundComJson(baseParam.getFundComJson());
BigDecimal fundComSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundCom) {
fundComSum = fundComSum.add(bigDecimal);
}
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
}
}
public void accountOtherByData(InsuranceAccountDetailPO insuranceAccountDetailPO, BalanceAccountBaseParam baseParam) {
//其他福利个人
if (StringUtils.isNotBlank(baseParam.getOtherPerJson())) {
List<BigDecimal> otherPer = new ArrayList<>();
HashMap<String, String> otherPerMap = JSON.parseObject(baseParam.getOtherPerJson(), new HashMap<String, String>().getClass());
otherPerMap.forEach((k, v) -> {
BigDecimal result = new BigDecimal(v);
otherPer.add(result);
});
insuranceAccountDetailPO.setOtherPerJson(baseParam.getOtherPerJson());
BigDecimal otherPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : otherPer) {
otherPerSum = otherPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
}
//其他福利单位
if (StringUtils.isNotBlank(baseParam.getOtherComJson())) {
List<BigDecimal> otherCom = new ArrayList<>();
HashMap<String, String> otherComMap = JSON.parseObject(baseParam.getOtherComJson(), new HashMap<String, String>().getClass());
otherComMap.forEach((k, v) -> {
BigDecimal result = new BigDecimal(v);
otherCom.add(result);
});
insuranceAccountDetailPO.setOtherComJson(baseParam.getOtherComJson());
BigDecimal otherComSum = new BigDecimal("0");
for (BigDecimal bigDecimal : otherCom) {
otherComSum = otherComSum.add(bigDecimal);
}
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
}
}
public void accountSocialByData(InsuranceAccountDetailPO insuranceAccountDetailPO, BalanceAccountBaseParam baseParam) {
//社保个人
if (StringUtils.isNotBlank(baseParam.getSocialPerJson())) {
List<BigDecimal> socialPer = new ArrayList<>();
HashMap<String, String> archivesPerson = JSON.parseObject(baseParam.getSocialPerJson(), new HashMap<String, String>().getClass());
archivesPerson.forEach((k, v) -> {
BigDecimal result = new BigDecimal(v);
socialPer.add(result);
});
insuranceAccountDetailPO.setSocialPerJson(baseParam.getSocialPerJson());
BigDecimal socialPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : socialPer) {
socialPerSum = socialPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
}
//社保单位
if (StringUtils.isNotBlank(baseParam.getSocialComJson())) {
List<BigDecimal> socialCom = new ArrayList<>();
HashMap<String, String> archivesCom = JSON.parseObject(baseParam.getSocialComJson(), new HashMap<String, String>().getClass());
archivesCom.forEach((k, v) -> {
BigDecimal result = new BigDecimal(v);
socialCom.add(result);
});
insuranceAccountDetailPO.setSocialComJson(baseParam.getSocialComJson());
BigDecimal socialComSum = new BigDecimal("0");
for (BigDecimal bigDecimal : socialCom) {
socialComSum = socialComSum.add(bigDecimal);
}
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
}
}
}

View File

@ -8,14 +8,18 @@ import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
import com.engine.salary.enums.sicategory.DataTypeEnum;
import com.engine.salary.enums.sicategory.IsPaymentEnum;
import com.engine.salary.enums.sicategory.PaymentScopeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.service.SIRepairService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -55,6 +59,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
/**
* 获取指定月份的福利缴纳基数作为补缴基数
* @param param
@ -155,7 +163,9 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
map.put("insuranceBase", entry.getValue());
String welfareTypeName = welfareTypeMap.get(Long.valueOf(entry.getKey())) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(entry.getKey())) == 2 ? "公积金" : "企业年金及其它福利" );
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(entry.getKey())) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(entry.getKey())) == 2 ? "fund" : "other" );
map.put("title", welfareTypeName);
map.put("titleSign", welfareTypeSign);
resulit.add(map);
}
}
@ -214,71 +224,91 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
if (projects.contains(ProjectTypeEnum.ALL.getValue())) {
if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) {
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
if (fundSchemePO != null && StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString())) {
Map<String, String> fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
fundMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
if (otherSchemePO != null && StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString())) {
Map<String, String> otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
otherMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
return resultList;
@ -286,25 +316,31 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) {
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
@ -316,24 +352,31 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
socialMap = socialMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()) || "9002".equals(e.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
@ -345,25 +388,31 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
socialMap = socialMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
@ -375,24 +424,31 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
Map<String, String> socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
socialMap = socialMap.entrySet().stream().filter(e -> "9002".equals(e.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId());
socialMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
@ -400,25 +456,31 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
if (projects.contains(ProjectTypeEnum.FUND.getValue())) {
if (fundSchemePO != null && StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString())) {
Map<String, String> fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId());
fundMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
@ -426,25 +488,31 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
if (projects.contains(ProjectTypeEnum.OTHER.getValue())) {
if (otherSchemePO != null && StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString())) {
Map<String, String> otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//查询该福利方案下开启缴纳的福利项
List<String> insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId());
otherMap.forEach((k, v) -> {
Map<String, String> perMap = new HashMap<>();
Map<String, String> comMap = new HashMap<>();
String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" );
perMap.put("title", welfareTypeName);
comMap.put("title", welfareTypeName);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
resultList.add(perMap);
resultList.add(comMap);
String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" );
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) {
Map<String, String> comMap = new HashMap<>();
comMap.put("title", welfareTypeName);
comMap.put("titleSign", welfareTypeSign);
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", "公司");
comMap.put("paymentScopeSign", "com");
resultList.add(comMap);
}
if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())) {
Map<String, String> perMap = new HashMap<>();
perMap.put("title", welfareTypeName);
perMap.put("titleSign", welfareTypeSign);
perMap.put("insuranceId", k);
perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
perMap.put("paymentScope", "个人");
perMap.put("paymentScopeSign", "per");
resultList.add(perMap);
}
});
}
@ -453,5 +521,18 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
return resultList;
}
public List<String> payInsuranceIdAndScopeList(Long socialSchemeId) {
//查询该福利方案下开启缴纳的福利项
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialSchemeId);
List<String> insuranceIdList = new ArrayList<>();
if (detailPOS != null && detailPOS.size() > 0) {
//开启缴纳的
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(m -> {
return m.getInsuranceId() .toString() + "-" + m.getPaymentScope().toString();
}).collect(Collectors.toList());
}
return insuranceIdList;
}
}

View File

@ -308,8 +308,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialJson != null) {
map.putAll(socialJson);
// SalaryEntityUtil.thousandthConvert(socialJson, map);
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(socialItem.getSocialSchemeId());
socialJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
// map.putAll(socialJson);
}
map.put("socialAccount", socialItem.getSocialAccount());
map.put("socialStartTime", socialItem.getSocialStartTime());
@ -321,8 +327,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundJson != null) {
map.putAll(fundJson);
// SalaryEntityUtil.thousandthConvert(fundJson, map);
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(fundItem.getFundSchemeId());
fundJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
// map.putAll(fundJson);
}
map.put("supplementFundAccount", fundItem.getSupplementFundAccount());
map.put("fundStartTime", fundItem.getFundStartTime());
@ -334,8 +346,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
});
if (otherJson != null) {
map.putAll(otherJson);
//SalaryEntityUtil.thousandthConvert(otherJson, map);
//查询该福利方案下开启缴纳的福利项
List<Long> insuranceIdList = payInsuranceIds(otherItem.getOtherSchemeId());
otherJson.forEach((k, v) -> {
if (insuranceIdList.contains(Long.valueOf(k))) {
map.put(k, v);
}
});
// map.putAll(otherJson);
}
map.put("otherStartTime", otherItem.getOtherStartTime());
map.put("otherEndTime", otherItem.getOtherEndTime());
@ -345,6 +363,17 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
return records;
}
public List<Long> payInsuranceIds(Long socialSchemeId) {
//查询该福利方案下开启缴纳的福利项
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialSchemeId);
List<Long> insuranceIdList = new ArrayList<>();
if (detailPOS != null && detailPOS.size() > 0) {
//开启缴纳的
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
}
return insuranceIdList;
}
@Override
public XSSFWorkbook export(InsuranceArchivesListParam param) {
InsuranceArchivesListParam request = InsuranceArchivesListParam.builder().build();
@ -928,7 +957,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
if (StringUtils.isNotBlank(socialStartMonth) && socialStartMonth.length() > 7) {
socialStartMonth = socialStartMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(socialStartMonth) && !SalaryDateUtil.checkYearMonth(socialStartMonth)) {
if (StringUtils.isNotBlank(socialStartMonth) && !SalaryDateUtil.checkYearMonth(socialStartMonth.replace("/", "-"))) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100315, "社保起始缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
excelComments.add(errorMessageMap);
@ -939,7 +968,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
if (StringUtils.isNotBlank(socialEndMonth) && socialEndMonth.length() > 7) {
socialEndMonth = socialEndMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(socialEndMonth) && !SalaryDateUtil.checkYearMonth(socialEndMonth)) {
if (StringUtils.isNotBlank(socialEndMonth) && !SalaryDateUtil.checkYearMonth(socialEndMonth.replace("/", "-"))) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100316, "社保最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
excelComments.add(errorMessageMap);
@ -950,7 +979,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
if (StringUtils.isNotBlank(fundStartMonth) && fundStartMonth.length() > 7) {
fundStartMonth = fundStartMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(fundStartMonth) && !SalaryDateUtil.checkYearMonth(fundStartMonth)) {
if (StringUtils.isNotBlank(fundStartMonth) && !SalaryDateUtil.checkYearMonth(fundStartMonth.replace("/", "-"))) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100317, "公积金起始缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
excelComments.add(errorMessageMap);
@ -961,7 +990,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
if (StringUtils.isNotBlank(fundEndMonth) && fundEndMonth.length() > 7) {
fundEndMonth = fundEndMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(fundEndMonth) && !SalaryDateUtil.checkYearMonth(fundEndMonth)) {
if (StringUtils.isNotBlank(fundEndMonth) && !SalaryDateUtil.checkYearMonth(fundEndMonth.replace("/", "-"))) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100319, "公积金最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
excelComments.add(errorMessageMap);
@ -972,7 +1001,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
if (StringUtils.isNotBlank(otherStartMonth) && otherStartMonth.length() > 7) {
otherStartMonth = otherStartMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(otherStartMonth) && !SalaryDateUtil.checkYearMonth(otherStartMonth)) {
if (StringUtils.isNotBlank(otherStartMonth) && !SalaryDateUtil.checkYearMonth(otherStartMonth.replace("/", "-"))) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100320, "其他福利起始缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
excelComments.add(errorMessageMap);
@ -983,7 +1012,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
if (StringUtils.isNotBlank(otherEndMonth) && otherEndMonth.length() > 7) {
otherEndMonth = otherEndMonth.substring(0, 7);
}
if (StringUtils.isNotBlank(otherEndMonth) && !SalaryDateUtil.checkYearMonth(otherEndMonth)) {
if (StringUtils.isNotBlank(otherEndMonth) && !SalaryDateUtil.checkYearMonth(otherEndMonth.replace("/", "-"))) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100321, "其他福利最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
excelComments.add(errorMessageMap);
@ -1150,13 +1179,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String socialStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
if (StringUtils.isNotBlank(socialStartDate) && socialStartDate.length() >= 7) {
socialStartDate = socialStartDate.substring(0, 7);
socialStartDate = socialStartDate.substring(0, 7).replace("/", "-");
insuranceArchivesSocialSchemePO.setSocialStartTime(socialStartDate);
}
String socialEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
if (StringUtils.isNotBlank(socialEndDate) && socialEndDate.length() >= 7) {
socialEndDate = socialEndDate.substring(0, 7);
socialEndDate = socialEndDate.substring(0, 7).replace("/", "-");
insuranceArchivesSocialSchemePO.setSocialEndTime(socialEndDate);
}
@ -1238,13 +1267,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String fundStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
if (StringUtils.isNotBlank(fundStartDate) && fundStartDate.length() >= 7) {
fundStartDate = fundStartDate.substring(0, 7);
fundStartDate = fundStartDate.substring(0, 7).replace("/", "-");
insuranceArchivesFundSchemePO.setFundStartTime(fundStartDate);
}
String fundEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
if (StringUtils.isNotBlank(fundEndDate) && fundEndDate.length() >= 7) {
fundEndDate = fundEndDate.substring(0, 7);
fundEndDate = fundEndDate.substring(0, 7).replace("/", "-");
insuranceArchivesFundSchemePO.setFundEndTime(fundEndDate);
}
@ -1314,13 +1343,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
String otherStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
if (StringUtils.isNotBlank(otherStartDate) && otherStartDate.length() >= 7) {
otherStartDate = otherStartDate.substring(0, 7);
otherStartDate = otherStartDate.substring(0, 7).replace("/", "-");
insuranceArchivesOtherSchemePO.setOtherStartTime(otherStartDate);
}
String otherEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
if (StringUtils.isNotBlank(otherEndDate) && otherEndDate.length() >= 7) {
otherEndDate = otherEndDate.substring(0, 7);
otherEndDate = otherEndDate.substring(0, 7).replace("/", "-");
insuranceArchivesOtherSchemePO.setOtherEndTime(otherEndDate);
}

View File

@ -18,9 +18,9 @@ import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salaryacct.po.*;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalarySobEmpFieldDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
@ -43,7 +43,6 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelParseHelper;
import com.engine.salary.util.excel.ExcelSupport;
import com.engine.salary.util.excel.ExcelUtilPlus;
import com.engine.salary.util.page.Column;
import com.engine.salary.util.valid.ValidUtil;
import com.engine.salary.wrapper.SalarySobItemWrapper;
import com.google.common.collect.Lists;
@ -54,6 +53,7 @@ import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.Sheet;
@ -68,6 +68,7 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.sys.constant.SalarySysConstant.OPEN_ACCT_RESULT_SUM;
import static com.engine.salary.sys.constant.SalarySysConstant.SALARY_ACCT_FIXED_COLUMNS;
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
/**
@ -381,7 +382,19 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// 查询薪资账套下的薪资项目+员工信息字段
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateWithItemHideBySalarySobId(salaryAcctRecordPO.getSalarySobId(),isBackCalc);
// 构建薪资核算结果列表表头
return SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO, ListUtils.emptyIfNull(salaryAcctRecordPO.getLockSalaryItemIds()));
List<WeaTableColumnGroup> columnList = SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO, ListUtils.emptyIfNull(salaryAcctRecordPO.getLockSalaryItemIds()));
// 获取固定列头数
SalarySysConfPO salaryAcctFixedColumns = getSalarySysConfMapper().getOneByCode(SALARY_ACCT_FIXED_COLUMNS);
if (ObjectUtils.isNotEmpty(salaryAcctFixedColumns)) {
int fixedNum = NumberUtils.isCreatable(salaryAcctFixedColumns.getConfValue()) ? Integer.valueOf(salaryAcctFixedColumns.getConfValue()) : 3;
if (fixedNum == 0) {
fixedNum = 3;
}
for (int i = 0; i < fixedNum; i++) {
columnList.get(i).setFixed("left");
}
}
return columnList;
}
/**
@ -657,19 +670,22 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
parseHeader(headerColumnGroup, finalWeaTableColumns);
List<Object> headerList = new ArrayList<>(finalWeaTableColumns);
// 查询薪资核算结果
List<Map<String, Object>> resultMapList = getSalaryAcctResultService(user).listByParam(param);
// excel导出的数据
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerColumnGroup.size());
for (WeaTableColumnGroup weaTableColumn : headerColumnGroup) {
row.add(map.getOrDefault(weaTableColumn.getColumn(), StringUtils.EMPTY));
if (param.getImportType() != null && param.getImportType().equals("true")) {
// 需要导出现有数据查询薪资核算结果
List<Map<String, Object>> resultMapList = getSalaryAcctResultService(user).listByParam(param);
for (Map<String, Object> map : resultMapList) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerColumnGroup.size());
for (WeaTableColumnGroup weaTableColumn : headerColumnGroup) {
row.add(map.getOrDefault(weaTableColumn.getColumn(), StringUtils.EMPTY));
}
rows.add(row);
}
rows.add(row);
}
String sheetName = "薪资核算导入模板";
return ExcelUtilPlus.genWorkbookWithChildTitleColumn(rows, sheetName, false);
}
@ -695,16 +711,30 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// 查询薪资项目
List<SalaryItemPO> salaryItemPOS = getSalarySobItemService(user).listBySalarySobId4SalaryItem(salaryAcctRecordPO.getSalarySobId());
Set<String> salaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, salaryItemPO -> "" + salaryItemPO.getId());
for (Column weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
for (WeaTableColumnGroup weaTableColumnGroup : salaryComparisonResultListDTO.getWeaTableColumns()) {
// 员工信息字段
if (employeeFieldCodeSet.contains(weaTableColumn.getKey())) {
headerList.add(weaTableColumn.getTitle());
}
// 薪资项目的表头
if (salaryItemIds.contains(weaTableColumn.getKey())) {
headerList.add(weaTableColumn.getTitle() + " (线上值)");
headerList.add(weaTableColumn.getTitle() + " (线下值)");
if (employeeFieldCodeSet.contains(weaTableColumnGroup.getColumn())) {
headerList.add(weaTableColumnGroup.getText());
} else {
// 薪资项目的表头
List<WeaTableColumnGroup> childrenList = weaTableColumnGroup.getChildren();
if (CollectionUtils.isEmpty(childrenList)) {
// 是否是无分类
if (salaryItemIds.contains(weaTableColumnGroup.getColumn())) {
headerList.add(weaTableColumnGroup.getText() + " (线上值)");
headerList.add(weaTableColumnGroup.getText() + " (线下值)");
}
} else {
for (WeaTableColumnGroup children : childrenList) {
if (salaryItemIds.contains(children.getColumn())) {
headerList.add(children.getText() + " (线上值)");
headerList.add(children.getText() + " (线下值)");
}
}
}
}
}
List<Map<String, Object>> resultMapList = salaryComparisonResultListDTO.getData().getList();
@ -713,16 +743,28 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
List<Object> row = Lists.newArrayList();
for (Column weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
for (WeaTableColumnGroup weaTableColumnGroup : salaryComparisonResultListDTO.getWeaTableColumns()) {
// 员工信息字段的值
if (employeeFieldCodeSet.contains(weaTableColumn.getKey())) {
row.add(map.get(weaTableColumn.getKey()));
if (employeeFieldCodeSet.contains(weaTableColumnGroup.getColumn())) {
row.add(map.get(weaTableColumnGroup.getColumn()));
}
// 薪资项目的值
if (salaryItemIds.contains(weaTableColumn.getKey())) {
Map tempMap = (Map) map.getOrDefault(weaTableColumn.getKey(), Collections.emptyMap());
row.add(tempMap.get("acctResultValue"));
row.add(tempMap.get("excelResultValue"));
List<WeaTableColumnGroup> childrenList = weaTableColumnGroup.getChildren();
if (CollectionUtils.isEmpty(childrenList)) {
// 是否是无分类
if (salaryItemIds.contains(weaTableColumnGroup.getColumn())) {
Map tempMap = (Map) map.getOrDefault(weaTableColumnGroup.getColumn(), Collections.emptyMap());
row.add(tempMap.get("acctResultValue"));
row.add(tempMap.get("excelResultValue"));
}
} else {
for (WeaTableColumnGroup children : childrenList) {
if (salaryItemIds.contains(children.getColumn())) {
Map tempMap = (Map) map.getOrDefault(children.getColumn(), Collections.emptyMap());
row.add(tempMap.get("acctResultValue"));
row.add(tempMap.get("excelResultValue"));
}
}
}
}
rows.add(row);
@ -745,12 +787,12 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 模板表头(默认必带"个税扣缴义务人""姓名")
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
//定位人员带部门手机号工号
headerList.add("部门");
headerList.add("手机号");
headerList.add("工号");
// // 模板表头(默认必带"个税扣缴义务人""姓名")
// List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
// //定位人员带部门手机号工号
// headerList.add("部门");
// headerList.add("手机号");
// headerList.add("工号");
// 查询薪资账套下的薪资项目
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateBySalarySobId(salaryAcctRecordPO.getSalarySobId());
@ -765,22 +807,46 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// }
//
// }
// 薪资项目分类下的新资项目
for (SalarySobItemGroupDTO itemGroup : salarySobItemAggregateDTO.getItemGroups()) {
for (SalarySobItemDTO item : itemGroup.getItems()) {
headerList.add(item.getName());
// // 薪资项目分类下的新资项目
// for (SalarySobItemGroupDTO itemGroup : salarySobItemAggregateDTO.getItemGroups()) {
// for (SalarySobItemDTO item : itemGroup.getItems()) {
// headerList.add(item.getName());
// }
// }
// // 没有分类的薪资项目
// for (SalarySobItemDTO item : salarySobItemAggregateDTO.getItems()) {
// headerList.add(item.getName());
// }
// 无分类薪资项目id
List<String> noGroupItemIds = salarySobItemAggregateDTO.getItems().stream().map(dto -> String.valueOf(dto.getSalaryItemId())).collect(Collectors.toList());
// 查询列表的表头
List<WeaTableColumnGroup> weaTableColumns = listWeaTableColumn(salaryAcctRecordPO);
List<Object> finalWeaTableColumns = new ArrayList<>();
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<SalarySobEmpFieldDTO> salarySobEmpFieldDTOS = new SalarySobItemAggregateBO().buildEmpField(salarySobEmpFieldPOS);
salarySobEmpFieldDTOS.stream().forEach(empField -> finalWeaTableColumns.add(new WeaTableColumnGroup("150", SalaryI18nUtil.getI18nLabel(0, empField.getFieldName()), SalaryI18nUtil.getI18nLabel(0, empField.getFieldName()))));
for (WeaTableColumnGroup tableColumn : weaTableColumns) {
WeaTableColumnGroup columnGroupItem = (WeaTableColumnGroup) tableColumn;
if (columnGroupItem.getChildren() != null) {
columnGroupItem.setChildren(columnGroupItem.getChildren());
finalWeaTableColumns.add(columnGroupItem);
} else if (noGroupItemIds.contains(columnGroupItem.getColumn())) {
// 无分类
finalWeaTableColumns.add(columnGroupItem);
}
}
// 没有分类的薪资项目
for (SalarySobItemDTO item : salarySobItemAggregateDTO.getItems()) {
headerList.add(item.getName());
}
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
rows.add(finalWeaTableColumns);
String sheetName = "线下对比结果导入模板";
// return ExcelUtil.genWorkbookV2(rows, sheetName);
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
// return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
return ExcelUtilPlus.genWorkbookWithChildTitleColumn(rows, sheetName, false);
}
public Map<String, Object> importSalaryAcctResult(SalaryAcctImportParam param) {
@ -804,8 +870,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
map.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
map.put("list", ExcelParseHelper.parse2List(sheet, 1));
map.put("headers", ExcelSupport.getSheetHeader(sheet, 1));
map.put("list", ExcelParseHelper.parse2List(sheet, 2, 1));
return map;
} finally {
@ -880,7 +946,11 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// 租户下所有的个税扣缴义务人
List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
// 薪资核算人员信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<String> salarySobEmpFields = SalaryEntityUtil.properties(new SalarySobItemAggregateBO().buildEmpField(salarySobEmpFieldPOS), SalarySobEmpFieldDTO::getFieldName, Collectors.toList());
List<String> excludeFields = Arrays.asList("个税扣缴义务人", "部门", "姓名");
salarySobEmpFields = salarySobEmpFields.stream().filter(field -> !excludeFields.contains(field)).collect(Collectors.toList());
// 索引(用于计算进度)
int index = 0;
// 失败的数量
@ -921,20 +991,20 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// 表头
// List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
List<String> headers;
if (StringUtils.equals("importSalaryAcctResult", importType)) {
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
headers = ExcelSupport.getSheetHeader(sheet, 1);
} else {
headers = ExcelSupport.getSheetHeader(sheet, 0);
}
// } else {
// headers = ExcelSupport.getSheetHeader(sheet, 0);
// }
// 处理数值
// List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
List<Map<String, Object>> data;
if (StringUtils.equals("importSalaryAcctResult", importType)) {
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
data = ExcelParseHelper.parse2Map(sheet, 2, 1);
} else {
data = ExcelParseHelper.parse2Map(sheet, 1);
}
// } else {
// data = ExcelParseHelper.parse2Map(sheet, 1);
// }
if (CollectionUtils.isEmpty(headers)) {
throw new RuntimeException("表头为空");
@ -1002,7 +1072,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
}
} else if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(86184, "部门"), dataKey.toString())
|| StringUtils.equals(SalaryI18nUtil.getI18nLabel(86186, "手机号"), dataKey.toString())
|| StringUtils.equals(SalaryI18nUtil.getI18nLabel(86186, "工号"), dataKey.toString())) {
|| StringUtils.equals(SalaryI18nUtil.getI18nLabel(86186, "工号"), dataKey.toString())
|| salarySobEmpFields.contains(dataKey.toString())
) {
} else if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), dataKey.toString())) {
if (StringUtils.isEmpty(dataValue)) {

View File

@ -7,6 +7,7 @@ import com.engine.salary.biz.*;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.bo.SalaryArchiveBO;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
@ -21,6 +22,7 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO;
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.salaryarchive.*;
import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum;
import com.engine.salary.exception.SalaryRunTimeException;
@ -598,7 +600,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
BeanUtils.copyProperties(salaryArchive, oldSalaryArchive);
List<SalaryArchivePO> oldList = Collections.singletonList(oldSalaryArchive);
// 收入所得项目
// boolean checkIncomeCategory = saveParam.getIncomeCategory() == null || StringUtils.isEmpty(SalaryArchiveBO.getIncomeCategoryByValue(saveParam.getIncomeCategory(), currentEmployeeId, currentTenantKey));
// boolean checkIncomeCategory = saveParam.getIncomeCategory() == null || StringUtils.isEmpty(SalaryArchiveBO.getIncomeCategoryByValue(saveParam.getIncomeCategory()));
// if (checkIncomeCategory) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(122085, "收入所得项目不能为空或不存在"));
// } else {
@ -706,7 +708,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// List<SalarySobPO> salarySobList = getSalarySobList(currentEmployeeId, currentTenantKey);
// List<Long> salarySobIds = salarySobList.stream().map(SalarySobPO::getId).filter(id -> saveParam.getSalarySobIds().contains(id)).collect(Collectors.toList());
// List<SalaryArchiveSobPO> salaryArchiveSobSaveList = SalaryArchiveBO.buildSalaryArchiveSob(salaryArchive.getId(), salarySobIds, LocalDateTime.now(), currentEmployeeId, currentTenantKey);
// List<SalaryArchiveSobPO> salaryArchiveSobSaveList = SalaryArchiveBO.buildSalaryArchiveSob(salaryArchive.getId(), salarySobIds, LocalDateTime.now());
// this.salaryArchiveSobService.saveBatchBySalaryArchiveIdsAndSaves(Collections.singletonList(salaryArchive.getId()), salaryArchiveSobSaveList, currentTenantKey);
return StringUtils.EMPTY;
@ -1293,4 +1295,32 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds);
}
@Override
public List<SalaryArchivePO> listByRunStatus(List<String> list) {
return getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(list).build());
}
/**
* 同步所有档案起始发薪日期变为入职日期
*
* @return
*/
@Override
public String syncPayStartDate() {
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
Map<Long, String> empPayStartDateMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getCompanystartdate);
List<SalaryArchivePO> list = getSalaryArchiveMapper().listAll();
List<SalaryArchivePO> archives = list.stream()
.peek(archive -> {
String payStartDate = empPayStartDateMap.getOrDefault(archive.getEmployeeId(), "");
if (SalaryDateUtil.checkDay(payStartDate)) {
archive.setPayStartDate(SalaryDateUtil.dateStrToLocalDate(payStartDate));
}
})
.collect(Collectors.toList());
salaryArchiveMapper.batchUpdate(archives);
return "执行完毕";
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
@ -16,10 +17,7 @@ import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
@ -27,7 +25,6 @@ import com.engine.salary.service.*;
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.google.common.collect.Lists;
@ -100,6 +97,10 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
return ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user);
}
private SalarySobItemHideService getSalarySobItemHideService(User user) {
return ServiceUtil.getService(SalarySobItemHideServiceImpl.class, user);
}
@Override
public List<ExcelAcctResultPO> listBySalaryAcctRecordId(Long salaryAcctRecordId) {
List<ExcelAcctResultPO> excelAcctResultPOS = getExcelAcctResultMapper().listSome(ExcelAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).build());
@ -150,6 +151,10 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询薪资核算所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 过滤在账套中隐藏的薪资项目
List<Long> hideItemIds = getSalarySobItemHideService(user).listSome(SalarySobItemHidePO.builder().itemHide(1L).salarySobId(salaryAcctRecordPO.getSalarySobId()).build())
.stream().map(SalarySobItemHidePO::getSalaryItemId).collect(Collectors.toList());
salarySobItemPOS = salarySobItemPOS.stream().filter(po -> !hideItemIds.contains(po.getSalaryItemId())).collect(Collectors.toList());
// 查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
@ -173,7 +178,7 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByResultQueryParam(queryParam);
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
// 构建薪资核算结果列表表头
List<Column> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, Collections.emptySet());
List<WeaTableColumnGroup> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResultByGroup(salarySobItemAggregateDTO, Collections.emptySet());
// 构建列表数据
// 返回结果
return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(new PageInfo<>());
@ -246,7 +251,7 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
.collect(Collectors.toSet());
}
// 构建薪资核算结果列表表头
List<Column> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, excludeSalaryItemIds);
List<WeaTableColumnGroup> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResultByGroup(salarySobItemAggregateDTO, excludeSalaryItemIds);
// 返回结果
return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
}

View File

@ -39,6 +39,7 @@ import com.google.common.collect.Lists;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
@ -206,6 +207,10 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
if (StringUtils.isNotBlank(name)) {
build.setName(name);
}
if (ObjectUtils.isNotEmpty(queryParam.getTaxAgentId())) {
build.setTaxAgentId(queryParam.getTaxAgentId());
}
if (BooleanUtils.isTrue(openDevolution) && !isChief) {
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(build);
// 根据权限过滤

View File

@ -100,4 +100,9 @@ public class SalarySysConstant {
* 工资单查询限制
*/
public static final String SALARY_BILL_VIEWING_LIMIT_MONTH = "SALARY_BILL_VIEWING_LIMIT_MONTH";
/**
* 核算固定列头数
*/
public static final String SALARY_ACCT_FIXED_COLUMNS = "salaryAcctFixedColumns";
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.util;
import cn.hutool.core.util.StrUtil;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.exception.SalaryRunTimeException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -554,14 +555,18 @@ public class SalaryDateUtil {
if (StringUtils.isNotBlank(startMonth)) {
startMonth = startMonth + "-01";
Date socialStartDate = SalaryDateUtil.dateStrToLocalDate(startMonth);
if (billMonthDate.before(socialStartDate)) {
if(socialStartDate == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "年月解析异常,请检查档案中相关数据设置") + ":" + startMonth.substring(0, startMonth.length() - 3));
} else if (billMonthDate.before(socialStartDate)) {
inDataRange = false;
}
}
if (StringUtils.isNotBlank(endMonth)) {
endMonth = endMonth + "-01";
Date socialEndDate = SalaryDateUtil.dateStrToLocalDate(endMonth);
if (billMonthDate.after(socialEndDate)) {
if(socialEndDate == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "年月解析异常,请检查档案中相关数据设置") + ":" + endMonth.substring(0, endMonth.length() - 3));
} else if (billMonthDate.after(socialEndDate)) {
inDataRange = false;
}
}

View File

@ -37,8 +37,8 @@ public class SalaryPageUtil {
return pageInfo;
}
public static <T> PageInfo<T> buildPage(Integer pageNo, Integer pageSize,List<T> totalCollection) {
PageInfo<T> pageInfo = new PageInfo<>();
public static <T> PageInfo<T> buildPage(Integer pageNo, Integer pageSize, List<T> totalCollection) {
PageInfo<T> pageInfo = new PageInfo<>();
pageInfo.setTotal(totalCollection.size());
totalCollection = subList(pageNo, pageSize, totalCollection);
pageInfo.setPageNum(pageNo);
@ -90,4 +90,16 @@ public class SalaryPageUtil {
return source.subList(startIndex > source.size() ? source.size() : startIndex,
endIndex > source.size() ? source.size() : endIndex);
}
public static String selfAdaption(String chars) {
int adaption = 0;
if (chars != null) {
adaption = chars.length() * 12 + 55;
}
if (adaption < 79) {
adaption = 79;
}
return adaption + "";
}
}

View File

@ -1103,4 +1103,28 @@ public class SIAccountController {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SupplementAccountBaseParam, List<Map<String, String>>>(user).run(getSIAccountWrapper(user)::getPaymentGroup, param);
}
/**
* 获取待编辑的补差费用相关福利项
*/
@POST
@Path("/detail/getBalancePaymentGroup")
@Produces(MediaType.APPLICATION_JSON)
public String getBalancePaymentGroup(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody BalanceAccountBaseParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<BalanceAccountBaseParam, List<Map<String, String>>>(user).run(getSIAccountWrapper(user)::getBalancePaymentGroup, param);
}
/**
* 新增补差数据
*/
@POST
@Path("/detail/addNewBalance")
@Produces(MediaType.APPLICATION_JSON)
public String addNewBalance(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody BalanceAccountBaseParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<BalanceAccountBaseParam, String>(user).run(getSIAccountWrapper(user)::addNewBalance, param);
}
}

View File

@ -233,6 +233,7 @@ public class SISchemeController {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();
@ -313,6 +314,7 @@ public class SISchemeController {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();

View File

@ -714,7 +714,7 @@ public class SalaryAcctController {
@Produces(MediaType.APPLICATION_JSON)
public String listComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryComparisonResultQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryComparisonResultQueryParam, PageInfo<Map<String, Object>>>(user).run(getSalaryComparisonResultWrapper(user)::listPage, param);
return new ResponseResult<SalaryComparisonResultQueryParam, Map<String, Object>>(user).run(getSalaryComparisonResultWrapper(user)::listPage, param);
}

View File

@ -586,6 +586,19 @@ public class SalaryArchiveController {
return new ResponseResult<SalaryArchiveStopParam, String>(user).run(getSalaryArchiveWrapper(user)::stopSalary, stopSalaryParam);
}
/**
* 同步所有档案起始发薪日期变为入职日期
*
* @return
*/
@GET
@Path("/syncPayStartDate")
@Produces(MediaType.APPLICATION_JSON)
public String syncPayStartDate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Void, String>(user).run(getSalaryArchiveWrapper(user)::syncPayStartDate);
}
// ******** 薪资档案主表 end ***********************************************************************************************/
// ******** 薪资项目调整 start ***********************************************************************************************/

View File

@ -6,10 +6,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.entity.hrm.dto.HrmInfoDTO;
import com.engine.salary.entity.hrm.param.HrmQueryParam;
import com.engine.salary.entity.siaccount.dto.InsuranceCompensationDTO;
import com.engine.salary.entity.siaccount.param.CompensationParam;
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
import com.engine.salary.entity.siaccount.param.RecessionParam;
import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.service.SIBalanceService;
import com.engine.salary.service.SICompensationService;
import com.engine.salary.service.SIRecessionService;
@ -155,4 +152,17 @@ public class SIAccountWrapper extends Service {
public List<Map<String, String>> getPaymentGroup(SupplementAccountBaseParam param) {
return getSIRepairService(user).getPaymentGroup(param);
}
/**
* 获取待编辑的补差费用相关福利项
* @param param
* @return
*/
public List<Map<String, String>> getBalancePaymentGroup(BalanceAccountBaseParam param) {
return getSIBalanceService(user).getPaymentGroup(param);
}
public void addNewBalance(BalanceAccountBaseParam param) {
getSIBalanceService(user).addNewBalance(param);
}
}

View File

@ -14,6 +14,7 @@ import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
@ -66,6 +67,10 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
// private ComInfoCache comInfoCache;
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
@ -99,8 +104,11 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
// 获取流程状态 key:流程请求id value:流程状态
Map<String, String> workflowStatusMap = getWorkflowStatusMap(requestIds);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getTaxAgentId);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 转换成列表dto
List<SalaryAcctRecordListDTO> salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, workflowStatusMap);
List<SalaryAcctRecordListDTO> salaryAcctRecordListDTOS = SalaryAcctRecordBO.convert2ListDTO(list, salarySobPOS, employeeComInfos, salaryAcctEmployeeCountDTOS, salarySendCheckResult, workflowStatusMap, taxAgentPOS);
dtoPage.setList(salaryAcctRecordListDTOS);
}
// WeaTable<SalaryAcctRecordListDTO> weaTable = SalaryFormatUtil.<SalaryAcctRecordListDTO>getInstance().buildTable(SalaryAcctRecordListDTO.class, dtoPage);

View File

@ -607,7 +607,7 @@ public class SalaryArchiveWrapper extends Service {
throw new SalaryRunTimeException("薪资档案不存在!");
}
return list.stream().map(a->getFrom(a.getId())).collect(Collectors.toList());
return list.stream().map(a -> getFrom(a.getId())).collect(Collectors.toList());
}
@ -619,4 +619,13 @@ public class SalaryArchiveWrapper extends Service {
public void deleteSalaryArchive(Collection<Long> salaryArchiveIds) {
getSalaryArchiveService(user).deleteSalaryArchive(salaryArchiveIds);
}
/**
* 同步所有档案起始发薪日期变为入职日期
*
* @return
*/
public String syncPayStartDate() {
return getSalaryArchiveService(user).syncPayStartDate();
}
}

View File

@ -1,19 +1,29 @@
package com.engine.salary.wrapper;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.SalaryComparisonResultService;
import com.engine.salary.service.SalarySobEmpFieldService;
import com.engine.salary.service.SalarySobItemService;
import com.engine.salary.service.impl.SalaryComparisonResultServiceImpl;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.util.page.PageInfo;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.engine.salary.sys.constant.SalarySysConstant.SALARY_ACCT_FIXED_COLUMNS;
/**
* 薪资核算线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
@ -28,6 +38,10 @@ public class SalaryComparisonResultWrapper extends Service {
private SalaryComparisonResultService getSalaryComparisonResultService(User user) {
return (SalaryComparisonResultService) ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user);
}
private SalarySysConfMapper getSalarySysConfMapper() {
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
}
private SalaryAcctRecordService salaryAcctRecordService;
@ -41,13 +55,29 @@ public class SalaryComparisonResultWrapper extends Service {
* @param queryParam 列表查询条件
* @return
*/
public PageInfo<Map<String, Object>> listPage(SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算线下对比列表
public Map<String, Object> listPage(SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算线下对比列表(不包含隐藏薪资项目)
SalaryComparisonResultListDTO salaryComparisonResultListDTO = getSalaryComparisonResultService(user).listPageByParam(queryParam);
PageInfo<Map<String, Object>> pageInfo = salaryComparisonResultListDTO.getData();
pageInfo.setColumns(salaryComparisonResultListDTO.getWeaTableColumns());
return pageInfo;
List<WeaTableColumnGroup> weaTableColumns = salaryComparisonResultListDTO.getWeaTableColumns();
// 获取固定列头数
SalarySysConfPO salaryAcctFixedColumns = getSalarySysConfMapper().getOneByCode(SALARY_ACCT_FIXED_COLUMNS);
if (ObjectUtils.isNotEmpty(salaryAcctFixedColumns)) {
int fixedNum = NumberUtils.isCreatable(salaryAcctFixedColumns.getConfValue()) ? Integer.valueOf(salaryAcctFixedColumns.getConfValue()) : 3;
if (fixedNum == 0) {
fixedNum = 3;
}
for (int i = 0; i < fixedNum; i++) {
weaTableColumns.get(i).setFixed("left");
}
}
Map<String, Object> datas = new HashMap<>();
datas.put("pageInfo", pageInfo);
datas.put("columns", weaTableColumns);
return datas;
}
}