diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index c9488e15d..8cbcfb731 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1,5 +1,6 @@ package com.engine.salary.biz; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.api.formmode.mybatis.util.SqlProxyHandle; @@ -44,17 +45,16 @@ import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.MapperProxyFactory; 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 com.wbi.util.StringUtil; -import com.engine.salary.util.db.IdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import weaver.general.Util; @@ -677,7 +677,7 @@ public class SIAccountBiz extends Service { needArchivesPerson.stream().forEach(e -> { InsuranceSchemeDetailPO po = otherPerson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -754,7 +754,7 @@ public class SIAccountBiz extends Service { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = otherCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -844,7 +844,7 @@ public class SIAccountBiz extends Service { needArchivesPerson.stream().forEach(e -> { InsuranceSchemeDetailPO po = fundperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -920,7 +920,7 @@ public class SIAccountBiz extends Service { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = fundCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1013,7 +1013,7 @@ public class SIAccountBiz extends Service { needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1089,7 +1089,7 @@ public class SIAccountBiz extends Service { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = schemeCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1595,7 +1595,7 @@ public class SIAccountBiz extends Service { needArchivesPerson.stream().forEach(e -> { InsuranceSchemeDetailPO po = otherPerson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1664,7 +1664,7 @@ public class SIAccountBiz extends Service { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = otherCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1745,7 +1745,7 @@ public class SIAccountBiz extends Service { needArchivesPerson.stream().forEach(e -> { InsuranceSchemeDetailPO po = fundperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1813,7 +1813,7 @@ public class SIAccountBiz extends Service { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = fundCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1898,7 +1898,7 @@ public class SIAccountBiz extends Service { needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -1967,7 +1967,7 @@ public class SIAccountBiz extends Service { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = schemeCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -2055,7 +2055,7 @@ public class SIAccountBiz extends Service { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); // BigDecimal paymentNum = new BigDecimal(archivesPerson.get(String.valueOf(e))); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); @@ -2126,7 +2126,7 @@ public class SIAccountBiz extends Service { InsuranceSchemeDetailPO po = schemeCom.get(e); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); // BigDecimal paymentNum = SalaryEntityUtil.string2BigDecimalDefault0(archivesCom.get(String.valueOf(e))); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); diff --git a/src/com/engine/salary/entity/extemp/po/ExtEmpPO.java b/src/com/engine/salary/entity/extemp/po/ExtEmpPO.java index 837d7ea7f..cce138efa 100644 --- a/src/com/engine/salary/entity/extemp/po/ExtEmpPO.java +++ b/src/com/engine/salary/entity/extemp/po/ExtEmpPO.java @@ -183,6 +183,8 @@ public class ExtEmpPO { private String tenantKey; private Collection ids; + private Collection subcompanyIds; + private Collection departmentIds; private String departmentOrgName; diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java index dc0a516e5..d5147940a 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.salaryacct.bo; +import cn.hutool.core.util.ObjectUtil; import com.engine.salary.annotation.SalaryFormulaVar; import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.constant.SalaryDefaultTenantConstant; @@ -27,7 +28,6 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; @@ -645,7 +645,7 @@ public class SalaryAcctResultBO { List items, SalaryAcctEmployeePO salaryAcctEmployee, Long employeeId) { - if (CollectionUtils.isEmpty(items) || ObjectUtils.isEmpty(salaryAcctEmployee)) { + if (CollectionUtils.isEmpty(items) || ObjectUtil.isEmpty(salaryAcctEmployee)) { return Collections.emptyList(); } Date now = new Date(); diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.java b/src/com/engine/salary/mapper/datacollection/EmployMapper.java index 17bf3b1f7..826497acb 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.java +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.java @@ -150,4 +150,12 @@ public interface EmployMapper { * @return */ List listVirtualEmpByVirtualSubCompanyIds(@Param("virtualSubCompanyIds") List virtualSubCompanyIds); + + /** + * 根据分部、部门获取查询 + * @param subCompanyIds + * @param departmentIds + * @return + */ + List listBySubCompanyOrDepartment(@Param("subCompanyIds") List subCompanyIds, @Param("departmentIds") List departmentIds); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index ac679e0fa..def395367 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -521,6 +521,36 @@ ) + + diff --git a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java index ce8dcc11d..46b868142 100644 --- a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java +++ b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java @@ -129,7 +129,9 @@ public class SalaryStatisticsReportBO { } // param.setGrade(((List) JSON.parseArray(po.getGradeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); // param.setPosition(((List) JSON.parseArray(po.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); -// param.setStatus(((List) JSON.parseArray(po.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList())); + if (po.getStatusSetting() != null) { + param.setStatus(((List) JSON.parseArray(po.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList())); + } if (po.getEmployeeSetting() != null) { param.setEmployee(((List) JSON.parseArray(po.getEmployeeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); } diff --git a/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeQueryParam.java b/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeQueryParam.java index 2a13d43de..b0be690c1 100644 --- a/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeQueryParam.java +++ b/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeQueryParam.java @@ -1,7 +1,7 @@ package com.engine.salary.report.entity.param; import com.engine.salary.common.BaseQueryParam; -import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum; +import com.engine.salary.report.enums.EmployeeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -24,7 +24,6 @@ import java.util.List; @AllArgsConstructor //"薪酬统计员工明细查询参数") public class SalaryStatisticsEmployeeQueryParam extends BaseQueryParam { - //关键字") private String keyword; diff --git a/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeSalaryQueryParam.java b/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeSalaryQueryParam.java new file mode 100644 index 000000000..13108c0be --- /dev/null +++ b/src/com/engine/salary/report/entity/param/SalaryStatisticsEmployeeSalaryQueryParam.java @@ -0,0 +1,50 @@ +package com.engine.salary.report.entity.param; + +import com.engine.salary.common.BaseQueryParam; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +/** + * @author Harryxzy + * @ClassName f + * @date 2024/03/25 9:56 + * @description + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//"薪酬统计员工明细查询参数") +public class SalaryStatisticsEmployeeSalaryQueryParam extends BaseQueryParam { + + // 关键字 + private String keyword; + + // 起始年月 + private String startDateStr; + private Date startDate; + + // 结束年月 + private String endDateStr; + private Date endDate; + + // 个税扣缴义务人id + private List taxAgentIds; + + // 分部id + private List subCompanyIds; + + // 部门id + private List departmentIds; + + // 是否是导出 + private boolean isExport; + + // 部分导出id + private List ids; +} \ No newline at end of file diff --git a/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java b/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java index 23b52f4b3..512e51d55 100644 --- a/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java +++ b/src/com/engine/salary/report/service/SalaryStatisticsEmployeeService.java @@ -1,9 +1,11 @@ package com.engine.salary.report.service; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultDTO; import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam; import com.engine.salary.util.page.PageInfo; import java.util.List; @@ -44,6 +46,10 @@ public interface SalaryStatisticsEmployeeService { */ List> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam); + PageInfo listSalaryAcctEmp(SalaryStatisticsEmployeeSalaryQueryParam queryParam); + + SalaryStatisticsEmployeeDetailResultDTO getDetailSalaryAcctResultByAcctEmp(List salaryAcctEmployeeList); + /** * 导出员工详情列表 * diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java index 9e0ac4d11..dd023e7eb 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsEmployeeServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.report.service.impl; +import cn.hutool.core.util.NumberUtil; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -11,6 +12,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum; +import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper; import com.engine.salary.report.common.constant.SalaryConstant; import com.engine.salary.report.entity.bo.SalaryStatisticsEmployeeBO; @@ -18,6 +20,7 @@ import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultD import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam; import com.engine.salary.report.service.SalaryStatisticsEmployeeService; import com.engine.salary.service.*; import com.engine.salary.service.impl.*; @@ -31,6 +34,7 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import com.wbi.util.Util; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -259,7 +263,9 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala acctResultValueMap.put(k, map); }); - + // 获取人员信息 + List employeeList = getSalaryEmployeeService(user).listByIds(salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList())); + Map empMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); List> list = Lists.newArrayList(); Map map; for (SalaryAcctEmployeePO se : salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList()) { @@ -269,11 +275,19 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala resultValueMap.forEach((k, v) -> { finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v); }); + DataCollectionEmployee emp = empMap.getOrDefault(se.getEmployeeId(), DataCollectionEmployee.builder().build()); map.put("id", se.getId().toString()); map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(se.getSalaryMonth())); map.put("taxAgent", taxAgentMap.get(se.getTaxAgentId())); map.put("salarySob",SalarySobMap.get(se.getSalarySobId())); map.put("acctTimes", salaryAcctRecordMap.get(se.getSalaryAcctRecordId())); + map.put("userName", Util.null2String(emp.getUsername())); + map.put("subCompany", Util.null2String(emp.getSubcompanyName())); + map.put("department", Util.null2String(emp.getDepartmentName())); + map.put("jobTitle", Util.null2String(emp.getJobtitleName())); + map.put("status", Util.null2String(NumberUtil.isNumber(emp.getStatus()) ? SalaryEmployeeStatusEnum.parseByValue(Integer.valueOf(emp.getStatus())).getDefaultLabel() : null)); + map.put("workCode", Util.null2String(emp.getWorkcode())); + // IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(Integer.parseInt(se.getIncomeCategory())); // map.put("incomeCategory", Objects.isNull(incomeCategoryEnum) ? "" : SalaryI18nUtil.getI18nLabel(incomeCategoryEnum.getLabelId(), incomeCategoryEnum.getDefaultLabel())); list.add(map); @@ -281,7 +295,92 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala return list; } -// @Override + @Override + public PageInfo listSalaryAcctEmp(SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + List list = Collections.emptyList(); + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, SalaryStatisticsEmployeeListDTO.class); + + // 1.分权处理, 首先获取个税扣缴义务人参数 + Collection taxAgentViews = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()); + List taxAgentIds = Objects.isNull(taxAgentViews) ? Lists.newArrayList() : taxAgentViews.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) { + taxAgentIds = taxAgentIds.stream().filter(queryParam.getTaxAgentIds()::contains).collect(Collectors.toList()); + } + if (CollectionUtils.isEmpty(taxAgentIds)) { + return new PageInfo<>(); + } + + // 2.年月参数处理,注意:薪资所属月居然是用字符串存储的,无法通过sql between处理 + List dataParam = new ArrayList<>(); + if (StringUtils.isNotBlank(queryParam.getStartDateStr())) { + dataParam.add(SalaryDateUtil.dateStrToLocalTime(queryParam.getStartDateStr()+ "-01 00:00:00")); + } + if (StringUtils.isNotBlank(queryParam.getEndDateStr())) { + dataParam.add(SalaryDateUtil.dateStrToLocalTime(queryParam.getEndDateStr()+ "-01 00:00:00")); + } + Set salaryMonths = SalaryStatisticsEmployeeBO.getSalaryMonths(null, dataParam) + .stream() + .map(SalaryDateUtil::dateStrToLocalYearMonth) + .collect(Collectors.toSet()); + + // 查询薪资核算人员 + List salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listByTaxAgentAndSalaryMonth(taxAgentIds, salaryMonths); + if (CollectionUtils.isNotEmpty(queryParam.getSubCompanyIds()) || CollectionUtils.isNotEmpty(queryParam.getDepartmentIds()) || StringUtils.isNotBlank(queryParam.getKeyword())) { + // 根据分部、部门筛选 + List employeeList = getSalaryEmployeeService(user).listBySubCompanyOrDepartment(queryParam.getSubCompanyIds(), queryParam.getDepartmentIds()); + // 根据关键词过滤 + if(StringUtils.isNotBlank(queryParam.getKeyword())) { + employeeList = employeeList.stream() + .filter(e -> (e.getUsername().contains(queryParam.getKeyword()) || (StringUtils.isNotEmpty(e.getWorkcode()) && e.getWorkcode().contains(queryParam.getKeyword())))) + .collect(Collectors.toList()); + } + List employeeIds = employeeList.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); + salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter( acctEmp -> employeeIds.contains(acctEmp.getEmployeeId())).collect(Collectors.toList()); + } + if (CollectionUtils.isEmpty(salaryAcctEmployeeList)) { + return new PageInfo<>(); + } + + // 分页 + if (CollectionUtils.isNotEmpty(queryParam.getIds())) { + salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(emp -> queryParam.getIds().contains(emp.getId())).collect(Collectors.toList()); + } + salaryAcctEmployeeList = salaryAcctEmployeeList.stream().sorted(Comparator.comparing(SalaryAcctEmployeePO::getSalaryMonth)).collect(Collectors.toList()); + Collections.reverse(salaryAcctEmployeeList); + PageInfo SalaryAcctEmployeePageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryAcctEmployeeList); + if (queryParam.isExport()) { + SalaryAcctEmployeePageInfo.setList(salaryAcctEmployeeList); + } + return SalaryAcctEmployeePageInfo; + } + + @Override + public SalaryStatisticsEmployeeDetailResultDTO getDetailSalaryAcctResultByAcctEmp(List salaryAcctEmployeeList) { + if (CollectionUtils.isEmpty(salaryAcctEmployeeList)) { + return SalaryStatisticsEmployeeDetailResultDTO.builder() + .salaryAcctEmployeeList(Collections.emptyList()) + .salaryAcctResultValueList(Collections.emptyList()) + .salaryItemList(Collections.emptyList()) + .build(); + } + + // 获取核算结果数据 + List salaryAcctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); + List salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); + + // 3.获取薪资项目 + List salaryItemIds = salaryAcctResultValues.stream().map(SalaryAcctResultPO::getSalaryItemId).distinct().collect(Collectors.toList()); + List salaryItemList = CollectionUtils.isEmpty(salaryItemIds) ? Lists.newArrayList() : getSalaryItemService(user).listByIds(salaryItemIds); + + return SalaryStatisticsEmployeeDetailResultDTO.builder() + .salaryAcctEmployeeList(salaryAcctEmployeeList) + .salaryAcctResultValueList(salaryAcctResultValues) + .salaryItemList(salaryItemList) + .build(); + } + + + // @Override // public void exportDetailList(Map map, SalaryStatisticsEmployeeDetailQueryParam queryParam) { // DataCollectionEmployee employee = getSalaryEmployeeService(user).getEmployeeById(queryParam.getEmployeeId()); // // 获取核算数据 diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsPushDetailServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsPushDetailServiceImpl.java index 4c9b1d084..2ad3fc866 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsPushDetailServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsPushDetailServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.report.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.engine.core.impl.Service; import com.engine.salary.mapper.report.salaryStatisticsPushDetailMapper; import com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO; @@ -7,7 +8,6 @@ import com.engine.salary.report.service.SalaryStatisticsPushDetailService; import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.math.NumberUtils; import java.util.ArrayList; @@ -84,7 +84,7 @@ public class SalaryStatisticsPushDetailServiceImpl extends Service implements Sa * @param */ public List queryPushDetailPOByBatchIdAndEmpIds(Long batchId, List sharedBy) { - if (CollectionUtils.isEmpty(sharedBy) || ObjectUtils.isEmpty(batchId)) { + if (CollectionUtils.isEmpty(sharedBy) || ObjectUtil.isEmpty(batchId)) { return Collections.emptyList(); } List> partition = Lists.partition(sharedBy, 999); diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java index 4248fab9d..46f961ee6 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsPushServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.report.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.common.BaseQueryParam; @@ -28,13 +29,12 @@ import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; -import com.engine.salary.util.db.IdGenerator; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import weaver.hrm.User; @@ -231,7 +231,7 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt @Override public void cancel(Long id) { SalaryStatisticsPushDetailPO detailPO = getSalaryStatisticsPushDetailService(user).getById(id); - if (ObjectUtils.isEmpty(detailPO)) { + if (ObjectUtil.isEmpty(detailPO)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(), 542148, "数据不存在")); } cancelSingle(detailPO); diff --git a/src/com/engine/salary/report/web/SalaryStatisticsEmployeeController.java b/src/com/engine/salary/report/web/SalaryStatisticsEmployeeController.java index 23571d9e8..a98c909ea 100644 --- a/src/com/engine/salary/report/web/SalaryStatisticsEmployeeController.java +++ b/src/com/engine/salary/report/web/SalaryStatisticsEmployeeController.java @@ -4,10 +4,13 @@ import com.engine.common.util.ServiceUtil; import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam; import com.engine.salary.report.wrapper.SalaryStatisticsEmployeeWrapper; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.page.PageInfo; import io.swagger.v3.oas.annotations.parameters.RequestBody; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -18,8 +21,14 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.time.LocalDate; import java.util.Map; + /** * 薪酬统计员工明细 *

Copyright: Copyright (c) 2022

@@ -28,6 +37,7 @@ import java.util.Map; * @author qiantao * @version 1.0 **/ +@Slf4j public class SalaryStatisticsEmployeeController { private SalaryStatisticsEmployeeWrapper getSalaryStatisticsEmployeeWrapper(User user) { @@ -62,6 +72,69 @@ public class SalaryStatisticsEmployeeController { return new ResponseResult>(user).run(getSalaryStatisticsEmployeeWrapper(user)::detailList, queryParam); } + /** + * 员工薪资列表 + * + * @param queryParam + * @return + */ + @POST + @Path("/salaryList") + @Produces(MediaType.APPLICATION_JSON) + public String salaryList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSalaryStatisticsEmployeeWrapper(user)::salaryList, queryParam); + } + + /** + * 员工薪资列表合计行 + * + * @param queryParam + * @return + */ + @POST + @Path("/salaryListSum") + @Produces(MediaType.APPLICATION_JSON) + public String salaryListSum(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSalaryStatisticsEmployeeWrapper(user)::salaryListSum, queryParam); + } + + /** + * 导出员工薪资列表 + * + * @param queryParam + * @return + */ + @POST + @Path("/exportSalaryList") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportSalaryList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + try { + User user = HrmUserVarify.getUser(request, response); + XSSFWorkbook workbook = getSalaryStatisticsEmployeeWrapper(user).exportSalaryList(queryParam); + + String fileName = "薪资明细" + LocalDate.now(); + + try { + fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error(e.getMessage(), e); + } + + 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; + } + } + // /** // * 导出员工详情列表 // * diff --git a/src/com/engine/salary/report/web/SalaryStatisticsReportController.java b/src/com/engine/salary/report/web/SalaryStatisticsReportController.java index b7c27d196..bcdbd2180 100644 --- a/src/com/engine/salary/report/web/SalaryStatisticsReportController.java +++ b/src/com/engine/salary/report/web/SalaryStatisticsReportController.java @@ -199,9 +199,36 @@ public class SalaryStatisticsReportController { */ @POST @Path("/getDataPerspective") - @Produces(MediaType.APPLICATION_OCTET_STREAM) + @Produces(MediaType.APPLICATION_JSON) public String getDataPerspective(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsDataPerspectiveQueryParam param) { User user = HrmUserVarify.getUser(request, response); return new ResponseResult>(user).run(getSalaryStatisticsReportWrapper(user)::getDataPerspective, param); } + + @POST + @Path("/exportDataPerspective") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportDataPerspective(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsDataPerspectiveQueryParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + Map map = getSalaryStatisticsReportWrapper(user).exportDataPerspective(param); + XSSFWorkbook workbook = (XSSFWorkbook) map.get("workbook"); + String time = LocalDate.now().toString(); + String fileName = map.get("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; + } + } } diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java index 84f8a055b..179cb494c 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java @@ -1,11 +1,13 @@ package com.engine.salary.report.wrapper; import com.cloudstore.eccom.constant.WeaBoolAttr; +import com.cloudstore.eccom.pc.table.WeaTable; import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.component.SalaryWeaTable; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.report.common.constant.SalaryConstant; @@ -14,10 +16,12 @@ import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultD import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeListDTO; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeDetailQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeQueryParam; +import com.engine.salary.report.entity.param.SalaryStatisticsEmployeeSalaryQueryParam; import com.engine.salary.report.service.SalaryStatisticsEmployeeService; import com.engine.salary.report.service.impl.SalaryStatisticsEmployeeServiceImpl; import com.engine.salary.report.util.ReportDataUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.excel.ExcelUtilPlus; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Maps; @@ -25,6 +29,9 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import weaver.general.Util; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.general.PageIdConst; +import weaver.general.Util; import weaver.hrm.User; import java.math.BigDecimal; @@ -32,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; /** * 薪酬统计员工明细 @@ -88,7 +96,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service { PageInfo> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), records); // 列表columns - List weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult); + List weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult, false); SalaryWeaTable table = new SalaryWeaTable(user, SalaryStatisticsEmployeeDetailResultDTO.class); table.setColumns(weaTableColumns); @@ -106,12 +114,20 @@ public class SalaryStatisticsEmployeeWrapper extends Service { return resultMap; } - private List buildDetailTableColumns(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult) { + private List buildDetailTableColumns(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, boolean isSalaryList) { // 表格表头 List columns = new ArrayList<>(); columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(user.getLanguage(),542604, "薪资所属月"), "salaryMonth")); columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(user.getLanguage(),537996, "个税扣缴义务人"), "taxAgent")); columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(user.getLanguage(),24427, "账套"), "salarySob")); + if (isSalaryList) { + columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "姓名"), "userName")); + columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "分部"), "subCompany")); + columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "部门"), "department")); + columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "岗位"), "jobTitle")); + columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "员工状态"), "status")); + columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "工号"), "workCode")); + } columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(user.getLanguage(),26755, "次数"), "acctTimes").setDisplay(WeaBoolAttr.FALSE)); // columns.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel(user.getLanguage(),542345, "收入所得项目"), "incomeCategory")); salaryStatisticsEmployeeDetailResult.getSalaryItemList().forEach(item -> { @@ -125,6 +141,142 @@ public class SalaryStatisticsEmployeeWrapper extends Service { return columns; } + /** + * 获取员工发薪明细列表 + * @param queryParam + */ + public Map salaryList(SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + Map resultMap = Maps.newHashMap(); + if (StringUtils.isBlank(queryParam.getStartDateStr()) || StringUtils.isBlank(queryParam.getEndDateStr())) { + return resultMap; + } + // 获取发薪人员 + PageInfo salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam); + // 获取薪资核算结果 + SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList()); + List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null); + + Map countResultMap = Maps.newHashMap(); + if (CollectionUtils.isNotEmpty(records)) { + List salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList(); + for (SalaryItemPO item : salaryItems) { + BigDecimal sumBigDecimal = new BigDecimal(SalaryStatisticsReportBO.ZERO); + String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX; + for (Map record : records) { + if (record.containsKey(itemKey)) { + if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) { + sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString())); + record.put(itemKey, ReportDataUtil.thousandthConvert(record.get(itemKey).toString())); + } + } + } + // 薪资项目合计 + if (queryParam.isExport()) { + countResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString())); + } + } + } + PageInfo> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + pageInfo.setList(records); + if (queryParam.isExport()) { + pageInfo.setList(records); + } + pageInfo.setTotal(salaryAcctEmployeePageInfo.getTotal()); + + // 列表columns + List weaTableColumns = buildDetailTableColumns(salaryStatisticsEmployeeDetailResult, true); + + // 结果 + if (queryParam.isExport()) { + resultMap.put("columns", weaTableColumns); + resultMap.put("salaryItems",salaryStatisticsEmployeeDetailResult.getSalaryItemList()); + resultMap.put("countResult", countResultMap); + } else { + WeaTable table = new WeaTable(); + String pageId = "b72ed4bb-725e-45de-aea1-4eb4c9184af7"; + table.setPageID(pageId); + table.setPageUID(pageId + user.getUID()); + table.setPagesize(PageIdConst.getPageSize(pageId, user.getUID())); + table.setBackfields(""); + table.setColumns(weaTableColumns); + + WeaResultMsg result = new WeaResultMsg(false); + result.putAll(table.makeDataResult()); + result.success(); + resultMap.put("dataKey", result.getResultMap()); + } + resultMap.put("pageInfo", pageInfo); + return resultMap; + } + + /** + * 获取员工发薪明细列表 + * @param queryParam + */ + public Map salaryListSum(SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + Map resultMap = Maps.newHashMap(); + if (StringUtils.isBlank(queryParam.getStartDateStr()) || StringUtils.isBlank(queryParam.getEndDateStr())) { + return resultMap; + } + queryParam.setExport(true); + // 获取发薪人员 + PageInfo salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam); + // 获取薪资核算结果 + SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList()); + List> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null); + + Map sumResultMap = Maps.newHashMap(); + if (CollectionUtils.isNotEmpty(records)) { + List salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList(); + for (SalaryItemPO item : salaryItems) { + BigDecimal sumBigDecimal = new BigDecimal(SalaryStatisticsReportBO.ZERO); + String itemKey = item.getId() + SalaryConstant.DYNAMIC_SUFFIX; + for (Map record : records) { + if (record.containsKey(itemKey)) { + if (Objects.nonNull(record.get(itemKey)) && StringUtils.isNotEmpty(record.get(itemKey).toString()) && NumberUtils.isCreatable(record.get(itemKey).toString())) { + sumBigDecimal = sumBigDecimal.add(new BigDecimal(record.get(itemKey).toString())); + } + } + } + // 薪资项目合计 + sumResultMap.put(itemKey, ReportDataUtil.thousandthConvert(sumBigDecimal.toString())); + } + } + resultMap.put("sumRow", sumResultMap); + return resultMap; + } + + public XSSFWorkbook exportSalaryList(SalaryStatisticsEmployeeSalaryQueryParam queryParam) { + queryParam.setCurrent(1); + queryParam.setExport(true); + Map resultMap = salaryList(queryParam); + List columns = (List)resultMap.get("columns"); + List salaryItemList = ((List)resultMap.get("salaryItems")); + List> resultList = ((PageInfo>) resultMap.get("pageInfo")).getList(); + Map countResult = (Map)resultMap.get("countResult"); + + List> rowList = new ArrayList<>(); + // 表头 + rowList.add(columns.stream().map(WeaTableColumn::getText).collect(Collectors.toList())); + // 数据 + for (Map valueMap : resultList) { + List list = new ArrayList<>(); + for (WeaTableColumn column : columns) { + list.add(Util.null2String(valueMap.get(column.getColumn()))); + } + rowList.add(list); + } + // 合计 + List sumRow = new ArrayList<>(); + sumRow.add("总计"); + for (int i=1; i exportDetailList(SalaryStatisticsEmployeeDetailQueryParam queryParam) { // SalaryAssert.notNull(queryParam.getEmployeeId(), SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 544325, "人员id不能为空")); // // 构建异步导出参数 diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index 887f915b2..01e94bd0a 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -7,13 +7,14 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.component.WeaFormOption; import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.config.SalaryElogConfig; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.enums.OperateTypeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.report.common.constant.SalaryConstant; import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO; @@ -41,6 +42,7 @@ import weaver.general.Util; import weaver.hrm.User; import weaver.wechat.util.Utils; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -498,6 +500,74 @@ public class SalaryStatisticsReportWrapper extends Service { return resultMap; } + /** + * 获取报表透视数据 + * + * @param param + * @return + */ + public Map exportDataPerspective(SalaryStatisticsDataPerspectiveQueryParam param) { + if (param.getId() == null || param.getDimensionId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + } + SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(param.getId()); + if (po == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); + } + SalaryStatisticsDimensionPO dimension = getSalaryStatisticsDimensionService(user).getById(param.getDimensionId()); + if (dimension == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在")); + } + // 校验报表权限,如果是被分享报表修改User + sharedReportCheck(param.isShare(), po); + // 查询自定义统计项目中所有薪资项目id + List salaryStatisticsItemPOS = getSalaryStatisticsItemService(user).listByStatisticsReportId(param.getId()); + List salaryItemIds = salaryStatisticsItemPOS.stream().filter(item -> StringUtils.isNotBlank(item.getItemValue())).map(p -> p.getItemValue().split(",")) + .flatMap(Arrays::stream).map(Long::valueOf).collect(Collectors.toList()); + + param.setCurrent(1); + param.setPageSize(1000000000); + PageInfo> pageInfo = getSalaryStatisticsReportService(user).buildDataPerspectiveRecords(param, po, dimension, salaryStatisticsItemPOS); + + + List> resultList = new ArrayList<>(); + + List itemList = getSalaryItemService(user).listByIds(salaryItemIds); + // 表格表头 + List weaTableColumns = buildDataPerspectiveTableColumns(itemList); + List columns = new ArrayList<>(); + for (WeaTableColumn column : weaTableColumns) { + columns.add(column.getText()); + } + resultList.add(columns); + + List> list = pageInfo.getList(); + for (Map resultMap : list) { + List row = new ArrayList<>(); + for (WeaTableColumn column : weaTableColumns) { + try { + if (StringUtils.isNotBlank(column.getOtherpara()) && column.getOtherpara().equals(SalaryDataTypeEnum.NUMBER.getValue())) { + // 数值 + row.add(new BigDecimal(resultMap.get(column.getColumn()).toString())); + } else { + row.add(Utils.null2String(resultMap.get(column.getColumn()))); + } + } catch (Exception e) { + row.add(Utils.null2String(resultMap.get(column.getColumn()))); + } + } + resultList.add(row); + } + + String sheetName = SalaryI18nUtil.getI18nLabel(179263, "薪酬统计报表明细") + "-" + dimension.getDimName(); + XSSFWorkbook book = ExcelUtilPlus.genWorkbookV2(resultList, sheetName); + + Map map = new HashMap<>(); + map.put("workbook", book); + map.put("fileName", sheetName); + return map; + } + /** * 权限校验 * @@ -536,7 +606,9 @@ public class SalaryStatisticsReportWrapper extends Service { String name; //20231113逻辑变更,对福利险种、薪资项目、薪资项目分组的名称舍弃基于labelId的多语言适配逻辑,直接以多语言命名方式设置name name = Util.formatMultiLang(item.getName(), String.valueOf(user.getLanguage())); - columns.add(new WeaTableColumn("100px", name, item.getId() + SalaryConstant.DYNAMIC_SUFFIX)); + WeaTableColumn weaTableColumn = new WeaTableColumn("100px", name, item.getId() + SalaryConstant.DYNAMIC_SUFFIX); + weaTableColumn.setOtherpara(item.getDataType()); + columns.add(weaTableColumn); }); return columns; } diff --git a/src/com/engine/salary/service/ExtEmpService.java b/src/com/engine/salary/service/ExtEmpService.java index ff5879c3f..7aaa9f11a 100644 --- a/src/com/engine/salary/service/ExtEmpService.java +++ b/src/com/engine/salary/service/ExtEmpService.java @@ -54,4 +54,6 @@ public interface ExtEmpService { Map previewImportExtEmp(ExtEmpImportParam param); Map importExtEmp(ExtEmpImportParam param); + + List listBySubCompanyOrDepartment(List subCompanyIds, List departmentIds); } \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryEmployeeService.java b/src/com/engine/salary/service/SalaryEmployeeService.java index 45b6509e0..faf27e61a 100644 --- a/src/com/engine/salary/service/SalaryEmployeeService.java +++ b/src/com/engine/salary/service/SalaryEmployeeService.java @@ -159,4 +159,12 @@ public interface SalaryEmployeeService { * @param virtualSubCompanyIds */ List getVirtualEmpByVirtualSubCompanyIds(List virtualSubCompanyIds); + + /** + * 根据部门或者分部查询人员 + * @param subCompanyIds + * @param departmentIds + * @return + */ + List listBySubCompanyOrDepartment(List subCompanyIds, List departmentIds); } diff --git a/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java b/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java index 373e5b56c..b3a20ee0b 100644 --- a/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java +++ b/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java @@ -618,4 +618,9 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService { resultPo.setModifier((long) user.getUID()); return resultPo; } + + @Override + public List listBySubCompanyOrDepartment(List subCompanyIds, List departmentIds) { + return getExternalEmployeeMapper().listSomeDataCollectionEmployee(ExtEmpPO.builder().subcompanyIds(subCompanyIds).departmentIds(departmentIds).build()); + } } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 36f8a0b94..928d40030 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.api.browser.bean.SearchConditionGroup; @@ -11,12 +12,12 @@ import com.cloudstore.eccom.pc.table.*; import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.*; +import com.engine.hrmelog.entity.dto.LoggerContext; +import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.component.SalaryWeaTable; import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.constant.SalaryItemConstant; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -58,6 +59,7 @@ import com.engine.salary.sys.enums.SalaryAcctEmployeeRuleEnum; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.*; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelParseHelper; import com.engine.salary.util.excel.ExcelSupport; @@ -71,12 +73,10 @@ import com.engine.salary.wrapper.SalaryFormulaWrapper; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.mzlion.core.utils.BeanUtils; -import com.engine.salary.util.db.IdGenerator; import com.wbi.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; @@ -1704,6 +1704,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } //存储待更新的InsuranceAccountDetailPO数据 List updateInsuranceAccountDetailList = new ArrayList<>(); + //存储待新增的InsuranceAccountDetailPO数据 + List insertInsuranceAccountDetailList = new ArrayList<>(); //遍历excel表具体数据 for (int i = 0; i < data.size(); i++) { @@ -1811,10 +1813,52 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } if (list.isEmpty()) { - isError = true; - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(user.getLanguage(),542453, "本次福利核算不包含该人员")); - excelComments.add(errorMessageMap); + if (headers.contains("补缴月份")) { + // 如果是补缴列表没有,则新增 + if (supplementaryMonth.substring(0, 7).equals(billMonth.substring(0, 7))) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100481, "当前月走正常缴纳")); + } + //校验补缴人员是否存在福利档案基础信息,并且runStatus处于正在缴纳或者待减员 + InsuranceArchivesBaseInfoPO insuranceBaseInfo = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(paymentOrganization, employeeId); + if (insuranceBaseInfo == null || !(insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) || insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue())) ) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补缴人员中存在未设置福利档案人员或相关人员不在福利在缴人员中,不可新建补缴信息!")); + } + List empIdsInPayMonthRange = listCanPayEmpIds(paymentOrganization, billMonth.substring(0, 7)); + if (!empIdsInPayMonthRange.contains(employeeId)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99920, "无核算人员")); + } + // 封装InsuranceAccountDetailPO + Date now = new Date(); + InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO(); + insuranceAccountDetailPO.setBillStatus(0); + insuranceAccountDetailPO.setEmployeeId(employeeId); + insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization); + insuranceAccountDetailPO.setPaymentStatus(1); + insuranceAccountDetailPO.setResourceFrom(0); + insuranceAccountDetailPO.setSupplementaryProjects("0,1,2,3,4,5"); + insuranceAccountDetailPO.setSocialPayOrg(paymentOrganization); + insuranceAccountDetailPO.setFundPayOrg(paymentOrganization); + insuranceAccountDetailPO.setOtherPayOrg(paymentOrganization); + insuranceAccountDetailPO.setCreator(Long.valueOf(user.getUID())); + insuranceAccountDetailPO.setCreateTime(now); + insuranceAccountDetailPO.setUpdateTime(now); + insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + insuranceAccountDetailPO.setDeleteType(0); + InsuranceAccountDetailPO insertPO = handleInsuranceAccountDetail4AddSupplementary(insuranceAccountDetailPO, map); + if(!checkBalancePayInsurance(insertPO)) { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "导入数据中存在福利档案中未设置的福利项缴纳数值!")); + excelComments.add(errorMessageMap); + } else { + insertInsuranceAccountDetailList.add(insertPO); + } + } else { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(user.getLanguage(),542453, "本次福利核算不包含该人员")); + excelComments.add(errorMessageMap); + } } else if (list.size() > 1) { isError = true; Map errorMessageMap = Maps.newHashMap(); @@ -1848,13 +1892,20 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } //将待更新列表加密 encryptUtil.encryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class, user); + // 将待插入列表加密 + encryptUtil.encryptList(insertInsuranceAccountDetailList, InsuranceAccountDetailPO.class, user); //更新 for(InsuranceAccountDetailPO po : updateInsuranceAccountDetailList) { // getSiAccountBiz(user).updateByEmployeeIdAndBillMonth(po); updateByEmployeeIdAndBillMonth(po); } + // 插入 + if (CollectionUtils.isNotEmpty(insertInsuranceAccountDetailList)) { + getInsuranceAccountDetailMapper().batchSaveAccountDetails(insertInsuranceAccountDetailList); + } //刷新hrsa_bill_batch中数据统计信息 + updateInsuranceAccountDetailList.addAll(insertInsuranceAccountDetailList); if (updateInsuranceAccountDetailList.size() > 0) { refreshBillBatch(updateInsuranceAccountDetailList.get(0).getPaymentOrganization(), updateInsuranceAccountDetailList.get(0).getBillMonth()); //记录操作日志 @@ -2292,6 +2343,213 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return insuranceAccountDetailPO; } + private InsuranceAccountDetailPO handleInsuranceAccountDetail4AddSupplementary(InsuranceAccountDetailPO po, Map baseMap) { + + //组装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 toDealMap = + baseMap.entrySet().stream() + .filter(map -> !"姓名".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; +// List categoryPOList = siCategoryBiz.listByName(entry.getKey().substring(0, keyName.length() - 2)); + List categoryPOList = getSICategoryService(user).listByName(entry.getKey().substring(0, keyName.length() - 2)); + if (categoryPOList.size() == 1) { + ICategoryPO iCategoryPO = categoryPOList.get(0); + welfareType = iCategoryPO.getWelfareType(); + + if ("个人".equals(payScope)) { + 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("福利类型不存在"); + } + } else if ("单位".equals(payScope)) { + 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("福利类型不存在"); + } + } + } + + } + + //组装新的insuranceAccountDetailPO对象数据 + if (!socialPerMap.isEmpty()) { + //对比新旧json中数据,并输出最终json + checkJsonMap(socialPerMap, null); + po.setSocialPerJson(JSON.toJSONString(socialPerMap)); + } + + if (!socialComMap.isEmpty()) { + checkJsonMap(socialComMap, null); + po.setSocialComJson(JSON.toJSONString(socialComMap)); + } + + if (!fundPerMap.isEmpty()) { + checkJsonMap(fundPerMap, null); + po.setFundPerJson(JSON.toJSONString(fundPerMap)); + } + + if (!fundComMap.isEmpty()) { + checkJsonMap(fundComMap, null); + po.setFundComJson(JSON.toJSONString(fundComMap)); + } + + if (!otherPerMap.isEmpty()) { + checkJsonMap(otherPerMap, null); + po.setOtherPerJson(JSON.toJSONString(otherPerMap)); + } + + if (!otherComMap.isEmpty()) { + checkJsonMap(otherComMap, null); + po.setOtherComJson(JSON.toJSONString(otherComMap)); + } + + + if (!StringUtils.isEmpty(baseMap.getOrDefault("社保个人合计", "").toString())) { + po.setSocialPerSum(baseMap.get("社保个人合计").toString()); + } else if (!socialPerMap.isEmpty()) { + po.setSocialPerSum(sumOfMapValue(socialPerMap)); + } else { + po.setSocialPerSum("0"); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金个人合计", "").toString())) { + po.setFundPerSum(baseMap.get("公积金个人合计").toString()); + } else if (!fundPerMap.isEmpty()) { + po.setFundPerSum(sumOfMapValue(fundPerMap)); + } else { + po.setFundPerSum("0"); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利个人合计", "").toString())) { + po.setOtherPerSum(baseMap.get("其他福利个人合计").toString()); + } else if (!otherPerMap.isEmpty()) { + po.setOtherPerSum(sumOfMapValue(otherPerMap)); + } else { + po.setOtherPerSum("0"); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("个人合计", "").toString())) { + po.setPerSum(baseMap.get("个人合计").toString()); + } else { + po.setPerSum(new BigDecimal(po.getSocialPerSum() == null ? "0" : po.getSocialPerSum()) + .add(new BigDecimal(po.getFundPerSum() == null ? "0" : po.getFundPerSum())) + .add(new BigDecimal(po.getOtherPerSum() == null ? "0" : po.getOtherPerSum())).toString()); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("社保单位合计", "").toString())) { + po.setSocialComSum(baseMap.get("社保单位合计").toString()); + } else if (!socialComMap.isEmpty()) { + po.setSocialComSum(sumOfMapValue(socialComMap)); + } else { + po.setSocialComSum("0"); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金单位合计", "").toString())) { + po.setFundComSum(baseMap.get("公积金单位合计").toString()); + } else if (!fundComMap.isEmpty()) { + po.setFundComSum(sumOfMapValue(fundComMap)); + } else { + po.setFundComSum("0"); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利单位合计", "").toString())) { + po.setOtherComSum(baseMap.get("其他福利单位合计").toString()); + } else if (!otherComMap.isEmpty()) { + po.setOtherComSum(sumOfMapValue(otherComMap)); + } else { + po.setOtherComSum("0"); + } + + + if (!StringUtils.isEmpty(baseMap.getOrDefault("单位合计", "").toString())) { + po.setComSum(baseMap.get("单位合计").toString()); + } else { + po.setComSum(new BigDecimal(po.getSocialComSum() == null ? "0" : po.getSocialComSum()) + .add(new BigDecimal(po.getFundComSum() == null ? "0" : po.getFundComSum())) + .add(new BigDecimal(po.getOtherComSum() == null ? "0" : po.getOtherComSum())).toString()); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("账单月份", "").toString())) { + po.setBillMonth(baseMap.get("账单月份").toString().substring(0, 7)); + } + + if (!StringUtils.isEmpty(baseMap.getOrDefault("社保合计", "").toString())) { + po.setSocialSum(baseMap.get("社保合计").toString()); + } else { + po.setSocialSum(new BigDecimal(po.getSocialComSum() == null ? "0" : po.getSocialComSum()) + .add(new BigDecimal(po.getSocialPerSum() == null ? "0" : po.getSocialPerSum())) + .toString()); + } + if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金合计", "").toString())) { + po.setFundSum(baseMap.get("公积金合计").toString()); + } else { + po.setFundSum(new BigDecimal(po.getFundComSum() == null ? "0" : po.getFundComSum()) + .add(new BigDecimal(po.getFundPerSum() == null ? "0" : po.getFundPerSum())) + .toString()); + } + if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利合计", "").toString())) { + po.setOtherSum(baseMap.get("其他福利合计").toString()); + } else { + po.setOtherSum(new BigDecimal(po.getOtherComSum() == null ? "0" : po.getOtherComSum()) + .add(new BigDecimal(po.getOtherPerSum() == null ? "0" : po.getOtherPerSum())) + .toString()); + } + if (!StringUtils.isEmpty(baseMap.getOrDefault("合计", "").toString())) { + po.setTotal(baseMap.get("合计").toString()); + } else { + po.setTotal(new BigDecimal(po.getPerSum() == null ? "0" : po.getPerSum()) + .add(new BigDecimal(po.getComSum() == null ? "0" : po.getComSum())) + .toString()); + } + + //如果导入的时补缴数据,还会包含补缴月份 + if (!StringUtils.isEmpty(baseMap.getOrDefault("补缴月份", "").toString())) { + po.setSupplementaryMonth(baseMap.get("补缴月份").toString().substring(0, 7)); + } + + po.setUpdateTime(new Date()); + + return po; + } + /** * map中value值求和 */ @@ -4860,7 +5118,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesPerson.stream().forEach(e -> { InsuranceSchemeDetailPO po = otherPerson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -4935,7 +5193,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = otherCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -5025,7 +5283,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesPerson.stream().forEach(e -> { InsuranceSchemeDetailPO po = fundperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -5099,7 +5357,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = fundCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -5191,7 +5449,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -5264,7 +5522,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesCom.stream().forEach(e -> { InsuranceSchemeDetailPO po = schemeCom.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -6003,7 +6261,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesPerson.forEach(e -> { InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); @@ -6063,7 +6321,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { needArchivesCom.forEach(e -> { InsuranceSchemeDetailPO po = schemeCom.get(e); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); - BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e))); + BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); diff --git a/src/com/engine/salary/service/impl/SIRepairServiceImpl.java b/src/com/engine/salary/service/impl/SIRepairServiceImpl.java index 6166ba59c..80493159c 100644 --- a/src/com/engine/salary/service/impl/SIRepairServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIRepairServiceImpl.java @@ -3,10 +3,12 @@ package com.engine.salary.service.impl; import com.alibaba.fastjson.JSON; import com.engine.core.impl.Service; import com.engine.salary.encrypt.EncryptUtil; -import com.engine.salary.entity.siaccount.param.SaveSupplementaryAccountParam; import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam; import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; -import com.engine.salary.entity.siarchives.po.*; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO; import com.engine.salary.entity.sicategory.po.ICategoryPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; import com.engine.salary.enums.siaccount.ProjectTypeEnum; @@ -24,10 +26,12 @@ import com.engine.salary.service.SIRepairService; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; -import com.google.common.collect.Maps; import org.apache.commons.lang3.StringUtils; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -232,10 +236,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId()); socialMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -264,10 +268,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId()); fundMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -330,10 +334,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId()); socialMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -368,10 +372,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId()); socialMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -406,10 +410,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId()); socialMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -444,10 +448,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(socialSchemePO.getSocialSchemeId()); socialMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -478,10 +482,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(fundSchemePO.getFundSchemeId()); fundMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); @@ -512,10 +516,10 @@ public class SIRepairServiceImpl extends Service implements SIRepairService { //查询该福利方案下开启缴纳的福利项 List insuranceIdAndScopeList = payInsuranceIdAndScopeList(otherSchemePO.getOtherSchemeId()); otherMap.forEach((k, v) -> { - String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保") - : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); - String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); + : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金") : SalaryI18nUtil.getI18nLabel(user.getLanguage(),542518, "企业年金及其它福利") ); + String welfareTypeSign = welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 1 ? "social" : (welfareTypeMap.get(Long.valueOf(k)) != null && welfareTypeMap.get(Long.valueOf(k)) == 2 ? "fund" : "other" ); if (insuranceIdAndScopeList.contains(k + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())) { Map comMap = new HashMap<>(); comMap.put("title", welfareTypeName); diff --git a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java index 85ec2fa8e..de7b380f0 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java @@ -697,19 +697,19 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct // } // list = list.stream().filter(po -> employeeIdsByPostionFilter.contains(po.getEmployeeId())).collect(Collectors.toList()); // } -// // 人事状态过滤 -// if (CollectionUtils.isNotEmpty(param.getStatus())) { -// Set employeeIdsByStatus = new HashSet<>(); -// simpleEmployeeList.forEach(simpleEmployee -> { -// if (simpleEmployee.getStatus() != null && param.getStatus().contains(simpleEmployee.getPersonnelStatus())) { -// employeeIdsByStatus.add(simpleEmployee.getEmployeeId()); -// } -// }); -// if (CollectionUtils.isEmpty(employeeIdsByStatus)) { -// return Lists.newArrayList(); -// } -// list = list.stream().filter(po -> employeeIdsByStatus.contains(po.getEmployeeId())).collect(Collectors.toList()); -// } + // 人事状态过滤 + if (CollectionUtils.isNotEmpty(param.getStatus())) { + Set employeeIdsByStatus = new HashSet<>(); + employeeList.forEach(simpleEmployee -> { + if (simpleEmployee.getStatus() != null && param.getStatus().contains(simpleEmployee.getStatus())) { + employeeIdsByStatus.add(simpleEmployee.getEmployeeId()); + } + }); + if (CollectionUtils.isEmpty(employeeIdsByStatus)) { + return Lists.newArrayList(); + } + list = list.stream().filter(po -> employeeIdsByStatus.contains(po.getEmployeeId())).collect(Collectors.toList()); + } // 入职日期 if (CollectionUtils.isNotEmpty(param.getHiredate())) { Set employeeIdsByHiredate = new HashSet<>(); diff --git a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java index bbf5e80a6..dcc9152f3 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java @@ -60,7 +60,7 @@ import com.wbi.util.Util; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; -import org.apache.commons.lang3.ObjectUtils; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.ss.usermodel.Sheet; @@ -459,7 +459,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc List columnList = SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO, ListUtils.emptyIfNull(salaryAcctRecordPO.getLockSalaryItemIds())); // 获取固定列头数 SalarySysConfPO salaryAcctFixedColumns = getSalarySysConfMapper().getOneByCode(SALARY_ACCT_FIXED_COLUMNS); - if (ObjectUtils.isNotEmpty(salaryAcctFixedColumns)) { + if (salaryAcctFixedColumns != null) { int fixedNum = NumberUtils.isCreatable(salaryAcctFixedColumns.getConfValue()) ? Integer.valueOf(salaryAcctFixedColumns.getConfValue()) : 3; if (fixedNum == 0) { fixedNum = 3; diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index cb9264406..7c6c714d2 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -3,12 +3,11 @@ package com.engine.salary.service.impl; import cn.hutool.core.util.ObjectUtil; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.common.LocalDateRange; import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; -import com.engine.hrmelog.entity.dto.LoggerContext; -import com.engine.hrmelog.util.LoggerTemplate; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO; @@ -49,6 +48,7 @@ import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -59,11 +59,9 @@ import com.google.common.collect.Sets; import com.weaver.util.threadPool.ThreadPoolUtil; import com.weaver.util.threadPool.constant.ModulePoolEnum; import com.weaver.util.threadPool.entity.LocalRunnable; -import com.engine.salary.util.db.IdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -1143,7 +1141,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe ValidUtil.doValidator(param); SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(param.getSalaryAcctRecordId()); - if (ObjectUtils.isEmpty(salaryAcctRecordPO)) { + if (salaryAcctRecordPO == null) { throw new SalaryRunTimeException("薪资核算记录不存在,或已被删除"); } List salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId()); diff --git a/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java b/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java index d53bdb128..b3cbc623f 100644 --- a/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java @@ -44,7 +44,7 @@ import com.weaver.util.threadPool.entity.LocalRunnable; import lombok.extern.slf4j.Slf4j; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; @@ -463,7 +463,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService @Override public void confirmSalaryBill(Long salaryInfoId) { SalarySendInfoPO sendInfoPO = getSalarySendInfoMapper().getById(salaryInfoId); - if(ObjectUtils.isEmpty(sendInfoPO)){ + if(sendInfoPO == null){ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544321, "工资单不存在或已被删除")); } sendInfoPO.setBillConfirmStatus(BillConfimStatusEnum.CONFIRMED.getValue()); @@ -474,7 +474,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService @Override public void feedBackSalaryBill(Long salaryInfoId) { SalarySendInfoPO sendInfoPO = getSalarySendInfoMapper().getById(salaryInfoId); - if(ObjectUtils.isEmpty(sendInfoPO)){ + if(sendInfoPO == null){ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544321, "工资单不存在或已被删除")); } sendInfoPO.setBillConfirmStatus(BillConfimStatusEnum.FEEDBACK.getValue()); @@ -767,8 +767,8 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService loggerContext.setTargetId(String.valueOf(salarySend.getId())); loggerContext.setTargetName(SalaryDateUtil.getFormatYearMonth(salarySend.getSalaryMonth()) + "-" + (salarySob == null ? "" : salarySob.getName())); loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0,"工资单发放")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0,"工资单发放")); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "工资单发放")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "工资单发放")); loggerContext.setOldValues(salarySend); loggerContext.setNewValues(salarySendNew); loggerContext.setOperator(user.getUID() + StringUtils.EMPTY); diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index fb343af61..80a06a379 100644 --- a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java @@ -55,6 +55,10 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee private EmployBiz employBiz = new EmployBiz(); + private EmployMapper getEmployMapper() { + return SqlProxyHandle.getProxy(EmployMapper.class); + } + private SalarySobRangeService getSalarySobRangeService(User user) { return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user); } @@ -63,10 +67,6 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } - private EmployMapper getEmployMapper() { - return SqlProxyHandle.getProxy(EmployMapper.class); - } - private ExpandFieldSettingsMapper getExpandFieldSettingsMapper() { return SqlProxyHandle.getProxy(ExpandFieldSettingsMapper.class); @@ -505,4 +505,14 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee } return getEmployMapper().listVirtualEmpByVirtualSubCompanyIds(virtualSubCompanyIds); } + + @Override + public List listBySubCompanyOrDepartment(List subCompanyIds, List departmentIds) { + List employeeList = new ArrayList<>(); + employeeList.addAll(getEmployMapper().listBySubCompanyOrDepartment(subCompanyIds, departmentIds)); + if (openExtEmp) { + employeeList.addAll(getExtEmpService(user).listBySubCompanyOrDepartment(subCompanyIds, departmentIds)); + } + return SalaryI18nUtil.i18nList(employeeList); + } } diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index f8e6ca21f..e9a945cd8 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -508,7 +508,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService // 获取默认模板信息 SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId()); - if(ObjectUtils.isEmpty(salarySendPO)){ + if(salarySendPO == null){ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544320, "工资单不存在")); } // 获取、记录首次查看时间 @@ -827,7 +827,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService PageInfo pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), page, SalarySendInfoListDTO.class, user); SalarySendPO salarySendPO = getSalarySendMapper().getById(queryParam.getSalarySendId()); - if (ObjectUtils.isEmpty(salarySendPO)){ + if (salarySendPO == null){ throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544321, "工资单不存在或已被删除")); } List salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Collections.singletonList(salarySendPO.getSalarySobId())); @@ -836,7 +836,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } Integer ackFeedbackStatus = salaryTemplates.get(0).getAckFeedbackStatus(); Integer feedbackStatus = salaryTemplates.get(0).getFeedbackStatus(); - if ( (ackFeedbackStatus != null && NumberUtils.compare(ackFeedbackStatus, 1) == 0) + if ((ackFeedbackStatus != null && NumberUtils.compare(ackFeedbackStatus, 1) == 0) || (feedbackStatus != null && NumberUtils.compare(feedbackStatus, 1) == 0)) { // 默认为空时,未读未确认 pageInfo.getList().stream().forEach(obj -> { @@ -1552,7 +1552,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService SalaryElogConfig.salarySendLoggerTemplate.write(loggerContext); - SalarySendGrantParam grantParam = SalarySendGrantParam.builder().ids(param.getIds()).salarySendId(param.getSalarySendId()).build(); // 异步发送消息:先修改数据再发消息,避免出错后无法撤回撤回消息 @@ -1706,8 +1705,8 @@ public class SalarySendServiceImpl extends Service implements SalarySendService loggerContext.setTargetId(String.valueOf(salarySend.getId())); loggerContext.setTargetName(SalaryDateUtil.getFormatYearMonth(salarySend.getSalaryMonth()) + "-" + (salarySob == null ? "" : salarySob.getName())); loggerContext.setOperateType(OperateTypeEnum.EXCEL_EXPORT.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0,"导出工资单")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0,"导出工资单")); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "导出工资单")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "导出工资单")); loggerContext.setOperator(user.getUID() + StringUtils.EMPTY); loggerContext.setOperatorName(Objects.isNull(user) ? StringUtils.EMPTY : user.getUsername()); SalaryElogConfig.salarySendLoggerTemplate.write(loggerContext); diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 6fc36fdca..f6e18840d 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -42,7 +42,7 @@ import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.ObjectUtils; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; @@ -210,7 +210,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (StringUtils.isNotBlank(name)) { build.setName(name); } - if (ObjectUtils.isNotEmpty(queryParam.getTaxAgentId())) { + if (queryParam.getTaxAgentId() != null) { build.setTaxAgentId(queryParam.getTaxAgentId()); } diff --git a/src/com/engine/salary/timer/AutoConfirmSalaryBillCronJob.java b/src/com/engine/salary/timer/AutoConfirmSalaryBillCronJob.java index 9ddee0497..3441a1dd8 100644 --- a/src/com/engine/salary/timer/AutoConfirmSalaryBillCronJob.java +++ b/src/com/engine/salary/timer/AutoConfirmSalaryBillCronJob.java @@ -10,7 +10,7 @@ import com.engine.salary.service.impl.SalarySendServiceImpl; import com.engine.salary.service.impl.SalaryTemplateServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; -import org.apache.commons.lang3.ObjectUtils; + import weaver.hrm.User; import weaver.interfaces.schedule.BaseCronJob; @@ -59,8 +59,9 @@ public class AutoConfirmSalaryBillCronJob extends BaseCronJob { List needAutoIds = unConfirmedList.stream().filter(po -> { LocalDateTime sendDateTime = SalaryDateUtil.dateToLocalDateTime(po.getSendTime()); Integer autoDays = autoAckDaysMap.get(po.getSalarySendId()); - if (ObjectUtils.isEmpty(autoDays)) + if (autoDays == null) { return false; + } LocalDateTime autoDateTime = sendDateTime.plus(autoDays, ChronoUnit.DAYS); return !autoDateTime.isAfter(now); }).map(SalarySendInfoPO::getId).collect(Collectors.toList()); diff --git a/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java index 8b599f655..c9d25101a 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java @@ -87,7 +87,6 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt data.put("adjustReason", adjustReason); data.put("description", description); data.put("adjustReasonList", SalaryArchiveItemAdjustReasonEnum.getList(user)); - return data; } @@ -126,6 +125,7 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt salaryItemMap.put("id", String.valueOf(m.getId())); salaryItemMap.put("content", m.getName()); salaryItemMap.put("dataType", m.getDataType()); + salaryItemMap.put("pattern", m.getPattern()); return salaryItemMap; }).collect(Collectors.toList()); diff --git a/src/com/engine/salary/wrapper/SalaryComparisonResultWrapper.java b/src/com/engine/salary/wrapper/SalaryComparisonResultWrapper.java index 8d1de7bbb..504fa456a 100644 --- a/src/com/engine/salary/wrapper/SalaryComparisonResultWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryComparisonResultWrapper.java @@ -14,7 +14,7 @@ import com.engine.salary.service.SalarySobItemService; import com.engine.salary.service.impl.SalaryComparisonResultServiceImpl; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.util.page.PageInfo; -import org.apache.commons.lang3.ObjectUtils; + import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; @@ -64,7 +64,7 @@ public class SalaryComparisonResultWrapper extends Service { List weaTableColumns = salaryComparisonResultListDTO.getWeaTableColumns(); // 获取固定列头数 SalarySysConfPO salaryAcctFixedColumns = getSalarySysConfMapper().getOneByCode(SALARY_ACCT_FIXED_COLUMNS); - if (ObjectUtils.isNotEmpty(salaryAcctFixedColumns)) { + if (salaryAcctFixedColumns != null) { int fixedNum = NumberUtils.isCreatable(salaryAcctFixedColumns.getConfValue()) ? Integer.valueOf(salaryAcctFixedColumns.getConfValue()) : 3; if (fixedNum == 0) { fixedNum = 3; diff --git a/src/com/engine/salary/wrapper/SalaryTemplateWrapper.java b/src/com/engine/salary/wrapper/SalaryTemplateWrapper.java index fb296393d..3d190b754 100644 --- a/src/com/engine/salary/wrapper/SalaryTemplateWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryTemplateWrapper.java @@ -31,7 +31,6 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.mzlion.core.utils.BeanUtils; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import weaver.general.Util; @@ -194,7 +193,7 @@ public class SalaryTemplateWrapper extends Service { salaryTemplateBaseSetDTO.setFeedbackStatus(NumberUtils.compare(po.getFeedbackStatus(), 1) == 0); } - salaryTemplateBaseSetDTO.setAutoAckDays(ObjectUtils.isEmpty(po.getAutoAckDays()) ? 7 : po.getAutoAckDays()); + salaryTemplateBaseSetDTO.setAutoAckDays(po.getAutoAckDays() == null ? 7 : po.getAutoAckDays()); // 规则赋值 如果为ALL传“” 如果为byRule传薪资项目ID salaryTemplateBaseSetDTO.setReplenishRule(SalaryTemplateReplenishRuleEnum.ALL.getValue().equals(po.getReplenishRule()) ? "" : po.getReplenishRule()); // 规则设置赋值