diff --git a/src/com/engine/salary/biz/SalarySendRangeObjBiz.java b/src/com/engine/salary/biz/SalarySendRangeObjBiz.java index 05ccaaadb..53633dce6 100644 --- a/src/com/engine/salary/biz/SalarySendRangeObjBiz.java +++ b/src/com/engine/salary/biz/SalarySendRangeObjBiz.java @@ -7,6 +7,8 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper; import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.util.db.MapperProxyFactory; +import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -23,6 +25,10 @@ public class SalarySendRangeObjBiz { return ServiceUtil.getService(TaxAgentServiceImpl.class); } + private SalarySendRangeObjMapper getSalarySendRangeObjMapper() { + return MapperProxyFactory.getProxy(SalarySendRangeObjMapper.class); + } + public R applyMapper(Function mapper) { try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) { final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class); @@ -41,7 +47,13 @@ public class SalarySendRangeObjBiz { } public List getSalarySendUserInfoDTOs(List employees) { - List userDTOs = applyMapper(mapper -> mapper.getUserInfoByEmployeeIds(employees)); + List userDTOs = new ArrayList<>(); + List> partition = Lists.partition(employees, 500); + partition.forEach(l->{ + List userInfos = getSalarySendRangeObjMapper().getUserInfoByEmployeeIds(l); + userDTOs.addAll(userInfos); + }); + Map userMap = userDTOs.stream() .collect(Collectors.toMap(SalarySendUserInfoDTO::getResourceId, Function.identity())); diff --git a/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java b/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java index 4e219c477..b6c6971a3 100644 --- a/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java +++ b/src/com/engine/salary/entity/salaryBill/bo/SalaryBillBO.java @@ -267,7 +267,7 @@ public class SalaryBillBO { } Util_Message.store(messageBean); } catch (IOException e) { - log.error("消息发送失败",e); + log.error("消息发送失败", e); } } @@ -649,7 +649,8 @@ public class SalaryBillBO { } else { for (Object keyName : e.keySet()) { if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) { - boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString())) + String itemValue = Util.null2String(e.get(keyName.toString())); + boolean isHide = (isHideNull && StringUtils.isEmpty(itemValue)) || (isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString()) && BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0); @@ -660,7 +661,7 @@ public class SalaryBillBO { emailContent.append(""); emailContent.append(""); - emailContent.append(e.get(keyName.toString())); + emailContent.append(itemValue.replaceAll("null", "")); emailContent.append(""); } break; @@ -729,7 +730,8 @@ public class SalaryBillBO { SalaryTemplateSalaryItemListDTO salaryItem = itemPartition.get(i); for (Object keyName : e.keySet()) { if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) { - boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString())) + String itemValue = Util.null2String(e.get(keyName.toString())); + boolean isHide = (isHideNull && StringUtils.isEmpty(itemValue)) || (isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString()) && BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0); @@ -740,7 +742,7 @@ public class SalaryBillBO { emailContent.append(""); emailContent.append(""); - emailContent.append(e.get(keyName.toString())); + emailContent.append(itemValue.replaceAll("null", "")); emailContent.append(""); } break; @@ -867,7 +869,7 @@ public class SalaryBillBO { if ("text".equals(wmClassify)) { wmTextFieldIds = (List) salaryBillWatermark.getWmSetting().getOrDefault("wmSelectedFieldIds", Collections.emptyList()); - List empFields = Arrays.asList(HRM_Name, HRM_Num, HRM_Mobile, HRM_Email, HRM_CurrentOperatorId, HRM_Department); + List empFields = Arrays.asList(HRM_Name, HRM_Num, HRM_Mobile, HRM_Email, HRM_CurrentOperatorId, HRM_Department, HRM_SecondDepartment); if (wmTextFieldIds.contains(HRM_SecondDepartment)) { // 需要查分部 salaryBillWatermark.getWmSetting().put("needQuerySubDepart", true); diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctConsolidatedTaxBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctConsolidatedTaxBO.java index d5155f0ae..d5399daab 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctConsolidatedTaxBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctConsolidatedTaxBO.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.salaryacct.bo; +import cn.hutool.core.util.StrUtil; import com.engine.salary.constant.TaxDeclarationDataIndexConstant; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; @@ -73,6 +74,9 @@ public class SalaryAcctConsolidatedTaxBO { .filter(e -> Objects.equals(e.getSalaryItemId(), optional.get())) .map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue())) .reduce(BigDecimal.ZERO, BigDecimal::add); + if (StrUtil.isBlank(resultValue)) { + resultValue = "0.00"; + } return new BigDecimal(resultValue).add(income).toPlainString(); } // 个税调差为0 @@ -98,6 +102,9 @@ public class SalaryAcctConsolidatedTaxBO { .map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue())) .reduce(BigDecimal.ZERO, BigDecimal::add); } + if (StrUtil.isBlank(resultValue)) { + resultValue = "0.00"; + } return new BigDecimal(resultValue).add(refundedOrSupplementedTax).subtract(taxAdjustment).toPlainString(); } return resultValue; diff --git a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctCalculateParam.java b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctCalculateParam.java index 52c3b7f13..d07b79a6b 100644 --- a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctCalculateParam.java +++ b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctCalculateParam.java @@ -20,7 +20,7 @@ import java.util.Collection; @Builder @NoArgsConstructor @AllArgsConstructor -public class SalaryAcctCalculateParam { +public class SalaryAcctCalculateParam { //核算人员的id,不是employeeId而是salaryAcctEmpId private Collection ids; diff --git a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java index b737f857e..8424aa765 100644 --- a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java +++ b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctRecordQueryParam.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.time.YearMonth; +import java.util.List; /** * 薪资核算列表查询参数 @@ -31,6 +32,11 @@ public class SalaryAcctRecordQueryParam extends BaseQueryParam { //账套名称") private String name; + /** + * 扣缴义务人id集合 + */ + private List taxAgentIds; + private String startMonthStr; private String endMonthStr; } diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java index b1a76a4a4..2daccbec2 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java @@ -144,7 +144,7 @@ public class SalarySobItemAggregateBO { .canEdit(openFormulaForcedEditing || Objects.equals(salaryItemPO.getCanEdit(), 1)) .canDelete(openFormulaForcedEditing || salaryItemPO.getCanDelete() == null || Objects.equals(salaryItemPO.getCanDelete(), 1)) .width(salaryItemPO.getWidth()) - .defaultValue(salaryItemPO.getDefaultValue()) + .defaultValue(salarySobItemPO.getDefaultValue()) .build()); } } diff --git a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationListDTO.java b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationListDTO.java index f52ce6a86..420daca25 100644 --- a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationListDTO.java +++ b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationListDTO.java @@ -37,6 +37,10 @@ public class TaxDeclarationListDTO { @TableTitle(title = "薪资类型", dataIndex = "incomeCategory", key = "incomeCategory") private String incomeCategory; + @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") + @TableTitle(title = "税款所属期", dataIndex = "taxCycle", key = "taxCycle") + private Date taxCycle; + @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") @TableTitle(title = "薪资所属月", dataIndex = "salaryMonth", key = "salaryMonth") private Date salaryMonth; @@ -47,10 +51,6 @@ public class TaxDeclarationListDTO { @TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName") private String taxAgentName; - @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") - @TableTitle(title = "税款所属期", dataIndex = "taxCycle", key = "taxCycle") - private Date taxCycle; - //@TableTitle(title = "操作人id", dataIndex = "operateEmployeeId", key = "operateEmployeeId") private Long operateEmployeeId; diff --git a/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java b/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java index 521fadd56..a7de714a9 100644 --- a/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java +++ b/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java @@ -1,9 +1,14 @@ package com.engine.salary.entity.taxdeclaration.param; import com.engine.salary.common.BaseQueryParam; -import lombok.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; -import java.time.YearMonth; + +import java.util.Date; /** * 个税申报记录查询条件 @@ -20,12 +25,13 @@ import java.time.YearMonth; public class TaxDeclarationListQueryParam extends BaseQueryParam { //薪资所属月范围起点 - private YearMonth fromSalaryMonth; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date fromSalaryMonth; - //薪资所属月范围终点 - private YearMonth endSalaryMonth; + //薪资所属月范围终点 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date endSalaryMonth; - private String fromSalaryMonthStr; - - private String endSalaryMonthStr; + //个税扣缴义务人菜单") + private String taxAgentName; } diff --git a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java index 8319f9e4d..9950f55cd 100644 --- a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java +++ b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java @@ -86,6 +86,13 @@ public class TaxDeclarationPO { LocalDateRange salaryMonths; + //"开始日期 + private Date taxCycleFromDate; + + //结束日期 + private Date taxCycleEndDate; + + private Collection taxAgentIds; } diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 3a2ed14af..5111bf7e1 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -11,6 +11,7 @@ e.workcode, e.certificatenum as idNo, e.accounttype as accountType, + e.sex as sex, 'false' as extEmp from hrmresource e left join hrmdepartment d on e.departmentid = d.id @@ -21,6 +22,7 @@ select e.id as employeeId, e.lastname as username, + e.sex as sex, e.certificatenum as idNo, e.status as status, e.workcode as workcode, @@ -122,6 +125,7 @@ select e.id as employeeId, e.lastname as username, e.status as status, + e.sex as sex, e.certificatenum as idNo, e.workcode as workcode, d.departmentname as departmentName, @@ -228,6 +232,7 @@ select e.id as employeeId, e.lastname as username, e.status as status, + e.sex as sex, e.certificatenum as idNo, e.workcode as workcode, d.departmentname as departmentName, @@ -282,6 +287,7 @@ e.lastname as username, e.status as status, e.workcode as workcode, + e.sex as sex, e.certificatenum as idNo, e.companystartdate as companystartdate, e.mobile as mobile, @@ -303,6 +309,7 @@ e.status as status, e.workcode as workcode, e.certificatenum as idNo, + e.sex as sex, e.companystartdate as companystartdate, e.mobile as mobile, e.accounttype as accountType, @@ -323,6 +330,7 @@ e.status as status, e.workcode as workcode, e.certificatenum as idNo, + e.sex as sex, e.companystartdate as companystartdate, e.mobile as mobile, e.departmentid as departmentId, @@ -486,6 +494,7 @@ e.lastname as username, e.status as status, e.certificatenum as idNo, + e.sex as sex, e.workcode as workcode, e.companystartdate as companystartdate, e.mobile as mobile, @@ -561,6 +570,7 @@ e.lastname as username, e.status as status, e.certificatenum as idNo, + e.sex as sex, e.workcode as workcode, d.departmentname as departmentName, d.id as departmentId, diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml index 1810e8970..b034b00ff 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml @@ -61,6 +61,12 @@ AND salary_month #{salaryMonths.endDate} + + AND tax_cycle = ]]> #{taxCycleFromDate} + + + AND tax_cycle #{taxCycleEndDate} + AND tax_agent_id IN diff --git a/src/com/engine/salary/report/entity/param/SalaryStatisticsDataPerspectiveQueryParam.java b/src/com/engine/salary/report/entity/param/SalaryStatisticsDataPerspectiveQueryParam.java index d0afd0c00..0d8303b72 100644 --- a/src/com/engine/salary/report/entity/param/SalaryStatisticsDataPerspectiveQueryParam.java +++ b/src/com/engine/salary/report/entity/param/SalaryStatisticsDataPerspectiveQueryParam.java @@ -45,6 +45,9 @@ public class SalaryStatisticsDataPerspectiveQueryParam extends BaseQueryParam { //个税扣缴义务人配置 private List taxAgent; + @JsonIgnore + private List salarySob; + @JsonIgnore //收入所得项目配置 private List incomeCategory; diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 2b62276cd..dbf64ecb8 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -469,12 +469,21 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary if (reportPO.getTaxAgentSetting() != null) { param.setTaxAgent(((List) JSON.parseArray(reportPO.getTaxAgentSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); } + if (reportPO.getSalarySobSetting() != null) { + param.setSalarySob(((List) JSON.parseArray(reportPO.getSalarySobSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); + } if (reportPO.getSubCompanySetting() != null) { param.setSubCompany(((List) JSON.parseArray(reportPO.getSubCompanySetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); } if (reportPO.getDepartSetting() != null) { param.setDepart(((List) JSON.parseArray(reportPO.getDepartSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); } + if (reportPO.getPositionSetting() != null) { + param.setPosition(((List) JSON.parseArray(reportPO.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); + } + if (reportPO.getStatusSetting() != null) { + param.setStatus(((List) JSON.parseArray(reportPO.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList())); + } if (reportPO.getEmployeeSetting() != null) { param.setEmployee(((List) JSON.parseArray(reportPO.getEmployeeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList())); } diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java index 3a5efdb87..2a4bdd282 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsEmployeeWrapper.java @@ -334,7 +334,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service { sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))); } } else { - sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))); + sumRow.add(""); } } rowList.add(sumRow); diff --git a/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java b/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java index 79f3ee877..39d4116b7 100644 --- a/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java @@ -172,7 +172,8 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar List baseInfoPOList = getInsuranceBaseInfoMapper().listAll(); List canAccountIds = baseInfoPOList.stream() .filter(f->f.getPaymentOrganization().toString().equals(queryParam.getPaymentOrganization()) - && (f.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()))) + && !f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()) + ) .map(InsuranceArchivesBaseInfoPO::getEmployeeId) .collect(Collectors.toList()); accountExportPOS = accountExportPOS.stream().filter(v -> canAccountIds.contains(v.getEmployeeId())).collect(Collectors.toList()); diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index 6d45abc1f..a45dc3bf2 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -2881,12 +2881,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (otherPaymentBaseString != null) { updateOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString); } + if (!welBaseDiffSign) { + otherPaymentBaseString = adaptWelBaseLimit(updateOtherInfo.getOtherSchemeId(), updateOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + if (otherPaymentBaseString != null) { + updateOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString); + } + } } else { StringBuilder errorMsg = new StringBuilder(""); if (!checkWelBaseLimit(updateOtherInfo.getOtherSchemeId(),updateOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); combineErrorMsg = "其他福利个人: " + errorMsg; } + if ( (!welBaseDiffSign) && (!checkWelBaseLimit(updateOtherInfo.getOtherSchemeId(),updateOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) { + // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); + combineErrorMsg = "其他福利公司: " + errorMsg; + } } //需要拆分个人和公司福利基数时 if (welBaseDiffSign) { @@ -2952,12 +2962,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (otherPaymentBaseString != null) { insertOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString); } + if (!welBaseDiffSign) { + otherPaymentBaseString = adaptWelBaseLimit(insertOtherInfo.getOtherSchemeId(), insertOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + if (otherPaymentBaseString != null) { + insertOtherInfo.setOtherPaymentBaseString(otherPaymentBaseString); + } + } } else { StringBuilder errorMsg = new StringBuilder(""); if (!checkWelBaseLimit(insertOtherInfo.getOtherSchemeId(),insertOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); combineErrorMsg = "其他福利个人:" + errorMsg; } + if ( (!welBaseDiffSign) && (!checkWelBaseLimit(insertOtherInfo.getOtherSchemeId(),insertOtherInfo.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) { + // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); + combineErrorMsg = "其他福利公司:" + errorMsg; + } } //需要拆分个人和公司福利基数时 if (welBaseDiffSign) { @@ -3092,12 +3112,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (fundPaymentBaseString != null) { updateFundInfo.setFundPaymentBaseString(fundPaymentBaseString); } + if (!welBaseDiffSign) { + fundPaymentBaseString = adaptWelBaseLimit(updateFundInfo.getFundSchemeId(), updateFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + if (fundPaymentBaseString != null) { + updateFundInfo.setFundPaymentBaseString(fundPaymentBaseString); + } + } } else { StringBuilder errorMsg = new StringBuilder(""); if (!checkWelBaseLimit(updateFundInfo.getFundSchemeId(),updateFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); combineErrorMsg = "公积金个人" + errorMsg; } + if ( (!welBaseDiffSign) && (!checkWelBaseLimit(updateFundInfo.getFundSchemeId(),updateFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) { + // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); + combineErrorMsg = "公积金公司" + errorMsg; + } } //需要拆分个人和公司福利基数时 @@ -3168,12 +3198,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (fundPaymentBaseString != null) { insertFundInfo.setFundPaymentBaseString(fundPaymentBaseString); } + if (!welBaseDiffSign) { + fundPaymentBaseString = adaptWelBaseLimit(insertFundInfo.getFundSchemeId(), insertFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + if (fundPaymentBaseString != null) { + insertFundInfo.setFundPaymentBaseString(fundPaymentBaseString); + } + } } else { StringBuilder errorMsg = new StringBuilder(""); if (!checkWelBaseLimit(insertFundInfo.getFundSchemeId(),insertFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); combineErrorMsg = "公积金个人:" + errorMsg; } + if ((!welBaseDiffSign) && (!checkWelBaseLimit(insertFundInfo.getFundSchemeId(),insertFundInfo.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) { + // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); + combineErrorMsg = "公积金公司:" + errorMsg; + } } //需要拆分个人和公司福利基数时 @@ -3315,12 +3355,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (socialPaymentBaseString != null) { updateSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString); } + if (!welBaseDiffSign) { + socialPaymentBaseString = adaptWelBaseLimit(updateSocialInfo.getSocialSchemeId(), updateSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + if (socialPaymentBaseString != null) { + updateSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString); + } + } } else { StringBuilder errorMsg = new StringBuilder(""); if (!checkWelBaseLimit(updateSocialInfo.getSocialSchemeId(),updateSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); combineErrorMsg = "社保个人:" + errorMsg; } + if ((!welBaseDiffSign) && (!checkWelBaseLimit(updateSocialInfo.getSocialSchemeId(),updateSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) { + // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); + combineErrorMsg = "社保公司:" + errorMsg; + } } //需要拆分个人和公司福利基数时 @@ -3390,12 +3440,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (socialPaymentBaseString != null) { insertSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString); } + if (!welBaseDiffSign) { + socialPaymentBaseString = adaptWelBaseLimit(insertSocialInfo.getSocialSchemeId(), insertSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + if (socialPaymentBaseString != null) { + insertSocialInfo.setSocialPaymentBaseString(socialPaymentBaseString); + } + } } else { StringBuilder errorMsg = new StringBuilder(""); if (!checkWelBaseLimit(insertSocialInfo.getSocialSchemeId(),insertSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg)) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); combineErrorMsg = "社保个人:" + errorMsg; } + if ((!welBaseDiffSign) && (!checkWelBaseLimit(insertSocialInfo.getSocialSchemeId(),insertSocialInfo.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg))) { + // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!")); + combineErrorMsg = "社保公司:" + errorMsg; + } } //需要拆分个人和公司福利基数时 if (welBaseDiffSign) { diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 504142ea9..4d688978f 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -1432,6 +1432,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { Boolean otherCheckBase = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_PERSON.getValue(), errorMsg); + Boolean socialCheckBase2 = true; + Boolean fundCheckBase2 = true; + Boolean otherCheckBase2 = true; + if (!welBaseDiffSign) { + socialCheckBase2 = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg); + fundCheckBase2 = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg); + otherCheckBase2 = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg); + } Boolean socialCheckComBase = true; Boolean fundCheckComBase = true; Boolean otherCheckComBase = true; @@ -1440,17 +1448,17 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { fundCheckComBase = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg); otherCheckComBase = getSIArchivesService(user).checkWelBaseLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue(), errorMsg); } - if (socialCheckBase && fundCheckBase && otherCheckBase && socialCheckComBase && fundCheckComBase && otherCheckComBase) { + if (socialCheckBase && fundCheckBase && otherCheckBase && socialCheckBase2 && fundCheckBase2 && otherCheckBase2 && socialCheckComBase && fundCheckComBase && otherCheckComBase) { insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO); } else { String checkMessage = "该条数据中"; - if (!socialCheckBase || !socialCheckComBase) { + if (!socialCheckBase || !socialCheckBase2 || !socialCheckComBase) { checkMessage = checkMessage + "社保福利基数、"; } - if (!fundCheckBase || !fundCheckComBase) { + if (!fundCheckBase || !fundCheckBase2 || !fundCheckComBase) { checkMessage = checkMessage + "公积金福利基数、"; } - if (!otherCheckBase || !otherCheckComBase) { + if (!otherCheckBase || !otherCheckBase2 || !otherCheckComBase) { checkMessage = checkMessage + "其他福利基数、"; } checkMessage = checkMessage.substring(0, checkMessage.length() - 1); @@ -1470,6 +1478,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(newSocialPaymentBaseString); insuranceArchivesFundSchemePO.setFundPaymentBaseString(newFundPaymentBaseString); insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(newOtherPaymentBaseString); + if (!welBaseDiffSign) { + newSocialPaymentBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + newFundPaymentBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesFundSchemePO.getFundSchemeId(), insuranceArchivesFundSchemePO.getFundPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + newOtherPaymentBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesOtherSchemePO.getOtherSchemeId(), insuranceArchivesOtherSchemePO.getOtherPaymentBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); + insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(newSocialPaymentBaseString); + insuranceArchivesFundSchemePO.setFundPaymentBaseString(newFundPaymentBaseString); + insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(newOtherPaymentBaseString); + } if (welBaseDiffSign) { String newSocialPaymentComBaseString = getSIArchivesService(user).checkAndBuildWelBaseWithLimit(insuranceArchivesSocialSchemePO.getSocialSchemeId(), insuranceArchivesSocialSchemePO.getSocialPaymentComBaseString(), PaymentScopeEnum.SCOPE_COMPANY.getValue()); diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 2a75368dc..9958f8d27 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.collection.CollUtil; import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; @@ -177,6 +178,21 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); po.setSalarySobIds(salarySobIds); } + if (CollUtil.isNotEmpty(queryParam.getTaxAgentIds())) { + List salarySobPOS = getSalarySobService(user).listByTaxAgentIds(queryParam.getTaxAgentIds()); + if (CollectionUtils.isEmpty(salarySobPOS)) { + return page; + } + Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); + + Collection existIds = po.getSalarySobIds(); + if (CollectionUtils.isNotEmpty(existIds)) { + existIds = SalaryEntityUtil.intersectionForList(existIds, salarySobIds); + po.setSalarySobIds(existIds); + } else { + po.setSalarySobIds(salarySobIds); + } + } LocalDateRange localDateRange = new LocalDateRange(); if (Objects.nonNull(queryParam.getStartMonth())) { localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getStartMonth().atDay(1))); @@ -827,6 +843,6 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe @Override public void updateDate(Long id, Date updateTime) { - getSalaryAcctRecordMapper().updateDate(id,updateTime); + getSalaryAcctRecordMapper().updateDate(id, updateTime); } } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 538160d20..ceab506eb 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1425,7 +1425,12 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe if (CollectionUtils.isEmpty(employeeIds)) { return Collections.emptyList(); } - return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds); + List> partition = Lists.partition(employeeIds, 500); + List resultList = new ArrayList<>(); + partition.forEach(part -> { + resultList.addAll(getSalaryArchiveMapper().listPayEndDateIsNull(part)); + }); + return resultList; } @Override diff --git a/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java b/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java index 4df8aa8f2..8928680cb 100644 --- a/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryBillServiceImpl.java @@ -169,16 +169,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService && Optional.ofNullable(salaryBillProgress.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(136104, "有其他人员正在发送中,请等待其他人员发送结束后再操作")); } - // 初始化进度 - ProgressDTO initProgress = ProgressDTO.builder() - .title(SalaryI18nUtil.getI18nLabel(136097, "发送中")) - .totalQuantity(NumberUtils.INTEGER_ZERO) - .calculatedQuantity(NumberUtils.INTEGER_ZERO) - .progress(BigDecimal.ZERO) - .status(true) - .message("") - .build(); - getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress); List ids = param.getIds(); @@ -190,6 +180,17 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService throw new SalaryRunTimeException("工资发放范围内没有匹配员工"); } } + // 初始化进度 + ProgressDTO initProgress = ProgressDTO.builder() + .title(SalaryI18nUtil.getI18nLabel(136097, "发送中")) + .totalQuantity(NumberUtils.INTEGER_ZERO) + .calculatedQuantity(NumberUtils.INTEGER_ZERO) + .progress(BigDecimal.ZERO) + .status(true) + .message("") + .build(); + getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress); + // 异步执行 List finalIds = ids; LocalRunnable localRunnable = new LocalRunnable() { diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index 854c87e71..219e3fcab 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -485,6 +485,11 @@ public class SalarySendServiceImpl extends Service implements SalarySendService if (salarySendInfo == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在")); } + + if (!Objects.equals(salarySendInfo.getSendStatus(), 1)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在")); + } + Long employeeId = salarySendInfo.getEmployeeId(); if (currentEmployeeId.compareTo(employeeId) != 0) { @@ -1343,7 +1348,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } - @Override public Map withdraw(SalarySendWithdrawParam param) { if (param.getSalarySendId() == null) { diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index 4388047f9..afe5a6991 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.util.StrUtil; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.hrmelog.entity.dto.LoggerContext; @@ -9,6 +10,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; @@ -114,15 +116,12 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration // 分页参数 TaxDeclarationPO po = TaxDeclarationPO.builder().build(); - LocalDateRange localDateRange = new LocalDateRange(); if (Objects.nonNull(queryParam.getFromSalaryMonth())) { - localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getFromSalaryMonth().atDay(1))); + po.setTaxCycleFromDate(queryParam.getFromSalaryMonth()); } if (Objects.nonNull(queryParam.getEndSalaryMonth())) { - localDateRange.setEndDate(SalaryDateUtil.localDateToDate(queryParam.getEndSalaryMonth().atEndOfMonth())); + po.setTaxCycleEndDate(queryParam.getEndSalaryMonth()); } - po.setSalaryMonths(localDateRange); - // 分权 Boolean openDevolution = getTaxAgentService(user).isNeedAuth(currentEmployeeId); @@ -138,6 +137,15 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration // 查询个税申报表 List taxDeclarationPOS = getTaxDeclarationMapper().listSome(po); + + + if (StrUtil.isNotBlank(queryParam.getTaxAgentName())) { + List taxAgentPOs = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(queryParam.getTaxAgentName()).build()); + Set taxAgentIds = SalaryEntityUtil.properties(taxAgentPOs, TaxAgentPO::getId); + taxDeclarationPOS = taxDeclarationPOS.stream().filter(tax -> taxAgentIds.contains(tax.getTaxAgentId())).collect(Collectors.toList()); + } + + return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationPOS, TaxDeclarationPO.class); diff --git a/src/com/engine/salary/util/excel/ExcelUtil.java b/src/com/engine/salary/util/excel/ExcelUtil.java index 5b7410994..6877e7e03 100644 --- a/src/com/engine/salary/util/excel/ExcelUtil.java +++ b/src/com/engine/salary/util/excel/ExcelUtil.java @@ -1,5 +1,6 @@ package com.engine.salary.util.excel; +import cn.hutool.core.util.StrUtil; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -139,8 +140,10 @@ public class ExcelUtil { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { cell.setCellType(CellType.NUMERIC); cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); @@ -235,8 +238,10 @@ public class ExcelUtil { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { cell.setCellType(CellType.NUMERIC); cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); @@ -311,8 +316,10 @@ public class ExcelUtil { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { cell.setCellType(CellType.NUMERIC); cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); @@ -377,8 +384,10 @@ public class ExcelUtil { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof Boolean) { cell.setCellType(CellType.BOOLEAN); cell.setCellValue(String.valueOf(o)); @@ -458,8 +467,10 @@ public class ExcelUtil { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof Boolean) { cell.setCellType(CellType.BOOLEAN); cell.setCellValue(String.valueOf(o)); diff --git a/src/com/engine/salary/util/excel/ExcelUtilPlus.java b/src/com/engine/salary/util/excel/ExcelUtilPlus.java index 9da402ce7..96cff32ec 100644 --- a/src/com/engine/salary/util/excel/ExcelUtilPlus.java +++ b/src/com/engine/salary/util/excel/ExcelUtilPlus.java @@ -1,11 +1,13 @@ package com.engine.salary.util.excel; +import cn.hutool.core.util.StrUtil; import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.util.SalaryDateUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.usermodel.*; +import weaver.wechat.util.Utils; import java.awt.Color; import java.math.BigDecimal; @@ -131,10 +133,10 @@ public class ExcelUtilPlus { for (int i = 0; i < header.size(); i++) { WeaTableColumnGroup columnGroupItem = (WeaTableColumnGroup) header.get(i); XSSFCell rowZeroCell = row0.createCell(i, CellType.STRING); - rowZeroCell.setCellValue(columnGroupItem.getText().toString()); + rowZeroCell.setCellValue(columnGroupItem.getText()); rowZeroCell.setCellStyle(titleCellStyle); //设置列宽 - sheet.setColumnWidth(i, Math.min(255, Math.max(12, columnGroupItem.getText().length() * 4)) * 256); + sheet.setColumnWidth(i, Math.min(255, Math.max(12, Utils.null2String(columnGroupItem.getText()).length() * 4)) * 256); patternList.add(columnGroupItem.getPattern()); } @@ -190,8 +192,10 @@ public class ExcelUtilPlus { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { if (lastRowRed && rowIndex == rowList.size() - 1) { cell.setCellStyle(numberRedCellStyleMap.get(patternList.get(cellIndex))); @@ -199,8 +203,7 @@ public class ExcelUtilPlus { cell.setCellStyle(numberCellStyleMap.get(patternList.get(cellIndex))); } cell.setCellType(CellType.NUMERIC); - double value = o == null ? 0 : ((BigDecimal) o).doubleValue(); - cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); + cell.setCellValue(((BigDecimal) o).doubleValue()); } else if (o instanceof Boolean) { cell.setCellType(CellType.BOOLEAN); cell.setCellValue(String.valueOf(o)); @@ -220,6 +223,7 @@ public class ExcelUtilPlus { } return workbook; } + public static XSSFWorkbook genWorkbookV2(List> rowList, String sheetName) { XSSFWorkbook workbook = new XSSFWorkbook(); @@ -280,11 +284,13 @@ public class ExcelUtilPlus { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { cell.setCellType(CellType.NUMERIC); - cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); + cell.setCellValue(((BigDecimal) o).doubleValue()); } else if (o instanceof Boolean) { cell.setCellType(CellType.BOOLEAN); cell.setCellValue(String.valueOf(o)); @@ -367,8 +373,10 @@ public class ExcelUtilPlus { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof Boolean) { cell.setCellType(CellType.BOOLEAN); cell.setCellValue(String.valueOf(o)); @@ -476,11 +484,13 @@ public class ExcelUtilPlus { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { cell.setCellType(CellType.NUMERIC); - cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); + cell.setCellValue(((BigDecimal) o).doubleValue()); } else if (o instanceof Boolean) { cell.setCellType(CellType.BOOLEAN); cell.setCellValue(String.valueOf(o)); @@ -674,8 +684,10 @@ public class ExcelUtilPlus { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { if (lastRowRed && rowIndex == rowList.size() - 1) { cell.setCellStyle(numberRedCellStyleMap.get(patternList.get(cellIndex))); @@ -839,8 +851,10 @@ public class ExcelUtilPlus { } Object o = infoList.get(cellIndex); if (o instanceof String) { - cell.setCellType(CellType.STRING); - cell.setCellValue(String.valueOf(o)); + if (StrUtil.isNotBlank(String.valueOf(o))) { + cell.setCellType(CellType.STRING); + cell.setCellValue(String.valueOf(o)); + } } else if (o instanceof BigDecimal) { cell.setCellType(CellType.NUMERIC); cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue()); diff --git a/src/com/engine/salary/util/valid/ValidUtil.java b/src/com/engine/salary/util/valid/ValidUtil.java index 906718077..bcdec10d6 100644 --- a/src/com/engine/salary/util/valid/ValidUtil.java +++ b/src/com/engine/salary/util/valid/ValidUtil.java @@ -250,7 +250,9 @@ public class ValidUtil { .replace("between", "between") .replace("BETWEEN", "BETWEEN") .replace("union", "union") - .replace("UNION", "UNION"); + .replace("UNION", "UNION") + .replace("substr", "substr") + .replace("SUBSTR", "SUBSTR"); } setValue(t, field.getName(), result); } else if (valueTypeEnum == ValueTypeEnum.OBJECT) { diff --git a/src/com/engine/salary/web/TaxDeclarationController.java b/src/com/engine/salary/web/TaxDeclarationController.java index 6d2332dd4..1c65fd7a2 100644 --- a/src/com/engine/salary/web/TaxDeclarationController.java +++ b/src/com/engine/salary/web/TaxDeclarationController.java @@ -31,7 +31,6 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.text.ParseException; import java.time.LocalDate; @@ -58,10 +57,8 @@ public class TaxDeclarationController { @POST @Path("/list") @Produces(MediaType.APPLICATION_JSON) - public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) throws ParseException { + public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam){ User user = HrmUserVarify.getUser(request, response); - queryParam.setFromSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getFromSalaryMonthStr() == null ? "" : queryParam.getFromSalaryMonthStr())); - queryParam.setEndSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndSalaryMonthStr() == null ? "" : queryParam.getEndSalaryMonthStr())); return new ResponseResult>(user).run(getTaxDeclarationWrapper(user)::listPage, queryParam); } diff --git a/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java b/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java index 1ae272efc..b308f7b82 100644 --- a/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java @@ -97,7 +97,10 @@ public class SalarySobRangeWrapper extends Service { .replace("between", "between") .replace("BETWEEN", "BETWEEN") .replace("union", "union") - .replace("UNION", "UNION")); + .replace("UNION", "UNION") + .replace("substr", "substr") + .replace("SUBSTR", "SUBSTR") + ); } }); @@ -127,7 +130,10 @@ public class SalarySobRangeWrapper extends Service { .replace("between", "between") .replace("BETWEEN", "BETWEEN") .replace("union", "union") - .replace("UNION", "UNION")); + .replace("UNION", "UNION") + .replace("substr", "substr") + .replace("SUBSTR", "SUBSTR") + ); } }); diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index d3ae590e6..ef31083b0 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -365,7 +365,10 @@ public class TaxAgentWrapper extends Service { .replace("between", "between") .replace("BETWEEN", "BETWEEN") .replace("union", "union") - .replace("UNION", "UNION")); + .replace("UNION", "UNION") + .replace("substr", "substr") + .replace("SUBSTR", "SUBSTR") + ); } }); @@ -399,7 +402,10 @@ public class TaxAgentWrapper extends Service { .replace("between", "between") .replace("BETWEEN", "BETWEEN") .replace("union", "union") - .replace("UNION", "UNION")); + .replace("UNION", "UNION") + .replace("substr", "substr") + .replace("SUBSTR", "SUBSTR") + ); } });