diff --git a/resource/pagehelper/pagehelper-5.0.0/jsqlparser.jar b/resource/pagehelper/pagehelper-5.0.0/jsqlparser.jar deleted file mode 100644 index 2bbde830f..000000000 Binary files a/resource/pagehelper/pagehelper-5.0.0/jsqlparser.jar and /dev/null differ diff --git a/resource/pagehelper/pagehelper-5.0.0/pagehelper-5.0.0.jar b/resource/pagehelper/pagehelper-5.0.0/pagehelper-5.0.0.jar deleted file mode 100644 index 187266c88..000000000 Binary files a/resource/pagehelper/pagehelper-5.0.0/pagehelper-5.0.0.jar and /dev/null differ diff --git a/resource/pagehelper/pagehelper-5.3.1 jsqlparser-4.4/jsqlparser.jar b/resource/pagehelper/pagehelper-5.3.1 jsqlparser-4.4/jsqlparser.jar deleted file mode 100644 index b3eeba5a2..000000000 Binary files a/resource/pagehelper/pagehelper-5.3.1 jsqlparser-4.4/jsqlparser.jar and /dev/null differ diff --git a/resource/pagehelper/pagehelper-5.3.1 jsqlparser-4.4/pagehelper-5.0.0.jar b/resource/pagehelper/pagehelper-5.3.1 jsqlparser-4.4/pagehelper-5.0.0.jar deleted file mode 100644 index 511e0d581..000000000 Binary files a/resource/pagehelper/pagehelper-5.3.1 jsqlparser-4.4/pagehelper-5.0.0.jar and /dev/null differ diff --git a/resource/sql/Oracle常见问题.txt b/resource/sql/Oracle常见问题.txt new file mode 100644 index 000000000..8725b72ea --- /dev/null +++ b/resource/sql/Oracle常见问题.txt @@ -0,0 +1,47 @@ +Oracle数据库中常见报错问题 +1、工资单发放----新建工资单模板时显示系统异常无法进行下一步 + + 解决方法:在数据库中执行以下语句,第一句执行成功后再执行第二句,如果第一句执行失败请勿执行下面的!!!!!! + + -- 创建临时表HRSA_SALARY_TEMPLAT_TEMPT 结构与数据和HRSA_SALARY_TEMPLATE一样 + create table HRSA_SALARY_TEMPLAT_TEMPT as select * from HRSA_SALARY_TEMPLATE; + + -- 删除原表HRSA_SALARY_TEMPLATE数据 + delete from HRSA_SALARY_TEMPLATE; + + alter table HRSA_SALARY_TEMPLATE modify salary_item_setting long; + alter table HRSA_SALARY_TEMPLATE modify salary_item_setting CLOB; + insert into HRSA_SALARY_TEMPLATE select * from HRSA_SALARY_TEMPLAT_TEMPT ; + drop table HRSA_SALARY_TEMPLAT_TEMPT; + + + + + + + + + + + +2、工资单发放----发放工资单时显示系统异常无法进行下一步 + + 解决方法:在数据库中执行以下语句,第一句执行成功后再执行第二句,如果第一句执行失败请勿执行下面的!!!!!! + + + -- 创建临时表HRSA_SALARY_SEND_INFO_TEMPI结构与数据和HRSA_SALARY_SEND_INFO一样 + create table HRSA_SALARY_SEND_INFO_TEMPI as select * from HRSA_SALARY_SEND_INFO; + + -- 删除原表HRSA_SALARY_SEND_INFO数据 + delete from HRSA_SALARY_SEND_INFO; + + alter table HRSA_SALARY_SEND_INFO modify SALARY_TEMPLATE long; + alter table HRSA_SALARY_SEND_INFO modify SALARY_TEMPLATE CLOB; + insert into HRSA_SALARY_SEND_INFO select * from HRSA_SALARY_SEND_INFO_TEMPI; + drop table HRSA_SALARY_SEND_INFO_TEMPI; + + + + + + diff --git a/src/com/engine/salary/biz/SICategoryBiz.java b/src/com/engine/salary/biz/SICategoryBiz.java index ddde273d0..6311c02b9 100644 --- a/src/com/engine/salary/biz/SICategoryBiz.java +++ b/src/com/engine/salary/biz/SICategoryBiz.java @@ -11,6 +11,7 @@ import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.util.SalaryEnumUtil; import com.mzlion.core.utils.BeanUtils; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -74,6 +75,7 @@ public class SICategoryBiz { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class); + iCategoryFormDTO.setInsuranceName(StringUtils.trim(iCategoryFormDTO.getInsuranceName())); List iCategoryPOS = listByName(iCategoryFormDTO.getInsuranceName()); if (CollectionUtils.isNotEmpty(iCategoryPOS)) { throw new SalaryRunTimeException("福利名称不允许重复"); diff --git a/src/com/engine/salary/biz/SISchemeBiz.java b/src/com/engine/salary/biz/SISchemeBiz.java index 64620f82f..13047d44b 100644 --- a/src/com/engine/salary/biz/SISchemeBiz.java +++ b/src/com/engine/salary/biz/SISchemeBiz.java @@ -251,6 +251,7 @@ public class SISchemeBiz { try { //保存福利项目主表 InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class); + saveParam.getInsuranceScheme().setSchemeName(StringUtils.trim(saveParam.getInsuranceScheme().getSchemeName())); List listResult = insuranceSchemeMapper.listByName(saveParam.getInsuranceScheme().getSchemeName()); SalaryAssert.isEmpty(listResult, "该福利名称已经存在,福利名称系统全局唯一"); diff --git a/src/com/engine/salary/encrypt/siaccount/ExcelInsuranceDetailPOEncrypt.java b/src/com/engine/salary/encrypt/siaccount/ExcelInsuranceDetailPOEncrypt.java new file mode 100644 index 000000000..6d6a30776 --- /dev/null +++ b/src/com/engine/salary/encrypt/siaccount/ExcelInsuranceDetailPOEncrypt.java @@ -0,0 +1,111 @@ +package com.engine.salary.encrypt.siaccount; + +import com.engine.salary.encrypt.AESEncryptUtil; +import com.engine.salary.entity.siaccount.po.ExcelInsuranceDetailPO; + +import java.util.List; + +/** + * hrsa_excel_bill_detail: 加解密 + * 字段: + * social_payment_base_string + * fund_payment_base_string + * other_payment_base_string + * social_per_json + * social_per_sum + * fund_per_json + * fund_per_sum + * other_per_json + * other_per_sum + * per_sum + * social_com_json + * social_com_sum + * fund_com_json + * fund_com_sum + * other_com_json + * other_com_sum + * com_sum + * social_sum + * fund_sum + * other_sum + * total + */ +public class ExcelInsuranceDetailPOEncrypt { + public static List encryptInsuranceAccountDetailPOList(List list) { + if(list == null || list.size() == 0) { + return list; + } + list.forEach(item -> { + item.setSocialPaymentBaseString(AESEncryptUtil.encrypt(item.getSocialPaymentBaseString())); + item.setFundPaymentBaseString(AESEncryptUtil.encrypt(item.getFundPaymentBaseString())); + item.setOtherPaymentBaseString(AESEncryptUtil.encrypt(item.getOtherPaymentBaseString())); + item.setSocialPerJson(AESEncryptUtil.encrypt(item.getSocialPerJson())); + item.setSocialPerSum(AESEncryptUtil.encrypt(item.getSocialPerSum())); + item.setFundPerJson(AESEncryptUtil.encrypt(item.getFundPerJson())); + item.setFundPerSum(AESEncryptUtil.encrypt(item.getFundPerSum())); + item.setOtherPerJson(AESEncryptUtil.encrypt(item.getOtherPerJson())); + item.setOtherPerSum(AESEncryptUtil.encrypt(item.getOtherPerSum())); + item.setPerSum(AESEncryptUtil.encrypt(item.getPerSum())); + item.setSocialComJson(AESEncryptUtil.encrypt(item.getSocialComJson())); + item.setSocialComSum(AESEncryptUtil.encrypt(item.getSocialComSum())); + item.setComSum(AESEncryptUtil.encrypt(item.getComSum())); + item.setSocialSum(AESEncryptUtil.encrypt(item.getSocialSum())); + item.setFundSum(AESEncryptUtil.encrypt(item.getFundSum())); + item.setOtherSum(AESEncryptUtil.encrypt(item.getOtherSum())); + item.setTotal(AESEncryptUtil.encrypt(item.getTotal())); + }); + return list; + } + + public static List decryptInsuranceAccountDetailPOList(List list) { + if(list == null || list.size() == 0) { + return list; + } + list.forEach(item -> { + item.setSocialPaymentBaseString(AESEncryptUtil.decrypt(item.getSocialPaymentBaseString())); + item.setFundPaymentBaseString(AESEncryptUtil.decrypt(item.getFundPaymentBaseString())); + item.setOtherPaymentBaseString(AESEncryptUtil.decrypt(item.getOtherPaymentBaseString())); + item.setSocialPerJson(AESEncryptUtil.decrypt(item.getSocialPerJson())); + item.setSocialPerSum(AESEncryptUtil.decrypt(item.getSocialPerSum())); + item.setFundPerJson(AESEncryptUtil.decrypt(item.getFundPerJson())); + item.setFundPerSum(AESEncryptUtil.decrypt(item.getFundPerSum())); + item.setOtherPerJson(AESEncryptUtil.decrypt(item.getOtherPerJson())); + item.setOtherPerSum(AESEncryptUtil.decrypt(item.getOtherPerSum())); + item.setPerSum(AESEncryptUtil.decrypt(item.getPerSum())); + item.setSocialComJson(AESEncryptUtil.decrypt(item.getSocialComJson())); + item.setSocialComSum(AESEncryptUtil.decrypt(item.getSocialComSum())); + item.setComSum(AESEncryptUtil.decrypt(item.getComSum())); + item.setSocialSum(AESEncryptUtil.decrypt(item.getSocialSum())); + item.setFundSum(AESEncryptUtil.decrypt(item.getFundSum())); + item.setOtherSum(AESEncryptUtil.decrypt(item.getOtherSum())); + item.setTotal(AESEncryptUtil.decrypt(item.getTotal())); + }); + return list; + } + + public static ExcelInsuranceDetailPO decryptItem(ExcelInsuranceDetailPO item) { + if(item == null) { + return item; + } + item.setSocialPaymentBaseString(AESEncryptUtil.decrypt(item.getSocialPaymentBaseString())); + item.setFundPaymentBaseString(AESEncryptUtil.decrypt(item.getFundPaymentBaseString())); + item.setOtherPaymentBaseString(AESEncryptUtil.decrypt(item.getOtherPaymentBaseString())); + item.setSocialPerJson(AESEncryptUtil.decrypt(item.getSocialPerJson())); + item.setSocialPerSum(AESEncryptUtil.decrypt(item.getSocialPerSum())); + item.setFundPerJson(AESEncryptUtil.decrypt(item.getFundPerJson())); + item.setFundPerSum(AESEncryptUtil.decrypt(item.getFundPerSum())); + item.setOtherPerJson(AESEncryptUtil.decrypt(item.getOtherPerJson())); + item.setOtherPerSum(AESEncryptUtil.decrypt(item.getOtherPerSum())); + item.setPerSum(AESEncryptUtil.decrypt(item.getPerSum())); + item.setSocialComJson(AESEncryptUtil.decrypt(item.getSocialComJson())); + item.setSocialComSum(AESEncryptUtil.decrypt(item.getSocialComSum())); + item.setComSum(AESEncryptUtil.decrypt(item.getComSum())); + item.setSocialSum(AESEncryptUtil.decrypt(item.getSocialSum())); + item.setFundSum(AESEncryptUtil.decrypt(item.getFundSum())); + item.setOtherSum(AESEncryptUtil.decrypt(item.getOtherSum())); + item.setTotal(AESEncryptUtil.decrypt(item.getTotal())); + return item; + } + + +} diff --git a/src/com/engine/salary/encrypt/siexport/ExcelAccountExportPOEncrypt.java b/src/com/engine/salary/encrypt/siexport/ExcelAccountExportPOEncrypt.java new file mode 100644 index 000000000..3121cc46d --- /dev/null +++ b/src/com/engine/salary/encrypt/siexport/ExcelAccountExportPOEncrypt.java @@ -0,0 +1,85 @@ +package com.engine.salary.encrypt.siexport; + +import com.engine.salary.encrypt.AESEncryptUtil; +import com.engine.salary.entity.siexport.po.ExcelAccountExportPO; + +import java.util.List; + +/** + * hrsa_excel_bill_detail: 加解密 + * 字段: + * social_payment_base_string + * fund_payment_base_string + * other_payment_base_string + * social_per_json + * social_per_sum + * fund_per_json + * fund_per_sum + * other_per_json + * other_per_sum + * per_sum + * social_com_json + * social_com_sum + * fund_com_json + * fund_com_sum + * other_com_json + * other_com_sum + * com_sum + * social_sum + * fund_sum + * other_sum + * total + */ +public class ExcelAccountExportPOEncrypt { + public static List encryptExcelAccountExportPOList(List list) { + if(list == null || list.size() == 0) { + return list; + } + list.forEach(item -> { + item.setSocialPaymentBaseString(AESEncryptUtil.encrypt(item.getSocialPaymentBaseString())); + item.setFundPaymentBaseString(AESEncryptUtil.encrypt(item.getFundPaymentBaseString())); + item.setOtherPaymentBaseString(AESEncryptUtil.encrypt(item.getOtherPaymentBaseString())); + item.setSocialPerJson(AESEncryptUtil.encrypt(item.getSocialPerJson())); + item.setSocialPerSum(AESEncryptUtil.encrypt(item.getSocialPerSum())); + item.setFundPerJson(AESEncryptUtil.encrypt(item.getFundPerJson())); + item.setFundPerSum(AESEncryptUtil.encrypt(item.getFundPerSum())); + item.setOtherPerJson(AESEncryptUtil.encrypt(item.getOtherPerJson())); + item.setOtherPerSum(AESEncryptUtil.encrypt(item.getOtherPerSum())); + item.setPerSum(AESEncryptUtil.encrypt(item.getPerSum())); + item.setSocialComJson(AESEncryptUtil.encrypt(item.getSocialComJson())); + item.setSocialComSum(AESEncryptUtil.encrypt(item.getSocialComSum())); + item.setComSum(AESEncryptUtil.encrypt(item.getComSum())); + item.setSocialSum(AESEncryptUtil.encrypt(item.getSocialSum())); + item.setFundSum(AESEncryptUtil.encrypt(item.getFundSum())); + item.setOtherSum(AESEncryptUtil.encrypt(item.getOtherSum())); + item.setTotal(AESEncryptUtil.encrypt(item.getTotal())); + }); + return list; + } + + public static List decryptExcelAccountExportPOList(List list) { + if(list == null || list.size() == 0) { + return list; + } + list.forEach(item -> { + item.setSocialPaymentBaseString(AESEncryptUtil.decrypt(item.getSocialPaymentBaseString())); + item.setFundPaymentBaseString(AESEncryptUtil.decrypt(item.getFundPaymentBaseString())); + item.setOtherPaymentBaseString(AESEncryptUtil.decrypt(item.getOtherPaymentBaseString())); + item.setSocialPerJson(AESEncryptUtil.decrypt(item.getSocialPerJson())); + item.setSocialPerSum(AESEncryptUtil.decrypt(item.getSocialPerSum())); + item.setFundPerJson(AESEncryptUtil.decrypt(item.getFundPerJson())); + item.setFundPerSum(AESEncryptUtil.decrypt(item.getFundPerSum())); + item.setOtherPerJson(AESEncryptUtil.decrypt(item.getOtherPerJson())); + item.setOtherPerSum(AESEncryptUtil.decrypt(item.getOtherPerSum())); + item.setPerSum(AESEncryptUtil.decrypt(item.getPerSum())); + item.setSocialComJson(AESEncryptUtil.decrypt(item.getSocialComJson())); + item.setSocialComSum(AESEncryptUtil.decrypt(item.getSocialComSum())); + item.setComSum(AESEncryptUtil.decrypt(item.getComSum())); + item.setSocialSum(AESEncryptUtil.decrypt(item.getSocialSum())); + item.setFundSum(AESEncryptUtil.decrypt(item.getFundSum())); + item.setOtherSum(AESEncryptUtil.decrypt(item.getOtherSum())); + item.setTotal(AESEncryptUtil.decrypt(item.getTotal())); + }); + return list; + } +} diff --git a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java new file mode 100644 index 000000000..26da6033b --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java @@ -0,0 +1,351 @@ +package com.engine.salary.entity.siaccount.bo; + +import com.alibaba.fastjson.JSON; +import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; +import com.engine.salary.entity.salarysob.dto.SalarySobEmpFieldDTO; +import com.engine.salary.entity.sicategory.po.ICategoryPO; +import com.engine.salary.entity.siexport.po.AccountExportPO; +import com.engine.salary.entity.siexport.po.ExcelAccountExportPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import com.engine.salary.mapper.sicategory.ICategoryMapper; +import com.engine.salary.mapper.taxagent.TaxAgentMapper; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; +import com.engine.salary.util.page.Column; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static com.engine.salary.enums.UserStatusEnum.getDefaultLabelByValue; + +/** + * @Author: sy + * @Description: 福利核算线上线下对比结果 + * @Date: 2022/9/28 + **/ +public class InsuranceComparisonResultBO { + /** + * 数据类型的后缀标识 + * 为了展示千分位,福利核算结果列表、线上线下对比结果列表需要返回给前端列表字段的数据类型,字段索引+后缀标识 + */ + private static final String DATA_TYPE_SUFFIX = "_type"; + + + /** + * 构建福利核算结果列表的表头(线下对比) + * + */ + public static List buildTableColumns4ComparisonResult() { + + List listAll = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + List socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1).collect(Collectors.toList()); + List fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList()); + List otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3).collect(Collectors.toList()); + + List columns = Lists.newArrayList(); + // 员工信息字段 + columns.add(new Column("姓名", "userName", "userName")); + columns.add(new Column("部门", "department", "department")); + columns.add(new Column("手机号", "mobile", "mobile")); + columns.add(new Column("工号", "workcode", "workcode")); + columns.add(new Column("员工状态", "employeeStatus", "employeeStatus")); + columns.add(new Column("数据来源", "sourceFrom", "sourceFrom")); + columns.add(new Column("个税扣缴义务人", "socialPayOrg", "socialPayOrg")); + columns.add(new Column("社保账号", "socialAccount", "socialAccount")); + columns.add(new Column("社保方案名称", "socialSchemeName", "socialSchemeName")); + //组装社保基数 + for (ICategoryPO po : socialWelfareList) { + columns.add(new Column(po.getInsuranceName() + "申报基数", po.getId() + "socialBase", po.getId() + "socialBase")); + } + columns.add(new Column("公积金账号", "fundAccount", "fundAccount")); + columns.add(new Column("公积金方案名称", "fundSchemeName", "fundSchemeName")); + //组装公积金基数 + for (ICategoryPO po : fundWelfareList) { + columns.add(new Column(po.getInsuranceName() + "申报基数", po.getId() + "fundBase", po.getId() + "fundBase")); + } + columns.add(new Column("补充公积金账号", "supplementFundAccount", "supplementFundAccount")); + columns.add(new Column("其他福利方案名称", "otherSchemeName", "otherSchemeName")); + //组装其他福利基数 + for (ICategoryPO po : otherWelfareList) { + columns.add(new Column(po.getInsuranceName() + "申报基数", po.getId() + "otherBase", po.getId() + "otherBase")); + } + + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) + for (ICategoryPO po : socialWelfareList) { + columns.add(new Column(po.getInsuranceName() + "个人", po.getId() + "socialPer", po.getId() + "socialPer")); + } + columns.add(new Column("社保个人合计", "socialPerSum", "socialPerSum")); + //住房公积金个人、补充住房公积金个人 + for (ICategoryPO po : fundWelfareList) { + columns.add(new Column(po.getInsuranceName() + "个人", po.getId() + "fundPer", po.getId() + "fundPer")); + } + columns.add(new Column("公积金个人合计", "fundPerSum", "fundPerSum")); + //其他个人(比如企业年金个人) + for (ICategoryPO po : otherWelfareList) { + columns.add(new Column(po.getInsuranceName() + "个人", po.getId() + "otherPer", po.getId() + "otherPer")); + } + columns.add(new Column("其他福利个人合计", "otherPerSum", "otherPerSum")); + columns.add(new Column("个人合计", "perSum", "perSum")); + //社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位) + for (ICategoryPO po : socialWelfareList) { + columns.add(new Column(po.getInsuranceName() + "单位", po.getId() + "socialCom", po.getId() + "socialCom")); + } + columns.add(new Column("社保单位合计", "socialComSum", "socialComSum")); + //住房公积金单位、补充住房公积金单位 + for (ICategoryPO po : fundWelfareList) { + columns.add(new Column(po.getInsuranceName() + "单位", po.getId() + "fundCom", po.getId() + "fundCom")); + } + columns.add(new Column("公积金单位合计", "fundComSum", "fundComSum")); + //其他单位(比如企业年金单位) + for (ICategoryPO po : otherWelfareList) { + columns.add(new Column(po.getInsuranceName() + "单位", po.getId() + "otherCom", po.getId() + "otherCom")); + } + columns.add(new Column("其他福利单位合计", "otherComSum", "otherComSum")); + columns.add(new Column("单位合计", "comSum", "comSum")); + + columns.add(new Column("社保合计", "socialSum", "socialSum")); + columns.add(new Column("公积金合计", "fundSum", "fundSum")); + columns.add(new Column("其他福利合计", "otherSum", "otherSum")); + columns.add(new Column("合计", "total", "total")); + return columns; + } + + /** + * 构建福利核算线下对比结果 + * + */ + public static List> buildComparisonTableData(List accountExportPOS, List excelAccountExportPOS) { + + Map> excelResultMap = SalaryEntityUtil.group2Map(excelAccountExportPOS, ExcelAccountExportPO::getWorkcode); +// Map> acctResultMap = SalaryEntityUtil.group2Map(accountExportPOS, AccountExportPO::getWorkcode); + + List paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll(); + Map paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgentPO::getId, Function.identity())); + + List> resultList = Lists.newArrayListWithExpectedSize(accountExportPOS.size()); + + //遍历线上数据 + for (AccountExportPO accountExportPO : accountExportPOS) { + + Map map = Maps.newHashMap(); + // 记录线下值和系统值之间是否存在差异 + map.put("different", "false"); + + //设置基本字段信息和类型 + map.put("userName", accountExportPO.getUserName()); + map.put("userName" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("department", accountExportPO.getDepartmentName()); + map.put("department" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("mobile", accountExportPO.getTelephone()); + map.put("mobile" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("workcode", accountExportPO.getWorkcode()); + map.put("workcode" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("employeeStatus", accountExportPO.getUserStatus() == null ? "" : getDefaultLabelByValue(accountExportPO.getUserStatus())); + map.put("employeeStatus" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("socialPayOrg", paymentMap.get(accountExportPO.getSocialPayOrg()) == null ? "" : paymentMap.get(accountExportPO.getSocialPayOrg()).getName()); + map.put("socialPayOrg" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + + //社保账号、公积金账号、补充公积金账号 + map.put("fundAccount", accountExportPO.getFundAccount()); + map.put("fundAccount" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("socialAccount", accountExportPO.getSocialAccount()); + map.put("socialAccount" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + map.put("supplementFundAccount", accountExportPO.getSupplementFundAccount()); + map.put("supplementFundAccount" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + + //线下值 + List excelResultValueList = excelResultMap.get(accountExportPO.getWorkcode()); + ExcelAccountExportPO excelAccountExportPO = new ExcelAccountExportPO(); + if (excelResultValueList != null && excelResultValueList.size() == 1) { + excelAccountExportPO = excelResultValueList.get(0); + } + //社保基数,socialPaymentBaseString + welfareElementCompare(map, accountExportPO.getSocialPaymentBaseString(), excelAccountExportPO.getSocialPaymentBaseString(), "Base", 1); + //公积金基数,fundPaymentBaseString + welfareElementCompare(map, accountExportPO.getFundPaymentBaseString(), excelAccountExportPO.getFundPaymentBaseString(), "Base", 2); + //其他福利基数,otherPaymentBaseString + welfareElementCompare(map, accountExportPO.getOtherPaymentBaseString(), excelAccountExportPO.getOtherPaymentBaseString(), "Base", 3); + //社保个人socialPerJson + welfareElementCompare(map, accountExportPO.getSocialPerJson(), excelAccountExportPO.getSocialPerJson(), "Per", 1); + //公积金个人fundPerJson + welfareElementCompare(map, accountExportPO.getFundPerJson(), excelAccountExportPO.getFundPerJson(), "Per", 2); + //其他个人otherPerJson + welfareElementCompare(map, accountExportPO.getOtherPerJson(), excelAccountExportPO.getOtherPerJson(), "Per", 3); + //社保单位socialComJson + welfareElementCompare(map, accountExportPO.getSocialComJson(), excelAccountExportPO.getSocialComJson(), "Com", 1); + //公积金单位fundComJson + welfareElementCompare(map, accountExportPO.getFundComJson(), excelAccountExportPO.getFundComJson(), "Com", 2); + //其他单位otherComJson + welfareElementCompare(map, accountExportPO.getOtherComJson(), excelAccountExportPO.getOtherComJson(), "Com", 3); + + //各种合计 + welfareSumCompare(map, accountExportPO, excelAccountExportPO); + + resultList.add(map); + } + return resultList; + } + + private static Map welfareElementCompare(Map map, String accountJson, String excelAccountJson, String welfareStand, Integer welfareType) { + List listAll = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + List accountWelfareList = listAll.stream().filter(e -> e.getWelfareType().equals(welfareType)).collect(Collectors.toList()); + + String baseTypeInfo = welfareType.equals(1) ? "social" : (welfareType.equals(2) ? "fund" : "other"); + + Map accountMap = JSON.parseObject(accountJson, HashMap.class); + Map excelAccountMap = JSON.parseObject(excelAccountJson, HashMap.class); + for (ICategoryPO welfare : accountWelfareList) { + Map temp = Maps.newHashMap(); + + if (accountMap != null && accountMap.get(welfare.getId().toString()) != null) { + temp.put("acctResultValue", accountMap.get(welfare.getId().toString())); + } else { + temp.put("acctResultValue", ""); + } + if (excelAccountMap != null && excelAccountMap.get(welfare.getId().toString()) != null) { + temp.put("excelResultValue", excelAccountMap.get(welfare.getId().toString())); + }else { + temp.put("excelResultValue", ""); + } + map.put(welfare.getId() + baseTypeInfo + welfareStand, temp); + // 薪资项目字段的字段类型 + map.put(welfare.getId() + baseTypeInfo + welfareStand + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !temp.get("acctResultValue").equals(temp.get("excelResultValue"))) { + map.put("different", "true"); + } + } + return map; + + } + private static Map welfareSumCompare(Map map, AccountExportPO accountExportPO, ExcelAccountExportPO excelAccountExportPO) { + + //社保个人合计、公积金个人合计、其他福利个人合计、个人合计 + Map socialPerSumTemp = Maps.newHashMap(); + socialPerSumTemp.put("acctResultValue", dealNull(accountExportPO.getSocialPerSum())); + socialPerSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getSocialPerSum())); + map.put("socialPerSum", socialPerSumTemp); + map.put("socialPerSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !socialPerSumTemp.get("acctResultValue").equals(socialPerSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map fundPerSumTemp = Maps.newHashMap(); + fundPerSumTemp.put("acctResultValue", dealNull(accountExportPO.getFundPerSum())); + fundPerSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getFundPerSum())); + map.put("fundPerSum", fundPerSumTemp); + map.put("fundPerSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !fundPerSumTemp.get("acctResultValue").equals(fundPerSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map otherPerSumTemp = Maps.newHashMap(); + otherPerSumTemp.put("acctResultValue", dealNull(accountExportPO.getOtherPerSum())); + otherPerSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getOtherPerSum())); + map.put("otherPerSum", otherPerSumTemp); + map.put("otherPerSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !otherPerSumTemp.get("acctResultValue").equals(otherPerSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map perSumTemp = Maps.newHashMap(); + perSumTemp.put("acctResultValue", dealNull(accountExportPO.getPerSum())); + perSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getPerSum())); + map.put("perSum", perSumTemp); + map.put("perSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !perSumTemp.get("acctResultValue").equals(perSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + //社保单位合计、公积金单位合计、其他福利单位合计、单位合计 + Map socialComSumTemp = Maps.newHashMap(); + socialComSumTemp.put("acctResultValue", dealNull(accountExportPO.getSocialComSum())); + socialComSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getSocialComSum())); + map.put("socialComSum", socialComSumTemp); + map.put("socialComSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !socialComSumTemp.get("acctResultValue").equals(socialComSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map fundComSumTemp = Maps.newHashMap(); + fundComSumTemp.put("acctResultValue", dealNull(accountExportPO.getFundComSum())); + fundComSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getFundComSum())); + map.put("fundComSum", fundComSumTemp); + map.put("fundComSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !fundComSumTemp.get("acctResultValue").equals(fundComSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map otherComSumTemp = Maps.newHashMap(); + otherComSumTemp.put("acctResultValue", dealNull(accountExportPO.getOtherComSum())); + otherComSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getOtherComSum())); + map.put("otherComSum", otherComSumTemp); + map.put("otherComSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !otherComSumTemp.get("acctResultValue").equals(otherComSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map perComTemp = Maps.newHashMap(); + perComTemp.put("acctResultValue", dealNull(accountExportPO.getComSum())); + perComTemp.put("excelResultValue", dealNull(excelAccountExportPO.getComSum())); + map.put("comSum", perComTemp); + map.put("comSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !perComTemp.get("acctResultValue").equals(perComTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + //社保合计、公积金合计、其他福利合计、合计 + Map socialSumTemp = Maps.newHashMap(); + socialSumTemp.put("acctResultValue", dealNull(accountExportPO.getSocialSum())); + socialSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getSocialSum())); + map.put("socialSum", socialSumTemp); + map.put("socialSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !socialSumTemp.get("acctResultValue").equals(socialSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map fundSumTemp = Maps.newHashMap(); + fundSumTemp.put("acctResultValue", dealNull(accountExportPO.getFundSum())); + fundSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getFundSum())); + map.put("fundSum", fundSumTemp); + map.put("fundSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !fundSumTemp.get("acctResultValue").equals(fundSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map otherSumTemp = Maps.newHashMap(); + otherSumTemp.put("acctResultValue", dealNull(accountExportPO.getOtherSum())); + otherSumTemp.put("excelResultValue", dealNull(excelAccountExportPO.getOtherSum())); + map.put("otherSum", otherSumTemp); + map.put("otherSum" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !otherSumTemp.get("acctResultValue").equals(otherSumTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + Map totalTemp = Maps.newHashMap(); + totalTemp.put("acctResultValue", dealNull(accountExportPO.getTotal())); + totalTemp.put("excelResultValue", dealNull(excelAccountExportPO.getTotal())); + map.put("total", totalTemp); + map.put("total" + DATA_TYPE_SUFFIX, SalaryDataTypeEnum.STRING.getValue()); + if (map.get("different").equals("false") && !totalTemp.get("acctResultValue").equals(totalTemp.get("excelResultValue"))) { + map.put("different", "true"); + } + + return map; + } + + private static String dealNull(String data) { + if (data == null) { + return ""; + } + return data; + } +} diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceComparisonResultListDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceComparisonResultListDTO.java new file mode 100644 index 000000000..2b9a67c4e --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceComparisonResultListDTO.java @@ -0,0 +1,29 @@ +package com.engine.salary.entity.siaccount.dto; + +import com.engine.salary.util.page.Column; +import com.engine.salary.util.page.PageInfo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.util.List; +import java.util.Map; + +/** + * @Author: sy + * @Description: 福利核算线下对比结果列表 + * @Date: 2022/9/28 + **/ +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class InsuranceComparisonResultListDTO { + + //列表的表头 + private List weaTableColumns; + + //列表数据 + private PageInfo> data; +} diff --git a/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java b/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java new file mode 100644 index 000000000..17b926b08 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java @@ -0,0 +1,29 @@ +package com.engine.salary.entity.siaccount.param; + +import com.engine.salary.util.valid.DataCheck; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author: sy + * @Description: 福利核算-线下对比导入参数 + * @Date: 2022/9/27 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ExcelInsuranceImportParam { + /** + * 上传文件id + */ + @DataCheck(require = true,message = "imageId为空") + String imageId; + + /** + * 账单月份 + */ + private String billMonth; +} diff --git a/src/com/engine/salary/entity/siaccount/param/InsuranceComparisonResultQueryParam.java b/src/com/engine/salary/entity/siaccount/param/InsuranceComparisonResultQueryParam.java new file mode 100644 index 000000000..703db7f76 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/param/InsuranceComparisonResultQueryParam.java @@ -0,0 +1,20 @@ +package com.engine.salary.entity.siaccount.param; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @Author: sy + * @Description: 福利台账-线上线下对比结果查询参数 + * @Date: 2022/9/28 + **/ +@Data +@EqualsAndHashCode(callSuper = true) +public class InsuranceComparisonResultQueryParam extends InsuranceAccountDetailParam{ + + //仅显示有差异的人员") + private boolean onlyDiffEmployee; + + //仅显示有差异的薪资项目") +// private boolean onlyDiffSalaryItem; +} diff --git a/src/com/engine/salary/entity/siaccount/po/ExcelInsuranceDetailPO.java b/src/com/engine/salary/entity/siaccount/po/ExcelInsuranceDetailPO.java new file mode 100644 index 000000000..7f7544456 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/po/ExcelInsuranceDetailPO.java @@ -0,0 +1,241 @@ +package com.engine.salary.entity.siaccount.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Author: sy + * @Description: 线下Excel福利明细表 + * @Date: 2022/9/27 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_excel_bill_detail +public class ExcelInsuranceDetailPO { + + /** + * 主键id + */ + private Long id; + + /** + * 员工id + */ + private Long employeeId; + + /** + * 账单月份,该处的账单月份即导入的数据需要对比的账单月份 + */ + private String billMonth; + + /** + * 账单状态 0-未归档 1-已归档 + */ + private Integer billStatus; + + /** + * 缴纳状态 + */ + private Integer paymentStatus; + + /** + * 补缴月份 + */ + private String supplementaryMonth; + + /** + * 补缴项目 + */ + private String supplementaryProjects; + + /** + * 数据来源 0-系统核算 1-临时数据 + */ + private Integer resourceFrom; + + /** + * 社保缴纳组织 + */ + private Long socialPayOrg; + + /** + * 社保账号 + */ + private String socialAccount; + + /** + * 公积金缴纳组织 + */ + private Long fundPayOrg; + + /** + * 公积金账号 + */ + private String fundAccount; + + /** + * 补充公积金账号 + */ + private String supplementFundAccount; + + /** + * 其他福利缴纳组织 + */ + private Long otherPayOrg; + + /** + * 社保方案ID + */ + private Long socialSchemeId; + + /** + * 社保缴纳基数 + */ + private String socialPaymentBaseString; + + /** + * 公积金方案ID + */ + private Long fundSchemeId; + + /** + * 公积金缴纳基数 + */ + private String fundPaymentBaseString; + + /** + * 其他福利方案id + */ + private Long otherSchemeId; + + /** + * 其他福利缴纳基数 + */ + private String otherPaymentBaseString; + + /** + * 社保个人缴费明细 + */ + private String socialPerJson; + + /** + * 社保个人合计 + */ + private String socialPerSum; + + /** + * 公积金个人缴费明细 + */ + private String fundPerJson; + + /** + * 公积金个人合计 + */ + private String fundPerSum; + + /** + * 其他福利个人缴费明细 + */ + private String otherPerJson; + + /** + * 其他福利个人合计 + */ + private String otherPerSum; + + /** + * 个人合计 + */ + private String perSum; + + /** + * 社保单位缴费明细 + */ + private String socialComJson; + + /** + * 社保单位合计 + */ + private String socialComSum; + + /** + * 公积金单位缴费明细 + */ + private String fundComJson; + + /** + * 公积金单位合计 + */ + private String fundComSum; + + /** + * 其他福利单位缴费明细 + */ + private String otherComJson; + + /** + * 其他福利单位合计 + */ + private String otherComSum; + + /** + * 单位合计 + */ + private String comSum; + + /** + * 社保合计 + */ + private String socialSum; + + /** + * 公积金合计 + */ + private String fundSum; + + /** + * 其他福利合计 + */ + private String otherSum; + + /** + * 合计 + */ + private String total; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; +} diff --git a/src/com/engine/salary/entity/siexport/po/AccountExportPO.java b/src/com/engine/salary/entity/siexport/po/AccountExportPO.java index f51411ce3..0207e01c3 100644 --- a/src/com/engine/salary/entity/siexport/po/AccountExportPO.java +++ b/src/com/engine/salary/entity/siexport/po/AccountExportPO.java @@ -19,6 +19,16 @@ public class AccountExportPO extends InsuranceAccountDetailPO { private Integer userStatus; + private String workcode; + + public void setWorkcode(String workcode) { + this.workcode = workcode; + } + + public String getWorkcode() { + return workcode; + } + public String getUserName() { return userName; } diff --git a/src/com/engine/salary/entity/siexport/po/ExcelAccountExportPO.java b/src/com/engine/salary/entity/siexport/po/ExcelAccountExportPO.java new file mode 100644 index 000000000..df88ef3e2 --- /dev/null +++ b/src/com/engine/salary/entity/siexport/po/ExcelAccountExportPO.java @@ -0,0 +1,61 @@ +package com.engine.salary.entity.siexport.po; + +import com.engine.salary.entity.siaccount.po.ExcelInsuranceDetailPO; + +/** + * @Author: sy + * @Description: + * @Date: 2022/9/28 + **/ +public class ExcelAccountExportPO extends ExcelInsuranceDetailPO { + + private String userName; + + private String telephone; + + private String departmentName; + + private Integer userStatus; + + private String workcode; + + public void setWorkcode(String workcode) { + this.workcode = workcode; + } + + public String getWorkcode() { + return workcode; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getTelephone() { + return telephone; + } + + public void setTelephone(String telephone) { + this.telephone = telephone; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } +} diff --git a/src/com/engine/salary/mapper/InsuranceExportMapper.java b/src/com/engine/salary/mapper/InsuranceExportMapper.java index 78fde573b..ec1bc4287 100644 --- a/src/com/engine/salary/mapper/InsuranceExportMapper.java +++ b/src/com/engine/salary/mapper/InsuranceExportMapper.java @@ -1,7 +1,9 @@ package com.engine.salary.mapper; +import com.engine.salary.entity.siaccount.param.InsuranceComparisonResultQueryParam; import com.engine.salary.entity.siexport.param.InsuranceExportParam; import com.engine.salary.entity.siexport.po.AccountExportPO; +import com.engine.salary.entity.siexport.po.ExcelAccountExportPO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,6 +16,8 @@ import java.util.List; **/ public interface InsuranceExportMapper { + List exportExcelAccount(@Param("param") InsuranceComparisonResultQueryParam param); + List exportAccount(@Param("paymentStatus") Integer paymentStatus, @Param("param") InsuranceExportParam param); } diff --git a/src/com/engine/salary/mapper/InsuranceExportMapper.xml b/src/com/engine/salary/mapper/InsuranceExportMapper.xml index 6c60c5ba3..2c02f2ace 100644 --- a/src/com/engine/salary/mapper/InsuranceExportMapper.xml +++ b/src/com/engine/salary/mapper/InsuranceExportMapper.xml @@ -6,7 +6,8 @@ e.lastname AS userName, e.MOBILE AS telephone, d.departmentname AS departmentName, - e.STATUS AS userStatus + e.STATUS AS userStatus, + e.workcode AS workcode FROM ( SELECT * from hrsa_bill_detail @@ -30,7 +31,8 @@ e.lastname AS userName, e.MOBILE AS telephone, d.departmentname AS departmentName, - e.STATUS AS userStatus + e.STATUS AS userStatus, + e.workcode AS workcode FROM ( SELECT * from hrsa_bill_detail @@ -54,7 +56,8 @@ e.lastname AS userName, e.MOBILE AS telephone, d.departmentname AS departmentName, - e.STATUS AS userStatus + e.STATUS AS userStatus, + e.workcode AS workcode FROM ( SELECT * from hrsa_bill_detail @@ -73,4 +76,41 @@ ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc} + + + + diff --git a/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.java b/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.java new file mode 100644 index 000000000..105c0f636 --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.java @@ -0,0 +1,39 @@ +package com.engine.salary.mapper.siaccount; + +import com.engine.salary.entity.siaccount.po.ExcelInsuranceDetailPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + * @author songyang + */ +public interface ExcelInsuranceDetailMapper { + + /** + * 查询对比数据 + * @param billMonth 账单月份 + * @param paymentOrganization 个税扣缴义务人 + * @param employeeId 人员id + * @return + */ + List queryCompareList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeId") Long employeeId); + + /** + * 根据id删除 + * + * @param id + */ + void deleteById(@Param("id") Long id); + + /** + * 根据id批量删除 + */ + void batchDelByIds(@Param("ids") Collection ids); + + /** + * 批量保存 + */ + void batchSave(@Param("accounts") Collection accounts); +} diff --git a/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml new file mode 100644 index 000000000..3f19abf57 --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + t + . + id + , t.employee_id + , e.status as employee_status + , t.bill_month + , t.bill_status + , t.payment_status + , t.supplementary_month + , t.supplementary_projects + , t.resource_from + , t.social_pay_org + , t.social_account + , t.fund_pay_org + , t.fund_account + , t.supplement_fund_account + , t.other_pay_org + , t.social_scheme_id + , t.social_payment_base_string + , t.fund_scheme_id + , t.fund_payment_base_string + , t.other_scheme_id + , t.other_payment_base_string + , t.social_per_json + , t.social_per_sum + , t.fund_per_json + , t.fund_per_sum + , t.other_per_json + , t.other_per_sum + , t.per_sum + , t.social_com_json + , t.social_com_sum + , t.fund_com_json + , t.fund_com_sum + , t.other_com_json + , t.other_com_sum + , t.com_sum + , t.social_sum + , t.fund_sum + , t.other_sum + , t.total + , t.creator + , t.delete_type + , t.create_time + , t.update_time + , t.tenant_key + , t.payment_organization + + + + + AND + t.bill_month = #{param.billMonth} + + + AND + t.payment_status = #{param.paymentStatus} + + + AND + t.payment_organization = #{param.paymentOrganization} + + + + + + + + UPDATE hrsa_excel_bill_detail + SET delete_type = 1 + WHERE id = #{id} + AND delete_type = 0 + + + + + UPDATE hrsa_excel_bill_detail + SET delete_type = 1 + WHERE delete_type = 0 + + AND id IN + + #{id} + + + + + + + INSERT INTO hrsa_excel_bill_detail + (id,employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, + fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, + social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) + VALUES + + ( + #{item.id}, + #{item.employeeId}, + #{item.billMonth}, + #{item.billStatus}, + #{item.paymentStatus}, + #{item.supplementaryMonth}, + #{item.supplementaryProjects}, + #{item.resourceFrom}, + #{item.socialPayOrg}, + #{item.socialAccount}, + #{item.socialSchemeId}, + #{item.socialPaymentBaseString}, + #{item.fundPayOrg}, + #{item.fundAccount}, + #{item.supplementFundAccount}, + #{item.fundSchemeId}, + #{item.fundPaymentBaseString}, + #{item.otherPayOrg}, + #{item.otherSchemeId}, + #{item.otherPaymentBaseString}, + #{item.socialPerJson}, + #{item.socialPerSum}, + #{item.fundPerJson}, + #{item.fundPerSum}, + #{item.otherPerJson}, + #{item.otherPerSum}, + #{item.perSum}, + #{item.socialComJson}, + #{item.socialComSum}, + #{item.fundComJson}, + #{item.fundComSum}, + #{item.otherComJson}, + #{item.otherComSum}, + #{item.comSum}, + #{item.socialSum}, + #{item.fundSum}, + #{item.otherSum}, + #{item.total}, + #{item.creator}, + #{item.createTime}, + #{item.updateTime}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.paymentOrganization} + ) + + + + INSERT INTO hrsa_excel_bill_detail + (id,employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, + fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, + social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) + + select + #{item.id,jdbcType=DOUBLE}, + #{item.employeeId,jdbcType=DOUBLE}, + #{item.billMonth,jdbcType=VARCHAR}, + #{item.billStatus,jdbcType=INTEGER}, + #{item.paymentStatus,jdbcType=INTEGER}, + #{item.supplementaryMonth,jdbcType=VARCHAR}, + #{item.supplementaryProjects,jdbcType=VARCHAR}, + #{item.resourceFrom,jdbcType=INTEGER}, + #{item.socialPayOrg,jdbcType=DOUBLE}, + #{item.socialAccount,jdbcType=VARCHAR}, + #{item.socialSchemeId,jdbcType=DOUBLE}, + #{item.socialPaymentBaseString,jdbcType=VARCHAR}, + #{item.fundPayOrg,jdbcType=DOUBLE}, + #{item.fundAccount,jdbcType=VARCHAR}, + #{item.supplementFundAccount,jdbcType=VARCHAR}, + #{item.fundSchemeId,jdbcType=DOUBLE}, + #{item.fundPaymentBaseString,jdbcType=VARCHAR}, + #{item.otherPayOrg,jdbcType=DOUBLE}, + #{item.otherSchemeId,jdbcType=DOUBLE}, + #{item.otherPaymentBaseString,jdbcType=VARCHAR}, + #{item.socialPerJson,jdbcType=VARCHAR}, + #{item.socialPerSum,jdbcType=VARCHAR}, + #{item.fundPerJson,jdbcType=VARCHAR}, + #{item.fundPerSum,jdbcType=VARCHAR}, + #{item.otherPerJson,jdbcType=VARCHAR}, + #{item.otherPerSum,jdbcType=VARCHAR}, + #{item.perSum,jdbcType=VARCHAR}, + #{item.socialComJson,jdbcType=VARCHAR}, + #{item.socialComSum,jdbcType=VARCHAR}, + #{item.fundComJson,jdbcType=VARCHAR}, + #{item.fundComSum,jdbcType=VARCHAR}, + #{item.otherComJson,jdbcType=VARCHAR}, + #{item.otherComSum,jdbcType=VARCHAR}, + #{item.comSum,jdbcType=VARCHAR}, + #{item.socialSum,jdbcType=VARCHAR}, + #{item.fundSum,jdbcType=VARCHAR}, + #{item.otherSum,jdbcType=VARCHAR}, + #{item.total,jdbcType=VARCHAR}, + #{item.creator,jdbcType=DOUBLE}, + #{item.createTime}, + #{item.updateTime}, + #{item.deleteType}, + #{item.tenantKey,jdbcType=VARCHAR}, + #{item.paymentOrganization,jdbcType=DOUBLE} + from dual + + + + + INSERT INTO hrsa_excel_bill_detail + (id,employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, + fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, + social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) + VALUES + ( + #{item.id}, + #{item.employeeId}, + #{item.billMonth}, + #{item.billStatus}, + #{item.paymentStatus}, + #{item.supplementaryMonth}, + #{item.supplementaryProjects}, + #{item.resourceFrom}, + #{item.socialPayOrg}, + #{item.socialAccount}, + #{item.socialSchemeId}, + #{item.socialPaymentBaseString}, + #{item.fundPayOrg}, + #{item.fundAccount}, + #{item.supplementFundAccount}, + #{item.fundSchemeId}, + #{item.fundPaymentBaseString}, + #{item.otherPayOrg}, + #{item.otherSchemeId}, + #{item.otherPaymentBaseString}, + #{item.socialPerJson}, + #{item.socialPerSum}, + #{item.fundPerJson}, + #{item.fundPerSum}, + #{item.otherPerJson}, + #{item.otherPerSum}, + #{item.perSum}, + #{item.socialComJson}, + #{item.socialComSum}, + #{item.fundComJson}, + #{item.fundComSum}, + #{item.otherComJson}, + #{item.otherComSum}, + #{item.comSum}, + #{item.socialSum}, + #{item.fundSum}, + #{item.otherSum}, + #{item.total}, + #{item.creator}, + #{item.createTime}, + #{item.updateTime}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.paymentOrganization} + ) + + + + + + + AND e.lastname like CONCAT('%',#{userName},'%') + + + + + + AND e.lastname like '%'||#{userName}||'%' + + + + + + AND e.lastname like '%'+#{userName}+'%' + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 59542951d..41f04ae99 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -103,6 +103,14 @@ public interface InsuranceAccountDetailMapper { * @return */ List querySupplementListByBillMonth(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); + + /** + * 查询正常缴纳数据 + * @param billMonth 账单月份 + * @param paymentOrganization 个税扣缴义务人 + * @return + */ + List queryNormalListByBillMonth(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); /** * 根据账单月份删除 * diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 8a1ccefaf..7bc471d47 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -235,6 +235,17 @@ AND t.payment_organization = #{paymentOrganization} + + - SELECT DISTINCT employee_type, employee_id + SELECT employee_type, employee_id FROM hrsa_tax_declaration_detail t LEFT JOIN hrmresource e ON e.id = t.employee_id LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID diff --git a/src/com/engine/salary/service/SIAComparisonResultService.java b/src/com/engine/salary/service/SIAComparisonResultService.java new file mode 100644 index 000000000..73e6d3b9c --- /dev/null +++ b/src/com/engine/salary/service/SIAComparisonResultService.java @@ -0,0 +1,30 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam; +import com.engine.salary.entity.siaccount.dto.InsuranceComparisonResultListDTO; +import com.engine.salary.entity.siaccount.param.InsuranceComparisonResultQueryParam; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +/** + * @Author: sy + * @Description: 福利核算的线下对比结果 + * @Date: 2022/9/28 + **/ +public interface SIAComparisonResultService { + + /** + * 根据列表查询条件查询线下对比结果(分页) + */ + InsuranceComparisonResultListDTO listPageByParam(InsuranceComparisonResultQueryParam queryParam); + + + /** + * 根据列表查询条件查询线下对比结果 + */ + InsuranceComparisonResultListDTO listByParam(InsuranceComparisonResultQueryParam queryParam); + + /** + * 导出福利核算线下对比结果 + */ + XSSFWorkbook exportComparisonResult(InsuranceComparisonResultQueryParam queryParam); +} diff --git a/src/com/engine/salary/service/SIAccountService.java b/src/com/engine/salary/service/SIAccountService.java index 7f268fc89..e7e61f8e6 100644 --- a/src/com/engine/salary/service/SIAccountService.java +++ b/src/com/engine/salary/service/SIAccountService.java @@ -227,5 +227,16 @@ public interface SIAccountService { * 导出“福利核算-补缴导入模板” */ XSSFWorkbook exportSupplyImportTemplate(InsuranceAcctDetailImportTemplateParam param); + + /** + * 导出“福利核算-线下对比导入模板” + */ + XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAcctDetailImportTemplateParam param); + + /** + * 将通过“福利核算-线下对比导入”模板导入的数据更新到hrsa_excel_bill_detail表中 + */ + Map importExcelInsuranceDetail(ExcelInsuranceImportParam excelInsuranceImportParam); + } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index a20c73d9a..55cf90c82 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -2,7 +2,6 @@ package com.engine.salary.service.impl; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; -import com.api.browser.bean.SearchConditionOption; import com.api.browser.util.ConditionFactory; import com.api.browser.util.ConditionType; import com.api.formmode.mybatis.util.SqlProxyHandle; @@ -53,7 +52,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; import weaver.general.Util; import weaver.hrm.User; -import weaver.systeminfo.SystemEnv; import java.io.InputStream; import java.text.SimpleDateFormat; @@ -143,37 +141,37 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction conditionItems.add(jobNum); - SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); - idNo.setInputType("input"); - idNo.setColSpan(2); - idNo.setFieldcol(16); - idNo.setLabelcol(8); - idNo.setViewAttr(2); - idNo.setLabel("证件号码"); - conditionItems.add(idNo); +// SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); +// idNo.setInputType("input"); +// idNo.setColSpan(2); +// idNo.setFieldcol(16); +// idNo.setLabelcol(8); +// idNo.setViewAttr(2); +// idNo.setLabel("证件号码"); +// conditionItems.add(idNo); //日期范围选项 - List dateOptions = new ArrayList(); - dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); - hiredate.setInputType("rangepicker"); - hiredate.setFormat("yyyy-MM-dd"); - hiredate.setFieldcol(16); - hiredate.setLabelcol(8); - hiredate.setViewAttr(2); - hiredate.setLabel("入职日期"); - hiredate.setOptions(dateOptions); - conditionItems.add(hiredate); +// List dateOptions = new ArrayList(); +// dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) +// SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); +// hiredate.setInputType("rangepicker"); +// hiredate.setFormat("yyyy-MM-dd"); +// hiredate.setFieldcol(16); +// hiredate.setLabelcol(8); +// hiredate.setViewAttr(2); +// hiredate.setLabel("入职日期"); +// hiredate.setOptions(dateOptions); +// conditionItems.add(hiredate); - - SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); - mobile.setInputType("input"); - mobile.setColSpan(2); - mobile.setFieldcol(16); - mobile.setLabelcol(8); - mobile.setViewAttr(2); - mobile.setLabel("手机号"); - conditionItems.add(mobile); +// +// SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); +// mobile.setInputType("input"); +// mobile.setColSpan(2); +// mobile.setFieldcol(16); +// mobile.setLabelcol(8); +// mobile.setViewAttr(2); +// mobile.setLabel("手机号"); +// conditionItems.add(mobile); addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); @@ -676,16 +674,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction for(AddUpDeductionDTO dto : list) { Map resultMap = new HashMap<>(); - resultMap.put("username", dto.getUsername()); - resultMap.put("departmentName", dto.getDepartmentName()); - resultMap.put("mobile", dto.getMobile()); - resultMap.put("workcode", dto.getJobNum()); - resultMap.put("taxAgentName", dto.getTaxAgentName()); + resultMap.put("username", Util.null2String(dto.getUsername())); + resultMap.put("departmentName", Util.null2String(dto.getDepartmentName())); + resultMap.put("mobile", Util.null2String(dto.getMobile())); + resultMap.put("workcode", Util.null2String(dto.getJobNum())); + resultMap.put("taxAgentName", Util.null2String(dto.getTaxAgentName())); if (dto.getIdNo() != null) { - resultMap.put("idNo", dto.getIdNo()); + resultMap.put("idNo", Util.null2String(dto.getIdNo())); } if (dto.getHiredate() != null) { - resultMap.put("hiredate", dto.getHiredate()); + resultMap.put("hiredate", Util.null2String(dto.getHiredate())); } resultList.add(resultMap); diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 6a3ad90f6..fbaa0426a 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -2,7 +2,6 @@ package com.engine.salary.service.impl; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; -import com.api.browser.bean.SearchConditionOption; import com.api.browser.util.ConditionFactory; import com.api.browser.util.ConditionType; import com.api.formmode.mybatis.util.SqlProxyHandle; @@ -25,7 +24,10 @@ import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpSituationMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; -import com.engine.salary.service.*; +import com.engine.salary.service.AddUpDeductionService; +import com.engine.salary.service.AddUpSituationService; +import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.TaxAgentService; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; @@ -48,7 +50,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; import weaver.general.Util; import weaver.hrm.User; -import weaver.systeminfo.SystemEnv; import java.io.InputStream; import java.text.SimpleDateFormat; @@ -129,37 +130,37 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation conditionItems.add(jobNum); - SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); - idNo.setInputType("input"); - idNo.setColSpan(2); - idNo.setFieldcol(16); - idNo.setLabelcol(8); - idNo.setViewAttr(2); - idNo.setLabel("证件号码"); - conditionItems.add(idNo); - - //日期范围选项 - List dateOptions = new ArrayList(); - dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); - hiredate.setInputType("rangepicker"); - hiredate.setFormat("yyyy-MM-dd"); - hiredate.setFieldcol(16); - hiredate.setLabelcol(8); - hiredate.setViewAttr(2); - hiredate.setLabel("入职日期"); - hiredate.setOptions(dateOptions); - conditionItems.add(hiredate); - - - SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); - mobile.setInputType("input"); - mobile.setColSpan(2); - mobile.setFieldcol(16); - mobile.setLabelcol(8); - mobile.setViewAttr(2); - mobile.setLabel("手机号"); - conditionItems.add(mobile); +// SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); +// idNo.setInputType("input"); +// idNo.setColSpan(2); +// idNo.setFieldcol(16); +// idNo.setLabelcol(8); +// idNo.setViewAttr(2); +// idNo.setLabel("证件号码"); +// conditionItems.add(idNo); +// +// //日期范围选项 +// List dateOptions = new ArrayList(); +// dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) +// SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); +// hiredate.setInputType("rangepicker"); +// hiredate.setFormat("yyyy-MM-dd"); +// hiredate.setFieldcol(16); +// hiredate.setLabelcol(8); +// hiredate.setViewAttr(2); +// hiredate.setLabel("入职日期"); +// hiredate.setOptions(dateOptions); +// conditionItems.add(hiredate); +// +// +// SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); +// mobile.setInputType("input"); +// mobile.setColSpan(2); +// mobile.setFieldcol(16); +// mobile.setLabelcol(8); +// mobile.setViewAttr(2); +// mobile.setLabel("手机号"); +// conditionItems.add(mobile); addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); diff --git a/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java b/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java new file mode 100644 index 000000000..d03541944 --- /dev/null +++ b/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java @@ -0,0 +1,228 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.encrypt.siexport.AccountExportPOEncrypt; +import com.engine.salary.encrypt.siexport.ExcelAccountExportPOEncrypt; +import com.engine.salary.entity.siaccount.bo.InsuranceComparisonResultBO; +import com.engine.salary.entity.siaccount.dto.InsuranceComparisonResultListDTO; +import com.engine.salary.entity.siaccount.param.InsuranceComparisonResultQueryParam; +import com.engine.salary.entity.sicategory.po.ICategoryPO; +import com.engine.salary.entity.siexport.param.InsuranceExportParam; +import com.engine.salary.entity.siexport.po.AccountExportPO; +import com.engine.salary.entity.siexport.po.ExcelAccountExportPO; +import com.engine.salary.mapper.InsuranceExportMapper; +import com.engine.salary.mapper.sicategory.ICategoryMapper; +import com.engine.salary.service.SIAComparisonResultService; +import com.engine.salary.util.db.MapperProxyFactory; +import com.engine.salary.util.excel.ExcelUtil; +import com.engine.salary.util.page.Column; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; +import com.engine.salary.util.valid.ValidUtil; +import com.google.common.collect.Lists; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Author: sy + * @Description: 福利核算的线下对比结果 + * @Date: 2022/9/28 + **/ +public class SIAComparisonResultServiceImpl extends Service implements SIAComparisonResultService { + + private InsuranceExportMapper getInsuranceExportMapper() { + return MapperProxyFactory.getProxy(InsuranceExportMapper.class); + } + + /** + * 根据列表查询条件查询线下对比结果(分页) + */ + @Override + public InsuranceComparisonResultListDTO listPageByParam(InsuranceComparisonResultQueryParam queryParam) { + return listByParam(true, queryParam); + } + + /** + * 根据列表查询条件查询线下对比结果 + */ + @Override + public InsuranceComparisonResultListDTO listByParam(InsuranceComparisonResultQueryParam queryParam) { + return listByParam(false, queryParam); + } + + @Override + public XSSFWorkbook exportComparisonResult(InsuranceComparisonResultQueryParam queryParam) { + ValidUtil.doValidator(queryParam); + + // 查询线下对比结果 + InsuranceComparisonResultListDTO insuranceComparisonResultListDTO = listByParam(queryParam); + // 薪资核算线下对比结果列表表头 + List headerList = Lists.newArrayList(); + + Set employeeInfo = employeeInfo(); + Set welfareInfo = welfareInfo(); + for (Column weaTableColumn : insuranceComparisonResultListDTO.getWeaTableColumns()) { + // 员工信息字段 + if (employeeInfo.contains(weaTableColumn.getKey())) { + headerList.add(weaTableColumn.getTitle()); + } + // 薪资项目的表头 + if (welfareInfo.contains(weaTableColumn.getKey())) { + headerList.add(weaTableColumn.getTitle() + " (线上值)"); + headerList.add(weaTableColumn.getTitle() + " (线下值)"); + } + } + + List> resultMapList = insuranceComparisonResultListDTO.getData().getList(); + // excel导出的数据 + List> rows = new ArrayList<>(); + rows.add(headerList); + for (Map map : resultMapList) { + List row = Lists.newArrayList(); + for (Column weaTableColumn : insuranceComparisonResultListDTO.getWeaTableColumns()) { + // 员工信息字段的值 + if (employeeInfo.contains(weaTableColumn.getKey())) { + row.add(map.get(weaTableColumn.getKey())); + } + // 福利项目的值 + if (welfareInfo.contains(weaTableColumn.getKey())) { + Map tempMap = (Map) map.getOrDefault(weaTableColumn.getKey(), Collections.emptyMap()); + row.add(tempMap.get("acctResultValue")); + row.add(tempMap.get("excelResultValue")); + } + } + rows.add(row); + } + + String sheetName = "线下对比结果"; + + return ExcelUtil.genWorkbookV2(rows, sheetName); + } + + + /** + * 根据福利核算人员查询福利核算线下对比结果 + */ + private InsuranceComparisonResultListDTO listByParam(boolean needPage, InsuranceComparisonResultQueryParam queryParam) { + + //1-查询线上福利核算记录 + InsuranceExportParam insuranceExportParam = new InsuranceExportParam(); + insuranceExportParam.setBillMonth(queryParam.getBillMonth()); + insuranceExportParam.setPaymentOrganization(queryParam.getPaymentOrganization()); + List accountExportPOS = getInsuranceExportMapper().exportAccount(queryParam.getPaymentStatus(), insuranceExportParam); + //如果入参包含姓名信息 + if (queryParam.getUserName() != null) { + accountExportPOS = accountExportPOS.stream().filter(v -> v.getUserName().contains(queryParam.getUserName())).collect(Collectors.toList()); + } + AccountExportPOEncrypt.decryptAccountExportPOList(accountExportPOS); + //2-查询线下对比数据 + List excelAccountExportPOS = getInsuranceExportMapper().exportExcelAccount(queryParam); + ExcelAccountExportPOEncrypt.decryptExcelAccountExportPOList(excelAccountExportPOS); + //3-构建福利核算对比结果列表表头 + List weaTableColumns = InsuranceComparisonResultBO.buildTableColumns4ComparisonResult(); + //4-通过线上线下两份数据获得对比结果 + List> resultMapList = InsuranceComparisonResultBO.buildComparisonTableData(accountExportPOS, excelAccountExportPOS); + + // 系统值和线下值一致的人员 + if (queryParam.isOnlyDiffEmployee()) { + // 过滤系统值和线下值一致的薪资核算人员 + resultMapList = resultMapList.stream() + .filter(map -> BooleanUtils.toBoolean(String.valueOf(map.get("different")))) + .collect(Collectors.toList()); + } + // 分页 + PageInfo> dtoPage = new PageInfo<>(); + dtoPage.setTotal(resultMapList.size()); + if (needPage) { + dtoPage.setList(SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), resultMapList)); + dtoPage.setPageSize(queryParam.getPageSize()); + dtoPage.setPageNum(queryParam.getCurrent()); + } else { + dtoPage.setList(resultMapList); + } + // 返回结果 + return new InsuranceComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage); + } + + private Set welfareInfo() { + + Set info = new HashSet<>(); + + List listAll = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + List socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1).collect(Collectors.toList()); + List fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList()); + List otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3).collect(Collectors.toList()); + + //组装社保基数 + for (ICategoryPO po : socialWelfareList) { + info.add(po.getId() + "socialBase"); + } + //组装公积金基数 + for (ICategoryPO po : fundWelfareList) { + info.add(po.getId() + "fundBase"); + } + //组装其他福利基数 + for (ICategoryPO po : otherWelfareList) { + info.add(po.getId() + "otherBase"); + } + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) + for (ICategoryPO po : socialWelfareList) { + info.add(po.getId() + "socialPer"); + } + info.add("socialPerSum"); + + //住房公积金个人、补充住房公积金个人 + for (ICategoryPO po : fundWelfareList) { + info.add(po.getId() + "fundPer"); + } + info.add("fundPerSum"); + + //其他个人(比如企业年金个人) + for (ICategoryPO po : otherWelfareList) { + info.add(po.getId() + "otherPer"); + } + info.add("otherPerSum"); + info.add("perSum"); + + //社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位) + for (ICategoryPO po : socialWelfareList) { + info.add(po.getId() + "socialCom"); + } + info.add("socialComSum"); + + //住房公积金单位、补充住房公积金单位 + for (ICategoryPO po : fundWelfareList) { + info.add(po.getId() + "fundCom"); + } + info.add("fundComSum"); + + //其他单位(比如企业年金单位) + for (ICategoryPO po : otherWelfareList) { + info.add(po.getId() + "otherCom"); + } + info.add("otherComSum"); + info.add("comSum"); + + info.add("socialSum"); + info.add("fundSum"); + info.add("otherSum"); + info.add("total"); + + return info; + } + + private Set employeeInfo() { + Set info = new HashSet<>(); + + info.add("userName"); + info.add("department"); + info.add("mobile"); + info.add("workcode"); + info.add("socialPayOrg"); + + return info; + } +} diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 62cee0be2..1e29e2fd7 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -12,6 +12,7 @@ import com.engine.core.impl.Service; import com.engine.salary.biz.*; import com.engine.salary.component.SalaryWeaTable; import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.encrypt.siaccount.ExcelInsuranceDetailPOEncrypt; import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt; import com.engine.salary.encrypt.siaccount.SiAccountEncrypt; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -20,11 +21,13 @@ import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO; import com.engine.salary.entity.siaccount.param.*; +import com.engine.salary.entity.siaccount.po.ExcelInsuranceDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; import com.engine.salary.entity.sicategory.po.ICategoryPO; +import com.engine.salary.entity.sischeme.po.InsuranceSchemePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.siaccount.BillStatusEnum; @@ -33,10 +36,12 @@ import com.engine.salary.enums.siaccount.PaymentStatusEnum; import com.engine.salary.enums.siaccount.ProjectTypeEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.siaccount.ExcelInsuranceDetailMapper; 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.sicategory.ICategoryMapper; +import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.mapper.taxagent.TaxAgentMapper; import com.engine.salary.service.*; @@ -57,6 +62,7 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Sheet; @@ -116,6 +122,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class); } + private ExcelInsuranceDetailMapper getExcelInsuranceDetailMapper() { + return MapperProxyFactory.getProxy(ExcelInsuranceDetailMapper.class); + } + private SalaryItemService getSalaryItemService(User user) { return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user); } @@ -138,6 +148,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private InsuranceSchemeMapper getInsuranceSchemeMapper() { + return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class); + } + private EmployBiz employeeBiz = new EmployBiz(); private TaxAgentBiz taxAgentBiz = new TaxAgentBiz(); @@ -1032,14 +1046,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { SalaryI18nUtil.getI18nLabel(86317, "工号"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), "账单月份"); -// List dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "taxAgentName", "billMonth"); + List dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth"); // 查询福利核算项目 List welfareNames = (List) param.getWelfareNames(); headerList.addAll(welfareNames); // excel导出的数据 - List> rows = new ArrayList<>(); + //查询当前已有的补缴数据 + List> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization()); + // excel导出的数据 + List> rows = Lists.newArrayListWithExpectedSize(resultMapList.size()); rows.add(headerList); + for (Map map : resultMapList) { + List row = Lists.newArrayListWithExpectedSize(headerList.size()); + for (String dataIndex : dataIndexList) { + row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY)); + } + rows.add(row); + } String sheetName = "福利核算导入模板"; return ExcelUtil.genWorkbookV2(rows, sheetName); @@ -1346,6 +1370,35 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return resultList; } + /** + * 获取福利台账中的正常缴纳数据 + * @param billMonth 账单月份 + * @param paymentOrganization 个税扣缴义务人id + * @return + */ + private List> getNormalDataByBillMonth(String billMonth, Long paymentOrganization) { + + List> resultList = new ArrayList<>(); + + DataCollectionEmployee employee = new DataCollectionEmployee(); + + TaxAgentPO taxAgentPO = taxAgentBiz.getById(paymentOrganization); + + List supplyDataList = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(billMonth, paymentOrganization); + for(InsuranceAccountDetailPO po : supplyDataList) { + Map resultMap = new HashMap<>(); + employee = employeeBiz.getEmployeeById(po.getEmployeeId()); + resultMap.put("username", employee.getUsername()); + resultMap.put("departmentName", employee.getDepartmentName()); + resultMap.put("mobile", employee.getMobile()); + resultMap.put("workcode", employee.getWorkcode()); + resultMap.put("taxAgentName", taxAgentPO.getName()); + resultMap.put("billMonth", billMonth); + + resultList.add(resultMap); + } + return resultList; + } /** * 将更新的数据设置到老的insuranceAccountDetailPO对象中 @@ -1569,4 +1622,436 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } } + /** + * 导出“福利核算-线下对比导入模板” + */ + @Override + public XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAcctDetailImportTemplateParam param) { + + List listAll = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + List socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1).collect(Collectors.toList()); + List fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList()); + List otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3).collect(Collectors.toList()); + List headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), + SalaryI18nUtil.getI18nLabel(86185, "部门"), + SalaryI18nUtil.getI18nLabel(86186, "手机号"), + SalaryI18nUtil.getI18nLabel(86317, "工号"), + SalaryI18nUtil.getI18nLabel(86187, "员工状态"), + SalaryI18nUtil.getI18nLabel(100377, "数据来源"), + SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人")); + headerList.add(SalaryI18nUtil.getI18nLabel(91324, "社保账号")); + headerList.add(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")); +// "失业保险申报基数" +// "生育保险申报基数" +// "养老保险申报基数" +// "医疗保险申报基数" +// "工伤保险申报基数" + for (ICategoryPO po : socialWelfareList) { + headerList.add(po.getInsuranceName() + "申报基数"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(91486, "公积金账号")); + headerList.add(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")); + //组装公积金基数 + for (ICategoryPO po : fundWelfareList) { + headerList.add(po.getInsuranceName() + "申报基数"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")); + headerList.add(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")); + //组装其他福利基数 + for (ICategoryPO po : otherWelfareList) { + headerList.add(po.getInsuranceName() + "申报基数"); + } + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) + for (ICategoryPO po : socialWelfareList) { + headerList.add(po.getInsuranceName() + "个人"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100388, "社保个人合计")); + //住房公积金个人、补充住房公积金个人 + for (ICategoryPO po : fundWelfareList) { + headerList.add(po.getInsuranceName() + "个人"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计")); + //其他个人(比如企业年金个人) + for (ICategoryPO po : otherWelfareList) { + headerList.add(po.getInsuranceName() + "个人"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100393, "个人合计")); + //社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位) + for (ICategoryPO po : socialWelfareList) { + headerList.add(po.getInsuranceName() + "单位"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100394, "社保单位合计")); + //住房公积金单位、补充住房公积金单位 + for (ICategoryPO po : fundWelfareList) { + headerList.add(po.getInsuranceName() + "单位"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计")); + //其他单位(比如企业年金单位) + for (ICategoryPO po : otherWelfareList) { + headerList.add(po.getInsuranceName() + "单位"); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100397, "单位合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100398, "社保合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100399, "公积金合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100400, "其他福利合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(93278, "合计")); + + List> rows = new ArrayList<>(); + rows.add(headerList); + String sheetName = "福利核算-线下对比导入模板"; + + return ExcelUtil.genWorkbookV2(rows, sheetName); + } + + /** + * 将通过“福利核算-线下对比导入”模板导入的数据更新到hrsa_excel_bill_detail表中 + */ + @Override + public Map importExcelInsuranceDetail(ExcelInsuranceImportParam importParam) { + + Map apidatas = new HashMap(); + EmployBiz employBiz = new EmployBiz(); + + //查询对于人员信息导入筛选的全局配置 + SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); + String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; + //检验参数 + //excel文件id + String imageId = Util.null2String(importParam.getImageId()); + + if (StringUtils.isBlank(imageId)) { + throw new SalaryRunTimeException("文件不存在"); + } + + // 获取租户下所有的人员 + List salaryEmployees = employBiz.listEmployee(); + + // 失败的数量 + int failCount = 0; + // 成功的数量 + int successCount = 0; + InputStream fileInputStream = null; + try { + fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(importParam.getImageId())); + + Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); + + // 错误提示信息 + List excelComments = Lists.newArrayList(); + // 存在错误的那行数据 + List> errorDatas = Lists.newArrayList(); + // 表头 + List headers = ExcelSupport.getSheetHeader(sheet, 0); + // 处理数值 + List> data = ExcelParseHelper.parse2Map(sheet, 1); + if (CollectionUtils.isEmpty(headers)) { + throw new RuntimeException("表头为空"); + } + if (CollectionUtils.isEmpty(data)) { + throw new RuntimeException("无数据"); + } + + String billMonth = importParam.getBillMonth(); + //存储待更新的InsuranceAccountDetailPO数据 + List addCompareList = new ArrayList<>(); + //记录待删除hrsa_excel_bill_detail.id + List idList = new ArrayList<>(); + //遍历excel表具体数据 + for (int i = 0; i < data.size(); i++) { + + String row = "第" + (i + 2) + "行"; + + boolean isError = false; + Map map = data.get(i); + Long employeeId = 0L; + + List list = new ArrayList<>(); + + String taxAgentName = (String) map.getOrDefault("个税扣缴义务人", ""); + Long paymentOrganization = 0L; + List taxAgentPoList = getTaxAgentMapper().listByName(taxAgentName); + + if (taxAgentPoList.size() == 1) { + paymentOrganization = taxAgentPoList.get(0).getId(); + } else { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人"))); + excelComments.add(errorMessageMap); + } + + //遍历表头 + for (int j = 0; j < headers.size(); j++) { + String header = headers.get(j); + String dataKey = header; + if (dataKey == null) { + continue; + } + String dataValue = (String) map.getOrDefault(dataKey.toString(), ""); + String deparmentName = (String) map.getOrDefault("部门", ""); + String mobile = (String) map.getOrDefault("手机号", ""); + String workcode = (String) map.getOrDefault("工号", ""); + + + if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) { + //当人员信息导入筛选的全局配置为"0"时,姓名才是必填项 + if (StringUtils.isEmpty(dataValue) && "0".equals(confValue)) { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空")); + excelComments.add(errorMessageMap); + + } else { + //筛选导入人员信息可以在人力资源池中匹配到的人员信息 + List employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(salaryEmployees, dataValue, deparmentName, mobile, workcode, null); + + if (CollectionUtils.isEmpty(employeeSameIds)) { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名")); + excelComments.add(errorMessageMap); + + } else if (employeeSameIds.size() > 1) { + //存在离职和在职状态取在职状态 + employeeSameIds = employeeSameIds.stream() + .filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())) + .collect(Collectors.toList()); + if (employeeSameIds.size() != 1) { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + "员工信息不存在或者存在多个员工"); + excelComments.add(errorMessageMap); + } else { + employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null; + } + } else { + employeeId = employeeSameIds.get(0).getEmployeeId(); + } + } + } + + + } + + if (!isError){ + List employeeIds = new ArrayList<>(); + employeeIds.add(employeeId); + //根据员工id、个税扣缴义务人id、账单月份查询,如果当前对比表中存在数据,则记录为待删除数据 + list = getExcelInsuranceDetailMapper().queryCompareList(billMonth, paymentOrganization, employeeIds.get(0)); + + if (!list.isEmpty()) { + List ids = list.stream().map(ExcelInsuranceDetailPO::getId) + .collect(Collectors.toList()); + + idList.addAll(ids); + } + //拼装待更新数据 + addCompareList.add(handleExcelInsuranceDetail(billMonth, employeeId, paymentOrganization, map)); + + } + + if (isError) { + failCount++; + errorDatas.add(map); + } else { + successCount++; + } + + } + //将待更新列表加密 + ExcelInsuranceDetailPOEncrypt.encryptInsuranceAccountDetailPOList(addCompareList); + //删除 + if (idList.size() > 0) { + getExcelInsuranceDetailMapper().batchDelByIds(idList); + } + //新增 + getExcelInsuranceDetailMapper().batchSave(addCompareList); + + apidatas.put("successCount", successCount); + apidatas.put("errorCount", failCount); + apidatas.put("errorData", excelComments); + + } finally { + IOUtils.closeQuietly(fileInputStream); + } + return apidatas; + } + + /** + * 将excel导入的数据行组装成ExcelInsuranceDetailPO对象 + * @param billMonth 对比的账单月份 + * @param baseMap excel导入的对比数据 + */ + private ExcelInsuranceDetailPO handleExcelInsuranceDetail(String billMonth, Long employeeId, Long paymentOrganization, Map baseMap) { + + ExcelInsuranceDetailPO excelInsuranceDetailPO = new ExcelInsuranceDetailPO(); + excelInsuranceDetailPO.setId(IdGenerator.generate()); + //组装json数据,格式Map + Map socialPerMap = new HashMap<>(); + Map fundPerMap = new HashMap<>(); + Map otherPerMap = new HashMap<>(); + Map socialComMap = new HashMap<>(); + Map fundComMap = new HashMap<>(); + Map otherComMap = new HashMap<>(); + //组装福利基数 + Map socialPaymentBaseMap = new HashMap<>(); + Map fundPaymentBaseMap = new HashMap<>(); + Map otherPaymentBaseMap = new HashMap<>(); + + //筛选出福利核算项 + Map toDealMap = + baseMap.entrySet().stream() + .filter(map -> !"姓名".equals(map.getKey()) + && !"部门".equals(map.getKey()) + && !"手机号".equals(map.getKey()) + && !"个税扣缴义务人".equals(map.getKey()) + && !"员工状态".equals(map.getKey()) + && !"数据来源".equals(map.getKey()) + && !"工号".equals(map.getKey())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + for(Map.Entry entry : toDealMap.entrySet()) { + //判断元素是否属于福利类 + String keyName = entry.getKey(); + //获取元素名后缀,方便之后判断“个人”或“单位”或者“基数” + String payScope = keyName.substring(keyName.length() - 2); + //获取福利类型 + Integer welfareType; + //根据元素名后缀,区分截取内容 + String targetWelfareName; + if ("基数".equals(payScope)) { + targetWelfareName = entry.getKey().substring(0, keyName.length() - 4); + } else { + targetWelfareName = entry.getKey().substring(0, keyName.length() - 2); + } + List categoryPOList = siCategoryBiz.listByName(targetWelfareName); + if (categoryPOList.size() == 1) { + ICategoryPO iCategoryPO = categoryPOList.get(0); + welfareType = iCategoryPO.getWelfareType(); + + switch (payScope) { + case "个人": + switch (welfareType) { + case 1: + socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 2: + fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 3: + otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + default: + throw new SalaryRunTimeException("福利类型不存在"); + } + break; + case "单位": + switch (welfareType) { + case 1: + socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 2: + fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 3: + otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + default: + throw new SalaryRunTimeException("福利类型不存在"); + } + break; + case "基数": + switch (welfareType) { + case 1: + socialPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 2: + fundPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 3: + otherPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + default: + throw new SalaryRunTimeException("福利类型不存在"); + } + break; + } + } + + } + + //设置社保个人和公司缴纳明细 + excelInsuranceDetailPO.setSocialPerJson(JSON.toJSONString(socialPerMap)); + excelInsuranceDetailPO.setSocialComJson(JSON.toJSONString(socialComMap)); + //设置公积金个人和公司缴纳明细 + excelInsuranceDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap)); + excelInsuranceDetailPO.setFundComJson(JSON.toJSONString(fundComMap)); + //设置其他福利个人和公司缴纳明细 + excelInsuranceDetailPO.setOtherPerJson(JSON.toJSONString(otherPerMap)); + excelInsuranceDetailPO.setOtherComJson(JSON.toJSONString(otherComMap)); + //设置社保、公积金、其他福利缴纳基数 + excelInsuranceDetailPO.setSocialPaymentBaseString(JSON.toJSONString(socialPaymentBaseMap)); + excelInsuranceDetailPO.setFundPaymentBaseString(JSON.toJSONString(fundPaymentBaseMap)); + excelInsuranceDetailPO.setOtherPaymentBaseString(JSON.toJSONString(otherPaymentBaseMap)); + + //组装新的insuranceAccountDetailPO对象数据 + excelInsuranceDetailPO.setEmployeeId(employeeId); + excelInsuranceDetailPO.setBillMonth(billMonth); + excelInsuranceDetailPO.setBillStatus(1); + excelInsuranceDetailPO.setPaymentStatus(0); + excelInsuranceDetailPO.setResourceFrom(1); + excelInsuranceDetailPO.setSocialAccount(baseMap.getOrDefault("社保账号", "").toString()); + if (baseMap.getOrDefault("社保方案名称", "") != null) { + List socialSchemeList = getInsuranceSchemeMapper().listByName(baseMap.get("社保方案名称").toString()); + if (socialSchemeList.size() == 1) { + //设置社保方案id + excelInsuranceDetailPO.setSocialSchemeId(socialSchemeList.get(0).getId()); + } + } + excelInsuranceDetailPO.setFundAccount(baseMap.getOrDefault("公积金账号", "").toString()); + excelInsuranceDetailPO.setSupplementFundAccount(baseMap.getOrDefault("补充公积金账号", "").toString()); + if (baseMap.getOrDefault("公积金方案名称", "") != null) { + List fundSchemeList = getInsuranceSchemeMapper().listByName(baseMap.get("公积金方案名称").toString()); + if (fundSchemeList.size() == 1) { + //设置公积金方案id + excelInsuranceDetailPO.setFundSchemeId(fundSchemeList.get(0).getId()); + } + } + if (baseMap.getOrDefault("其他福利方案名称", "") != null) { + List otherSchemeList = getInsuranceSchemeMapper().listByName(baseMap.get("其他福利方案名称").toString()); + if (otherSchemeList.size() == 1) { + //其他福利方案id + excelInsuranceDetailPO.setOtherSchemeId(otherSchemeList.get(0).getId()); + } + } + + excelInsuranceDetailPO.setSocialPerSum(baseMap.getOrDefault("社保个人合计", "").toString()); + excelInsuranceDetailPO.setFundPerSum(baseMap.getOrDefault("公积金个人合计", "").toString()); + excelInsuranceDetailPO.setOtherPerSum(baseMap.getOrDefault("其他福利个人合计", "").toString()); + excelInsuranceDetailPO.setPerSum(baseMap.getOrDefault("个人合计", "").toString()); + + excelInsuranceDetailPO.setSocialComSum(baseMap.getOrDefault("社保单位合计", "").toString()); + excelInsuranceDetailPO.setFundComSum(baseMap.getOrDefault("公积金单位合计", "").toString()); + excelInsuranceDetailPO.setOtherComSum(baseMap.getOrDefault("其他福利单位合计", "").toString()); + excelInsuranceDetailPO.setComSum(baseMap.getOrDefault("单位合计", "").toString()); + + excelInsuranceDetailPO.setSocialSum(baseMap.getOrDefault("社保合计", "").toString()); + excelInsuranceDetailPO.setFundSum(baseMap.getOrDefault("公积金合计", "").toString()); + excelInsuranceDetailPO.setOtherSum(baseMap.getOrDefault("其他福利合计", "").toString()); + excelInsuranceDetailPO.setTotal(baseMap.getOrDefault("合计", "").toString()); + + excelInsuranceDetailPO.setCreator((long) user.getUID()); + excelInsuranceDetailPO.setCreateTime(new Date()); + excelInsuranceDetailPO.setUpdateTime(new Date()); + excelInsuranceDetailPO.setDeleteType(0); + excelInsuranceDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + excelInsuranceDetailPO.setPaymentOrganization(paymentOrganization); + + + return excelInsuranceDetailPO; + } + + } diff --git a/src/com/engine/salary/service/impl/SIExportServiceImpl.java b/src/com/engine/salary/service/impl/SIExportServiceImpl.java index a0359bc82..62446c1f0 100644 --- a/src/com/engine/salary/service/impl/SIExportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIExportServiceImpl.java @@ -173,6 +173,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { record.put("department", item.getDepartmentName()); record.put("supplementaryMonth", item.getSupplementaryMonth()); record.put("mobile", item.getTelephone()); + record.put("workcode", item.getWorkcode()); record.put("employeeStatus", item.getUserStatus() == null ? "" : getDefaultLabelByValue(item.getUserStatus())); ResourceFromEnum from = SalaryEnumUtil.enumMatchByValue(item.getResourceFrom(), ResourceFromEnum.values(), ResourceFromEnum.class); record.put("sourceFrom", SalaryI18nUtil.getI18nLabel(from.getLabelId(), from.getDefaultLabel())); @@ -418,6 +419,7 @@ public class SIExportServiceImpl extends Service implements SIExportService { list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "userName")); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "department")); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile")); + list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86317, "工号"), "workcode")); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "employeeStatus")); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100377, "数据来源"), "sourceFrom")); if (flag) { diff --git a/src/com/engine/salary/service/impl/SIImportServiceImpl.java b/src/com/engine/salary/service/impl/SIImportServiceImpl.java index 31126fa6a..aecdd2e8d 100644 --- a/src/com/engine/salary/service/impl/SIImportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIImportServiceImpl.java @@ -140,8 +140,8 @@ public class SIImportServiceImpl extends Service implements SIImportService { // 4.注释 List excelComments = Lists.newArrayList(); excelComments.add(new ExcelComment(0, 0, 3, 2, SalaryI18nUtil.getI18nLabel(100344, "必填"))); - excelComments.add(new ExcelComment(4, 0, 5, 2, SalaryI18nUtil.getI18nLabel(100344, "必填"))); - excelComments.add(new ExcelComment(5, 0, 6, 2, SalaryI18nUtil.getI18nLabel(100344, "社保,公积金,其他福利方案名称不可同时为空"))); + excelComments.add(new ExcelComment(5, 0, 6, 2, SalaryI18nUtil.getI18nLabel(100344, "必填"))); + excelComments.add(new ExcelComment(6, 0, 7, 2, SalaryI18nUtil.getI18nLabel(100344, "社保,公积金,其他福利方案名称不可同时为空"))); //工作簿数据 diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index 8428275b7..d6b21f47a 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -278,12 +278,14 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe Map map = new HashMap<>(); Map> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryItemId); salaryItemPOS.stream().filter(item -> SalaryDataTypeEnum.NUMBER.getValue().equals(item.getDataType())).forEach(item -> { - BigDecimal sum = acctResultMap.get(item.getId()).stream() + BigDecimal sum = Optional.ofNullable(acctResultMap.get(item.getId())) + .orElse(new ArrayList<>()) + .stream() .map(SalaryAcctResultPO::getResultValue) .filter(NumberUtils::isCreatable) .map(BigDecimal::new) .reduce(BigDecimal.ZERO, BigDecimal::add); - map.put(item.getId().toString(), SalaryAcctFormulaBO.roundResultValue(sum.toString(),item)); + map.put(item.getId().toString(), SalaryAcctFormulaBO.roundResultValue(sum.toString(), item)); }); return map; } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java index 4f1e9d4cb..7524ea9c3 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java @@ -85,9 +85,16 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); queryParam.setOrderRule(orderRule); - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); +// SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List taxDeclarationEmployeeDTOS = getTaxDeclarationDetailMapper().listPage4EmployeeId(queryParam); - return new PageInfo<>(taxDeclarationEmployeeDTOS, TaxDeclarationEmployeeDTO.class); + taxDeclarationEmployeeDTOS = taxDeclarationEmployeeDTOS.stream().filter(SalaryEntityUtil.distinctByKey(TaxDeclarationEmployeeDTO::getEmployeeId)).collect(Collectors.toList()); + + List list = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationEmployeeDTOS); + PageInfo pageInfo = new PageInfo<>(list, TaxDeclarationEmployeeDTO.class); + pageInfo.setPageNum(queryParam.getCurrent()); + pageInfo.setPageSize(queryParam.getPageSize()); + pageInfo.setTotal(taxDeclarationEmployeeDTOS.size()); + return pageInfo; } @Override diff --git a/src/com/engine/salary/util/SalaryEntityUtil.java b/src/com/engine/salary/util/SalaryEntityUtil.java index 8329eff0d..6a38480f1 100644 --- a/src/com/engine/salary/util/SalaryEntityUtil.java +++ b/src/com/engine/salary/util/SalaryEntityUtil.java @@ -12,7 +12,9 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collector; import java.util.stream.Collectors; @@ -152,6 +154,28 @@ public class SalaryEntityUtil { Collectors.collectingAndThen(Collectors.toList(), e -> e.stream().map(valueMapper).collect(Collectors.toList())))); } + /** + * LinkedHashMap有序去重 + * @param keyExtractor + * @param + * @return + */ + public static Predicate distinctByKey(Function keyExtractor) { + LinkedHashMap map = new LinkedHashMap<>(); + return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; + } + + /** + * ConcurrentHashMap无序去重 + * @param keyExtractor + * @param + * @return + */ + public static Predicate distinctByKeyMap(Function keyExtractor) { + ConcurrentHashMap map = new ConcurrentHashMap<>(); + return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; + } + public static BigDecimal reduce(Collection objs, Function function) { if (CollectionUtils.isEmpty(objs)) { return BigDecimal.ZERO; diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 4fac70a4c..4634f9ca8 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -11,6 +11,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.service.impl.SIAccountServiceImpl; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.page.PageInfo; +import com.engine.salary.wrapper.SIAComparisonResultWrapper; import com.engine.salary.wrapper.SIAccountWrapper; import com.engine.salary.wrapper.SalaryFormulaWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -56,6 +57,11 @@ public class SIAccountController { private SalaryFormulaWrapper getSalaryFormulaWrapper(User user) { return (SalaryFormulaWrapper) ServiceUtil.getService(SalaryFormulaWrapper.class, user); } + + private SIAComparisonResultWrapper getSIAComparisonResultWrapper(User user) { + return (SIAComparisonResultWrapper) ServiceUtil.getService(SIAComparisonResultWrapper.class, user); + } + /** * 获取台账列表页 * @@ -409,6 +415,8 @@ public class SIAccountController { try { InsuranceAcctDetailImportTemplateParam param = new InsuranceAcctDetailImportTemplateParam(); + param.setPaymentOrganization(Long.valueOf(request.getParameter("paymentOrganization"))); + param.setBillMonth(request.getParameter("billMonth")); String welfareNames = request.getParameter("welfareNames"); if (StringUtils.isNotBlank(welfareNames)) { param.setWelfareNames(Arrays.stream(welfareNames.split(",")).map(String::valueOf).collect(Collectors.toList())); @@ -503,5 +511,105 @@ public class SIAccountController { } + // **********************************线下对比 start*********************************/ + /** + * 导出“福利核算导入”模板 + */ + @GET + @Path("/comparisonwelfare/importtemplate/export") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportComparisonWelfareTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + InsuranceAcctDetailImportTemplateParam param = new InsuranceAcctDetailImportTemplateParam(); +// String welfareNames = request.getParameter("welfareNames"); +// if (StringUtils.isNotBlank(welfareNames)) { +// param.setWelfareNames(Arrays.stream(welfareNames.split(",")).map(String::valueOf).collect(Collectors.toList())); +// } + + User user = HrmUserVarify.getUser(request, response); + XSSFWorkbook workbook = getService(user).exportComparisonWelfareTemplate(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(); + } catch (Exception e) { + log.error("福利核算-线下对比导入模板导出异常", e); + throw e; + } + + } + + /** + * 将通过“福利核算-线下对比导入”模板导入的数据更新到hrsa_excel_bill_detail表中 + */ + @POST + @Path("/comparisonwelfare/importExcelInsuranceDetail") + @Produces(MediaType.APPLICATION_JSON) + public String importExcelInsuranceDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ExcelInsuranceImportParam excelInsuranceImportParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getService(user)::importExcelInsuranceDetail, excelInsuranceImportParam); + } + + + //福利核算-线上线下对比结果列表 + @POST + @Path("/comparisonwelfare/list") + @Produces(MediaType.APPLICATION_JSON) + public String listComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceComparisonResultQueryParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>>(user).run(getSIAComparisonResultWrapper(user)::listPage, param); + } + + //导出福利核算-线上线下对比结果 + @GET + @Path("/comparisonresult/export") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + InsuranceComparisonResultQueryParam param = new InsuranceComparisonResultQueryParam(); + + param.setPaymentStatus(Integer.valueOf(request.getParameter("paymentStatus"))); + param.setBillMonth(request.getParameter("billMonth")); + param.setPaymentOrganization(request.getParameter("paymentOrganization")); + String onlyDiffEmployee = request.getParameter("onlyDiffEmployee"); + if (StringUtils.isNotBlank(onlyDiffEmployee)) { + param.setOnlyDiffEmployee(Boolean.parseBoolean(onlyDiffEmployee)); + } + String userName = request.getParameter("userName"); + if (StringUtils.isNotBlank(userName)) { + param.setUserName(userName); + } + + User user = HrmUserVarify.getUser(request, response); + XSSFWorkbook workbook = getSIAComparisonResultWrapper(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(); + } catch (Exception e) { + log.error("福利核算-线下对比结果导出异常", e); + throw e; + } + } + + // **********************************线下对比 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/OtherDeductionWrapper.java b/src/com/engine/salary/wrapper/OtherDeductionWrapper.java index e5eb8f0ed..493dd5623 100644 --- a/src/com/engine/salary/wrapper/OtherDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/OtherDeductionWrapper.java @@ -2,7 +2,6 @@ package com.engine.salary.wrapper; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; -import com.api.browser.bean.SearchConditionOption; import com.api.browser.util.ConditionFactory; import com.api.browser.util.ConditionType; import com.engine.common.util.ServiceUtil; @@ -23,7 +22,6 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; -import weaver.systeminfo.SystemEnv; import java.util.ArrayList; import java.util.HashMap; @@ -91,37 +89,37 @@ public class OtherDeductionWrapper extends Service { conditionItems.add(jobNum); - SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); - idNo.setInputType("input"); - idNo.setColSpan(2); - idNo.setFieldcol(16); - idNo.setLabelcol(8); - idNo.setViewAttr(2); - idNo.setLabel("证件号码"); - conditionItems.add(idNo); - - //日期范围选项 - List dateOptions = new ArrayList(); - dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); - hiredate.setInputType("rangepicker"); - hiredate.setFormat("yyyy-MM-dd"); - hiredate.setFieldcol(16); - hiredate.setLabelcol(8); - hiredate.setViewAttr(2); - hiredate.setLabel("入职日期"); - hiredate.setOptions(dateOptions); - conditionItems.add(hiredate); - - - SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); - mobile.setInputType("input"); - mobile.setColSpan(2); - mobile.setFieldcol(16); - mobile.setLabelcol(8); - mobile.setViewAttr(2); - mobile.setLabel("手机号"); - conditionItems.add(mobile); +// SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); +// idNo.setInputType("input"); +// idNo.setColSpan(2); +// idNo.setFieldcol(16); +// idNo.setLabelcol(8); +// idNo.setViewAttr(2); +// idNo.setLabel("证件号码"); +// conditionItems.add(idNo); +// +// //日期范围选项 +// List dateOptions = new ArrayList(); +// dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) +// SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); +// hiredate.setInputType("rangepicker"); +// hiredate.setFormat("yyyy-MM-dd"); +// hiredate.setFieldcol(16); +// hiredate.setLabelcol(8); +// hiredate.setViewAttr(2); +// hiredate.setLabel("入职日期"); +// hiredate.setOptions(dateOptions); +// conditionItems.add(hiredate); +// +// +// SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); +// mobile.setInputType("input"); +// mobile.setColSpan(2); +// mobile.setFieldcol(16); +// mobile.setLabelcol(8); +// mobile.setViewAttr(2); +// mobile.setLabel("手机号"); +// conditionItems.add(mobile); addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); diff --git a/src/com/engine/salary/wrapper/SIAComparisonResultWrapper.java b/src/com/engine/salary/wrapper/SIAComparisonResultWrapper.java new file mode 100644 index 000000000..2e4fc0d37 --- /dev/null +++ b/src/com/engine/salary/wrapper/SIAComparisonResultWrapper.java @@ -0,0 +1,55 @@ +package com.engine.salary.wrapper; + +import com.engine.common.util.ServiceUtil; +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.entity.siaccount.dto.InsuranceComparisonResultListDTO; +import com.engine.salary.entity.siaccount.param.InsuranceComparisonResultQueryParam; +import com.engine.salary.service.SIAComparisonResultService; +import com.engine.salary.service.SalaryComparisonResultService; +import com.engine.salary.service.impl.SIAComparisonResultServiceImpl; +import com.engine.salary.service.impl.SalaryComparisonResultServiceImpl; +import com.engine.salary.util.page.PageInfo; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.hrm.User; + +import java.util.Map; + +/** + * @Author: sy + * @Description: 福利核算线下对比结果 + * @Date: 2022/9/28 + **/ +public class SIAComparisonResultWrapper extends Service { + + + private SIAComparisonResultService getSIAComparisonResultService(User user) { + return (SIAComparisonResultService) ServiceUtil.getService(SIAComparisonResultServiceImpl.class, user); + } + /** + * 福利核算线下对比列表 + * + * @param queryParam 列表查询条件 + * @return + */ + public PageInfo> listPage(InsuranceComparisonResultQueryParam queryParam) { + // 查询薪资核算线下对比列表 + InsuranceComparisonResultListDTO salaryComparisonResultListDTO = getSIAComparisonResultService(user).listPageByParam(queryParam); + + PageInfo> pageInfo = salaryComparisonResultListDTO.getData(); + pageInfo.setColumns(salaryComparisonResultListDTO.getWeaTableColumns()); + + return pageInfo; + } + + /** + * 导出福利核算线下对比结果 + * + * @param queryParam 列表查询条件 + * @return + */ + public XSSFWorkbook exportComparisonResult(InsuranceComparisonResultQueryParam queryParam) { + return getSIAComparisonResultService(user).exportComparisonResult( queryParam); + } +} diff --git a/src/com/engine/salary/wrapper/SalaryItemWrapper.java b/src/com/engine/salary/wrapper/SalaryItemWrapper.java index 2d4e42ae6..e5d6b0133 100644 --- a/src/com/engine/salary/wrapper/SalaryItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryItemWrapper.java @@ -94,6 +94,12 @@ public class SalaryItemWrapper extends Service { List sysSalaryItemPOS = getSysSalaryItemService(user).listByIds(sysSalaryItemIds); // 转换成薪资项目列表dto List salaryItemListDTOS = SalaryItemBO.convert2ListDTO(salaryItemList, expressFormulas, sysSalaryItemPOS); + //薪资档案引用时不能删除 + salaryItemListDTOS.forEach(dto -> { + if (dto.getUseInEmployeeSalary() == 1) { + dto.setCanDelete(false); + } + }); //3、被引用的薪资项目不能删除 Set salaryItemIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getId); salarySobItems = getSalarySobItemService(user).listBySalaryItemIds(salaryItemIds); diff --git a/src/com/engine/salary/wrapper/SalarySendWrapper.java b/src/com/engine/salary/wrapper/SalarySendWrapper.java index cfbba9ffa..097e4e2c2 100644 --- a/src/com/engine/salary/wrapper/SalarySendWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySendWrapper.java @@ -236,7 +236,7 @@ public class SalarySendWrapper extends Service { conditionItems.add(position); //状态 - SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent"); + SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "userstatus"); status.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 status.setFieldcol(16); //条件输入框所占宽度,默认值18 status.setLabelcol(8); @@ -248,19 +248,19 @@ public class SalarySendWrapper extends Service { status.setLabel("状态"); //设置文本值 这个将覆盖多语言标签的值 conditionItems.add(status); - //入职日期 - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate"); - hiredate.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 - hiredate.setLabelcol(8); - hiredate.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 - Map otherParams1 = new HashMap(); - otherParams1.put("format", "yyyy-MM-dd"); - hiredate.setOtherParams(otherParams1); - hiredate.setInputType("day"); - hiredate.setMode("day"); - hiredate.setLabel("入职日期"); //设置文本值 这个将覆盖多语言标签的值 - conditionItems.add(hiredate); +// //入职日期 +// SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate"); +// hiredate.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 +// hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 +// hiredate.setLabelcol(8); +// hiredate.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 +// Map otherParams1 = new HashMap(); +// otherParams1.put("format", "yyyy-MM-dd"); +// hiredate.setOtherParams(otherParams1); +// hiredate.setInputType("day"); +// hiredate.setMode("day"); +// hiredate.setLabel("入职日期"); //设置文本值 这个将覆盖多语言标签的值 +// conditionItems.add(hiredate); //发送状态 SearchConditionItem sendStatus = conditionFactory.createCondition(ConditionType.SELECT, 25034, "sendStatus"); @@ -417,7 +417,7 @@ public class SalarySendWrapper extends Service { conditionItems.add(position); //状态 - SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent"); + SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "userstatus"); status.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 status.setFieldcol(16); //条件输入框所占宽度,默认值18 status.setLabelcol(8); @@ -429,19 +429,19 @@ public class SalarySendWrapper extends Service { status.setLabel("状态"); //设置文本值 这个将覆盖多语言标签的值 conditionItems.add(status); - //入职日期 - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate"); - hiredate.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 - hiredate.setLabelcol(8); - hiredate.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 - Map otherParams1 = new HashMap(); - otherParams1.put("format", "yyyy-MM-dd"); - hiredate.setOtherParams(otherParams1); - hiredate.setInputType("day"); - hiredate.setMode("day"); - hiredate.setLabel("入职日期"); //设置文本值 这个将覆盖多语言标签的值 - conditionItems.add(hiredate); +// //入职日期 +// SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate"); +// hiredate.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 +// hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 +// hiredate.setLabelcol(8); +// hiredate.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 +// Map otherParams1 = new HashMap(); +// otherParams1.put("format", "yyyy-MM-dd"); +// hiredate.setOtherParams(otherParams1); +// hiredate.setInputType("day"); +// hiredate.setMode("day"); +// hiredate.setLabel("入职日期"); //设置文本值 这个将覆盖多语言标签的值 +// conditionItems.add(hiredate); //合并计税 SearchConditionItem mergeCountTax = conditionFactory.createCondition(ConditionType.CHECKBOX, 25034, "mergeCountTax");