Merge branch 'release/个税版本' 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-08 13:34:34 +08:00
commit f73cab0ca1
59 changed files with 2520 additions and 298 deletions

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

@ -0,0 +1,31 @@
package com.engine.salary.entity.employeedeclare.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 同步入职日期参数
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EmployeeDeclareSyncStartDateParam {
// 个税扣缴义务人id
@DataCheck(require = true, message = "参数错误个税扣缴义务人id不能为空")
private Long taxAgentId;
// 税款所属期
@DataCheck(require = true, message = "参数错误,税款所属期参数格式错误")
private Date taxCycle;
}

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.salaryaccounting.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 -> {
SalarySobPO salarySobPO = salarySobMap.get(salaryAcctRecordPO.getSalarySobId());
@ -98,6 +99,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,6 @@ 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.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
@ -86,36 +85,77 @@ 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;
}

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

@ -18,4 +18,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

@ -96,8 +96,8 @@ public class TaxAgentTaxReturnBO {
requestMap.put("djxhid", taxAgentTaxReturn.getTaxRegistrationNumber());
requestMap.put("nsrsbh", taxAgentTaxReturn.getTaxCode());
requestMap.put("areaid", taxAgentTaxReturn.getAreaCode());
requestMap.put("bmbh", "");
requestMap.put("bmmc", "");
requestMap.put("bmbh", taxAgentTaxReturn.getDepartmentCode());
requestMap.put("bmmc", taxAgentTaxReturn.getDepartmentName());
return requestMap;
}

View File

@ -43,7 +43,7 @@ public class QueryAccountBalanceResponse {
/**
* 税号
*/
private String taxNumber;
private String taxNum;
/**
* 已使用流量
*/

View File

@ -0,0 +1,44 @@
package com.engine.salary.maintainer.EmployeeDeclare;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareSyncStartDateParam;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.valid.ValidUtil;
import weaver.hrm.User;
public class EmployeeDeclareManager extends Service {
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
private ExtEmpService getExtEmpService(User user) {
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryCacheService getSalaryCacheService(User user) {
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
/**
* 同步任职受雇日期为入职日期
*
* @return
*/
public String syncEmploymentDate(EmployeeDeclareSyncStartDateParam param) {
ValidUtil.doValidator(param);
return getEmployeeDeclareService(user).syncEmploymentDate(param);
}
}

View File

@ -1,11 +1,14 @@
package com.engine.salary.maintainer;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareSyncStartDateParam;
import com.engine.salary.maintainer.EmployeeDeclare.EmployeeDeclareManager;
import com.engine.salary.maintainer.datacollection.AddUpSituationManager;
import com.engine.salary.maintainer.salaryacct.SalaryAcctManager;
import com.engine.salary.maintainer.salaryacct.SalaryAcctSupplementParam;
import com.engine.salary.maintainer.salaryarchive.SalaryArchiveManager;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryDateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.HrmUserVarify;
@ -16,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Arrays;
@ -45,6 +49,10 @@ public class MaintainerController {
return ServiceUtil.getService(SalaryArchiveManager.class, user);
}
private EmployeeDeclareManager getEmployeeDeclareManager(User user) {
return ServiceUtil.getService(EmployeeDeclareManager.class, user);
}
//---------------------------薪资核算 start ------------------------------------
/**
@ -108,4 +116,32 @@ public class MaintainerController {
return new ResponseResult<String, Boolean>(user).run(getSalaryArchiveManager(user)::initPayStartDate);
}
/**
* 同步所有档案起始发薪日期变为入职日期
*
* @return
*/
@GET
@Path("/salaryArchive/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(getSalaryArchiveManager(user)::syncPayStartDate);
}
/**
* 同步任职受雇日期为入职日期
*
* @return
*/
@GET
@Path("/employeedeclare/syncEmploymentDate")
@Produces(MediaType.APPLICATION_JSON)
public String syncEmploymentDate(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "taxAgentId") Long taxAgentId, @QueryParam(value = "taxCycle")String taxCycle) {
User user = HrmUserVarify.getUser(request, response);
EmployeeDeclareSyncStartDateParam param = EmployeeDeclareSyncStartDateParam.builder().taxAgentId(taxAgentId).taxCycle(SalaryDateUtil.stringToDate(taxCycle)).build();
return new ResponseResult<EmployeeDeclareSyncStartDateParam, String>(user).run(getEmployeeDeclareManager(user)::syncEmploymentDate,param);
}
}

View File

@ -61,4 +61,15 @@ public class SalaryArchiveManager extends Service {
return null;
}
/**
* 同步所有档案起始发薪日期变为入职日期
*
* @return
*/
public String syncPayStartDate() {
return getSalaryArchiveService(user).syncPayStartDate();
}
}

View File

@ -639,7 +639,7 @@
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO">
@ -730,9 +730,7 @@
<if test="employmentDate != null">
employment_date=#{employmentDate},
</if>
<if test="dismissDate != null">
dismiss_date=#{dismissDate},
</if>
dismiss_date=#{dismissDate},
<if test="disability != null">
disability=#{disability},
</if>

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

@ -147,7 +147,7 @@
</foreach>
</if>
<if test="taxCodes != null and taxCodes.size()>0">
AND taxCode IN
AND tax_code IN
<foreach collection="taxCodes" open="(" item="taxCode" separator="," close=")">
#{taxCode}
</foreach>

View File

@ -0,0 +1,31 @@
package com.engine.salary.remote.tax.client;
import com.engine.salary.util.HttpUtil;
import com.engine.salary.util.SingnatureData;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class DeclareClient extends TaxBaseClient{
public DeclareClient(Long taxAgentId) {
super(taxAgentId);
}
/**
* 申报内置算税结果查询
* @param requestId·
* @return
*/
public Object getDeclareTaxResultFeedback(String requestId){
// 供应商信息
String url = super.apiConfig.getHost() + "/gateway/iit/report/getDeclareTaxResultFeedback";
Map<String, String> params = new HashMap<>(1);
params.put("requestId", requestId);
Map<String, String> header = SingnatureData.initHeader(Collections.emptyMap(), apiConfig.getAppKey(), apiConfig.getAppSecret());
String res = HttpUtil.getRequest(url, header, params);
return res;
}
}

View File

@ -0,0 +1,54 @@
package com.engine.salary.service;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* @description: 人员报送人员导入导出
* @author: xiajun
* @modified By: xiajun
* @date: Created in 9/5/22 10:22 AM
* @version:v1.0
*/
public interface EmployeeDeclareExcelService {
/**
* 导出下载模板
*
* @param importParam
* @return
*/
// Map<String, Object> exportTemplate(EmployeeDeclareImportParam importParam);
/**
* 导出人员信息采集-全部
*
* @param queryParam
* @return
*/
XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam);
// /**
// * 导出人员信息采集-本月新增
// *
// * @param queryParam
// * @return
// */
// XSSFWorkbook export4Add(EmployeeDeclareAddListQueryParam queryParam);
//
// /**
// * 导出人员信息采集-本月信息变动
// *
// * @param queryParam
// * @return
// */
// XSSFWorkbook export4Update(EmployeeDeclareListQueryParam queryParam);
//
// /**
// * 导出人员信息采集-本月报送失败
// *
// * @param queryParam
// * @return
// */
// XSSFWorkbook export4Fail(EmployeeDeclareFailListQueryParam queryParam);
}

View File

@ -175,4 +175,11 @@ public interface EmployeeDeclareService{
* @param param
*/
void getDeclareFeedback(EmployeeDeclareParam param, EmployeeDeclareRateDTO employeeDeclareRate);
/**
* 同步任职受雇日期为入职日期
*
* @return
*/
String syncEmploymentDate(EmployeeDeclareSyncStartDateParam param);
}

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

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

View File

@ -131,6 +131,14 @@ public interface TaxDeclareRecordService {
*/
void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate);
/**
* 申报内置算税结果查询
* @param id
* @return
*/
Object getDeclareTaxResultFeedback(Long id);
/**
* 作废
*

View File

@ -134,7 +134,21 @@ public abstract class AbstractTaxAgentTaxReturnCheckService extends Service impl
for (int i = 1; i <= registerInfos.size(); i++) {
CompanyRegisterInfoResponse.CompanyRegisterInfo registerInfo = registerInfos.get(i - 1);
SalaryAssert.notNull(registerInfo.getFbmba(), "税局接口异常,请稍后重试");
TaxAgentTaxReturnCheckFormDTO checkFormDTO = TaxAgentTaxReturnCheckFormDTO.builder().taxAgentName(registerInfo.getQymc()).taxAgentId(saveParam.getTaxAgentId()).taxCode(saveParam.getTaxCode()).businessAddress(registerInfo.getScjydz()).legalPersonName(registerInfo.getFrxm()).mobile(registerInfo.getLxdh()).industryName(registerInfo.getHymc()).taxAuthorities(registerInfo.getZgswjgmc()).taxBranch(registerInfo.getZgswjgskmc()).taxRegistrationNumber(registerInfo.getDjxhid()).divideFiling(SalaryOnOffEnum.parseByValue(Integer.parseInt(registerInfo.getFbmba()))).index((long) i).build();
TaxAgentTaxReturnCheckFormDTO checkFormDTO = TaxAgentTaxReturnCheckFormDTO
.builder()
.taxAgentName(registerInfo.getQymc())
.taxAgentId(saveParam.getTaxAgentId())
.taxCode(saveParam.getTaxCode())
.businessAddress(registerInfo.getScjydz())
.legalPersonName(registerInfo.getFrxm())
.mobile(registerInfo.getLxdh())
.industryName(registerInfo.getHymc())
.taxAuthorities(registerInfo.getZgswjgmc())
.taxBranch(registerInfo.getZgswjgskmc())
.taxRegistrationNumber(registerInfo.getDjxhid())
.divideFiling(SalaryOnOffEnum.parseByValue(Integer.parseInt(registerInfo.getFbmba())))
.index((long) i)
.build();
checkFormDTOList.add(checkFormDTO);
}
return checkFormDTOList;

View File

@ -0,0 +1,649 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareListDTO;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.service.EmployeeDeclareExcelService;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.excel.ExcelUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: 人员报送人员导入导出
* @author: xiajun
* @modified By: xiajun
* @date: Created in 9/7/22 5:39 PM
* @version:v1.0
*/
@Slf4j
public class EmployeeDeclareExcelServiceImpl extends Service implements EmployeeDeclareExcelService {
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
// private ExtEmployeeService extEmployeeService;
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
// @Override
// public Map<String, Object> exportTemplate( EmployeeDeclareImportParam importParam) {
// String tenantKey = simpleEmployee.getTenantKey();
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
// // 查询人员
// List<EmployeeDeclarePO> employeeDeclares = Collections.emptyList();
// if (StringUtils.equalsIgnoreCase(importParam.getExportData(), "true")) {
// employeeDeclares = getEmployeeDeclareService(user).listByParam(importParam);
// }
// String yesI18 = SalaryI18nUtil.getI18nLabel( 84967, "");
// String noI18 = SalaryI18nUtil.getI18nLabel( 84968, "");
// List<List<Object>> rows = Lists.newArrayList();
// for (EmployeeDeclarePO employeeDeclare : employeeDeclares) {
// EmploymentStatusEnum employmentStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentStatus(), EmploymentStatusEnum.class);
// EmploymentTypeEnum employmentTypeEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentType(), EmploymentTypeEnum.class);
// List<Object> row = Lists.newArrayList();
// row.add(employeeDeclare.getJobNum());
// row.add(employeeDeclare.getEmployeeName());
// row.add(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel());
// row.add(employeeDeclare.getCardNum());
// row.add(employmentStatusEnum == null ? "" : employmentStatusEnum.getDefaultLabel());
// row.add(employmentTypeEnum == null ? "" : employmentTypeEnum.getDefaultLabel());
// row.add(employeeDeclare.getEmploymentFirstYear());
// row.add(employeeDeclare.getMobile());
// row.add(Util.null2String(employeeDeclare.getEmploymentDate()));
// row.add(Util.null2String(employeeDeclare.getDismissDate()));
// row.add(Objects.equals(employeeDeclare.getDisability(), 1) ? yesI18 : noI18);
// row.add(employeeDeclare.getDisabilityCardNo());
// row.add(Objects.equals(employeeDeclare.getMartyrDependents(), 1) ? yesI18 : noI18);
// row.add(employeeDeclare.getMartyrDependentsCardNo());
// row.add(Objects.equals(employeeDeclare.getLonelyOld(), 1) ? yesI18 : noI18);
// row.add(Objects.equals(employeeDeclare.getDeductExpenses(), 1) ? yesI18 : noI18);
// rows.add(row);
// }
// // 组装excel导出数据
// String[] headers = getImportHeader(currentEmployeeId, tenantKey).toArray(new String[0]);
// ExcelSheetData excelSheetData = new ExcelSheetData();
// excelSheetData.setSheetName(SalaryI18nUtil.getI18nLabel( 156425, "人员信息采集"));
// excelSheetData.setHeaders(Collections.singletonList(headers));
// excelSheetData.setRows(rows);
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
// .fileName(SalaryI18nUtil.getI18nLabel( 156424, "人员信息采集导入模板") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
// .dataType(SalaryI18nUtil.getI18nLabel( 156424, "人员信息采集导入模板"))
// .function(excelExportParam.getFunction())
// .handlerName("exportEmployeeDeclareTemplate")
// .flag(true)
// .bizId(excelExportParam.getBiz())
// .module(excelExportParam.getModule())
// .userId(simpleEmployee.getEmployeeId())
// .tenantKey(simpleEmployee.getTenantKey())
// .operator(simpleEmployee.getUsername())
// .eteamsId(TenantRpcContext.getEteamsId())
// .build();
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
// }
//
// @BatchExportHandler("exportEmployeeDeclareTemplate")
// private void exportEmployeeDeclareTemplate() {
// BatchCallbackMessage message = BatchExportContext.getBatchCallbackMessage();
// log.info("导出结束:{}", JsonUtil.toJsonString(message));
// }
@Override
public XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam) {
// 查询需要报送的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByParam(queryParam);
// 转换成dto
List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
// 需要导出的数据
List<List<Object>> excelSheetData = getExcelSheetData(EmployeeDeclareListDTO.class, dtoList);
return ExcelUtil.genWorkbookV2(excelSheetData, "人员信息采集");
}
// @Override
// public XSSFWorkbook export4Add(EmployeeDeclareAddListQueryParam queryParam) {
// String tenantKey = simpleEmployee.getTenantKey();
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
// // 查询需要报送的人员
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).list4AddByParam(queryParam);
// // 转换成dto
// List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
// // 需要导出的数据
// ExcelSheetData excelSheetData = getExcelSheetData(EmployeeDeclareListDTO.class, dtoList);
// CustomExportUtil.customColumnsBuild(false, queryParam.getCustomColumns(), excelSheetData);
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
// .fileName(SalaryI18nUtil.getI18nLabel(156426, "人员信息采集本月新增") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
// .dataType(SalaryI18nUtil.getI18nLabel(156426, "人员信息采集本月新增"))
// .function(excelExportParam.getFunction())
// .handlerName("exportEmployeeDeclare4Add")
// .flag(true)
// .bizId(excelExportParam.getBiz())
// .module(excelExportParam.getModule())
// .userId(simpleEmployee.getEmployeeId())
// .tenantKey(simpleEmployee.getTenantKey())
// .operator(simpleEmployee.getUsername())
// .eteamsId(TenantRpcContext.getEteamsId())
// .build();
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
// }
//
// @BatchExportHandler("exportEmployeeDeclare4Add")
// private void exportEmployeeDeclare4Add() {
// BatchCallbackMessage message = BatchExportContext.getBatchCallbackMessage();
// log.info("导出结束:{}", JsonUtil.toJsonString(message));
// }
//
// @Override
// public XSSFWorkbook export4Update(EmployeeDeclareListQueryParam queryParam) {
// String tenantKey = simpleEmployee.getTenantKey();
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
// // 查询需要报送的人员
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).list4UpdateByParam(queryParam);
// // 转换成dto
// List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
// // 需要导出的数据
// ExcelSheetData excelSheetData = getExcelSheetData(EmployeeDeclareListDTO.class, dtoList);
// CustomExportUtil.customColumnsBuild(false, queryParam.getCustomColumns(), excelSheetData);
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
// .fileName(SalaryI18nUtil.getI18nLabel(156427, "人员信息采集本月信息变动") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
// .dataType(SalaryI18nUtil.getI18nLabel(156427, "人员信息采集本月信息变动"))
// .function(excelExportParam.getFunction())
// .handlerName("exportEmployeeDeclare4Update")
// .flag(true)
// .bizId(excelExportParam.getBiz())
// .module(excelExportParam.getModule())
// .userId(simpleEmployee.getEmployeeId())
// .tenantKey(simpleEmployee.getTenantKey())
// .operator(simpleEmployee.getUsername())
// .eteamsId(TenantRpcContext.getEteamsId())
// .build();
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
// }
//
// @BatchExportHandler("exportEmployeeDeclare4Update")
// private void exportEmployeeDeclare4Update() {
// BatchCallbackMessage message = BatchExportContext.getBatchCallbackMessage();
// log.info("导出结束:{}", JsonUtil.toJsonString(message));
// }
//
// @Override
// public XSSFWorkbook export4Fail(EmployeeDeclareFailListQueryParam queryParam) {
// String tenantKey = simpleEmployee.getTenantKey();
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
// // 查询需要报送的人员
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).list4FailByParam(queryParam);
// // 转换成dto
// List<EmployeeDeclareFailListDTO> dtos = getEmployeeDeclareService(user).convert2FailListDTO(employeeDeclares);
// // 需要导出的数据
// ExcelSheetData excelSheetData = getExcelSheetData(EmployeeDeclareFailListDTO.class, dtos);
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
// .fileName(SalaryI18nUtil.getI18nLabel(156428, "人员信息采集本月报送失败") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
// .dataType(SalaryI18nUtil.getI18nLabel(156428, "人员信息采集本月报送失败"))
// .function(excelExportParam.getFunction())
// .handlerName("exportEmployeeDeclare4Fail")
// .flag(true)
// .bizId(excelExportParam.getBiz())
// .module(excelExportParam.getModule())
// .userId(simpleEmployee.getEmployeeId())
// .tenantKey(simpleEmployee.getTenantKey())
// .operator(simpleEmployee.getUsername())
// .eteamsId(TenantRpcContext.getEteamsId())
// .build();
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
// }
private <T> List<List<Object>> getExcelSheetData(Class<T> clazz, List<T> dtoList) {
// 导出的表头
Map<String, List<Object>> headerMap = getHeader(clazz);
// 导出的数据
List<List<Object>> rows = new ArrayList<>();
rows.add(headerMap.get("header"));
dtoList.forEach(dto -> {
Map<String, Object> map = JsonUtil.parseMap(dto, Object.class);
List<Object> row = Lists.newArrayListWithExpectedSize(headerMap.get("dataIndex").size());
headerMap.get("dataIndex").forEach(dataIndex -> row.add(map.get(dataIndex)));
rows.add(row);
});
return rows;
}
//
// @Transactional(rollbackFor = Exception.class)
// @BatchImportHandler("importEmployeeDeclare")
// public void importEmployeeDeclare() {
// BatchDocumentMessage message = BatchImportContext.getBatchDocumentMessage();
// Long employeeId = message.getUserId();
// String tenantKey = message.getTenantKey();
// try {
// LocalDateTime now = LocalDateTime.now();
// Map<String, Object> paramMap = JsonUtil.parseMap(message.getUploadSet().getCustomData(), Object.class);
// // 个税扣缴义务人id
// Long taxAgentId = Util.getLongValue(Util.null2String(paramMap.get("taxAgentId")));
// TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxAgentId, employeeId, tenantKey);
// if (taxAgent == null) {
// salaryBatchService.sendImportCallBackInfo(message, SalaryI18nUtil.getI18nLabel(employeeId, 187469, "参数错误,无法找到个税扣缴义务人"));
// return;
// }
// // 税款所属期
// String taxCycle = Util.null2String(paramMap.get("taxCycle"));
// if (!SalaryDateUtil.checkYearMonth(taxCycle)) {
// salaryBatchService.sendImportCallBackInfo(message, SalaryI18nUtil.getI18nLabel(employeeId, 156384, "参数错误,税款所属期参数格式错误"));
// return;
// }
//
// // 导出模板中的表头
// List<String> headerList = getImportHeader(employeeId, tenantKey);
// // 查询所有的人员
// List<Long> orgEmployeeIds = hrmCommonEmployeeService.getAllEmployee(tenantKey);
// List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(orgEmployeeIds, tenantKey);
// // 查询所有的外部人员
// List<ExtEmployeePO> extEmployees = extEmployeeService.listAll(tenantKey);
// // 查询人员报送表的人员
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentId(YearMonth.parse(taxCycle),
// taxAgentId, tenantKey);
// // 校验字段
// String checkType = Util.null2String(paramMap.getOrDefault("checkType", "jobNum"));
// Map<String, ExtEmployeePO> extEmployeeMap = Maps.newHashMap();
// Map<String, SimpleEmployee> simpleEmployeeMap = Maps.newHashMap();
// Map<String, EmployeeDeclarePO> employeeDeclareMap = Maps.newHashMapWithExpectedSize(employeeDeclares.size());
// if (Objects.equals(checkType, "jobNum")) {
// extEmployeeMap = Collections.emptyMap();
// simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getJobNum);
// employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getJobNum);
// } else {
// // 查询所有人员的个人信息
// List<SimpleUserInfo> simpleUserInfos = getSalaryEmployeeService(user).listByEmployeeIds(orgEmployeeIds, tenantKey);
// Map<Long, SimpleEmployee> idKeySimpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getId);
// for (SimpleUserInfo simpleUserInfo : simpleUserInfos) {
// if (idKeySimpleEmployeeMap.containsKey(simpleUserInfo.getEmployeeId())) {
// simpleEmployeeMap.put(simpleUserInfo.getIdNo(), idKeySimpleEmployeeMap.get(simpleUserInfo.getEmployeeId()));
// }
// }
// extEmployeeMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getCardNum);
// employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getCardNum);
//
// }
// // 需要新增的报送人员
// List<EmployeeDeclarePO> needAddEmployeeDeclares = Lists.newArrayList();
// // 需要更新的报送人员
// List<EmployeeDeclarePO> needUpdateEmployeeDeclares = Lists.newArrayList();
// // 索引(用于计算进度)
// int index = 0;
// // 失败的数量
// int failCount = 0;
// // 成功的数量
// int successCount = 0;
// // 错误行的索引
// int failRowIndex = 1;
// // 包含错误提示信息的sheet页
// List<ExcelSheet> errorExcelSheets = Lists.newArrayList();
// for (ExcelSheet excelSheet : message.getBatchFile().getExcelSheets()) {
// if (CollectionUtils.isEmpty(excelSheet.getHeader())) {
// continue;
// }
// // 表头
// List<String> headers = excelSheet.getHeader().stream()
// .map(m -> Util.null2String(m.get("key")))
// .collect(Collectors.toList());
// // 检查表头
// boolean isCorrectHeader = checkHeader(message, headers, headerList);
// if (!isCorrectHeader) {
// return;
// }
// // 表头每一列的位置
// Map<String, Integer> columnIndexMap = Maps.newHashMap();
// for (int i = 0; i < headers.size(); i++) {
// columnIndexMap.put(headers.get(i), i);
// }
// // 数据
// List<Map<String, Object>> data = excelSheet.getData();
// if (CollectionUtils.isEmpty(data)) {
// continue;
// }
// // 错误提示信息
// List<ExcelComment> excelComments = Lists.newArrayList();
// // 存在错误的那行数据
// List<Map<String, Object>> errorData = Lists.newArrayList();
// for (int i = 0; i < data.size(); i++) {
// Map<String, Object> map = data.get(i);
// // 数据是否存在错误
// boolean isError = false;
// EmployeeDeclareExcelDTO employeeDeclareExcel = new EmployeeDeclareExcelDTO();
// for (String dataKey : getImportHeader(employeeId, tenantKey)) {
// Integer j = columnIndexMap.get(dataKey);
// String dataValue = Util.null2String(map.get(dataKey));
// if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 86317, "工号"))) {
// if (StringUtils.equals(checkType, "jobNum") && StringUtils.isEmpty(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 136250, "工号不能为空"), failRowIndex, failRowIndex, j, j);
// }
// employeeDeclareExcel.setJobNum(dataValue);
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 85429, "姓名"))) {
// if (StringUtils.isEmpty(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 102838, "姓名不能为空"), failRowIndex, failRowIndex, j, j);
// } else {
// employeeDeclareExcel.setEmployeeName(dataValue);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 105139, "证件类型"))) {
// employeeDeclareExcel.setCardType(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getValue());
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 86318, "证件号码"))) {
// if (StringUtils.isEmpty(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156386, "证件号码不能为空"), failRowIndex, failRowIndex, j, j);
// } else if (!SalaryCardUtil.checkIdNum(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156429, "证件号码格式不正确"), failRowIndex, failRowIndex, j, j);
// } else {
// employeeDeclareExcel.setCardNum(dataValue);
// employeeDeclareExcel.setGender(SalaryCardUtil.judgeGender(dataValue).getValue());
// employeeDeclareExcel.setBirthday(SalaryCardUtil.judgeBirthday(dataValue));
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156394, "人员状态"))) {
// boolean legalDataValue = false;
// for (EmploymentStatusEnum employmentStatusEnum : EmploymentStatusEnum.values()) {
// if (StringUtils.equals(dataValue, employmentStatusEnum.getDefaultLabel())) {
// legalDataValue = true;
// employeeDeclareExcel.setEmploymentStatus(employmentStatusEnum.getValue());
// break;
// }
// }
// if (!legalDataValue) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156430, "人员状态只能填写正常或非正常"), failRowIndex, failRowIndex, j, j);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156396, "任职受雇从业类型"))) {
// boolean legalDataValue = false;
// for (EmploymentTypeEnum employmentTypeEnum : EmploymentTypeEnum.values()) {
// if (StringUtils.equals(dataValue, employmentTypeEnum.getDefaultLabel())) {
// legalDataValue = true;
// employeeDeclareExcel.setEmploymentType(employmentTypeEnum.getValue());
// break;
// }
// }
// if (!legalDataValue) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156431, "任职受雇从业类型填写错误"), failRowIndex, failRowIndex, j, j);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 187374, "入职年度就业情形"))) {
// employeeDeclareExcel.setEmploymentFirstYear(dataValue);
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 98621, "手机号码"))) {
// if (StringUtils.isEmpty(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 106429, "手机号码不能为空"), failRowIndex, failRowIndex, j, j);
// } else if (!SalaryCardUtil.checkMobile(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 160510, "手机号码格式不正确"), failRowIndex, failRowIndex, j, j);
// } else {
// employeeDeclareExcel.setMobile(dataValue);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156409, "任职受雇从业日期"))) {
// if (StringUtils.isEmpty(dataValue)) {
// if (!Objects.equals(employeeDeclareExcel.getEmploymentType(), EmploymentTypeEnum.OTHER.getValue())) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 160511, "任职受雇从业类型不为「其他」时,任职受雇从业日期为必填"), failRowIndex, failRowIndex, j, j);
// }
// } else {
// if (!SalaryDateUtil.checkDay(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156432, "日期格式不正确"), failRowIndex, failRowIndex, j, j);
// } else {
// employeeDeclareExcel.setEmploymentDate(LocalDate.parse(dataValue));
// }
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 95228, "离职日期"))) {
// if (StringUtils.isEmpty(dataValue)) {
// if (Objects.equals(employeeDeclareExcel.getEmploymentStatus(), EmploymentStatusEnum.ABNORMAL.getValue())) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 160512, "人员状态为非正常时,离职日期必填"), failRowIndex, failRowIndex, j, j);
// }
// } else {
// if (!SalaryDateUtil.checkDay(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156432, "日期格式不正确"), failRowIndex, failRowIndex, j, j);
// } else {
// employeeDeclareExcel.setDismissDate(LocalDate.parse(dataValue));
// }
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156399, "是否残疾"))) {
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
// employeeDeclareExcel.setDisability(SalaryOnOffEnum.ON.getValue());
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
// employeeDeclareExcel.setDisability(SalaryOnOffEnum.OFF.getValue());
// } else {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156433, "是否残疾只能填写是与否"), failRowIndex, failRowIndex, j, j);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156412, "残疾证号"))) {
// if (StringUtils.isEmpty(dataValue)) {
// if (Objects.equals(employeeDeclareExcel.getDisability(), SalaryOnOffEnum.ON.getValue())) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 160513, "「是否残疾」填「是」时,残疾证号必填"), failRowIndex, failRowIndex, j, j);
// }
// } else {
// employeeDeclareExcel.setDisabilityCardNo(dataValue);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 187385, "是否烈属"))) {
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
// employeeDeclareExcel.setMartyrDependents(SalaryOnOffEnum.ON.getValue());
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
// employeeDeclareExcel.setMartyrDependents(SalaryOnOffEnum.OFF.getValue());
// } else {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156433, "是否烈属只能填写是与否"), failRowIndex, failRowIndex, j, j);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156413, "烈属证号"))) {
// if (StringUtils.isEmpty(dataValue)) {
// if (Objects.equals(employeeDeclareExcel.getMartyrDependents(), SalaryOnOffEnum.ON.getValue())) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 160514, "「是否烈属」填「是」时,烈属证号必填"), failRowIndex, failRowIndex, j, j);
// }
// } else {
// employeeDeclareExcel.setMartyrDependentsCardNo(dataValue);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156400, "是否孤老"))) {
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
// employeeDeclareExcel.setLonelyOld(SalaryOnOffEnum.ON.getValue());
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
// employeeDeclareExcel.setLonelyOld(SalaryOnOffEnum.OFF.getValue());
// } else {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156434, "是否孤老只能填写是与否"), failRowIndex, failRowIndex, j, j);
// }
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(employeeId, 156402, "是否扣除减除费用"))) {
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
// employeeDeclareExcel.setDeductExpenses(SalaryOnOffEnum.ON.getValue());
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
// employeeDeclareExcel.setDeductExpenses(SalaryOnOffEnum.OFF.getValue());
// } else {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156435, "是否扣除减除费用只能填写是与否"), failRowIndex, failRowIndex, j, j);
// }
// }
// }
// if (!isError) {
// if (StringUtils.equals(checkType, "jobNum")) {
// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(employeeDeclareExcel.getJobNum());
// if (employeeDeclare == null) {
// ExtEmployeePO extEmployee = extEmployeeMap.get(employeeDeclareExcel.getJobNum());
// SimpleEmployee simpleEmployee = simpleEmployeeMap.get(employeeDeclareExcel.getJobNum());
// if (extEmployee == null && simpleEmployee == null) {
// isError = true;
// String jobNumI18 = SalaryI18nUtil.getI18nLabel(employeeId, 86317, "工号");
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156436, "系统内的人员不存在该工号"), failRowIndex, failRowIndex, headers.indexOf(jobNumI18), headers.indexOf(jobNumI18));
// } else {
// needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
// employeeDeclareExcel, taxAgentId, taxCycle, now, employeeId, tenantKey));
// }
// } else {
// EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
// BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
// BeanUtils.copyProperties(employeeDeclareExcel, newEmployeeDeclare);
// newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1)
// .setUpdateTime(now);
// needUpdateEmployeeDeclares.add(newEmployeeDeclare);
// if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
// newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
// newEmployeeDeclare.setDeclareErrorMsg("");
// }
// }
// } else {
// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(employeeDeclareExcel.getCardNum());
// if (employeeDeclare == null) {
// ExtEmployeePO extEmployee = extEmployeeMap.get(employeeDeclareExcel.getCardNum());
// SimpleEmployee simpleEmployee = simpleEmployeeMap.get(employeeDeclareExcel.getCardNum());
// if (extEmployee == null && simpleEmployee == null) {
// isError = true;
// String cardNoI18 = SalaryI18nUtil.getI18nLabel(employeeId, 86318, "证件号码");
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(employeeId, 156437, "系统内的人员不存在该证件号码"), failRowIndex, failRowIndex, headers.indexOf(cardNoI18), headers.indexOf(cardNoI18));
// } else {
// needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
// employeeDeclareExcel, taxAgentId, taxCycle, now, employeeId, tenantKey));
// }
// } else {
// EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
// BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
// BeanUtils.copyProperties(employeeDeclareExcel, newEmployeeDeclare);
// newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1)
// .setUpdateTime(now);
// if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
// newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
// newEmployeeDeclare.setDeclareErrorMsg("");
// }
// needUpdateEmployeeDeclares.add(newEmployeeDeclare);
// }
// }
// }
// if (isError) {
// failCount++;
// failRowIndex++;
// errorData.add(map);
// continue;
// }
// successCount++;
// }
// // 如果sheet包含错误数据
// if (CollectionUtils.isNotEmpty(errorData)) {
// salaryBatchService.createErrorExcelSheet(excelSheet.getHeader(), errorData, excelSheet.getName(), excelComments, errorExcelSheets);
// }
// }
// if (CollectionUtils.isNotEmpty(needAddEmployeeDeclares)) {
// getEmployeeDeclareService(user).saveBatch(needAddEmployeeDeclares);
// }
// if (CollectionUtils.isNotEmpty(needUpdateEmployeeDeclares)) {
// getEmployeeDeclareService(user).updateBatchById(needUpdateEmployeeDeclares);
// }
// // 发送导入回调信息
// salaryBatchService.sendImportCallBackInfo(message, successCount, failCount, errorExcelSheets);
// } catch (Exception e) {
// log.error("人员报送信息导入失败:{}", e.getMessage(), e);
// salaryBatchService.sendImportCallBackInfo(message, SalaryI18nUtil.getI18nLabel(employeeId, 156438, "人员报送信息导入失败:") + e.getMessage());
// }
// }
//
// private EmployeeDeclarePO buildEmployeeDeclare(ExtEmployeePO extEmployee,
// EmployeeDeclareExcelDTO employeeDeclareExcel, Long taxAgentId,
// String taxCycle, LocalDateTime now, Long employeeId, String tenantKey) {
// EmployeeDeclarePO employeeDeclare = new EmployeeDeclarePO()
// .setId(IdGenerator.generate())
// .setTaxAgentId(taxAgentId)
// .setTaxCycle(taxCycle)
// .setTenantKey(tenantKey)
// .setCreator(employeeId)
// .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue())
// .setCreateTime(now)
// .setUpdateTime(now);
// BeanUtils.copyProperties(employeeDeclareExcel, employeeDeclare);
// if (extEmployee != null) {
// employeeDeclare.setEmployeeId(extEmployee.getId())
// .setEmployeeType(EmployeeTypeEnum.EXT_EMPLOYEE.getValue());
// }
// if (simpleEmployee != null) {
// employeeDeclare.setEmployeeId(simpleEmployee.getEmployeeId())
// .setEmployeeType(EmployeeTypeEnum.ORGANIZATION.getValue());
// }
// return employeeDeclare;
// }
//
// private List<String> getImportHeader(Long employeeId, String tenantKey) {
// return Lists.newArrayList(
// SalaryI18nUtil.getI18nLabel(employeeId, 86317, "工号"),
// SalaryI18nUtil.getI18nLabel(employeeId, 85429, "姓名"),
// SalaryI18nUtil.getI18nLabel(employeeId, 105139, "证件类型"),
// SalaryI18nUtil.getI18nLabel(employeeId, 86318, "证件号码"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156394, "人员状态"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156396, "任职受雇从业类型"),
// SalaryI18nUtil.getI18nLabel(employeeId, 187374, "入职年度就业情形"),
// SalaryI18nUtil.getI18nLabel(employeeId, 98621, "手机号码"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156409, "任职受雇从业日期"),
// SalaryI18nUtil.getI18nLabel(employeeId, 95228, "离职日期"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156399, "是否残疾"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156412, "残疾证号"),
// SalaryI18nUtil.getI18nLabel(employeeId, 187385, "是否烈属"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156413, "烈属证号"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156400, "是否孤老"),
// SalaryI18nUtil.getI18nLabel(employeeId, 156402, "是否扣除减除费用"));
// }
private <T> Map<String, List<Object>> getHeader(Class<T> clazz) {
Map<String, List<Object>> headerMap = new HashMap<>();
// 导出的表头
List<Object> headerList = Lists.newArrayList();
List<Object> dataIndexList = Lists.newArrayList();
Field[] declaredFields = clazz.getDeclaredFields();
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(SalaryTableColumn.class)) {
continue;
}
SalaryTableColumn annotation = declaredField.getAnnotation(SalaryTableColumn.class);
headerList.add(annotation.text());
dataIndexList.add(annotation.column());
}
headerMap.put("header", headerList);
headerMap.put("dataIndex", dataIndexList);
return headerMap;
}
// /**
// * 检查表头
// *
// * @param message
// * @param headers
// * @return
// */
// private boolean checkHeader(BatchDocumentMessage message, List<String> headers, List<String> headerList) {
// Long employeeId = message.getUserId();
// String tenantKey = message.getTenantKey();
// // 缺少的列
// List<String> lackHeaders = headerList.stream()
// .filter(header -> !headers.contains(header))
// .collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(lackHeaders)) {
// // 发送导入回调信息
// String errorMsg = SalaryI18nUtil.getI18nLabel(employeeId, 101850, "缺少如下列,请检查:") + Joiner.on(",").join(lackHeaders);
// salaryBatchService.sendImportCallBackInfo(message, errorMsg);
// return false;
// }
// return true;
// }
}

View File

@ -28,6 +28,7 @@ import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.SalaryOnOffEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum;
@ -243,13 +244,17 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
employeeDeclare.setId(originEmployeeDeclare.getId());
employeeDeclare.setEmployeeId(originEmployeeDeclare.getEmployeeId());
employeeDeclare.setEmployeeType(originEmployeeDeclare.getEmployeeType());
employeeDeclare.setSuccessfullyDeclared(originEmployeeDeclare.getSuccessfullyDeclared());
employeeDeclare.setTenantKey(originEmployeeDeclare.getTenantKey());
employeeDeclare.setCreator(originEmployeeDeclare.getCreator());
employeeDeclare.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
employeeDeclare.setCreateTime(originEmployeeDeclare.getCreateTime());
employeeDeclare.setUpdateTime(now);
employeeDeclare.setSuccessfullyDeclared(originEmployeeDeclare.getSuccessfullyDeclared());
// 判断本次编辑是否有修改人员信息
if (!StringUtils.equals(employeeDeclare.toCompareString(), originEmployeeDeclare.toCompareString())) {
employeeDeclare.setNewEmployeeInfo(1);
}
getEmployeeDeclareMapper().updateIgnoreNull(employeeDeclare);
getEmployeeDeclareMapper().update(employeeDeclare);
// 记录日志
// LoggerContext<EmployeeDeclarePO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId(Util.null2String(saveParam.getTaxAgentId()));
@ -703,4 +708,23 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
employeeDeclareRate.setMsg(SalaryI18nUtil.getI18nLabel(187388, "报送成功{0}条").replace("{0}", Util.null2String(needUpdateEmployeeDeclares.size())));
}
}
@Override
public String syncEmploymentDate(EmployeeDeclareSyncStartDateParam param) {
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
Map<Long, String> empPayStartDateMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getCompanystartdate);
List<EmployeeDeclarePO> employeeDeclarePOS = listByTaxCycleAndTaxAgentId(param.getTaxCycle(), param.getTaxAgentId());
employeeDeclarePOS.forEach(po -> {
String payStartDate = empPayStartDateMap.getOrDefault(po.getEmployeeId(), "");
if (SalaryDateUtil.checkDay(payStartDate)) {
po.setEmploymentDate(SalaryDateUtil.dateStrToLocalDate(payStartDate));
po.setNewEmployeeInfo(1);
po.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
getEmployeeDeclareMapper().updateIgnoreNull(po);
}
});
return "执行完毕";
}
}

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

@ -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;
}
public List<WeaTableColumnGroup> listWeaTableColumnForWorkflow(SalaryAcctRecordPO salaryAcctRecordPO) {
@ -705,16 +718,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();
@ -723,16 +750,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);
@ -785,12 +824,37 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
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<>();
finalWeaTableColumns.add(new WeaTableColumnGroup("150", SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(85429, "姓名")));
finalWeaTableColumns.add(new WeaTableColumnGroup("150", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人")));
finalWeaTableColumns.add(new WeaTableColumnGroup("150", "部门", "部门"));
finalWeaTableColumns.add(new WeaTableColumnGroup("150", "手机号", "手机号"));
finalWeaTableColumns.add(new WeaTableColumnGroup("150", "工号", "工号"));
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);
}
}
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) {
@ -814,8 +878,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));
return map;
} finally {
@ -931,20 +995,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("表头为空");

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()));
// boolean checkIncomeCategory = saveParam.getIncomeCategory() == null || StringUtils.isEmpty(SalaryArchiveBO.getIncomeCategoryByValue(saveParam.getIncomeCategory(), currentEmployeeId, currentTenantKey));
// 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());
// List<SalaryArchiveSobPO> salaryArchiveSobSaveList = SalaryArchiveBO.buildSalaryArchiveSob(salaryArchive.getId(), salarySobIds, LocalDateTime.now(), currentEmployeeId, currentTenantKey);
// this.salaryArchiveSobService.saveBatchBySalaryArchiveIdsAndSaves(Collections.singletonList(salaryArchive.getId()), salaryArchiveSobSaveList, currentTenantKey);
return StringUtils.EMPTY;
@ -1298,4 +1300,27 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
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

@ -42,6 +42,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;
@ -234,6 +235,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

@ -62,7 +62,7 @@ public class TaxDeclarationApiFlowStatisticServiceImpl extends Service implement
return TaxDeclarationApiFlowTotalDTO.builder()
.total(apiConfigPO.getTotality())
.remain(apiConfigPO.getRemain())
.used(apiConfigPO.getTotality() - apiConfigPO.getRemain())
.used(Long.parseLong(response.getBody().getSurplus()))
.lastUpdateTime(SalaryDateUtil.getFormatLocalDateTime(apiConfigPO.getLastUpdateTime()))
.build();
}
@ -81,7 +81,7 @@ public class TaxDeclarationApiFlowStatisticServiceImpl extends Service implement
log.info("details is empty");
return new ArrayList<>();
}
Set<String> taxCodes = details.stream().map(QueryAccountBalanceResponse.Detail::getTaxNumber).collect(Collectors.toSet());
Set<String> taxCodes = details.stream().map(QueryAccountBalanceResponse.Detail::getTaxNum).collect(Collectors.toSet());
List<TaxAgentTaxReturnPO> returnPOList = getTaxAgentTaxReturnService(user).getByTaxCodes(taxCodes);
if (returnPOList.isEmpty()) {
log.info("TaxAgentTaxReturnPO is empty");
@ -98,7 +98,7 @@ public class TaxDeclarationApiFlowStatisticServiceImpl extends Service implement
Map<String, List<TaxAgentTaxReturnPO>> taxCodeMap = returnPOList.stream().collect(Collectors.groupingBy(TaxAgentTaxReturnPO::getTaxCode));
List<TaxDeclarationApiFlowStatisticListDTO> flowStatisticDTOS = new ArrayList<>();
for (QueryAccountBalanceResponse.Detail detail : details) {
List<TaxAgentTaxReturnPO> list = taxCodeMap.getOrDefault(detail.getTaxNumber(), new ArrayList<>());
List<TaxAgentTaxReturnPO> list = taxCodeMap.getOrDefault(detail.getTaxNum(), new ArrayList<>());
for (TaxAgentTaxReturnPO returnPO : list) {
TaxDeclarationApiFlowStatisticListDTO statisticDTO = new TaxDeclarationApiFlowStatisticListDTO();
statisticDTO.setId(IdGenerator.generate());

View File

@ -40,6 +40,7 @@ import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum;
import com.engine.salary.enums.taxdeclaration.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper;
import com.engine.salary.remote.tax.client.DeclareClient;
import com.engine.salary.service.*;
import com.engine.salary.service.factory.TaxPaymentServiceFactory;
import com.engine.salary.util.*;
@ -913,6 +914,17 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
// taxDeclarationLoggerTemplate.write(loggerContext);
}
@Override
public Object getDeclareTaxResultFeedback(Long id) {
TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id);
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord();
DeclareClient declareClient = new DeclareClient(taxDeclareRecord.getTaxAgentId());
return declareClient.getDeclareTaxResultFeedback(taxDeclareRecord.getRequestId());
}
@Override
public void updateDeclare(Long id) {
TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id);

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;
@ -569,14 +570,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

@ -11,6 +11,8 @@ import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.EmployeeDeclareWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -19,6 +21,11 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.util.Collection;
import java.util.Map;
@ -30,6 +37,7 @@ import java.util.Map;
* @author qiantao
* @version 1.0
**/
@Slf4j
public class EmployeeDeclareController {
private EmployeeDeclareWrapper getEmployeeDeclareWrapper(User user) {
@ -263,19 +271,38 @@ public class EmployeeDeclareController {
return new ResponseResult<EmployeeDeclareParam, Object>(user).run(getEmployeeDeclareWrapper(user)::getCompanyEmployee, param);
}
// /**
// * 人员报送-导出全部人员
// *
// * @param queryParam 导出参数
// * @return
// */
// @POST
// @Path("/export")
// @Produces(MediaType.APPLICATION_JSON)
// public String export(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareListQueryParam queryParam) {
// Map<String, Object> exportMap = employeeDeclareWrapper.export(queryParam, UserContext.getCurrentUser());
// return WeaResult.success(exportMap);
// }
/**
* 人员报送-导出全部人员
*
* @param queryParam 导出参数
* @return
*/
@POST
@Path("/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareListQueryParam queryParam) {
try {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getEmployeeDeclareWrapper(user).export(queryParam);
String fileName = "人员信息采集-" + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
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();
} catch (Exception e) {
log.error("人员报送-导出全部人员异常", e);
throw e;
}
}
// /**
// * 人员报送-导出本月新增人员

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,7 @@ public class SalaryArchiveController {
return new ResponseResult<SalaryArchiveStopParam, String>(user).run(getSalaryArchiveWrapper(user)::stopSalary, stopSalaryParam);
}
// ******** 薪资档案主表 end ***********************************************************************************************/
// ******** 薪资项目调整 start ***********************************************************************************************/

View File

@ -202,6 +202,21 @@ public class TaxDeclarationController {
return new ResponseResult<Long, String>(user).run(getTaxDeclareRecordWrapper(user)::getDeclareFeedback, taxDeclareRecordParam.getTaxDeclareRecordId());
}
/**
* 申报内置算税结果查询
*
* @param
* @return
*/
@GET
@Path("/getDeclareTaxResultFeedback")
@Produces(MediaType.APPLICATION_JSON)
public String getDeclareTaxResultFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Object>(user).run(getTaxDeclareRecordWrapper(user)::getDeclareTaxResultFeedback, id);
}
/**
* 作废
*

View File

@ -5,7 +5,6 @@ import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.remote.tax.client.EmployeeClient;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.bo.EmployeeDeclareList;
@ -17,6 +16,7 @@ import com.engine.salary.enums.SalaryOnOffEnum;
import com.engine.salary.enums.employeedeclare.*;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.remote.tax.client.EmployeeClient;
import com.engine.salary.remote.tax.response.employee.GetCompanyEmployeeResponse;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
@ -35,6 +35,7 @@ import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.*;
@ -71,6 +72,12 @@ public class EmployeeDeclareWrapper extends Service {
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
private EmployeeDeclareExcelService employeeDeclareExcelService;
private EmployeeDeclareExcelService getEmployeeDeclareExcelService(User user) {
return ServiceUtil.getService(EmployeeDeclareExcelServiceImpl.class, user);
}
/**
* 人员报送的个税扣缴义务人列表
*
@ -547,32 +554,19 @@ public class EmployeeDeclareWrapper extends Service {
GetCompanyEmployeeResponse companyEmployee = employeeClient.getCompanyEmployee(param);
return companyEmployee;
}
// /**
// * 人员报送-导出本月全部的人员
// *
// * @param queryParam
// * @param simpleEmployee
// * @return
// */
// public Map<String, Object> export(EmployeeDeclareListQueryParam queryParam, SimpleEmployee simpleEmployee) {
// ExcelExportParam excelExportParam = new ExcelExportParam()
// .setBiz(String.valueOf(IdGenerator.generate()))
// .setModule(EntityType.hrmsalary.name())
// .setFunction("exportEmployeeDeclare");
// LocalRunnable localRunnable = new LocalRunnable() {
// @Override
// public void execute() {
// employeeDeclareExcelService.export(excelExportParam, queryParam, simpleEmployee);
// }
// };
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployeeDeclare", localRunnable);
// return JsonUtil.parseMap(excelExportParam, Object.class);
// }
//
/**
* 人员报送-导出本月全部的人员
*
* @param queryParam
* @return
*/
public XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam) {
return getEmployeeDeclareExcelService(user).export(queryParam);
}
// /**
// * 人员报送-导出本月新增的人员
// *

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.*;
@ -67,6 +68,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,12 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
requestIds.remove(null);
// 获取流程状态 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;
}
}

View File

@ -461,6 +461,11 @@ public class TaxDeclareRecordWrapper extends Service {
return taxDeclarationRate.getIndex();
}
public Object getDeclareTaxResultFeedback(Long id) {
return getTaxDeclareRecordService(user).getDeclareTaxResultFeedback(id);
}
/**
* 作废
*