Merge branch 'develop' into test_xxy

This commit is contained in:
18895359881@163.com 2022-04-16 16:14:56 +08:00
commit a5b73098c9
82 changed files with 4887 additions and 821 deletions

Binary file not shown.

View File

@ -0,0 +1,7 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/formula")
public class SalaryFormulaController extends com.engine.salary.web.SalaryFormulaController {
}

View File

@ -5,10 +5,7 @@ import com.alibaba.fastjson.TypeReference;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
import com.engine.salary.entity.siaccount.param.AccountParam;
import com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar;
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
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.InsuranceAccountDetailTempPO;
@ -17,20 +14,17 @@ import com.engine.salary.entity.siarchives.po.InsuranceArchivesAccountPO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
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.InspectStatusEnum;
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.NonPaymentEnum;
import com.engine.salary.enums.sicategory.PaymentScopeEnum;
import com.engine.salary.enums.siaccount.*;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper;
import com.engine.salary.mapper.siaccount.SIAccountDetailTempMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryDateUtil;
@ -69,6 +63,7 @@ import java.util.stream.Collectors;
**/
public class SIAccountBiz {
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
public PageInfo<InsuranceAccountBatchPO> listPage(InsuranceAccountBatchParam queryParam, Long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
@ -704,8 +699,561 @@ public class SIAccountBiz {
}
public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId) {
List<Long> collect;
SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel( 100466, "参数为空"));
SalaryAssert.notNull(param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 100467, "账单月为空"));
if (CollectionUtils.isNotEmpty(param.getExcludes())) {
collect = param.getIncludes().stream().filter(item -> !param.getExcludes().contains(item)).collect(Collectors.toList());
} else {
collect = param.getIncludes();
}
SalaryAssert.notEmpty(collect, SalaryI18nUtil.getI18nLabel( 99920, "无核算人员"));
AccountParam accountParam = new AccountParam();
accountParam.setBillMonth(param.getBillMonth());
accountParam.setIds(collect);
accounting(accountParam, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
}
public void delete(AccountParam param, Long employeeId) {
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth());
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).deleteById(insuranceAccountBatchPO.getId());
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDeleteNotFile(param.getBillMonth());
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId()));
// insuranceSchemeContext.setTargetName(insuranceAccountBatchPO.getBillMonth());
// insuranceSchemeContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 100464, "删除台账"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 100464, "删除台账"));
// insuranceSchemeContext.setNewValues(insuranceAccountBatchPO);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
}
public void saveSupplementaryAccount(SaveSupplementaryAccountParam param, Long employeeId) {
if (StringUtils.isBlank(param.getBillMonth()) || CollectionUtils.isEmpty(param.getBillMonthList()) || CollectionUtils.isEmpty(param.getProjects())
|| CollectionUtils.isEmpty(param.getIncludes())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
}
//需要补缴的月份
if (param.getBillMonthList().contains(param.getBillMonth())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 100481, "当前月走正常缴纳"));
}
//需要补缴的员工id
List<Long> employeeIds = param.getIncludes();
if (CollectionUtils.isNotEmpty(param.getExcludes())) {
employeeIds = employeeIds.stream().filter(item -> !param.getExcludes().contains(item)).collect(Collectors.toList());
}
SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel( 99920, "无核算人员"));
List<SupplementAccountBaseParam> baseList = new ArrayList<>();
employeeIds.stream().forEach(id -> {
param.getBillMonthList().stream().forEach(month -> {
SupplementAccountBaseParam supplementAccountBaseParam = SupplementAccountBaseParam.builder()
.supplementaryMonth(month)
.employeeId(id)
.projects(param.getProjects())
.billMonth(param.getBillMonth())
.build();
baseList.add(supplementAccountBaseParam);
});
});
//核算开始
accountSupplement(baseList, employeeIds, param.getBillMonth(),employeeId);
updateBatchAccount(param.getBillMonth(), employeeId,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
}
/**
* @param baseList 员工id-账单月份-补缴月份单挑-补缴项 集合
* @param employeeIds 需要补缴的员工id
* @return
*/
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth,Long employeeId) {
//(k,v) k-员工id v-员工对应的福利档案数据
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
//核算结果集
List<InsuranceAccountDetailPO> pos = new ArrayList<>();
baseList.forEach(baseParam -> {
InsuranceAccountDetailPO insuranceAccountDetailPO = accountSingleEmployeeBill(baseParam, longInsuranceArchivesAccountPOMap.get(baseParam.getEmployeeId()),employeeId);
pos.add(insuranceAccountDetailPO);
});
batchSaveSupplementAccount(pos, billMonth,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
return SalaryI18nUtil.getI18nLabel(100492, "核算完成,数据保存成功");
}
public InsuranceAccountDetailPO accountSingleEmployeeBill(SupplementAccountBaseParam baseParam, InsuranceArchivesAccountPO accountPO,Long employeeId) {
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
List<Integer> projects = baseParam.getProjects();
insuranceAccountDetailPO.setBillMonth(baseParam.getBillMonth());
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
insuranceAccountDetailPO.setCreator(employeeId);
insuranceAccountDetailPO.setCreateTime(new Date());
insuranceAccountDetailPO.setUpdateTime(new Date());
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
insuranceAccountDetailPO.setId(IdGenerator.generate());
insuranceAccountDetailPO.setEmployeeId(baseParam.getEmployeeId());
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
insuranceAccountDetailPO.setSupplementaryMonth(baseParam.getSupplementaryMonth());
insuranceAccountDetailPO.setSupplementaryProjects(
String.join(",",
baseParam.getProjects() == null ? new ArrayList<>() : baseParam.getProjects().stream().map(String::valueOf).collect(Collectors.toList())));
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
if (projects.contains(ProjectTypeEnum.ALL.getValue())) {
accountSocial(insuranceAccountDetailPO, accountPO);
accountFund(insuranceAccountDetailPO, accountPO);
accountOther(insuranceAccountDetailPO, accountPO);
return account(insuranceAccountDetailPO);
}
if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
accountSocial(insuranceAccountDetailPO, accountPO);
}
if (!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
List<Long> ids = new ArrayList<>();
List<ICategoryPO> list = MapperProxyFactory.getProxy(ICategoryMapper.class).listByDataType(DataTypeEnum.SYSTEM.getValue());
if (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) {
ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(93113, "养老保险").equals(item.getInsuranceName())).findFirst()
.get();
ids.add(insuranceCategoryPO.getId());
}
if (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue())) {
ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(93114, "医疗保险").equals(item.getInsuranceName())).findFirst()
.get();
ids.add(insuranceCategoryPO.getId());
}
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids);
}
if (projects.contains(ProjectTypeEnum.FUND.getValue())) {
accountFund(insuranceAccountDetailPO, accountPO);
}
if (projects.contains(ProjectTypeEnum.OTHER.getValue())) {
accountOther(insuranceAccountDetailPO, accountPO);
}
return account(insuranceAccountDetailPO);
}
public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) {
if (accountPO.getOther() != null) {
InsuranceArchivesOtherSchemePO otherPO = accountPO.getOther();
insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization());
insuranceAccountDetailPO.setOtherSchemeId(otherPO.getOtherSchemeId());
insuranceAccountDetailPO.setOtherPaymentBaseString(otherPO.getOtherPaymentBaseString());
if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId());
//方案中包含的需要缴纳其他的个人福利
Map<Long, InsuranceSchemeDetailPO> otherPerson = detailPOS.stream()
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算其他的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
archivesPerson.forEach((id, value) -> {
if (otherPerson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
}
});
List<BigDecimal> otherPer = new ArrayList<>();
Map<String, String> otherPerJsonMap = new HashMap<>();
needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = otherPerson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
;
otherPerJsonMap.put(String.valueOf(e), result.toPlainString());
otherPer.add(result);
});
insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerJsonMap));
BigDecimal otherPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : otherPer) {
otherPerSum = otherPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
//方案中包含的需要缴纳公积金的单位福利
Map<Long, InsuranceSchemeDetailPO> otherCom = detailPOS.stream()
.filter(
item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算其他的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
archivesCom.forEach((id, value) -> {
if (otherCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
}
});
List<BigDecimal> otherComList = new ArrayList<>();
Map<String, String> otherComJsonMap = new HashMap<>();
needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = otherCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
;
otherComJsonMap.put(String.valueOf(e), result.toPlainString());
otherComList.add(result);
});
insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComJsonMap));
BigDecimal otherComSum = new BigDecimal("0");
for (BigDecimal bigDecimal : otherComList) {
otherComSum = otherComSum.add(bigDecimal);
}
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
}
}
return insuranceAccountDetailPO;
}
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) {
if (accountPO.getFund() != null) {
InsuranceArchivesFundSchemePO fundPO = accountPO.getFund();
insuranceAccountDetailPO.setFundPayOrg(fundPO.getPaymentOrganization());
insuranceAccountDetailPO.setFundAccount(fundPO.getFundAccount());
insuranceAccountDetailPO.setSupplementFundAccount(fundPO.getSupplementFundAccount());
insuranceAccountDetailPO.setFundSchemeId(fundPO.getFundSchemeId());
insuranceAccountDetailPO.setFundPaymentBaseString(fundPO.getFundPaymentBaseString());
if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId());
//方案中包含的需要缴纳社保的个人福利
Map<Long, InsuranceSchemeDetailPO> fundperson = detailPOS.stream()
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算公积金的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
archivesPerson.forEach((id, value) -> {
if (fundperson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
}
});
List<BigDecimal> fundPer = new ArrayList<>();
Map<String, String> fundPerJsonMap = new HashMap<>();
needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = fundperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
;
fundPerJsonMap.put(String.valueOf(e), result.toPlainString());
fundPer.add(result);
});
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap));
BigDecimal funPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundPer) {
funPerSum = funPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setFundPerSum(funPerSum.toPlainString());
//方案中包含的需要缴纳公积金的单位福利
Map<Long, InsuranceSchemeDetailPO> fundCom = detailPOS.stream()
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算公积金的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
archivesCom.forEach((id, value) -> {
if (fundCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
}
});
List<BigDecimal> fundComList = new ArrayList<>();
Map<String, String> fundComJsonMap = new HashMap<>();
needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = fundCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
;
fundComJsonMap.put(String.valueOf(e), result.toPlainString());
fundComList.add(result);
});
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComJsonMap));
BigDecimal fundComSum = new BigDecimal("0");
for (BigDecimal bigDecimal : fundComList) {
fundComSum = fundComSum.add(bigDecimal);
}
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
}
}
return insuranceAccountDetailPO;
}
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO) {
if (accountPO.getSocial() != null) {
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId());
//方案中包含的需要缴纳社保的个人福利
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
archivesPerson.forEach((id, value) -> {
if (schemeperson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
}
});
List<BigDecimal> socialPer = new ArrayList<>();
Map<String, String> socialPerJsonMap = new HashMap<>();
needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = schemeperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
socialPer.add(result);
});
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
BigDecimal socialPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : socialPer) {
socialPerSum = socialPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
//方案中包含的需要缴纳社保的单位福利
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
archivesCom.forEach((id, value) -> {
if (schemeCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
}
});
List<BigDecimal> socialCom = new ArrayList<>();
Map<String, String> sociaComJsonMap = new HashMap<>();
needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = schemeCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
socialCom.add(result);
});
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(sociaComJsonMap));
BigDecimal socialComSum = new BigDecimal("0");
for (BigDecimal decimal : socialCom) {
socialComSum = socialComSum.add(decimal);
}
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
}
}
return insuranceAccountDetailPO;
}
public InsuranceAccountDetailPO accountEndowmentInsurance(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, List<Long> categoryIds) {
if (accountPO.getSocial() != null) {
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
if ((NonPaymentEnum.YES.getValue() == socialPO.getNonPayment() || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId());
//方案中包含的需要缴纳社保的个人福利
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_PERSON.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
categoryIds.forEach(item -> {
if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) {
needArchivesPerson.add(item);
}
});
List<BigDecimal> socialPer = new ArrayList<>();
Map<String, String> socialPerJsonMap = new HashMap<>();
needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = schemeperson.get(e);
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
;
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
socialPer.add(result);
});
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
BigDecimal socialPerSum = new BigDecimal("0");
for (BigDecimal bigDecimal : socialPer) {
socialPerSum = socialPerSum.add(bigDecimal);
}
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
//方案中包含的需要缴纳社保的单位福利
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
.filter(item -> IsPaymentEnum.YES.getValue() == item.getIsPayment() && item.getPaymentScope() == PaymentScopeEnum.SCOPE_COMPANY.getValue())
.collect(
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
//档案中包含的基数信息
HashMap<String, String> archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
archivesCom.forEach((id, value) -> {
if (schemeCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
}
});
List<BigDecimal> socialCom = new ArrayList<>();
Map<String, String> sociaComJsonMap = new HashMap<>();
needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = schemeCom.get(e);
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
;
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
socialCom.add(result);
});
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(sociaComJsonMap));
BigDecimal socialComSum = new BigDecimal("0");
for (BigDecimal decimal : socialCom) {
socialComSum = socialComSum.add(decimal);
}
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
}
}
return insuranceAccountDetailPO;
}
@Transactional
public void batchSaveSupplementAccount(List<InsuranceAccountDetailPO> pos, String billMonth, String tenantKey) {
if (CollectionUtils.isEmpty(pos)) {
return;
}
batchSaveAccountInspectDetail(pos, billMonth, tenantKey);
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelSupplementAccountDetails(pos);
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchSaveAccountDetails(pos);
//删除日志
// pos.stream().forEach(item -> {
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(item.getId()));
// insuranceSchemeContext.setTargetName(String.valueOf(item.getEmployeeId()));
// insuranceSchemeContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(100448, "删除核算记录"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(100448, "删除核算记录"));
// insuranceSchemeContext.setNewValues(item);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
// });
//插入日志
// pos.stream().forEach(item -> {
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(item.getId()));
// insuranceSchemeContext.setTargetName(String.valueOf(item.getEmployeeId()));
// insuranceSchemeContext.setOperateType(OperateTypeEnum.ADD.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(100494, "新建核算记录"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(100494, "新建核算记录"));
// insuranceSchemeContext.setNewValues(item);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
// });
}
public void deleteCommonAccount(SaveCommonAccountParam param, Long employeeId) {
SalaryAssert.notBlank(param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelAccountDetails(param.getIncludes(), param.getBillMonth());
//记录日志
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.join(",", param.getIncludes().stream().map(item -> String.valueOf(item)).collect(Collectors.toList())));
// insuranceSchemeContext.setTargetName(param.getBillMonth());
// insuranceSchemeContext.setOperateType(OperateTypeEnum.ADD.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100462, "新增台账"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100462, "新增台账"));
// insuranceSchemeContext.setNewValues(param);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
updateBatchAccount(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
}
public void deleteSupplementaryAccount(List<SupplementAccountBaseParam> param, Long employeeId) {
SalaryAssert.notEmpty(param, SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
boolean valid = param.stream().anyMatch(item -> item.getEmployeeId() == null
|| StringUtils.isBlank(item.getSupplementaryMonth())
|| StringUtils.isBlank(item.getBillMonth()));
if (valid) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelSupplementDetailsByIds(param);
// param.stream().forEach(item -> {
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(IdGenerator.generate()));
// insuranceSchemeContext.setTargetName(item.getBillMonth());
// insuranceSchemeContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100490, "删除补缴核算记录"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100490, "删除补缴核算记录"));
// insuranceSchemeContext.setNewValues(item);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
// });
updateBatchAccount(param.get(0).getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
}
public void file(String billMonth, Long employeeId) {
//归档前检查是否有核算异常
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByInspectStatusAndBillMonth(InspectStatusEnum.IGNORE.getValue(),billMonth);
SalaryAssert.isEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100500, "当前核算月存在核算异常数据"));
//开始归档数据
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillStatus(billMonth,BillStatusEnum.NOT_ARCHIVED.getValue());
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 100503, "月份账单不存在"));
SalaryAssert.isFalse(insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.ARCHIVED.getValue(), SalaryI18nUtil.getI18nLabel( 100504, "月份账单已归档"));
insuranceAccountBatchPO.setBillStatus(BillStatusEnum.ARCHIVED.getValue());
MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).updateById(insuranceAccountBatchPO);
//日志记录
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId()));
// insuranceSchemeContext.setTargetName(insuranceAccountBatchPO.getBillMonth());
// insuranceSchemeContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100506, "台账归档"));
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100506, "台账归档"));
// insuranceSchemeContext.setNewValues(insuranceAccountBatchPO);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
}
}

View File

@ -4,8 +4,8 @@ import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.enums.SalaryOnOffEnum;
import com.engine.salary.mapper.salaryitem.SalaryItemMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
@ -92,10 +92,9 @@ public class SalaryItemBiz {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
// PageUtil.start(searchParam.getPageNum(), searchParam.getPageSize());
return PageHelper.startPage(searchParam.getCurrent(), searchParam.getPageSize()).doSelectPageInfo(mapper::listAll);
// List<SalaryItemPO> salaryItemPOS = mapper.listAll();
PageUtil.start(searchParam.getCurrent(), searchParam.getPageSize());
List<SalaryItemPO> salaryItemPOList = mapper.listByParam(searchParam);
return new PageInfo<SalaryItemPO>(salaryItemPOList);
} finally {
sqlSession.close();
}

View File

@ -2,7 +2,6 @@ package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.mapper.salarysob.SalarySobMapper;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
@ -11,8 +10,13 @@ import java.util.List;
public class SalarySobBiz {
public SalarySobPO getById(Long id) {
SalarySobMapper mapper = MapperProxyFactory.getProxy(SalarySobMapper.class);
return mapper.getById(id);
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}

View File

@ -1,12 +1,13 @@
package com.engine.salary.constant;
/**
* @description: 薪酬管理公式编辑器的常量
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/24/21 5:51 PM
* @version:v1.0
*/
* 薪酬管理公式编辑器的常量
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryFormulaFieldConstant {
// 公式变量的所属模块

View File

@ -1,46 +0,0 @@
package com.engine.salary.entity.formula;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.weaver.excel.formula.api.entity.ExpressFormulaSourceLink;
import com.weaver.excel.formula.api.entity.FormulaVar;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ExpressFormula {
@JsonSerialize(
using = ToStringSerializer.class
)
private Long id;
//名称
private String name;
private String module;
private String parameter;
private Long userId;
private Integer status;
private String msgFormula;
private String msgParameter;
private Date addTime;
private Date lastUpdate;
private Integer isDelete;
private Long formId;
private int type;
private String tenantKey;
private DataCollectionEmployee creator;
private List<ExpressFormulaSourceLink> sourceLinks;
//引用类型
private String referenceType;
//返回类型
private String returnType;
//公式内容
private String formula;
private boolean showInLibrary;
private String codeFormula;
private String msgCodeFormula;
private List<FormulaVar> parameters;
private List<FormulaVar> msgParameters;
}

View File

@ -1,16 +1,13 @@
package com.engine.salary.entity.salaryacct.bo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.salary.constant.SalaryFormulaFieldConstant;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.enums.SalaryFormulaReferenceEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Maps;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.excel.formula.api.entity.FormulaVar;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -18,17 +15,17 @@ import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @description: 薪资核算公式
* @author: xiajun
* @modified By: xiajun
* @date: Created in 6/2/22 10:33 PM
* @version:v1.0
*/
* 薪资核算公式
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class ExpressFormulaBO {
/**
@ -53,17 +50,7 @@ public class ExpressFormulaBO {
}
Map<Long, List<FormulaVar>> resultMap = Maps.newHashMapWithExpectedSize(expressFormulas.size());
for (ExpressFormula expressFormula : expressFormulas) {
if (StringUtils.isEmpty(expressFormula.getParameter())) {
continue;
}
JSONObject paramJson = JSON.parseObject(expressFormula.getParameter());
if (paramJson != null) {
JSONArray paramArray = paramJson.getJSONArray("formulavars");
if (paramArray != null) {
List<FormulaVar> formulaVars = paramArray.toJavaList(FormulaVar.class);
resultMap.put(expressFormula.getId(), formulaVars);
}
}
resultMap.put(expressFormula.getId(), expressFormula.getParameters());
}
return resultMap;
}
@ -106,25 +93,15 @@ public class ExpressFormulaBO {
*/
public static List<FormulaVar> buildFormulaVar4Accounting(ExpressFormula expressFormula, Map<String, String> formulaVarValueMap) {
List<FormulaVar> formulaVars = Collections.emptyList();
// 公式异常
if (Objects.isNull(expressFormula) || StringUtils.isEmpty(expressFormula.getParameter())) {
return Collections.emptyList();
}
JSONObject paramJson = JSON.parseObject(expressFormula.getParameter());
if (paramJson != null) {
JSONArray paramArray = paramJson.getJSONArray("formulavars");
if (paramArray != null) {
formulaVars = paramArray.toJavaList(FormulaVar.class);
for (FormulaVar formulaVar : formulaVars) {
// 公式变量的值
String formulaVarValue = formulaVarValueMap.getOrDefault(formulaVar.getFieldId(), StringUtils.EMPTY);
// 如果公式的返回值类型为number公式中的变量的值如果为空公式运行的时候会报错所以需要替换成0
if (StringUtils.isEmpty(formulaVarValue) && "number".equals(expressFormula.getReturnType())) {
formulaVarValue = BigDecimal.ZERO.toPlainString();
}
formulaVar.setContent(formulaVarValue);
}
formulaVars = expressFormula.getParameters();
for (FormulaVar formulaVar : formulaVars) {
// 公式变量的值
String formulaVarValue = formulaVarValueMap.getOrDefault(formulaVar.getFieldId(), StringUtils.EMPTY);
// 如果公式的返回值类型为number公式中的变量的值如果为空公式运行的时候会报错所以需要替换成0
if (StringUtils.isEmpty(formulaVarValue) && "number".equals(expressFormula.getReturnType())) {
formulaVarValue = BigDecimal.ZERO.toPlainString();
}
formulaVar.setContent(formulaVarValue);
}
return formulaVars;
}

View File

@ -1,13 +1,13 @@
package com.engine.salary.entity.salaryacct.bo;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,6 +1,8 @@
package com.engine.salary.entity.salaryacct.bo;
import com.engine.salary.constant.SalaryFormulaFieldConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.enums.SalaryFormulaReferenceEnum;
@ -9,8 +11,6 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.excel.formula.api.entity.FormulaVar;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -24,12 +24,13 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @description: 薪资核算-薪资项目运算优先级
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2/7/22 2:49 PM
* @version:v1.0
*/
* 薪资核算-薪资项目运算优先级
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryAcctCalculatePriorityBO {
/**

View File

@ -22,10 +22,7 @@ import java.util.Collection;
@AllArgsConstructor
public class SalaryAcctCalculateParam {
/**
* 不是employeeId而是salaryAcctEmpId
*/
//核算人员的id")
//核算人员的id,不是employeeId而是salaryAcctEmpId
private Collection<Long> ids;
@DataCheck(require = true,message = "参数错误薪资核算记录ID不能为空")

View File

@ -5,15 +5,17 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Date;
/**
* @description: 线下excel核算的结果
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/14/21 2:33 PM
* @version:v1.0
*/
* 线下excel核算的结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@ -79,10 +81,13 @@ public class ExcelAcctResultPO {
/**
* 创建时间
*/
private LocalDateTime createTime;
private Date createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
private Date updateTime;
//条件
private Collection<Long> salaryAcctEmpIds;
}

View File

@ -0,0 +1,70 @@
package com.engine.salary.entity.salaryformula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ExpressFormula {
/**
* id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 备注
*/
private String description;
/**
* 模块
*/
private String module;
/**
* 用途
*/
private String useFor;
/**
* 引用类型
*/
private String referenceType;
/**
* 返回类型numberstring
*/
private String returnType;
/**
* 校验类型,numberstring
*/
private String validateType;
/**
* 扩展参数
*/
private String extendParam;
/**
* 公式内容
*/
private String formula;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除0否1是
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private List<FormulaVar> parameters;
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.salaryformula.bo;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
@ -9,12 +9,13 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* @description: 薪酬管理公式
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/7/21 5:49 PM
* @version:v1.0
*/
* 薪酬管理公式
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryFormulaBO {
public static List<ExpressFormulaDTO> convert2DTO(List<ExpressFormula> expressFormulas) {

View File

@ -19,12 +19,12 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class ExpressFormulaDTO {
//公式idTaxAgent
//公式id
private Long id;
//公式名称TaxAgent
//公式名称
private String name;
//公式表达式TaxAgent
//公式表达式
private String formula;
}

View File

@ -22,43 +22,43 @@ public class SalaryFormulaEmployeeDTO {
private Long employeeId;
@SalaryFormulaVar(defaultLabel ="个税扣缴义务人", labelId = 86184, dataType = "string")
@SalaryFormulaVar(defaultLabel = "个税扣缴义务人", labelId = 86184, dataType = "string")
private String taxAgentName;
@SalaryFormulaVar(defaultLabel ="姓名", labelId = 85429, dataType = "string")
@SalaryFormulaVar(defaultLabel = "姓名", labelId = 85429, dataType = "string")
private String username;
@SalaryFormulaVar(defaultLabel ="邮件", labelId = 92919, dataType = "string")
@SalaryFormulaVar(defaultLabel = "邮件", labelId = 92919, dataType = "string")
private String email;
@SalaryFormulaVar(defaultLabel ="手机", labelId = 98621, dataType = "string")
@SalaryFormulaVar(defaultLabel = "手机", labelId = 98621, dataType = "string")
private String mobile;
@SalaryFormulaVar(defaultLabel ="电话", labelId = 98620, dataType = "string")
@SalaryFormulaVar(defaultLabel = "电话", labelId = 98620, dataType = "string")
private String telephone;
// //证件号码", labelId = 86318, dataType = "string")
// @SalaryFormulaVar(defaultLabel = "证件号码", labelId = 86318, dataType = "string")
// private String idNo;
@SalaryFormulaVar(defaultLabel ="性别", labelId = 98622, dataType = "string")
@SalaryFormulaVar(defaultLabel = "性别", labelId = 98622, dataType = "string")
private String sex;
@SalaryFormulaVar(defaultLabel ="状态", labelId = 91075, dataType = "string")
@SalaryFormulaVar(defaultLabel = "状态", labelId = 91075, dataType = "string")
private String status;
@SalaryFormulaVar(defaultLabel ="部门", labelId = 86185, dataType = "string")
@SalaryFormulaVar(defaultLabel = "部门", labelId = 86185, dataType = "string")
private String departmentName;
@SalaryFormulaVar(defaultLabel ="岗位", labelId = 90633, dataType = "string")
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "string")
private String positionName;
@SalaryFormulaVar(defaultLabel ="职级", labelId = 98623, dataType = "string")
@SalaryFormulaVar(defaultLabel = "职级", labelId = 98623, dataType = "string")
private String gradeName;
@SalaryFormulaVar(defaultLabel ="入职日期", labelId = 86319, dataType = "string")
@SalaryFormulaVar(defaultLabel = "入职日期", labelId = 86319, dataType = "string")
private String hireDate;
@SalaryFormulaVar(defaultLabel ="出生日期", labelId = 98624, dataType = "string")
@SalaryFormulaVar(defaultLabel = "出生日期", labelId = 98624, dataType = "string")
private String birthday;
// //首次参加工作日期", labelId = 98625, dataType = "string")

View File

@ -8,12 +8,13 @@ import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @description: 薪资公式计算器-个税税率表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/30/21 5:03 PM
* @version:v1.0
*/
* 薪资公式计算器-个税税率表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor

View File

@ -0,0 +1,29 @@
package com.engine.salary.entity.salaryformula.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* 公式字段查询参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryFormulaFieldQueryParam {
@DataCheck(require = true,message = "变量来源不可为空")
String sourceId;
Map<String, Object> extendParam;
}

View File

@ -0,0 +1,62 @@
package com.engine.salary.entity.salaryformula.param;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.util.valid.DataCheck;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryFormulaSaveParam {
/**
* id
*/
@DataCheck(require = true,message = "主键为空",runtime = RuntimeTypeEnum.UPDATE)
private Long id;
/**
* 名称
*/
private String name;
/**
* 备注
*/
private String description;
/**
* 模块
*/
private String module;
/**
* 用途
*/
private String useFor;
/**
* 引用类型
*/
private String referenceType;
/**
* 返回类型
*/
private String returnType;
/**
* 校验类型
*/
private String validateType;
/**
* 扩展参数
*/
private String extendParam;
/**
* 公式内容
*/
private String formula;
private List<FormulaVar> parameters;
}

View File

@ -0,0 +1,75 @@
package com.engine.salary.entity.salaryformula.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FormulaPO {
/**
* id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 备注
*/
private String description;
/**
* 模块
*/
private String module;
/**
* 用途
*/
private String useFor;
/**
* 引用类型
*/
private String referenceType;
/**
* 返回类型
*/
private String returnType;
/**
* 校验类型
*/
private String validateType;
/**
* 扩展参数
*/
private String extendParam;
/**
* 公式内容
*/
private String formula;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除0否1是
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
//主键id集合
private Collection<Long> ids;
}

View File

@ -0,0 +1,67 @@
package com.engine.salary.entity.salaryformula.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FormulaVar {
/**
* id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 公式id
*/
private Long formulaId;
/**
* 字段id
*/
private String fieldId;
/**
* 字段名称
*/
private String fieldName;
/**
* 字段类型number,string
*/
private String fieldType;
/**
* 来源
*/
private String source;
/**
* 排序
*/
private Integer orderIndex;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除,0否1是
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
//
private String content;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryitem.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
@ -11,21 +12,22 @@ import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.conn.util.IdGenerator;
import java.util.*;
import java.util.stream.Collectors;
/**
* @description: 薪资项目
* @author: xiajun
* @modified By: xiajun
* @date: Created in 10/28/21 4:55 PM
* @version:v1.0
*/
* 薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryItemBO {
@ -165,7 +167,7 @@ public class SalaryItemBO {
// long id = IdGenerator.generate();
SalaryItemPO salaryItemPO = SalaryItemPO.builder()
// .id(id)
// .code(String.valueOf(id))
.code(IdGenerator.getUUID())
.name(saveParam.getName())
.systemType(SalarySystemTypeEnum.CUSTOM.getValue())
.sysSalaryItemId(NumberUtils.LONG_ZERO)
@ -175,7 +177,7 @@ public class SalaryItemBO {
.pattern(Optional.ofNullable(saveParam.getPattern()).orElse(2))
.valueType(saveParam.getValueType())
.dataType(saveParam.getDataType())
.formulaId(saveParam.getValueType() == SalaryValueTypeEnum.FORMULA.getValue() ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
.formulaId(Objects.equals(saveParam.getValueType(), SalaryValueTypeEnum.FORMULA.getValue()) ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
.description(saveParam.getDescription())
.canEdit(NumberUtils.INTEGER_ONE)
.creator(employeeId)

View File

@ -4,6 +4,7 @@ import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@ -32,32 +33,39 @@ public class SalaryItemListDTO {
private Long id;
@SalaryTableColumn(text = "名称", width = "10%", column = "name")
@TableTitle(title = "名称",dataIndex = "name",key = "name")
private String name;
//薪资档案引用
@SalaryTableColumn(text = "薪资档案引用", width = "10%", column = "useInEmployeeSalary")
@TableTitle(title = "薪资档案引用",dataIndex = "useInEmployeeSalary",key = "useInEmployeeSalary")
private Integer useInEmployeeSalary;
//默认使用
@SalaryTableColumn(text = "默认使用", width = "10%", column = "useDefault")
@TableTitle(title = "默认使用",dataIndex = "useDefault",key = "useDefault")
private Integer useDefault;
//进位规则
@SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode",transmethod = "com.engine.salary.transmethod.TransMethod.roundingMode")
@TableTitle(title = "进位规则",dataIndex = "roundingMode",key = "roundingMode")
private String roundingMode;
//保留小数位
@SalaryTableColumn(text = "保留小数位", width = "10%", column = "pattern")
@TableTitle(title = "保留小数位",dataIndex = "pattern",key = "pattern")
private Integer pattern;
//取值方式
@SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType",transmethod = "com.engine.salary.transmethod.TransMethod.datasource")
@TableTitle(title = "取值方式",dataIndex = "valueType",key = "valueType")
private String valueType;
/**
* @see SalaryDataTypeEnum
*/
@SalaryTableColumn(text = "字段类型", width = "10%", column = "dataType",transmethod = "com.engine.salary.transmethod.TransMethod.dataType")
@TableTitle(title = "字段类型",dataIndex = "dataType",key = "dataType")
private String dataType;
//公式id
@ -67,16 +75,21 @@ public class SalaryItemListDTO {
private String formulaContent;
@SalaryTableColumn(text = "个税申报表对应字段", width = "10%", column = "taxDeclarationColumn")
@TableTitle(title = "个税申报表对应字段",dataIndex = "taxDeclarationColumn",key = "taxDeclarationColumn")
private String taxDeclarationColumn;
//备注
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
@TableTitle(title = "备注",dataIndex = "description",key = "description")
private String description;
//是否可以编辑
private boolean canEdit;
//是否可以删除
private boolean canDelete;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
@ -8,7 +9,6 @@ import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -17,7 +17,6 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -134,7 +133,7 @@ public class SalarySobItemAggregateBO {
if (CollectionUtils.isEmpty(salarySobEmpFields)) {
return Collections.emptyList();
}
Field[] declaredFields = DataCollectionEmployee.class.getDeclaredFields();
Field[] declaredFields = SalaryFormulaEmployeeDTO.class.getDeclaredFields();
Map<String, String> empFieldMap = Maps.newHashMapWithExpectedSize(declaredFields.length);
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class)) {

View File

@ -24,7 +24,6 @@ import java.util.Date;
@AllArgsConstructor
@SalaryTable(pageId = "021c4a65-c401-4bcc-a720-6233996e17f1", tableType = WeaTableType.CHECKBOX,operates = {
})
@Accessors(chain = true)
public class InsuranceAccountDetailPO {
/**

View File

@ -1,6 +1,9 @@
package com.engine.salary.entity.siaccount.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
@ -13,7 +16,9 @@ import java.util.Date;
* @Version V1.0
**/
@Data
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceAccountDetailTempPO {
/**

View File

@ -6,11 +6,11 @@ import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description:
* @Author: zhangheng
* @CreateDate: 2021/12/7 19:05
* @Version: v1.0
*/
* @Author weaver_cl
* @Description: TODO
* @Date 2022/3/17
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor

View File

@ -4,38 +4,39 @@ package com.engine.salary.enums;
import java.util.Objects;
/**
* @description: 薪资项目公式引用分类
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/1/21 10:16 AM
* @version:v1.0
*/
public enum SalaryFormulaReferenceEnum implements BaseEnum<Integer> {
* 薪资项目公式引用分类
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryFormulaReferenceEnum implements BaseEnum<String> {
SALARY_ITEM(1, "薪资项目", 84960),
// SALARY_ITEM_OF_HISTORY(2, "历史台账薪资项目", 85364),
EMPLOYEE_INFO(3, "员工基本信息", 85366),
SALARY_ARCHIVES(4, "薪资档案", 85368),
ATTEND(5, "考勤引用", 85367),
ADD_UP_SITUATION(6, "往期累计情况", 104412),
ADD_UP_DEDUCTIONS(7, "累计专项附加扣除", 85380),
WELFARE(8, "社保福利", 87522),
OTHER_DEDUCTION(9, "其他免税扣除", 93849),
SALARY_ITEM("salaryItem", "薪资项目", 84960),
// SALARY_ITEM_OF_HISTORY("salaryItemOfHistory", "历史台账薪资项目", 85364),
EMPLOYEE_INFO("employeeInfo", "员工基本信息", 85366),
SALARY_ARCHIVES("salaryArchives", "薪资档案", 85368),
ATTEND("attend", "考勤引用", 85367),
ADD_UP_SITUATION("addUpSituation", "往期累计情况", 104412),
ADD_UP_DEDUCTIONS("addUpDeductions", "累计专项附加扣除", 85380),
WELFARE("welfare", "社保福利", 87522),
OTHER_DEDUCTION("otherDeduction", "其他免税扣除", 93849),
;
private int value;
private String value;
private String defaultLabel;
private int labelId;
SalaryFormulaReferenceEnum(int value, String defaultLabel, int labelId) {
SalaryFormulaReferenceEnum(String value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
@Override
public Integer getValue() {
public String getValue() {
return value;
}
@ -51,7 +52,7 @@ public enum SalaryFormulaReferenceEnum implements BaseEnum<Integer> {
public static SalaryFormulaReferenceEnum parseByValue(String value) {
for (SalaryFormulaReferenceEnum referenceEnum : SalaryFormulaReferenceEnum.values()) {
if (Objects.equals(referenceEnum.getValue() + "", value)) {
if (Objects.equals(referenceEnum.getValue(), value)) {
return referenceEnum;
}
}

View File

@ -5,12 +5,13 @@ import java.util.Arrays;
import java.util.Objects;
/**
* @description: 字段类型
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/1/21 4:35 PM
* @version:v1.0
*/
* 字段类型
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryValueTypeEnum implements BaseEnum<Integer> {
INPUT(1, "输入", 84976),

View File

@ -6,12 +6,13 @@ import java.util.Arrays;
import java.util.Objects;
/**
* @description: 薪资项目的字段类型
* @author: xiajun
* @modified By: xiajun
* @date: 2022/3/10 17:16
* @version:v1.0
*/
* 薪资项目的字段类型
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryDataTypeEnum implements BaseEnum<String> {
STRING("string", "字符", 105093),
NUMBER("number", "数值", 87625),

View File

@ -22,6 +22,8 @@ alter table hrsa_salary_archive_item modify id bigint auto_increment;
alter table hrsa_salary_acct_record modify id bigint auto_increment;
alter table hrsa_salary_acct_emp modify id bigint auto_increment;
alter table hrsa_acct_result_temp modify id bigint auto_increment;
alter table hrsa_formula modify id bigint auto_increment;
alter table hrsa_formula_var modify id bigint auto_increment;
--

View File

@ -174,7 +174,7 @@
<select id="getEmployeeIdsByUserName" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select
a.LASTNAME as username,
a.LASTNAME as username
from hrmresource a
where
1 = 1

View File

@ -0,0 +1,60 @@
package com.engine.salary.mapper.formula;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface FormulaMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<FormulaPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<FormulaPO> listSome(FormulaPO formula);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
FormulaPO getById(Long id);
/**
* 新增忽略null字段
*
* @param formula 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(FormulaPO formula);
/**
* 修改忽略null字段
*
* @param formula 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(FormulaPO formula);
/**
* 删除记录
*
* @param formula 待删除的记录
* @return 返回影响行数
*/
int delete(FormulaPO formula);
List<FormulaPO> listByIds(@Param("ids")Collection<Long> ids);
}

View File

@ -0,0 +1,302 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.formula.FormulaMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryformula.po.FormulaPO">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="description" property="description"/>
<result column="module" property="module"/>
<result column="use_for" property="useFor"/>
<result column="reference_type" property="referenceType"/>
<result column="return_type" property="returnType"/>
<result column="validate_type" property="validateType"/>
<result column="extend_param" property="extendParam"/>
<result column="formula" property="formula"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.name
, t.description
, t.module
, t.use_for
, t.reference_type
, t.return_type
, t.validate_type
, t.extend_param
, t.formula
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="name != null">
AND name = #{name}
</if>
<if test="description != null">
AND description = #{description}
</if>
<if test="module != null">
AND module = #{module}
</if>
<if test="useFor != null">
AND use_for = #{useFor}
</if>
<if test="referenceType != null">
AND reference_type = #{referenceType}
</if>
<if test="returnType != null">
AND return_type = #{returnType}
</if>
<if test="validateType != null">
AND validate_type = #{validateType}
</if>
<if test="extendParam != null">
AND extend_param = #{extendParam}
</if>
<if test="formula != null">
AND formula = #{formula}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_formula
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="module != null">
module,
</if>
<if test="useFor != null">
use_for,
</if>
<if test="referenceType != null">
reference_type,
</if>
<if test="returnType != null">
return_type,
</if>
<if test="validateType != null">
validate_type,
</if>
<if test="extendParam != null">
extend_param,
</if>
<if test="formula != null">
formula,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="name != null">
#{name},
</if>
<if test="description != null">
#{description},
</if>
<if test="module != null">
#{module},
</if>
<if test="useFor != null">
#{useFor},
</if>
<if test="referenceType != null">
#{referenceType},
</if>
<if test="returnType != null">
#{returnType},
</if>
<if test="validateType != null">
#{validateType},
</if>
<if test="extendParam != null">
#{extendParam},
</if>
<if test="formula != null">
#{formula},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
UPDATE hrsa_formula
<set>
name=#{name},
description=#{description},
module=#{module},
use_for=#{useFor},
reference_type=#{referenceType},
return_type=#{returnType},
validate_type=#{validateType},
extend_param=#{extendParam},
formula=#{formula},
creator=#{creator},
delete_type=#{deleteType},
create_time=#{createTime},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
UPDATE hrsa_formula
<set>
<if test="name != null">
name=#{name},
</if>
<if test="description != null">
description=#{description},
</if>
<if test="module != null">
module=#{module},
</if>
<if test="useFor != null">
use_for=#{useFor},
</if>
<if test="referenceType != null">
reference_type=#{referenceType},
</if>
<if test="returnType != null">
return_type=#{returnType},
</if>
<if test="validateType != null">
validate_type=#{validateType},
</if>
<if test="extendParam != null">
extend_param=#{extendParam},
</if>
<if test="formula != null">
formula=#{formula},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
UPDATE hrsa_formula
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<!-- 查询全部 -->
<select id="listByIds" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@ -0,0 +1,49 @@
package com.engine.salary.mapper.formula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import java.util.List;
public interface FormulaVarMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<FormulaVar> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<FormulaVar> listSome(FormulaVar formulaVar);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
FormulaVar getById(Long id);
/**
* 新增忽略null字段
*
* @param formulaVar 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(FormulaVar formulaVar);
/**
* 修改忽略null字段
*
* @param formulaVar 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(FormulaVar formulaVar);
void deleteByFormulaId(Long formulaId);
}

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.formula.FormulaVarMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryformula.po.FormulaVar">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="formula_id" property="formulaId"/>
<result column="field_id" property="fieldId"/>
<result column="field_name" property="fieldName"/>
<result column="field_type" property="fieldType"/>
<result column="source" property="source"/>
<result column="order_index" property="orderIndex"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.name
, t.formula_id
, t.field_id
, t.field_name
, t.field_type
, t.source
, t.order_index
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula_var t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula_var t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula_var t
WHERE delete_type = 0
<if test="name != null">
AND name = #{name}
</if>
<if test="formulaId != null">
AND formula_id = #{formulaId}
</if>
<if test="fieldId != null">
AND field_id = #{fieldId}
</if>
<if test="fieldName != null">
AND field_name = #{fieldName}
</if>
<if test="fieldType != null">
AND field_type = #{fieldType}
</if>
<if test="source != null">
AND source = #{source}
</if>
<if test="orderIndex != null">
AND order_index = #{orderIndex}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_formula_var
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
name,
</if>
<if test="formulaId != null">
formula_id,
</if>
<if test="fieldId != null">
field_id,
</if>
<if test="fieldName != null">
field_name,
</if>
<if test="fieldType != null">
field_type,
</if>
<if test="source != null">
source,
</if>
<if test="orderIndex != null">
order_index,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name},
</if>
<if test="formulaId != null">
#{formulaId},
</if>
<if test="fieldId != null">
#{fieldId},
</if>
<if test="fieldName != null">
#{fieldName},
</if>
<if test="fieldType != null">
#{fieldType},
</if>
<if test="source != null">
#{source},
</if>
<if test="orderIndex != null">
#{orderIndex},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar">
UPDATE hrsa_formula_var
<set>
<if test="name != null">
name=#{name},
</if>
<if test="formulaId != null">
formula_id=#{formulaId},
</if>
<if test="fieldId != null">
field_id=#{fieldId},
</if>
<if test="fieldName != null">
field_name=#{fieldName},
</if>
<if test="fieldType != null">
field_type=#{fieldType},
</if>
<if test="source != null">
source=#{source},
</if>
<if test="orderIndex != null">
order_index=#{orderIndex},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<delete id="deleteByFormulaId" parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar">
UPDATE hrsa_formula_var
SET delete_type=1
WHERE formula_id = #{formulaId}
AND delete_type = 0
</delete>
</mapper>

View File

@ -0,0 +1,54 @@
package com.engine.salary.mapper.salaryacct;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* 线下excel核算的结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface ExcelAcctResultMapper {
/**
* 分页查询ExcelAcctResult和SalaryAcctResult的employeeId
*
* @return
*/
List<Long> listEmployeeIdUnionSalaryAcctResult(@Param("employeeIds") Collection<Long> employeeIds,
@Param("salaryAcctRecordId") Long salaryAcctRecordId);
/**
* 批量新增
*
* @param excelAcctResults
*/
void batchInsert(@Param("collection") Collection<ExcelAcctResultPO> excelAcctResults);
/**
* 根据薪资核算记录id删除
*
* @param salaryAcctEmployeeIds
*/
void deleteBySalaryAcctEmployeeIds(@Param("salaryAcctEmployeeIds") Collection<Long> salaryAcctEmployeeIds);
/**
* 根据薪资核算记录id删除
*
* @param salaryAcctRecordIds
*/
void deleteBySalaryAcctRecordIds(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctRecordIds);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<ExcelAcctResultPO> listSome(ExcelAcctResultPO excelAcctResult);
}

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper">
<select id="listEmployeeIdUnionSalaryAcctResult" resultType="long">
SELECT DISTINCT employee_id
FROM hrsa_salary_acct_result
WHERE salary_acct_record_id = #{salaryAcctRecordId}
<if test="employeeIds != null and employeeIds.size() > 0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
UNION
SELECT DISTINCT employee_id
FROM hrsa_excel_acct_result
WHERE salary_acct_record_id = #{salaryAcctRecordId}
<if test="employeeIds != null and employeeIds.size() > 0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
<insert id="batchInsert">
INSERT INTO hrsa_excel_acct_result(salary_sob_id, salary_acct_emp_id, salary_acct_record_id, employee_id,
salary_item_id, result_value, creator, create_time, update_time,
delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.salaryAcctEmpId},
#{item.salaryAcctRecordId},
#{item.employeeId},
#{item.salaryItemId},
#{item.resultValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_excel_acct_result(salary_sob_id, salary_acct_emp_id, salary_acct_record_id, employee_id,
salary_item_id, result_value, creator, create_time, update_time,
delete_type, tenant_key)
<foreach collection="collection" item="item" separator="union all">
select
#{item.salarySobId},
#{item.salaryAcctEmpId},
#{item.salaryAcctRecordId},
#{item.employeeId},
#{item.salaryItemId},
#{item.resultValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
INSERT INTO hrsa_excel_acct_result( salary_sob_id, salary_acct_emp_id, salary_acct_record_id, employee_id,
salary_item_id, result_value, creator, create_time, update_time,
delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.salaryAcctEmpId},
#{item.salaryAcctRecordId},
#{item.employeeId},
#{item.salaryItemId},
#{item.resultValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<delete id="deleteBySalaryAcctEmployeeIds">
DELETE FROM hrsa_excel_acct_result
WHERE salary_acct_emp_id IN
<foreach collection="salaryAcctEmployeeIds" open="(" item="salaryAcctEmployeeId" separator="," close=")">
#{salaryAcctEmployeeId}
</foreach>
</delete>
<delete id="deleteBySalaryAcctRecordIds">
DELETE FROM hrsa_excel_acct_result
WHERE salary_acct_record_id IN
<foreach collection="salaryAcctRecordIds" open="(" item="salaryAcctRecordId" separator="," close=")">
#{salaryAcctRecordId}
</foreach>
</delete>
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO">
<result column="id" property="id" />
<result column="salary_sob_id" property="salarySobId" />
<result column="salary_acct_emp_id" property="salaryAcctEmpId" />
<result column="salary_acct_record_id" property="salaryAcctRecordId" />
<result column="employee_id" property="employeeId" />
<result column="salary_item_id" property="salaryItemId" />
<result column="result_value" property="resultValue" />
<result column="creator" property="creator" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
<result column="tax_agent_id" property="taxAgentId" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.salary_sob_id
, t.salary_acct_emp_id
, t.salary_acct_record_id
, t.employee_id
, t.salary_item_id
, t.result_value
, t.creator
, t.create_time
, t.update_time
, t.delete_type
, t.tenant_key
, t.tax_agent_id
</sql>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_excel_acct_result t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="salaryAcctEmpId != null">
AND salary_acct_emp_id = #{salaryAcctEmpId}
</if>
<if test="salaryAcctRecordId != null">
AND salary_acct_record_id = #{salaryAcctRecordId}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="salaryItemId != null">
AND salary_item_id = #{salaryItemId}
</if>
<if test="resultValue != null">
AND result_value = #{resultValue}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="salaryAcctEmpIds != null and salaryAcctEmpIds.size()>0">
AND salary_acct_emp_id IN
<foreach collection="salaryAcctEmpIds" open="(" item="salaryAcctEmpId" separator="," close=")">
#{salaryAcctEmpId}
</foreach>
</if>
ORDER BY id DESC
</select>
</mapper>

View File

@ -51,4 +51,12 @@ public interface InsuranceAccountBatchMapper {
*/
void updateById(@Param("pos") InsuranceAccountBatchPO pos);
/**
*
* @param billMonth
* @param billStatus
* @return
*/
InsuranceAccountBatchPO getByBillStatus(@Param("billMonth") String billMonth,@Param("billStatus")Integer billStatus);
}

View File

@ -83,7 +83,7 @@
<sql id="paramSql">
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
AND
t.bill_month between param.startTime and param.endTime
t.bill_month between #{param.startTime} and #{param.endTime}
</if>
</sql>
@ -118,6 +118,17 @@
</select>
<select id="getByBillStatus" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
hrsa_bill_batch t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
AND t.bill_status = #{billStatus}
</select>
<delete id="deleteById">
UPDATE hrsa_bill_batch
SET delete_type = 1

View File

@ -1,6 +1,7 @@
package com.engine.salary.mapper.siaccount;
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import org.apache.ibatis.annotations.Param;
@ -47,5 +48,37 @@ public interface InsuranceAccountDetailMapper {
void batchSaveAccountDetails(@Param("accounts") Collection<InsuranceAccountDetailPO> accounts);
/**
* 条件查询
* @param billMonth
* @return
*/
List<InsuranceAccountDetailPO> selectList(@Param("billMonth") String billMonth);
/**
* 根据账单月份删除
* @param billMonth
*/
void batchDeleteNotFile(@Param("billMonth") String billMonth);
/**
* 批量删除
* @param pos
*/
void batchDelSupplementAccountDetails(@Param("pos") Collection<InsuranceAccountDetailPO> pos);
/**
* 根据员工id批量删除
* @param pos
*/
void batchDelSupplementDetailsByIds(@Param("pos") Collection<SupplementAccountBaseParam> pos);
void batchUnConfirmedInspectDetails(@Param("ids") Collection<Long> ids);
void batchIgnoreInspectDetails(@Param("ids") Collection<Long> ids);
}

View File

@ -97,11 +97,11 @@
<sql id="paramSql">
<if test="param.billMonth != null and param.billMonth != ''">
AND
t.bill_month = param.billMonth
t.bill_month = #{param.billMonth}
</if>
<if test="param.paymentStatus != null and param.paymentStatus != ''">
AND
t.payment_status = param.paymentStatus
t.payment_status = #{param.paymentStatus}
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
@ -118,7 +118,6 @@
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
1 = 1
<include refid="paramSql"/>
ORDER BY t.update_time DESC
</select>
@ -133,7 +132,7 @@
</select>
<select id="selectAccountIds" resultMap="Long">
<select id="selectAccountIds" resultType="java.lang.Long">
SELECT
t.employee_id
FROM
@ -144,13 +143,58 @@
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
<delete id="deleteById" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
UPDATE hrsa_bill_detail
SET delete_type = 1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="batchDeleteNotFile" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
DELETE
FROM hrsa_bill_detail
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND bill_status = 0
</delete>
<delete id="batchDelSupplementAccountDetails">
UPDATE hrsa_bill_detail
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="pos" open="(" item="po" separator="," close=")">
#{po.id}
</foreach>
</delete>
<update id="batchUnConfirmedInspectDetails">
UPDATE
hrsa_bill_inspect
SET
inspect_status = 0
WHERE
delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<update id="batchIgnoreInspectDetails">
UPDATE
hrsa_bill_inspect
SET
inspect_status = 1
WHERE
delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 批量删除 -->
<delete id="batchDelAccountDetails">
@ -165,6 +209,17 @@
</delete>
<delete id="batchDelSupplementDetailsByIds">
UPDATE hrsa_bill_detail
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="pos" open="(" item="po" separator="," close=")">
#{po.employeeId}
</foreach>
</delete>
<insert id="batchSaveAccountDetails">
INSERT INTO hrsa_bill_detail
(employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,fund_pay_org,

View File

@ -4,6 +4,7 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @Author weaver_cl
@ -25,4 +26,18 @@ public interface InsuranceAccountInspectMapper {
*/
void batchSaveInspectDetails(@Param("pos") Collection<InsuranceAccountInspectPO> pos);
/**
*
* @param inspectStatus
* @param billMonth
* @return
*/
List<InsuranceAccountInspectPO> getByInspectStatusAndBillMonth(@Param("inspectStatus")Integer inspectStatus,@Param("billMonth")String billMonth);
List<InsuranceAccountInspectPO> getByInspectStatusAndIds(@Param("inspectStatus")Integer inspectStatus,@Param("ids")Collection<Long> ids);
}

View File

@ -32,6 +32,34 @@
, t.tenant_key
</sql>
<select id="getByInspectStatusAndBillMonth" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
hrsa_bill_inspect t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
AND t.inspect_status = #{inspectStatus}
</select>
<sql id="paramSql">
<if test="ids != null and ids.size()>0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</sql>
<select id="getByInspectStatusAndIds" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
hrsa_bill_inspect t
WHERE t.delete_type = 0
AND t.inspect_status = #{inspectStatus}
<include refid="paramSql"/>
</select>
<!-- 批量删除 -->
<delete id="batchDelInspectDetails">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper">
<mapper namespace="com.engine.salary.mapper.siaccount.SIAccountDetailTempMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailTempPO">
<result column="id" property="id"/>
<result column="employee_id" property="employeeId"/>

View File

@ -66,4 +66,12 @@ public interface ICategoryMapper {
*/
List<ICategoryPO> listByWelfareType(@Param("welfareType") Integer welfareType,
@Param("dataType") Integer dataType);
/**
* 根据数据类型查询
* @param dataType
* @return
*/
List<ICategoryPO> listByDataType(@Param("dataType") Integer dataType);
}

View File

@ -97,6 +97,22 @@
ORDER BY id DESC
</select>
<select id="listByDataType" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_insurance_category t
WHERE data_type= #{dataType} AND delete_type = 0
</select>
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_insurance_category t
WHERE delete_type = 0
</select>
<!-- 更新,更新修改字段 -->
<update id="update" parameterType="com.engine.salary.entity.sicategory.po.ICategoryPO">
UPDATE hrsa_insurance_category

View File

@ -0,0 +1,13 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import java.util.List;
public interface FormulaRunService {
Object run(ExpressFormula expressFormula, List<FormulaVar> formulaVars, DataCollectionEmployee simpleEmployee);
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service;
import com.weaver.excel.formula.api.entity.FormulaVar;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import java.util.List;
import java.util.Map;
@ -12,6 +13,9 @@ public interface RemoteExcelService {
List<FormulaVar> fieldList(String sourceId, Map<String, Object> extendParam);
List<Map<String,Object>> fieldGroupList(Map<String, Object> extendParam);
// ExcelPage<FormulaDataSource> dataSourceList(String categoryId, ExcelPage<FormulaDataSource> page, Map<String, Object> extendParam, SimpleEmployee employee);
//
// List<FormulaVar> findProperData(String dataId, String fieldId, String fieldType, Map<String, Object> extendParam, SimpleEmployee employee);

View File

@ -1,9 +1,10 @@
package com.engine.salary.service;
import com.engine.salary.entity.siaccount.param.AccountParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.param.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
@ -14,18 +15,120 @@ import java.util.Map;
**/
public interface SIAccountService {
/**
* 查询台账列表
* @param insuranceAccountBatchParam
* @return
*/
Map<String,Object> listPage(InsuranceAccountBatchParam insuranceAccountBatchParam);
/**
* 获取正常缴纳列表
* @param insuranceAccountDetailParam
* @return
*/
Map<String,Object> listCommonPage(InsuranceAccountDetailParam insuranceAccountDetailParam);
/**
* 根据姓名名获取正常缴纳列表
* @param insuranceAccountDetailParam
* @return
*/
Map<String,Object> listCommonPageByName(InsuranceAccountDetailParam insuranceAccountDetailParam);
/**
* 获取补缴缴纳列表
* @param insuranceAccountDetailParam
* @return
*/
Map<String,Object> listSupplementaryPage(InsuranceAccountDetailParam insuranceAccountDetailParam);
/**
* 根据姓名获取补缴缴纳列表
* @param insuranceAccountDetailParam
* @return
*/
Map<String,Object> supplementaryByNameList(InsuranceAccountDetailParam insuranceAccountDetailParam);
/**
* 获取核算月份备注填写表单
* @param params
* @return
*/
Map<String, Object> getForm(Map<String, Object> params);
Map<String, Object> save(AccountParam param);
/**
* 保存并进入核算
* @param param
*/
void save(AccountParam param);
/**
* 正常缴纳页核算
* @param saveCommonAccountParam
*/
void commonAccount(SaveCommonAccountParam saveCommonAccountParam);
/**
* 删除月份表单
* @param accountParam
*/
void delete(AccountParam accountParam);
/**
* 添加正常缴纳人员
* @param accountParam
*/
void saveCommonAccount(SaveCommonAccountParam accountParam);
/**
* 添加补缴人员
* @param saveSupplementaryAccountParam
*/
void saveSupplementaryAccount(SaveSupplementaryAccountParam saveSupplementaryAccountParam);
/**
* 删除正常缴纳人员
* @param accountParam
*/
void deleteCommonAccount(SaveCommonAccountParam accountParam);
/**
* 删除补缴人员
* @param supplementAccountBaseParams
*/
void deleteSummplementaryAccount(List<SupplementAccountBaseParam> supplementAccountBaseParams);
/**
* 台账归档
* @param accountParam
*/
void file(AccountParam accountParam);
/**
* 重置核算异常
* @param ids
*/
void unconfirmed(Collection<Long> ids);
/**
* 获取核算异常列表页是否导出档案开关
* @param billMonth
*/
Map<String, Boolean> buttonCheck(String billMonth);
/**
* 忽略核算异常
* @param longs
*/
void ignore(Collection<Long> longs);
/**
* tab信息
* @param billMonth
*/
InsuranceAccountTabDTO tabList(String billMonth);
}

View File

@ -60,14 +60,14 @@ public interface SalaryAcctExcelService {
*/
XSSFWorkbook exportImportTemplate(SalaryAcctImportTemplateParam param);
// /**
// * 薪资核算线下对比结果导出
// *
// * @param queryParam
// * @return
// */
// XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam);
//
/**
* 薪资核算线下对比结果导出
*
* @param queryParam
* @return
*/
XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam);
// /**
// * 薪资核算线下对比结果导入模板导出
// *

View File

@ -8,12 +8,13 @@ import java.util.Collection;
import java.util.List;
/**
* @description: 薪资核算的线下对比结果
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/20/22 7:00 PM
* @version:v1.0
*/
* 薪资核算的线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalaryComparisonResultService {
/**

View File

@ -1,17 +1,19 @@
package com.engine.salary.service;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import java.util.Collection;
import java.util.List;
/**
* @description: 薪酬管理公式编辑器
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/7/21 5:38 PM
* @version:v1.0
*/
* 薪酬管理公式编辑器
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalaryFormulaService {
/**
@ -26,8 +28,11 @@ public interface SalaryFormulaService {
* 根据公式id获取公式内容
*
* @param formulaId
* @param tenantKey
* @return
*/
ExpressFormula getExpressFormula(Long formulaId);
void save(SalaryFormulaSaveParam salaryFormulaSaveParam);
void update(SalaryFormulaSaveParam salaryFormulaSaveParam);
}

View File

@ -4,7 +4,7 @@ import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.github.pagehelper.PageInfo;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;

View File

@ -0,0 +1,33 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.service.FormulaRunService;
import org.apache.commons.jexl3.*;
import java.util.List;
public class FormulaRunServiceImpl extends Service implements FormulaRunService {
@Override
public Object run(ExpressFormula expressFormula, List<FormulaVar> formulaVars, DataCollectionEmployee simpleEmployee) {
String formula = expressFormula.getFormula();
JexlBuilder jexlBuilder = new JexlBuilder();
// 创建Jexl表达式引擎
JexlEngine jexlEngine = jexlBuilder.create();
// 创建Jexl表达式解析器
JexlScript jexlScript = jexlEngine.createScript(formula);
// 创建Jexl表达式变量上下文
JexlContext jexlContext = new MapContext();
formulaVars.forEach(v->{
jexlContext.set(v.getFieldId(),v.getContent());
});
// 执行Jexl表达式得到结果
Object execute = jexlScript.execute(jexlContext);
return execute;
}
}

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.formula.DataType;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaTaxRateDTO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -22,7 +23,6 @@ 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 com.weaver.excel.formula.api.entity.FormulaVar;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -130,6 +130,16 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
return vars;
}
@Override
public List<Map<String, Object>> fieldGroupList(Map<String, Object> extendParam) {
return Arrays.stream(SalaryFormulaReferenceEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put("key", e.getValue());
map.put("value", SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()));
return map;
}).collect(Collectors.toList());
}
// @Override
// public ExcelPage<FormulaDataSource> dataSourceList(String categoryId, ExcelPage<FormulaDataSource> page, Map<String, Object> extendParam, SimpleEmployee employee) {
// log.info("categoryId: {}, page: {}", categoryId, JsonUtil.toJsonString(page));
@ -218,7 +228,7 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
private List<FormulaVar> salaryItem2FormulaVar(SalaryFormulaReferenceEnum referenceEnum, Map<String, Object> extendParam) {
Set<Long> salaryItemIds = Collections.emptySet();
Object salarySobId = extendParam.get("salarySobId");
Object salarySobId = extendParam == null ? null : extendParam.get("salarySobId");
if (Objects.nonNull(salarySobId)) {
List<SalarySobItemPO> salarySobItems = getSalarySobItemService(user).listBySalarySobId(Long.valueOf(String.valueOf(salarySobId)));
salaryItemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
@ -233,12 +243,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
.map(e -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + e.getCode());
formulaVar.setTitle(e.getName());
formulaVar.setFormId("" + referenceEnum.getValue());
formulaVar.setDataType(DataType.NUMBER);
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setProperKey(DataType.NUMBER);
formulaVar.setProperKey(e.getDataType());
formulaVar.setName(e.getName());
formulaVar.setSource("" + referenceEnum.getValue());
formulaVar.setFieldType(e.getDataType());
return formulaVar;
}).collect(Collectors.toList());
@ -258,13 +265,11 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
} else {
formulaVar.setFieldId(annotation.fieldId());
}
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setTitle(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel()));
formulaVar.setFormId(formId);
formulaVar.setDataType(annotation.dataType());
formulaVar.setProperKey(DataType.NUMBER);
formulaVar.setName(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel()));
formulaVar.setSource(formId);
formulaVar.setFieldType(annotation.dataType());
if (StringUtils.equals(formId, "" + SalaryFormulaReferenceEnum.EMPLOYEE_INFO.getValue())) {
formulaVar.setProperKey(DataType.STRING);
formulaVar.setSource(DataType.STRING);
}
formulaVars.add(formulaVar);
}
@ -279,12 +284,12 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
List<FormulaVar> formulaVars = Lists.newArrayListWithExpectedSize(welfareColumns.size());
welfareColumns.forEach((k, v) -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + v);
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setTitle(k);
formulaVar.setFormId("" + referenceEnum.getValue());
formulaVar.setDataType(DataType.NUMBER);
formulaVar.setProperKey(DataType.NUMBER);
// formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + v);
// formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
// formulaVar.setTitle(k);
// formulaVar.setFormId("" + referenceEnum.getValue());
// formulaVar.setDataType(DataType.NUMBER);
// formulaVar.setProperKey(DataType.NUMBER);
formulaVars.add(formulaVar);
});
return formulaVars;
@ -298,11 +303,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
List<FormulaVar> formulaVars = fields.stream().map(e -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + e.getId());
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setTitle(e.getFieldName());
formulaVar.setFormId("" + referenceEnum.getValue());
formulaVar.setDataType(DataType.NUMBER);
formulaVar.setProperKey(DataType.NUMBER);
formulaVar.setName(e.getFieldName());
formulaVar.setSource("" + referenceEnum.getValue());
formulaVar.setFieldType(DataType.NUMBER);
return formulaVar;
}).collect(Collectors.toList());
return formulaVars;

View File

@ -13,17 +13,18 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.param.AccountParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
import com.engine.salary.entity.siaccount.param.Permission;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
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.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.InspectStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper;
import com.engine.salary.service.ColumnBuildService;
import com.engine.salary.service.RecordsBuildService;
import com.engine.salary.service.SIAccountService;
@ -33,6 +34,7 @@ import java.util.stream.Collectors;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryFormItemUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.ValidUtil;
@ -136,7 +138,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId);
PageInfo<Map<String, Object>> pageInfos = new PageInfo<Map<String, Object>>(records);
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
pageInfos.setTotal(records.size());
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
@ -174,7 +176,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Long employeeId = (long)user.getUID();
Map<String,Object> datas = new HashMap<>();
//正常缴纳列表
//补缴缴纳列表
queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
List<InsuranceAccountDetailPO> list = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).list(queryParam);
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class);
@ -251,27 +253,124 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return apidatas;
}
/**
* 保存月份和备注信息并进入核算
*
* @param param 请求入参
* <p>
* 接口逻辑
* 1检查当前月份是否已经归档如果已经归档直接返回状态为未归档继续执行
* 2从基础人员表左连接部门和离职表以及档案表查询出来符合缴纳的人员清单
* 1离职日期在当月一号零时之后
* 2档案中配置了福利缴纳开始缴纳月开始时间包含当前月
* 3forkjoin核算并入库
* 4更新台账
*/
@Override
public Map<String, Object> save(AccountParam param) {
Map<String, Object> apidatas = new HashMap<>();
public void save(AccountParam param) {
Long employeeId = (long)user.getUID();
String lastname = user.getLastname();
String lastName = user.getLastname();
ValidUtil.doValidator(param);
siAccountBiz.save(true,param,employeeId,lastname);
return apidatas;
siAccountBiz.save(true,param,employeeId,lastName);
}
@Override
public void commonAccount(SaveCommonAccountParam param) {
Long employeeId = (long)user.getUID();
ValidUtil.doValidator(param);
siAccountBiz.saveCommonAccount(param,employeeId);
}
@Override
public void delete(AccountParam accountParam) {
Long employeeId = (long)user.getUID();
siAccountBiz.delete(accountParam,employeeId);
}
@Override
public void saveCommonAccount(SaveCommonAccountParam accountParam) {
Long employeeId = (long)user.getUID();
siAccountBiz.saveCommonAccount(accountParam,employeeId);
}
@Override
public void saveSupplementaryAccount(SaveSupplementaryAccountParam saveSupplementaryAccountParam) {
Long employeeId = (long)user.getUID();
siAccountBiz.saveSupplementaryAccount(saveSupplementaryAccountParam,employeeId);
}
@Override
public void deleteCommonAccount(SaveCommonAccountParam param) {
Long employeeId = (long)user.getUID();
siAccountBiz.deleteCommonAccount(param,employeeId);
}
@Override
public void deleteSummplementaryAccount(List<SupplementAccountBaseParam> supplementAccountBaseParams) {
Long employeeId = (long)user.getUID();
siAccountBiz.deleteSupplementaryAccount(supplementAccountBaseParams,employeeId);
}
@Override
public void file(AccountParam accountParam) {
Long employeeId = (long)user.getUID();
String billMonth = accountParam.getBillMonth();
siAccountBiz.file(billMonth,employeeId);
}
@Override
public void unconfirmed(Collection<Long> ids) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByInspectStatusAndIds(InspectStatusEnum.COMFORED.getValue(),ids);
if (CollectionUtils.isNotEmpty(insuranceAccountInspectPOS)) {
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchUnConfirmedInspectDetails(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getId).collect(Collectors.toList()));
}
}
@Override
public Map<String, Boolean> buttonCheck(String billMonth) {
Map<String, Boolean> result = new HashMap<>();
List<InsuranceAccountInspectPO> list = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByInspectStatusAndBillMonth(InspectStatusEnum.IGNORE.getValue(),billMonth);
if (CollectionUtils.isEmpty(list)) {
result.put("displayFlag", false);
return result;
}
result.put("displayFlag", true);
return result;
}
@Override
public void ignore(Collection<Long> ids) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByInspectStatusAndIds(InspectStatusEnum.IGNORE.getValue(),ids);
if (CollectionUtils.isNotEmpty(insuranceAccountInspectPOS)) {
MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchIgnoreInspectDetails(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getId).collect(Collectors.toList()));
}
}
@Override
public InsuranceAccountTabDTO tabList(String billMonth) {
InsuranceAccountTabDTO insuranceAccountTabDTO = InsuranceAccountTabDTO.builder().build();
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth);
boolean isShow = false;
if (insuranceAccountBatchPO == null || insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.NOT_ARCHIVED.getValue()) {
isShow = true;
}
if (insuranceAccountBatchPO != null) {
insuranceAccountTabDTO.setRemarks(insuranceAccountBatchPO.getRemarks());
}
List<Map<String, Object>> tabList = new ArrayList<>();
Map<String, Object> common = new HashMap<>();
common.put("id", "1");
common.put("content", SalaryI18nUtil.getI18nLabel( 92265, "正常缴纳"));
tabList.add(common);
if (isShow) {
Map<String, Object> change = new HashMap<>();
change.put("id", "2");
change.put("content", SalaryI18nUtil.getI18nLabel( 100509, "异动清单"));
tabList.add(change);
}
Map<String, Object> repair = new HashMap<>();
repair.put("id", "3");
repair.put("content", SalaryI18nUtil.getI18nLabel(92267, "补缴"));
tabList.add(repair);
Map<String, Object> overView = new HashMap<>();
overView.put("id", "4");
overView.put("content", SalaryI18nUtil.getI18nLabel( 99927, "总览"));
tabList.add(overView);
insuranceAccountTabDTO.setTabList(tabList);
insuranceAccountTabDTO.setShow(isShow);
insuranceAccountTabDTO.setBillMonth(billMonth);
return insuranceAccountTabDTO;
}

View File

@ -9,6 +9,8 @@ import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteDataDTO;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryacct.bo.*;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
@ -22,8 +24,6 @@ import com.engine.salary.enums.SalaryFormulaReferenceEnum;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.excel.formula.api.entity.FormulaVar;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -45,7 +45,7 @@ import java.util.stream.Collectors;
@Slf4j
public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcctCalculateService {
private SalaryAcctResultService getSalaryAcctResultService(User user) {
return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
}
@ -53,43 +53,45 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return (SalaryArchiveService) ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private AddUpSituationService getAddUpSituationService(User user) {
return (AddUpSituationService) ServiceUtil.getService(AddUpSituationServiceImpl.class, user);
}
private AddUpDeductionService getAddUpDeductionService(User user) {
return (AddUpDeductionService) ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
}
private OtherDeductionService getOtherDeductionService(User user) {
return (OtherDeductionService) ServiceUtil.getService(OtherDeductionServiceImpl.class, user);
}
// private SIAccountService siAccountService;
private AttendQuoteDataService getAttendQuoteDataService(User user) {
return (AttendQuoteDataService) ServiceUtil.getService(AttendQuoteDataServiceImpl.class, user);
}
// private ExcelRunService excelRunService;
private FormulaRunService getFormulaRunService(User user) {
return (FormulaRunService) ServiceUtil.getService(FormulaRunServiceImpl.class, user);
}
private SalaryAcctResultTempService getSalaryAcctResultTempService(User user) {
return (SalaryAcctResultTempService) ServiceUtil.getService(SalaryAcctResultTempServiceImpl.class, user);
}
private SalaryAcctProgressService salaryAcctProgressService;
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
@ -244,12 +246,17 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
private String runExpressFormula(ExpressFormula expressFormula, Map<String, String> formulaVarValueMap, DataCollectionEmployee simpleEmployee) {
// 给公式中的变量填入值
List<FormulaVar> formulaVars = ExpressFormulaBO.buildFormulaVar4Accounting(expressFormula, formulaVarValueMap);
String formula = expressFormula.getFormula();
// todo 运行公式
// ExcelResult excelResult = excelRunService.run(expressFormula, formulaVars, simpleEmployee);
Object run = getFormulaRunService(user).run(expressFormula, formulaVars, simpleEmployee);
// if (excelResult.isStatus()) {
// return excelResult.getStringData();
// }
return StringUtils.EMPTY;
return run.toString();
// return StringUtils.EMPTY;
}
/**

View File

@ -9,13 +9,16 @@ import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctImportFieldDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctImportTemplateParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.SalaryValueTypeEnum;
@ -74,9 +77,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
// }
// private SalaryComparisonResultService getSalaryComparisonResultService(User user) {
// return (SalaryComparisonResultService) ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user);
// }
private SalaryComparisonResultService getSalaryComparisonResultService(User user) {
return (SalaryComparisonResultService) ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user);
}
private TaxAgentBiz taxAgentService = new TaxAgentBiz();
@ -317,76 +320,61 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
//
// @Override
// public XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
// // 查询薪资核算记录
// SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
// if (Objects.isNull(salaryAcctRecordPO)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
// }
// // 查询线下对比结果
// SalaryComparisonResultListDTO salaryComparisonResultListDTO = getSalaryComparisonResultService(user).listByParam(queryParam);
// // 薪资核算线下对比结果列表表头
// List<String> headerList = Lists.newArrayList();
// // 查询薪资核算所用的薪资账套的员工信息字段
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// Set<String> employeeFieldCodeSet = SalaryEntityUtil.properties(salarySobEmpFieldPOS, SalarySobEmpFieldPO::getFieldCode);
// // 查询薪资项目
// List<SalaryItemPO> salaryItemPOS = getSalarySobItemService(user).listBySalarySobId4SalaryItem(salaryAcctRecordPO.getSalarySobId());
// Set<String> salaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, salaryItemPO -> "" + salaryItemPO.getId());
// for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// // 员工信息字段
// if (employeeFieldCodeSet.contains(weaTableColumn.getDataIndex())) {
// headerList.add(weaTableColumn.getTitle());
// }
// // 薪资项目的表头
// if (salaryItemIds.contains(weaTableColumn.getDataIndex())) {
// headerList.add(weaTableColumn.getTitle() + " (线上值)");
// headerList.add(weaTableColumn.getTitle() + " (线下值)");
// }
// }
// String[] headers = headerList.toArray(new String[0]);
//
// List<Map<String, Object>> resultMapList = salaryComparisonResultListDTO.getData().getRecords();
// // excel导出的数据
// List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
// for (Map<String, Object> map : resultMapList) {
// List<Object> row = Lists.newArrayList();
// for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// // 员工信息字段的值
// if (employeeFieldCodeSet.contains(weaTableColumn.getDataIndex())) {
// row.add(map.get(weaTableColumn.getDataIndex()));
// }
// // 薪资项目的值
// if (salaryItemIds.contains(weaTableColumn.getDataIndex())) {
// Map tempMap = (Map) map.getOrDefault(weaTableColumn.getDataIndex(), Collections.emptyMap());
// row.add(tempMap.get("acctResultValue"));
// row.add(tempMap.get("excelResultValue"));
// }
// }
// rows.add(row);
// }
//
// ExcelSheetData excelSheetData = new ExcelSheetData();
// excelSheetData.setSheetName("线下对比结果");
// excelSheetData.setHeaders(Collections.singletonList(headers));
// excelSheetData.setRows(rows);
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
// .fileName("线下对比结果")
// .dataType("线下对比结果")
// .function(excelExportParam.getFunction())
// .handlerName("comparisonResultHandler")
// .flag(true)
// .bizId(String.valueOf(excelExportParam.getBiz()))
// .module(excelExportParam.getModule())
// .userId(simpleEmployee.getEmployeeId())
// .tenantKey(tenantKey)
// .operator(simpleEmployee.getUsername())
// .eteamsId(eteamsId)
// .build();
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
// }
@Override
public XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 查询线下对比结果
SalaryComparisonResultListDTO salaryComparisonResultListDTO = getSalaryComparisonResultService(user).listByParam(queryParam);
// 薪资核算线下对比结果列表表头
List<Object> headerList = Lists.newArrayList();
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
Set<String> employeeFieldCodeSet = SalaryEntityUtil.properties(salarySobEmpFieldPOS, SalarySobEmpFieldPO::getFieldCode);
// 查询薪资项目
List<SalaryItemPO> salaryItemPOS = getSalarySobItemService(user).listBySalarySobId4SalaryItem(salaryAcctRecordPO.getSalarySobId());
Set<String> salaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, salaryItemPO -> "" + salaryItemPO.getId());
for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// 员工信息字段
if (employeeFieldCodeSet.contains(weaTableColumn.getColumn())) {
headerList.add(weaTableColumn.getText());
}
// 薪资项目的表头
if (salaryItemIds.contains(weaTableColumn.getColumn())) {
headerList.add(weaTableColumn.getText() + " (线上值)");
headerList.add(weaTableColumn.getText() + " (线下值)");
}
}
List<Map<String, Object>> resultMapList = salaryComparisonResultListDTO.getData().getList();
// excel导出的数据
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
List<Object> row = Lists.newArrayList();
for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// 员工信息字段的值
if (employeeFieldCodeSet.contains(weaTableColumn.getColumn())) {
row.add(map.get(weaTableColumn.getColumn()));
}
// 薪资项目的值
if (salaryItemIds.contains(weaTableColumn.getColumn())) {
Map tempMap = (Map) map.getOrDefault(weaTableColumn.getColumn(), Collections.emptyMap());
row.add(tempMap.get("acctResultValue"));
row.add(tempMap.get("excelResultValue"));
}
}
rows.add(row);
}
String sheetName = "线下对比结果";
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
//
//
// @Override

View File

@ -6,6 +6,7 @@ import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
@ -39,7 +40,6 @@ import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
@ -95,8 +95,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
// return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
return null;
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
private SalarySobAdjustRuleService getSalarySobAdjustRuleService(User user) {
return (SalarySobAdjustRuleService) ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
@ -390,7 +389,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 8查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
List<ExpressFormula> expressFormulas = Lists.newArrayList();//getSalaryFormulaService(user).listExpressFormula(formulaIds);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 9计算薪资项目的运算优先级
List<List<Long>> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas);
// 10根据id查询其他合并计税的薪资核算记录
@ -482,6 +481,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// salaryAcctRecordLoggerTemplate.write(loggerContext);
} catch (Exception e) {
log.info("薪资核算出错:{}", e.getMessage(), e);
throw new SalaryRunTimeException(e);
// salaryAcctProgressService.fail("" + calculateParam.getSalaryAcctRecordId(), SalaryI18nUtil.getI18nLabel(99642, "薪资核算出错") + ": " + e.getMessage());
} finally {
// 数据库字段加密用

View File

@ -1,244 +1,257 @@
//package com.engine.salary.service.impl;
//
//import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
//import com.engine.core.impl.Service;
//import com.engine.salary.service.SalaryComparisonResultService;
//import com.google.common.collect.Sets;
//import com.weaver.common.component.table.column.WeaTableColumn;
//import com.weaver.common.component.table.page.Page;
//import com.weaver.common.hrm.service.HrmCommonEmployeeService;
//import com.weaver.excel.formula.api.entity.ExpressFormula;
//import com.weaver.hrm.salary.dao.ExcelAcctResultMapper;
//import com.weaver.hrm.salary.entity.salaryacct.bo.SalaryAcctResultBO;
//import com.weaver.hrm.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
//import com.weaver.hrm.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
//import com.weaver.hrm.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
//import com.weaver.hrm.salary.entity.salaryacct.po.ExcelAcctResultPO;
//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctRecordPO;
//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctResultPO;
//import com.weaver.hrm.salary.entity.salaryarchive.po.TaxAgentPO;
//import com.weaver.hrm.salary.entity.salaryitem.po.SalaryItemPO;
//import com.weaver.hrm.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
//import com.weaver.hrm.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobEmpFieldPO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobItemGroupPO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobItemPO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobPO;
//import com.weaver.hrm.salary.exception.SalaryRunTimeException;
//import com.weaver.hrm.salary.service.*;
//import com.weaver.hrm.salary.util.SalaryEntityUtil;
//import com.weaver.hrm.salary.util.SalaryI18nUtil;
//import com.weaver.hrm.salary.util.SalaryPageUtil;
//import com.weaver.teams.domain.user.SimpleEmployee;
//import org.apache.commons.collections4.CollectionUtils;
//import org.apache.commons.lang3.BooleanUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.commons.lang3.math.NumberUtils;
//
//import java.util.*;
//import java.util.stream.Collectors;
//
///**
// * 薪资核算的线下对比结果
// * <p>Copyright: Copyright (c) 2022</p>
// * <p>Company: 泛微软件</p>
// *
// * @author qiantao
// * @version 1.0
// **/
//public class SalaryComparisonResultServiceImpl extends Service implements SalaryComparisonResultService {
//
//
// private ExcelAcctResultMapper excelAcctResultMapper;
//
// private SalaryAcctResultService salaryAcctResultService;
//
// private SalaryAcctEmployeeService salaryAcctEmployeeService;
//
// private SalarySobItemService salarySobItemService;
//
// private SalaryAcctRecordService salaryAcctRecordService;
//
// private SalarySobEmpFieldService salarySobEmpFieldService;
//
// private HrmCommonEmployeeService hrmCommonEmployeeService;
//
// private TaxAgentService taxAgentService;
//
// private SalaryFormulaService salaryFormulaService;
//
// private SalaryItemService salaryItemService;
//
// private SalarySobService salarySobService;
//
// private SalarySobItemGroupService salarySobItemGroupService;
//
// @Override
// public List<ExcelAcctResultPO> listBySalaryAcctRecordId(Long salaryAcctRecordId, String tenantKey) {
// return new LambdaQueryChainWrapper<>(excelAcctResultMapper)
// .eq(ExcelAcctResultPO::getTenantKey, tenantKey)
// .eq(ExcelAcctResultPO::getDeleteType, 0)
// .eq(ExcelAcctResultPO::getSalaryAcctRecordId, salaryAcctRecordId)
// .list();
// }
//
// @Override
// public List<ExcelAcctResultPO> listBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds, String tenantKey) {
// if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
// return Collections.emptyList();
// }
// return new LambdaQueryChainWrapper<>(excelAcctResultMapper)
// .eq(ExcelAcctResultPO::getTenantKey, tenantKey)
// .eq(ExcelAcctResultPO::getDeleteType, 0)
// .in(ExcelAcctResultPO::getSalaryAcctEmpId, salaryAcctEmployeeIds)
// .list();
// }
//
// @Override
// public SalaryComparisonResultListDTO listPageByParam(SalaryComparisonResultQueryParam queryParam, String tenantKey) {
// return listByParam(true, queryParam, tenantKey);
// }
//
// @Override
// public SalaryComparisonResultListDTO listByParam(SalaryComparisonResultQueryParam queryParam, String tenantKey) {
// return listByParam(false, queryParam, tenantKey);
// }
//
// /**
// * 根据薪资核算人员查询薪资核算线下对比结果
// *
// * @param queryParam 列表查询条件
// * @param tenantKey 租户key
// * @return
// */
// private SalaryComparisonResultListDTO listByParam(boolean needPage, SalaryComparisonResultQueryParam queryParam, String tenantKey) {
// // 查询薪资核算记录
// SalaryAcctRecordPO salaryAcctRecordPO = salaryAcctRecordService.getById(queryParam.getSalaryAcctRecordId(), tenantKey);
// if (Objects.isNull(salaryAcctRecordPO)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
// }
// // 查询薪资核算所用薪资账套
// SalarySobPO salarySobPO = salarySobService.getById(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询薪资核算所用的薪资账套的员工信息字段
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询薪资账套的薪资项目分类
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询薪资核算所用薪资账套的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalarySobId(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询公式详情
// Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 转换成
// Map<Long, String> expressFormulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
// Map<Long, String> customParameters = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId, salarySobItemPO -> {
// if (salarySobItemPO.getFormulaId() <= 0) {
// return SalaryI18nUtil.getI18nLabel(92004, "输入/导入");
// }
// return expressFormulaMap.getOrDefault(salarySobItemPO.getFormulaId(), StringUtils.EMPTY);
// });
// // 查询薪资项目
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
// List<SalaryItemPO> salaryItemPOS = salaryItemService.listByIds(salaryItemIds, tenantKey);
// // 转换成聚合dto
// SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
// salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
// SalarySobItemAggregateDTO salarySobItemAggregateDTO = salarySobItemAggregateBO.convert2AggregateDTO();
//
// // 薪资核算人员
// List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = salaryAcctEmployeeService.listByResultQueryParam(queryParam, tenantKey);
// if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
// // 构建薪资核算结果列表表头
// List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, Collections.emptySet());
// // 构建列表数据
// Page<Map<String, Object>> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// dtoPage.setTotal(NumberUtils.INTEGER_ZERO);
// dtoPage.setRecords(Collections.emptyList());
// // 返回结果
// return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
// }
// // 薪资核算结果
// List<SalaryAcctResultPO> salaryAcctResultPOS;
// // 线下导入结果
// List<ExcelAcctResultPO> excelAcctResultPOS;
// // 如果薪资核算人员太多利用薪资核算人员id查询薪资核算结果的效率就不太好改为直接用薪资核算记录id查询
// if (salaryAcctEmployeePOS.size() > 1000) {
// // 查询薪资核算结果
// salaryAcctResultPOS = salaryAcctResultService.listBySalaryAcctRecordIds(Collections.singleton(queryParam.getSalaryAcctRecordId()), tenantKey);
// // 查询线下导入结果
// excelAcctResultPOS = listBySalaryAcctRecordId(queryParam.getSalaryAcctRecordId(), tenantKey);
// } else {
// // 薪资核算人员id
// Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
// // 查询薪资核算结果
// salaryAcctResultPOS = salaryAcctResultService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey);
// // 查询线下导入结果
// excelAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey);
// }
//
// // 查询个税扣缴义务人
// Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
// List<TaxAgentPO> taxAgentPOS = taxAgentService.listByIds(taxAgentIds, tenantKey);
// // 查询人员信息
// List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
// List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey);
// // 判断是否存在合并计税
// Set<Long> salaryAcctEmployeeIds4ConsolidatedTax;
// if (StringUtils.isEmpty(queryParam.getConsolidatedTaxation())) {
// salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
// } else {
// SalaryAcctEmployeeQueryParam accEmployeeQueryParam = new SalaryAcctEmployeeQueryParam()
// .setSalaryAcctRecordId(queryParam.getSalaryAcctRecordId())
// .setIds(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId));
// List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = salaryAcctEmployeeService.listByParam4ConsolidatedTax(accEmployeeQueryParam, tenantKey);
// salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);
// }
// // 系统值和线下值不一致的薪资项目id
// Set<Long> includeSalaryItemIds = Sets.newHashSetWithExpectedSize(salaryItemPOS.size());
// // 转换成薪资核算线下对比结果
// List<Map<String, Object>> resultMapList = SalaryAcctResultBO.buildComparisonTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees,
// salaryAcctEmployeePOS, salaryAcctResultPOS, excelAcctResultPOS, taxAgentPOS, customParameters, salaryAcctEmployeeIds4ConsolidatedTax, includeSalaryItemIds);
// // 系统值和线下值一致的人员
// if (queryParam.isOnlyDiffEmployee()) {
// // 过滤系统值和线下值一致的薪资核算人员
// resultMapList = resultMapList.stream()
// .filter(map -> BooleanUtils.toBoolean(String.valueOf(map.get("different"))))
// .collect(Collectors.toList());
// }
// // 分页
// Page<Map<String, Object>> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// dtoPage.setTotal(resultMapList.size());
// if (needPage) {
// dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), resultMapList));
// } else {
// dtoPage.setRecords(resultMapList);
// }
// Set<Long> excludeSalaryItemIds = Sets.newHashSet();
// if (queryParam.isOnlyDiffSalaryItem()) {
// // 过滤系统值和线下值一致的薪资项目
// excludeSalaryItemIds = salaryItemPOS.stream()
// .filter(salaryItemPO -> !includeSalaryItemIds.contains(salaryItemPO.getId()))
// .map(SalaryItemPO::getId)
// .collect(Collectors.toSet());
// }
// // 构建薪资核算结果列表表头
// List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, excludeSalaryItemIds);
// // 返回结果
// return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
// }
//
// @Override
// public void batchSave(Collection<ExcelAcctResultPO> excelAcctResultPOS) {
// excelAcctResultMapper.batchInsert(excelAcctResultPOS);
// }
//
// @Override
// public void deleteBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds, String tenantKey) {
// excelAcctResultMapper.deleteBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey);
// }
//
// @Override
// public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds, String tenantKey) {
// excelAcctResultMapper.deleteBySalaryAcctRecordIds(salaryAcctRecordIds, tenantKey);
// }
//}
package com.engine.salary.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
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.taxrate.TaxAgent;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
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.PageInfo;
import com.engine.salary.util.page.PageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资核算的线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryComparisonResultServiceImpl extends Service implements SalaryComparisonResultService {
private ExcelAcctResultMapper getExcelAcctResultMapper() {
return MapperProxyFactory.getProxy(ExcelAcctResultMapper.class);
}
private SalaryAcctResultService getSalaryAcctResultService(User user) {
return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
}
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) {
return (SalarySobEmpFieldService) ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private TaxAgentBiz taxAgentService = new TaxAgentBiz();
private SalaryFormulaService getSalaryFormulaService(User user) {
return null;
// return (SalaryFormulaService)ServiceUtil.getService(SalaryFormulaServiceImpl.class,user);
}
private SalaryItemService getSalaryItemService(User user) {
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return (SalarySobService) ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SalarySobItemGroupService getSalarySobItemGroupService(User user) {
return (SalarySobItemGroupService) ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user);
}
@Override
public List<ExcelAcctResultPO> listBySalaryAcctRecordId(Long salaryAcctRecordId) {
return getExcelAcctResultMapper().listSome(ExcelAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).build());
}
@Override
public List<ExcelAcctResultPO> listBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds) {
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
return Collections.emptyList();
}
return getExcelAcctResultMapper().listSome(ExcelAcctResultPO.builder().salaryAcctEmpIds(salaryAcctEmployeeIds).build());
}
@Override
public SalaryComparisonResultListDTO listPageByParam(SalaryComparisonResultQueryParam queryParam) {
return listByParam(true, queryParam);
}
@Override
public SalaryComparisonResultListDTO listByParam(SalaryComparisonResultQueryParam queryParam) {
return listByParam(false, queryParam);
}
/**
* 根据薪资核算人员查询薪资核算线下对比结果
*
* @param queryParam 列表查询条件
* @return
*/
private SalaryComparisonResultListDTO listByParam(boolean needPage, SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 查询薪资核算所用薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询薪资核算所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
List<ExpressFormula> expressFormulas = Lists.newArrayList();//todo getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 转换成
Map<Long, String> expressFormulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
Map<Long, String> customParameters = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId, salarySobItemPO -> {
if (salarySobItemPO.getFormulaId() <= 0) {
return SalaryI18nUtil.getI18nLabel(92004, "输入/导入");
}
return expressFormulaMap.getOrDefault(salarySobItemPO.getFormulaId(), StringUtils.EMPTY);
});
// 查询薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 转换成聚合dto
SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
SalarySobItemAggregateDTO salarySobItemAggregateDTO = salarySobItemAggregateBO.convert2AggregateDTO();
// 薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByResultQueryParam(queryParam);
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
// 构建薪资核算结果列表表头
List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, Collections.emptySet());
// 构建列表数据
// 返回结果
return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(new PageInfo<>());
}
// 薪资核算结果
List<SalaryAcctResultPO> salaryAcctResultPOS;
// 线下导入结果
List<ExcelAcctResultPO> excelAcctResultPOS;
// 如果薪资核算人员太多利用薪资核算人员id查询薪资核算结果的效率就不太好改为直接用薪资核算记录id查询
if (salaryAcctEmployeePOS.size() > 1000) {
// 查询薪资核算结果
salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(queryParam.getSalaryAcctRecordId()));
// 查询线下导入结果
excelAcctResultPOS = listBySalaryAcctRecordId(queryParam.getSalaryAcctRecordId());
} else {
// 薪资核算人员id
Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
// 查询薪资核算结果
salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
// 查询线下导入结果
excelAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
}
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = taxAgentService.listByIds(taxAgentIds);
// 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);
// 判断是否存在合并计税
Set<Long> salaryAcctEmployeeIds4ConsolidatedTax;
if (StringUtils.isEmpty(queryParam.getConsolidatedTaxation())) {
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
} else {
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder()
.salaryAcctRecordId(queryParam.getSalaryAcctRecordId())
.ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId))
.build();
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = getSalaryAcctEmployeeService(user).listByParam4ConsolidatedTax(accEmployeeQueryParam);
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);
}
// 系统值和线下值不一致的薪资项目id
Set<Long> includeSalaryItemIds = Sets.newHashSetWithExpectedSize(salaryItemPOS.size());
// 转换成薪资核算线下对比结果
List<Map<String, Object>> resultMapList = SalaryAcctResultBO.buildComparisonTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees,
salaryAcctEmployeePOS, salaryAcctResultPOS, excelAcctResultPOS, taxAgentPOS, customParameters, salaryAcctEmployeeIds4ConsolidatedTax, includeSalaryItemIds);
// 系统值和线下值一致的人员
if (queryParam.isOnlyDiffEmployee()) {
// 过滤系统值和线下值一致的薪资核算人员
resultMapList = resultMapList.stream()
.filter(map -> BooleanUtils.toBoolean(String.valueOf(map.get("different"))))
.collect(Collectors.toList());
}
// 分页
PageInfo<Map<String, Object>> dtoPage = new PageInfo<>();
dtoPage.setTotal(resultMapList.size());
if (needPage) {
dtoPage.setList(PageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), resultMapList));
} else {
dtoPage.setList(resultMapList);
}
Set<Long> excludeSalaryItemIds = Sets.newHashSet();
if (queryParam.isOnlyDiffSalaryItem()) {
// 过滤系统值和线下值一致的薪资项目
excludeSalaryItemIds = salaryItemPOS.stream()
.filter(salaryItemPO -> !includeSalaryItemIds.contains(salaryItemPO.getId()))
.map(SalaryItemPO::getId)
.collect(Collectors.toSet());
}
// 构建薪资核算结果列表表头
List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, excludeSalaryItemIds);
// 返回结果
return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
}
@Override
public void batchSave(Collection<ExcelAcctResultPO> excelAcctResultPOS) {
getExcelAcctResultMapper().batchInsert(excelAcctResultPOS);
}
@Override
public void deleteBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds) {
getExcelAcctResultMapper().deleteBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
}
@Override
public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
getExcelAcctResultMapper().deleteBySalaryAcctRecordIds(salaryAcctRecordIds);
}
}

View File

@ -0,0 +1,165 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.formula.FormulaMapper;
import com.engine.salary.mapper.formula.FormulaVarMapper;
import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪酬管理公式编辑器
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Slf4j
public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaService {
private FormulaMapper getFormulaMapper() {
return MapperProxyFactory.getProxy(FormulaMapper.class);
}
private FormulaVarMapper getFormulaVarMapper() {
return MapperProxyFactory.getProxy(FormulaVarMapper.class);
}
@Override
public List<ExpressFormula> listExpressFormula(Collection<Long> formulaIds) {
formulaIds = formulaIds.stream().filter(id -> id != null && id > 0).collect(Collectors.toList());
if (CollectionUtils.isEmpty(formulaIds)) {
return Collections.emptyList();
}
try {
// 当前租户自己新建的公式
List<FormulaPO> expressFormulas = getFormulaMapper().listByIds(Lists.newArrayList(formulaIds));
return expressFormulas.stream()
.filter(Objects::nonNull)
.map(m -> {
ExpressFormula expressFormula = new ExpressFormula();
BeanUtils.copyProperties(m, expressFormula);
List<FormulaVar> formulaVarPOS = getFormulaVarMapper().listSome(FormulaVar.builder().formulaId(m.getId()).build());
expressFormula.setParameters(formulaVarPOS);
return expressFormula;
})
.collect(Collectors.toList());
} catch (Exception e) {
log.info("获取公示详情失败", e);
throw new SalaryRunTimeException("获取公示详情失败");
}
}
@Override
public ExpressFormula getExpressFormula(Long formulaId) {
if (formulaId == null || formulaId <= 0) {
return null;
}
try {
// 当前租户自己新建的公式
FormulaPO formulaPO = getFormulaMapper().getById(formulaId);
ExpressFormula expressFormula = new ExpressFormula();
BeanUtils.copyProperties(formulaPO, expressFormula);
List<FormulaVar> formulaVarPOS = getFormulaVarMapper().listSome(FormulaVar.builder().formulaId(formulaId).build());
expressFormula.setParameters(formulaVarPOS);
return expressFormula;
} catch (Exception e) {
log.info("获取公示详情失败", e);
throw new SalaryRunTimeException("获取公示详情失败");
}
}
@Override
public void save(SalaryFormulaSaveParam param) {
FormulaPO formulaPO = new FormulaPO();
formulaPO.setName(param.getName());
formulaPO.setDescription(param.getDescription());
formulaPO.setModule(param.getModule());
formulaPO.setUseFor(param.getUseFor());
formulaPO.setReferenceType(param.getReferenceType());
formulaPO.setReturnType(param.getReturnType());
formulaPO.setValidateType(param.getValidateType());
formulaPO.setExtendParam(param.getExtendParam());
formulaPO.setFormula(param.getFormula());
formulaPO.setDeleteType(NumberUtils.INTEGER_ZERO);
Date now = new Date();
formulaPO.setCreateTime(now);
formulaPO.setUpdateTime(now);
formulaPO.setCreator((long) user.getUID());
getFormulaMapper().insertIgnoreNull(formulaPO);
List<FormulaVar> parameters = param.getParameters();
parameters.forEach(po -> {
po.setFormulaId(formulaPO.getId());
po.setDeleteType(NumberUtils.INTEGER_ZERO);
po.setCreator((long) user.getUID());
po.setCreateTime(now);
po.setUpdateTime(now);
getFormulaVarMapper().insertIgnoreNull(po);
});
}
@Override
public void update(SalaryFormulaSaveParam param) {
ValidUtil.doValidator(param, RuntimeTypeEnum.UPDATE);
Long id = param.getId();
FormulaPO formulaPO = getFormulaMapper().getById(id);
if (formulaPO == null) {
throw new SalaryRunTimeException("公式不存在或已删除");
}
formulaPO.setName(param.getName());
formulaPO.setDescription(param.getDescription());
formulaPO.setModule(param.getModule());
formulaPO.setUseFor(param.getUseFor());
formulaPO.setReferenceType(param.getReferenceType());
formulaPO.setReturnType(param.getReturnType());
formulaPO.setValidateType(param.getValidateType());
formulaPO.setExtendParam(param.getExtendParam());
formulaPO.setFormula(param.getFormula());
formulaPO.setDeleteType(NumberUtils.INTEGER_ZERO);
Date now = new Date();
formulaPO.setUpdateTime(now);
formulaPO.setCreator((long) user.getUID());
getFormulaMapper().updateIgnoreNull(formulaPO);
List<FormulaVar> parameters = param.getParameters();
//删除公式下的变量
getFormulaVarMapper().deleteByFormulaId(id);
parameters.forEach(po -> {
po.setCreator((long) user.getUID());
po.setCreateTime(now);
po.setUpdateTime(now);
getFormulaVarMapper().insertIgnoreNull(po);
});
}
}

View File

@ -17,7 +17,7 @@ import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.SalarySobItemService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.github.pagehelper.PageInfo;
import com.engine.salary.util.page.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import weaver.hrm.User;

View File

@ -6,6 +6,7 @@ import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.biz.SalarySobItemBiz;
import com.engine.salary.biz.SalarySobItemGroupBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
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;
@ -18,7 +19,6 @@ import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -270,6 +270,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
@Override
public void batchSave(Collection<SalarySobItemPO> salarySobItemPOS) {
if (CollectionUtils.isEmpty(salarySobItemPOS)){
return;
}
salarySobItemMapper.batchInsert(salarySobItemPOS);
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.transmethod;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.SalaryDataSourceEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.datacollection.AttendQuoteFieldSourceTypeEnum;
import com.engine.salary.enums.datacollection.AttendQuoteFieldTypeEnum;
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
@ -90,7 +90,7 @@ public class TransMethod {
* @return
*/
public static String datasource(String datasource) {
return SalaryDataSourceEnum.getDefaultLabelByValue(Integer.valueOf(datasource));
return SalaryValueTypeEnum.getDefaultLabelByValue(Integer.valueOf(datasource));
}
/**

View File

@ -119,7 +119,7 @@ public class ExcelUtil {
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
cell.setCellValue(o == null ? "" : o.toString());
}
}
}
@ -184,8 +184,8 @@ public class ExcelUtil {
}
}
if(CollectionUtils.isNotEmpty(comments)){
for (ExcelComment c:comments) {
if (CollectionUtils.isNotEmpty(comments)) {
for (ExcelComment c : comments) {
XSSFDrawing patr = sheet.createDrawingPatriarch();
XSSFComment cellComment = patr.createCellComment(new XSSFClientAnchor(c.dx1, c.dy1, c.dx2, c.dy2, c.col1, c.row1, c.col2, c.row2));
cellComment.setString(c.content);

View File

@ -2,12 +2,14 @@ package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siaccount.param.AccountParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam;
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.util.ResponseResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.web.bind.annotation.RequestParam;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import com.engine.salary.service.SIAccountService;
@ -17,6 +19,8 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
@ -28,11 +32,12 @@ import java.util.Map;
public class SIAccountController {
public SIAccountService getService(User user) {
return ServiceUtil.getService(SIAccountServiceImpl.class,user);
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
/**
* 获取台账列表页
*
* @param request
* @param response
* @return
@ -40,13 +45,14 @@ public class SIAccountController {
@GET
@Path("/batch/list")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody InsuranceAccountBatchParam insuranceAccountBatchParam) {
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceAccountBatchParam insuranceAccountBatchParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<InsuranceAccountBatchParam, Map<String, Object>>().run(getService(user)::listPage, insuranceAccountBatchParam);
}
/**
* 获取正常缴纳列表
*
* @param request
* @param response
* @param insuranceAccountDetailParam
@ -63,6 +69,7 @@ public class SIAccountController {
/**
* 根据姓名获取正常缴纳列表
*
* @param request
* @param response
* @param insuranceAccountDetailParam
@ -72,13 +79,14 @@ public class SIAccountController {
@Path("/detail/common/search")
@Produces(MediaType.APPLICATION_JSON)
public String commonByNameList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<InsuranceAccountDetailParam, Map<String, Object>>().run(getService(user)::listCommonPageByName, insuranceAccountDetailParam);
}
/**
* 获取补缴缴纳列表
*
* @param request
* @param response
* @param insuranceAccountDetailParam
@ -88,13 +96,14 @@ public class SIAccountController {
@Path("/detail/supplementary/list")
@Produces(MediaType.APPLICATION_JSON)
public String listSupplementaryPage(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<InsuranceAccountDetailParam, Map<String, Object>>().run(getService(user)::listSupplementaryPage, insuranceAccountDetailParam);
}
/**
* 根据姓名获取补缴缴纳列表
*
* @param request
* @param response
* @param insuranceAccountDetailParam
@ -104,7 +113,7 @@ public class SIAccountController {
@Path("/detail/supplementary/search")
@Produces(MediaType.APPLICATION_JSON)
public String supplementaryByNameList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<InsuranceAccountDetailParam, Map<String, Object>>().run(getService(user)::supplementaryByNameList, insuranceAccountDetailParam);
}
@ -112,6 +121,7 @@ public class SIAccountController {
/**
* 获取核算月份备注填写表单
*
* @param request
* @param response
* @return
@ -127,6 +137,7 @@ public class SIAccountController {
/**
* 保存并进入核算
*
* @param request
* @param response
* @param param
@ -138,15 +149,188 @@ public class SIAccountController {
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody AccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AccountParam, Map<String, Object>>().run(getService(user)::save, param);
return new ResponseResult<AccountParam, String>().run(getService(user)::save, param);
}
/**
* 正常缴纳页核算
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/commonAccount")
@Produces(MediaType.APPLICATION_JSON)
public String commonAccount(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody SaveCommonAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
if (CollectionUtils.isNotEmpty(param.getIncludes())) {
return new ResponseResult<SaveCommonAccountParam, String>().run(getService(user)::commonAccount, param);
} else {
AccountParam reqParam = new AccountParam();
reqParam.setBillMonth(param.getBillMonth());
return new ResponseResult<AccountParam, String>().run(getService(user)::save, reqParam);
}
}
/**
* 删除月份表单
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/delete")
@Produces(MediaType.APPLICATION_JSON)
public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody AccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AccountParam, String>().run(getService(user)::delete, param);
}
// @GetMapping("commonForm")
// @ApiOperation("正常缴纳添加缴纳人员表单")
// @WeaPermission
// public WeaResult<WeaForm> queryCommonForm() {
// return siAccountWrapper.getCommonForm(UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
@POST
@Path("/common/save")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody SaveCommonAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SaveCommonAccountParam, String>().run(getService(user)::saveCommonAccount, param);
}
// @GetMapping("querySupplementaryForm")
// @ApiOperation("补缴添加缴纳人员表单")
// @WeaPermission
// public WeaResult<WeaForm> querySupplementaryForm() {
// return siAccountWrapper.getSupplementaryForm(UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
@POST
@Path("/supplementary/save")
@Produces(MediaType.APPLICATION_JSON)
public String saveSummplementaryAccount(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody SaveSupplementaryAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SaveSupplementaryAccountParam, String>().run(getService(user)::saveSupplementaryAccount, param);
}
@POST
@Path("/common/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteCommon(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody SaveCommonAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SaveCommonAccountParam, String>().run(getService(user)::deleteCommonAccount, param);
}
@POST
@Path("/supplementary/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSummplementaryAccount(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody List<SupplementAccountBaseParam> param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<List<SupplementAccountBaseParam>, String>().run(getService(user)::deleteSummplementaryAccount, param);
}
@POST
@Path("/file")
@Produces(MediaType.APPLICATION_JSON)
public String file(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody AccountParam accountParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AccountParam, String>().run(getService(user)::file, accountParam);
}
// @GET
// @Path("/changeList")
// @Produces(MediaType.APPLICATION_JSON)
// public String changeList(@Context HttpServletRequest request, @Context HttpServletResponse response,
// @RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<InsuranceAccountDetailParam, Map<String, Object>>().run(getService(user)::changeList, insuranceAccountDetailParam);
// }
// @GetMapping("overView")
// @ApiOperation("总览")
// @WeaPermission
// public WeaResult<WeaTable<InsuranceAccountViewListDTO>> overView(@RequestParam(value = "billMonth") String billMonth) {
// return siAccountWrapper.overView(billMonth, UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
//
@GET
@Path("/tabList")
@Produces(MediaType.APPLICATION_JSON)
public String tabList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("billMonth") String billMonth) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, InsuranceAccountTabDTO>().run(getService(user)::tabList, billMonth);
}
// @GetMapping("inspectList")
// @ApiOperation("核算失败列表")
// @WeaPermission
// public WeaResult<WeaTable> getInspectTable(@RequestParam(value = "billMonth") String billMonth) {
// return siAccountWrapper.getInspectTable(billMonth, UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
//
// @PostMapping("inspectAccount")
// @ApiOperation("核算核算异常")
// @WeaPermission
// public WeaResult<String> accountInspect(@RequestBody InspectAccountParam param) {
// return siAccountWrapper.accountInspect(param.getIds(), param.getBillMonth(), UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
//
@POST
@Path("/ignore")
@Produces(MediaType.APPLICATION_JSON)
public String ignore(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>().run(getService(user)::ignore, ids);
}
@POST
@Path("/unconfirmed")
@Produces(MediaType.APPLICATION_JSON)
public String unconfirmed(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>().run(getService(user)::unconfirmed, ids);
}
@GET
@Path("/getDisplayFlag")
@Produces(MediaType.APPLICATION_JSON)
public String buttonCheck(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("billMonth") String billMonth) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, Map<String, Boolean>>().run(getService(user)::buttonCheck, billMonth);
}
}

View File

@ -8,13 +8,12 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.service.SalaryAcctExcelService;
import com.engine.salary.service.impl.SalaryAcctExcelServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalaryAcctEmployeeWrapper;
import com.engine.salary.wrapper.SalaryAcctExcelWrapper;
import com.engine.salary.wrapper.SalaryAcctRecordWrapper;
import com.engine.salary.wrapper.SalaryAcctResultWrapper;
import com.engine.salary.wrapper.*;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -62,11 +61,17 @@ public class SalaryAcctController {
}
// private SalaryAcctCheckResultWrapper salaryAcctCheckResultWrapper;
// private SalaryComparisonResultWrapper salaryComparisonResultWrapper;
private SalaryComparisonResultWrapper getSalaryComparisonResultWrapper(User user) {
return (SalaryComparisonResultWrapper) ServiceUtil.getService(SalaryComparisonResultWrapper.class, user);
}
private SalaryAcctExcelWrapper getSalaryAcctExcelWrapper(User user) {
return (SalaryAcctExcelWrapper) ServiceUtil.getService(SalaryAcctExcelWrapper.class, user);
}
// private SalaryAcctExcelService salaryAcctExcelService;
private SalaryAcctExcelService getSalaryAcctExcelService(User user) {
return (SalaryAcctExcelService) ServiceUtil.getService(SalaryAcctExcelServiceImpl.class, user);
}
// private SalaryBatchService salaryBatchService;
//
// /**********************************薪资核算记录相关 start*********************************/
@ -305,9 +310,9 @@ public class SalaryAcctController {
}
/**********************************薪资核算人员相关 end*********************************/
// **********************************薪资核算人员相关 end*********************************/
/**********************************薪资核算结果 start*********************************/
// **********************************薪资核算结果 start*********************************/
//薪资核算结果列表
@POST
@ -368,7 +373,8 @@ public class SalaryAcctController {
@Path("/acctresult/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportSalaryAcctResult(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryAcctResultQueryParam param = null;
SalaryAcctResultQueryParam param = new SalaryAcctResultQueryParam();
setSalaryAcctResultQueryParam(request,param);
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportSalaryAcctResult(param);
String time = LocalDate.now().toString();
@ -387,40 +393,53 @@ public class SalaryAcctController {
}
// @GetMapping("/acctresult/importField")
// @GetMapping("/acctresult/importField")
// @ApiOperation("导入核算结果前生成导入模板时可选的薪资项目")
// @WeaPermission
// public WeaResult<SalaryAcctImportFieldDTO> getImportField(@RequestParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
// SalaryAcctImportFieldDTO importField = salaryAcctExcelService.getImportField(salaryAcctRecordId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// SalaryAcctImportFieldDTO importField = getSalaryAcctExcelService(user).getImportField(salaryAcctRecordId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(importField);
// }
//
// @PostMapping("/acctresult/importtemplate/export")
// @ApiOperation("导出导入模板")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportImportTemplate(@RequestBody @Validated SalaryAcctImportTemplateParam param) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportImportTemplate(param, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// @GetMapping("/acctresult/importParams")
// @ApiOperation("获取导入核算结果的导入参数")
// @WeaPermission
// public WeaResult<ExcelImportParam> getAcctResultImportParams() {
// return WeaResult.success(salaryBatchService.buildImportParam("importSalaryAcctResult",
// "importSalaryAcctResult",
// "薪资核算结果",
// null,
// null));
// }
//
// /**********************************薪资核算结果 end*********************************/
//
// /**********************************检验异常 start*********************************/
//
//导出导入模板
@GET
@Path("/acctresult/importtemplate/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportImportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryAcctImportTemplateParam param = new SalaryAcctImportTemplateParam();
setSalaryAcctResultQueryParam(request,param);
String importType = request.getParameter("importType");
if (StringUtils.isNotBlank(importType)) {
param.setImportType(importType);
}
String salaryItemIds = request.getParameter("salaryItemIds");
if (StringUtils.isNotBlank(salaryItemIds)) {
param.setSalaryItemIds(Arrays.stream(salaryItemIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportImportTemplate(param);
String time = LocalDate.now().toString();
String fileName = "薪资核算导入模板" + time;
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();
}
// **********************************薪资核算结果 end*********************************/
// **********************************检验异常 start*********************************/
// @GetMapping("/checkresult/getCount")
// @ApiOperation(("获取校验结果(异常)总数"))
// @WeaPermission
@ -491,18 +510,20 @@ public class SalaryAcctController {
// return WeaResult.success(map);
// }
//
// /**********************************检验异常 end*********************************/
//
// /**********************************线下对比 start*********************************/
//
// @PostMapping("/comparisonresult/list")
// @ApiOperation("线上线下对比结果列表")
// @WeaPermission
// public WeaResult<WeaTable<Map<String, Object>>> listComparisonResult(@RequestBody @Validated SalaryComparisonResultQueryParam queryParam) {
// WeaTable<Map<String, Object>> weaTable = salaryComparisonResultWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// **********************************检验异常 end*********************************/
// **********************************线下对比 start*********************************/
//线上线下对比结果列表
@POST
@Path("/comparisonresult/list")
@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, Map<String, Object>>().run(getSalaryComparisonResultWrapper(user)::listPage, param);
}
// @GetMapping("/comparisonresult/importParams")
// @ApiOperation("获取导入核算结果的导入参数")
// @WeaPermission
@ -513,7 +534,79 @@ public class SalaryAcctController {
// null,
// null));
// }
//
//导出线上线下对比结果
@GET
@Path("/comparisonresult/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryComparisonResultQueryParam param = new SalaryComparisonResultQueryParam();
setSalaryAcctResultQueryParam(request, param);
String onlyDiffEmployee = request.getParameter("onlyDiffEmployee");
if(StringUtils.isNotBlank(onlyDiffEmployee)){
param.setOnlyDiffEmployee(Boolean.parseBoolean(onlyDiffEmployee));
}
String onlyDiffSalaryItem = request.getParameter("onlyDiffSalaryItem");
if(StringUtils.isNotBlank(onlyDiffSalaryItem)){
param.setOnlyDiffSalaryItem(Boolean.parseBoolean(onlyDiffSalaryItem));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportComparisonResult(param);
String time = LocalDate.now().toString();
String fileName = "线下对比结果" + time;
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();
}
private void setSalaryAcctResultQueryParam(HttpServletRequest request, SalaryAcctResultQueryParam param) {
String salaryAcctRecordId = request.getParameter("salaryAcctRecordId");
if (StringUtils.isNotBlank(salaryAcctRecordId)) {
param.setSalaryAcctRecordId(Long.parseLong(salaryAcctRecordId));
}
String employeeName = request.getParameter("employeeName");
if (StringUtils.isNotBlank(employeeName)) {
param.setEmployeeName(employeeName);
}
String taxAgentId = request.getParameter("taxAgentId");
if (StringUtils.isNotBlank(taxAgentId)) {
param.setTaxAgentId(Long.parseLong(taxAgentId));
}
String departmentIds = request.getParameter("departmentIds");
if (StringUtils.isNotBlank(departmentIds)) {
param.setDepartmentIds(Arrays.stream(departmentIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
String positionIds = request.getParameter("positionIds");
if (StringUtils.isNotBlank(positionIds)) {
param.setPositionIds(Arrays.stream(positionIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
String status = request.getParameter("status");
if (StringUtils.isNotBlank(status)) {
param.setStatus(SalaryEmployeeStatusEnum.parseByValue(Integer.parseInt(status)));
}
//fixme 日期
request.getParameter("dismissDate");
String consolidatedTaxation = request.getParameter("consolidatedTaxation");
if (StringUtils.isNotBlank(consolidatedTaxation)) {
param.setConsolidatedTaxation(consolidatedTaxation);
}
String ids = request.getParameter("ids");
if (StringUtils.isNotBlank(ids)) {
param.setIds(Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
}
// @PostMapping("/comparisonresult/export")
// @ApiOperation("导出线上线下对比结果")
// @WeaPermission

View File

@ -0,0 +1,65 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.wrapper.SalaryFormulaWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
public class SalaryFormulaController {
private SalaryFormulaWrapper getSalaryFormulaWrapper(User user) {
return (SalaryFormulaWrapper) ServiceUtil.getService(SalaryFormulaWrapper.class, user);
}
//变量项
@POST
@Path("/search/group")
@Produces(MediaType.APPLICATION_JSON)
public String fieldGroupList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Map<String, Object>, List<Map<String, Object>>>().run(getSalaryFormulaWrapper(user)::fieldGroupList, param);
}
//变量字段列表
@POST
@Path("/search/field")
@Produces(MediaType.APPLICATION_JSON)
public String fieldList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryFormulaFieldQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryFormulaFieldQueryParam, List<FormulaVar>>().run(getSalaryFormulaWrapper(user)::fieldList, param);
}
//获取公式详情
@GET
@Path("/detail")
@Produces(MediaType.APPLICATION_JSON)
public String detail(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "formulaId") Long formulaId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, ExpressFormulaDTO>().run(getSalaryFormulaWrapper(user)::detail, formulaId);
}
@POST
@Path("/save")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryFormulaSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryFormulaSaveParam, String>().run(getSalaryFormulaWrapper(user)::save, param);
}
}

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalaryItemWrapper;
import com.engine.salary.wrapper.SysSalaryItemWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -58,7 +59,7 @@ public class SalaryItemController {
@Produces(MediaType.APPLICATION_JSON)
public String listSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam searchParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryItemSearchParam, Map<String, Object>>().run(getSalaryItemWrapper(user)::listPage, searchParam);
return new ResponseResult<SalaryItemSearchParam, PageInfo<SalaryItemListDTO>>().run(getSalaryItemWrapper(user)::listPageV2, searchParam);
}
@ -75,7 +76,7 @@ public class SalaryItemController {
@Produces(MediaType.APPLICATION_JSON)
public String listCanDeleteSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam searchParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryItemSearchParam, Map<String, Object>>().run(getSalaryItemWrapper(user)::listPage4CanDelete, searchParam);
return new ResponseResult<SalaryItemSearchParam, PageInfo<SalaryItemListDTO>>().run(getSalaryItemWrapper(user)::listPage4CanDelete, searchParam);
}
/**

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctImportTemplateParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.service.SalaryAcctExcelService;
import com.engine.salary.service.impl.SalaryAcctExcelServiceImpl;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -68,9 +69,9 @@ public class SalaryAcctExcelWrapper extends Service {
* @param queryParam
* @return
*/
// public Map<String, Object> exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
// return getSalaryAcctExcelService(user).exportComparisonResult(excelExportParam, queryParam, simpleEmployee, tenantKey, eteamsId);
// }
public XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
return getSalaryAcctExcelService(user).exportComparisonResult( queryParam);
}
/**
* 薪资核算线下对比结果导入模板导出

View File

@ -19,9 +19,6 @@ import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.ValidUtil;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
import weaver.hrm.User;
import java.util.HashMap;
@ -187,13 +184,13 @@ public class SalaryAcctResultWrapper extends Service {
// .setMessage(StringUtils.EMPTY);
// salaryAcctProgressService.initProgress("" + calculateParam.getSalaryAcctRecordId(), initProgress, simpleEmployee.getEmployeeId(), tenantKey);
// 异步执行薪资核算
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
// LocalRunnable localRunnable = new LocalRunnable() {
// @Override
// public void execute() {
getSalaryAcctResultService(user).calculate(calculateParam, simpleEmployee);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryAcctCalculate", localRunnable);
// }
// };
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryAcctCalculate", localRunnable);
}
/**

View File

@ -22,11 +22,9 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import weaver.hrm.User;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
/**
@ -37,16 +35,13 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Component
public class SalaryArchiveItemWrapper extends Service {
private SalaryArchiveItemService getSalaryArchiveItemService(User user) {
return (SalaryArchiveItemService) ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user);
}
private ExecutorService taskExecutor;
/**
* 构建薪资项目基础信息表单
*

View File

@ -0,0 +1,59 @@
package com.engine.salary.wrapper;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
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 java.util.HashMap;
import java.util.Map;
/**
* 薪资核算线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryComparisonResultWrapper extends Service {
private SalaryComparisonResultService salaryComparisonResultService;
private SalaryAcctRecordService salaryAcctRecordService;
private SalarySobEmpFieldService salarySobEmpFieldService;
private SalarySobItemService salarySobItemService;
/**
* 薪资核算线下对比列表
*
* @param queryParam 列表查询条件
* @return
*/
public Map<String, Object> listPage(SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算线下对比列表
SalaryComparisonResultListDTO salaryComparisonResultListDTO = salaryComparisonResultService.listPageByParam(queryParam);
WeaTable table = new WeaTable();
table.setColumns(salaryComparisonResultListDTO.getWeaTableColumns());
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
Map<String,Object> datas = new HashMap<>();
datas.put("pageInfo", salaryComparisonResultListDTO.getData());
datas.put("dataKey",result.getResultMap());
return datas;
}
}

View File

@ -0,0 +1,74 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryformula.bo.SalaryFormulaBO;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.RemoteExcelService;
import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.service.impl.RemoteExcelServiceImpl;
import com.engine.salary.service.impl.SalaryFormulaServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryFormulaWrapper extends Service {
private RemoteExcelService getRemoteExcelService(User user) {
return (RemoteExcelService) ServiceUtil.getService(RemoteExcelServiceImpl.class, user);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
/**
* 公式字段列表
*
* @param param 查询参数
* @return
*/
public List<FormulaVar> fieldList(SalaryFormulaFieldQueryParam param) {
return getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam());
}
/**
* 公式字段分类
*
* @param param 查询参数
* @return
*/
public List<Map<String, Object>> fieldGroupList(Map<String, Object> param) {
return getRemoteExcelService(user).fieldGroupList(param);
}
public ExpressFormulaDTO detail(Long formulaId) {
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(Collections.singleton(formulaId));
if (CollectionUtils.isEmpty(expressFormulas)) {
throw new SalaryRunTimeException("获取公式详情失败");
}
return SalaryFormulaBO.convert2DTO(expressFormulas).get(0);
}
public void save(SalaryFormulaSaveParam salaryFormulaSaveParam) {
getSalaryFormulaService(user).save(salaryFormulaSaveParam);
}
}

View File

@ -1,10 +1,9 @@
package com.engine.salary.wrapper;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.component.WeaFormOption;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO;
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
@ -20,11 +19,13 @@ import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.SalarySobItemService;
import com.engine.salary.service.SysSalaryItemService;
import com.engine.salary.service.impl.SalaryFormulaServiceImpl;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
import com.engine.salary.service.impl.SalarySobItemServiceImpl;
import com.engine.salary.service.impl.SysSalaryItemServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
@ -51,7 +52,10 @@ public class SalaryItemWrapper extends Service {
return (SysSalaryItemService) ServiceUtil.getService(SysSalaryItemServiceImpl.class, user);
}
private SalaryFormulaService salaryFormulaService;
private SalaryFormulaService getSalaryFormulaService(User user) {
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
@ -63,88 +67,52 @@ public class SalaryItemWrapper extends Service {
* @param searchParam 查询参数
* @return
*/
public Map<String, Object> listPage(SalaryItemSearchParam searchParam) {
public PageInfo<SalaryItemListDTO> listPageV2(SalaryItemSearchParam searchParam) {
SalaryWeaTable<SalaryItemListDTO> table = new SalaryWeaTable<SalaryItemListDTO>(user, SalaryItemListDTO.class);
// 1查询薪资项目
PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(searchParam);
List<SalaryItemPO> salaryItemList = page.getList();
String fields = " t.id" +
" , t.name" +
" , t.code" +
" , t.system_type" +
" , t.sys_salary_item_id" +
" , t.use_default as useDefault" +
" , t.use_in_employee_salary as useInEmployeeSalary" +
" , t.rounding_mode as roundingMode" +
" , t.pattern" +
" , t.value_type as valueType" +
" , t.formula_id" +
" , t.description" +
" , t.can_edit" +
" , t.data_type as dataType" +
" , t.can_delete";
//最终返回的分页对象
PageInfo<SalaryItemListDTO> salaryItemListDTOPage = new PageInfo<>(SalaryItemListDTO.class);
salaryItemListDTOPage.setPageSize(page.getPageSize());
salaryItemListDTOPage.setPageNum(page.getPageNum());
salaryItemListDTOPage.setTotal(page.getTotal());
String from = "from hrsa_salary_item t";
// 被薪资账套引用的薪资项目
List<SalarySobItemPO> salarySobItems = new ArrayList<>();
if (CollectionUtils.isNotEmpty(salaryItemList)) {
//2填充公式内容
Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getFormulaId);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 转换成薪资项目列表dto
List<SalaryItemListDTO> salaryItemListDTOS = SalaryItemBO.convert2ListDTO(salaryItemList, expressFormulas);
//3被引用的薪资项目不能删除
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getId);
salarySobItems = getSalarySobItemService(user).listBySalaryItemIds(salaryItemIds);
if (CollectionUtils.isNotEmpty(salarySobItems)) {
Set<Long> salaryItemIdsUseBySob = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
salaryItemListDTOS.forEach(dto->{
if (salaryItemIdsUseBySob.contains(dto.getId())){
dto.setCanDelete(false);
}
});
}
salaryItemListDTOPage.setList(salaryItemListDTOS);
}
table.setBackfields(fields);
table.setSqlform(from);
table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(searchParam));
table.setSqlorderby("t.id DESC");
table.setSqlprimarykey("t.id");
table.setSqlisdistinct("false");
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
// // 1查询薪资项目
// PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(searchParam);
// List<SalaryItemPO> salaryItemList = page.getList();
//
// //最终返回的分页对象
// PageInfo<SalaryItemListDTO> salaryItemListDTOPage = new PageInfo<>();
//
// if (CollectionUtils.isNotEmpty(salaryItemList)) {
// //2填充公式内容
// Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getFormulaId);
// // todo 查询公式
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds);
// // 转换成薪资项目列表dto
// salaryItemListDTOPage.setList(SalaryItemBO.convert2ListDTO(salaryItemList, expressFormulas));
//
// //3被引用的薪资项目不能删除
// // 查询被账套引用的薪资项目
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getId);
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalaryItemIds(salaryItemIds);
// }
// // 构建前端所需的数据格式
// WeaTable<SalaryItemListDTO> weaTable = SalaryFormatUtil.<SalaryItemListDTO>getInstance().buildTable(SalaryItemListDTO.class, dtoPage);
// // 被薪资账套引用的薪资项目不可删除
// if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(salarySobItems)) {
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
// for (int i = 0; i < page.getRecords().size(); i++) {
// SalaryItemPO salaryItemPO = page.getRecords().get(i);
// if (salaryItemIds.contains(salaryItemPO.getId())) {
// Permission permission = weaTable.getOperatesPermission().get(i).get(1);
// permission.setVisible(false);
// permission.setDisabled(true);
// }
// }
// }
return salaryItemListDTOPage;
}
/**
* 可以删除的薪资项目列表
*
* @param searchParam 查询人员
* @return
*/
public Map<String, Object> listPage4CanDelete(SalaryItemSearchParam searchParam) {
public PageInfo<SalaryItemListDTO> listPage4CanDelete(SalaryItemSearchParam searchParam) {
// 查询所有薪资账套中的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).list();
// 被引用的薪资项目id
@ -152,8 +120,7 @@ public class SalaryItemWrapper extends Service {
// 排除被引用的薪资项目被引用的薪资项目不可以删除
searchParam.setExcludeIds(salaryItemIds);
// 转换成前端所需的数据格式
Map<String, Object> map = listPage(searchParam);
return map;
return listPageV2(searchParam);
}
@ -170,24 +137,11 @@ public class SalaryItemWrapper extends Service {
}
// 查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId);
// todo List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 转换成薪资项目列表dto
return SalaryItemBO.convert2ListDTO(salaryItemPOS, null);
return SalaryItemBO.convert2ListDTO(salaryItemPOS, expressFormulas);
}
// /**
// * 薪资项目列表的高级搜索
// *
// * @return
// */
// public WeaSearchCondition getSearchCondition() {
// WeaSearchCondition searchCondition = SalaryFormatUtil.<SalaryItemSearchConditionDTO>getInstance()
// .buildCondition(SalaryItemSearchConditionDTO.class, new SalaryItemSearchConditionDTO(), "salaryItemCondition");
// // "其他条件"不要
// searchCondition.getGroups().remove(1);
// return searchCondition;
// }
/**
* 薪资项目详情
*
@ -206,17 +160,16 @@ public class SalaryItemWrapper extends Service {
if (Objects.isNull(salaryItemPO) && Objects.isNull(sysSalaryItemPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
}
//todo 公式详情
// ExpressFormula expressFormula;
ExpressFormula expressFormula;
// // 转换成薪资项目详情dto
if (Objects.isNull(salaryItemPO)) {
salaryItemFormDTO = SysSalaryItemBO.convert2FormDTO(sysSalaryItemPO);
// expressFormula = salaryFormulaService.getExpressFormula(sysSalaryItemPO.getFormulaId());
expressFormula = getSalaryFormulaService(user).getExpressFormula(sysSalaryItemPO.getFormulaId());
} else {
salaryItemFormDTO = SalaryItemBO.convert2FormDTO(salaryItemPO);
// expressFormula = salaryFormulaService.getExpressFormula(salaryItemPO.getFormulaId());
expressFormula = getSalaryFormulaService(user).getExpressFormula(salaryItemPO.getFormulaId());
}
// salaryItemFormDTO.setFormulaContent(Optional.ofNullable(expressFormula).map(ExpressFormula::getFormula).orElse(""));
salaryItemFormDTO.setFormulaContent(Optional.ofNullable(expressFormula).map(ExpressFormula::getFormula).orElse(""));
}
return salaryItemFormDTO;
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salarysob.bo.SalarySobCheckRuleBO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleListDTO;
@ -15,7 +16,6 @@ import com.engine.salary.service.SalarySobCheckRuleService;
import com.engine.salary.service.impl.SalarySobCheckRuleServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import weaver.hrm.User;
import java.util.ArrayList;

View File

@ -34,7 +34,7 @@ import java.util.*;
* @author qiantao
* @version 1.0
**/
@Component
public class SalarySobItemWrapper extends Service {
private SalarySobItemService getSalarySobItemService(User user) {

View File

@ -32,7 +32,7 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Component
public class SysSalaryItemWrapper extends Service {

View File

@ -0,0 +1,160 @@
package com.engine.workflow.cmd.requestForm.remind;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/**
* 邮件提醒候取链接
* Created by wcc on 2019/7/2.
*/
public class GetEmailRemindUrlCmd extends AbstractCommonCommand<Map<String, Object>> {
protected String requestName;
protected String requestId;
public GetEmailRemindUrlCmd(User user, Map<String, Object> params, String requestId, String requestName) throws UnsupportedEncodingException {
this.user = user;
this.params = params;
this.requestId = requestId;
this.requestName = requestName;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
BaseBean baseBean = new BaseBean();
RecordSet rs = new RecordSet();
if (Strings.isNullOrEmpty(requestName)) {
rs.executeQuery("select requestNameNew from workflow_requestbase where requestid = ?", requestId);
rs.next();
requestName = rs.getString(1);
}
String emailLink = "(" + requestName + ")";
// 从数据库中取得OAaddress数据作为host
rs.executeQuery("select oaaddress from systemset");
rs.next();
String host = Util.null2String(rs.getString("oaaddress"));
baseBean.writeLog("qc1602252---static_host=" + host);
// String domain = (String) Util_DataCache.getObjVal("qc1602252"+this.user.getUID());
// baseBean.writeLog("qc1602252---key="+"qc1602252"+this.user.getUID());
// baseBean.writeLog("qc1602252---domain="+domain);
// if(StringUtils.isNotBlank(domain)){
// host = domain;
// }else{
// //找不到人与域名映射的情况获取requestId映射的域名
// String requestIdDomain = (String) Util_DataCache.getObjVal("domain"+requestId);
// baseBean.writeLog("domain---key="+"domain"+requestId);
// baseBean.writeLog("requestIdDomain="+requestIdDomain);
// if(StringUtils.isNotBlank(requestIdDomain)){
// host = requestIdDomain;
// }
// }
//为适配移动端将流程创建人的分部与域名绑定
if (StringUtils.isNotBlank(requestId) && !"-1".equals(requestId)) {
baseBean.writeLog("qc1602252---requestId=" + requestId);
baseBean.writeLog("qc1602252---config=" + SubCompanyName + "--" + Domain + "--" + XXFWSubCompanyName + "--" + XXFWDomain);
baseBean.writeLog("qc1602252---requestId=" + requestId);
rs.executeQuery("select creater from workflow_requestbase where requestid = ?", requestId);
if (rs.next()) {
String creater = rs.getString("creater");
baseBean.writeLog("qc1602252---requestId creater= " + requestId + "---" + creater);
rs.executeQuery("select subcompanyid1 from hrmresource where id = ?", creater);
if (rs.next()) {
String subcompanyid1 = rs.getString("subcompanyid1");
baseBean.writeLog("qc1602252---requestId creater subcompanyid1=" + requestId + "---" + creater + "---" + subcompanyid1);
Map<String, String> map = new HashMap<>();
map.put("subcompanyid1", subcompanyid1);
Map<String, String> subcompany = getSubcompany(map);
String targetUrl = subcompany.get("targetUrl");
host = targetUrl;
baseBean.writeLog("qc1602252---" + "---requestId creater lastsubcompanyid1=" + requestId + "---" + creater + "---" + subcompany.get("subcompanyid1"));
baseBean.writeLog("qc1602252---requestId creater subcompanyname=" + requestId + "---" + creater + "---" + subcompany.get("subcompanyname"));
baseBean.writeLog("qc1602252---requestId creater targetUrl=" + requestId + "---" + creater + "---" + subcompany.get("targetUrl"));
}
}
}
if (!Strings.isNullOrEmpty(host)) {
String loginPage = "/login/LoginMail.jsp";
String gotoPage = "/common/chatResource/view.html?resourcetype=0&resourceid=" + requestId;
if (GCONST.getMailReminderSet()) {
loginPage = Strings.isNullOrEmpty(GCONST.getMailLoginPage()) ? loginPage : GCONST.getMailLoginPage();
gotoPage = Strings.isNullOrEmpty(GCONST.getMailGotoPage()) ? gotoPage : GCONST.getMailGotoPage();
}
try {
gotoPage = URLEncoder.encode(gotoPage, "utf-8");
//需要编码两次
gotoPage = URLEncoder.encode(gotoPage, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String url = String.format("%s?gopage=%s&target=2", loginPage, gotoPage);
emailLink = "(<a style='text-decoration: underline; color: blue;cursor:hand' target='_blank' href='" +
host + url + " '>" + requestName + "</a>)";
}
baseBean.writeLog("qc1602252---requestId=" + requestId);
baseBean.writeLog("qc1602252---emailLink=" + emailLink);
Map<String, Object> result = new HashMap<>();
result.put("url", emailLink);
return result;
}
@Override
public BizLogContext getLogContext() {
return null;
}
BaseBean baseBean = new BaseBean();
String SubCompanyName = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "SubCompanyName")).getBytes("ISO-8859-1"), "utf-8")).trim();
String Domain = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "Domain")).getBytes("ISO-8859-1"), "utf-8")).trim();
String XXFWSubCompanyName = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "XXFWSubCompanyName")).getBytes("ISO-8859-1"), "utf-8")).trim();
String XXFWDomain = Util.null2String(new String(Util.null2String(baseBean.getPropValue("SZSM_subcompany_domain_config", "XXFWDomain")).getBytes("ISO-8859-1"), "utf-8")).trim();
private List<String> SubCompanyNameList = Arrays.stream(SubCompanyName.split(",")).collect(Collectors.toList());
private List<String> XXFWSubCompanyNameList = Arrays.stream(XXFWSubCompanyName.split(",")).collect(Collectors.toList());
private Map<String, String> getSubcompany(Map<String, String> map) {
Map<String, String> hashMap = Maps.newHashMap();
RecordSet rs = new RecordSet();
rs.executeQuery("select SUPSUBCOMID,SUBCOMPANYNAME from hrmsubcompany where id = ? ", map.get("subcompanyid1"));
if (rs.next()) {
String subcompanyid1 = rs.getString("SUPSUBCOMID");
String subcompanyname = rs.getString("SUBCOMPANYNAME");
hashMap.put("subcompanyid1", subcompanyid1);
hashMap.put("subcompanyname", subcompanyname);
if (SubCompanyNameList.contains(subcompanyname)) {
hashMap.put("targetUrl", Domain);
return hashMap;
} else if (XXFWSubCompanyNameList.contains(subcompanyname)) {
hashMap.put("targetUrl", XXFWDomain);
return hashMap;
} else {
if (!map.get("subcompanyid1").equals(hashMap.get("subcompanyid1"))) {
return getSubcompany(hashMap);
} else {
return hashMap;
}
}
}
return hashMap;
}
}

File diff suppressed because it is too large Load Diff