diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobAddUpRulePO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobAddUpRulePO.java index 5ae545bf1..68be3de77 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobAddUpRulePO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobAddUpRulePO.java @@ -4,7 +4,6 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; import java.util.Collection; import java.util.Date; @@ -18,7 +17,6 @@ import java.util.Date; * @version 1.0 **/ @Data -@Accessors(chain = true) @Builder @AllArgsConstructor @NoArgsConstructor diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobTaxReportRulePO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobTaxReportRulePO.java index 927069540..05ec43f5c 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobTaxReportRulePO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobTaxReportRulePO.java @@ -4,7 +4,6 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; import java.util.Collection; import java.util.Date; @@ -18,7 +17,6 @@ import java.util.Date; * @version 1.0 **/ @Data -@Accessors(chain = true) @Builder @AllArgsConstructor @NoArgsConstructor diff --git a/src/com/engine/salary/service/impl/SalarySobAddUpRuleServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobAddUpRuleServiceImpl.java index b1d74cf3b..ce9280183 100644 --- a/src/com/engine/salary/service/impl/SalarySobAddUpRuleServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobAddUpRuleServiceImpl.java @@ -58,6 +58,7 @@ public class SalarySobAddUpRuleServiceImpl extends Service implements SalarySobA private SalarySobBackItemService getSalarySobBackItemService(User user) { return ServiceUtil.getService(SalarySobBackItemServiceImpl.class, user); } + @Override public List listBySalarySobIds(Collection salarySobIds) { if (CollectionUtils.isEmpty(salarySobIds)) { @@ -136,17 +137,17 @@ public class SalarySobAddUpRuleServiceImpl extends Service implements SalarySobA List salarySobAddUpRulePOS = Lists.newArrayList(); for (SalarySobAddUpRuleSaveParam.AddUpRuleIncomeCategoryParam incomeCategoryParam : saveParam.getIncomeCategoryParams()) { for (SalarySobAddUpRuleSaveParam.AddUpRuleParam addUpRuleParam : incomeCategoryParam.getAddUpRuleParams()) { - SalarySobAddUpRulePO salarySobAddUpRulePO = new SalarySobAddUpRulePO() - .setId(IdGenerator.generate()) - .setSalarySobId(saveParam.getSalarySobId()) - .setIncomeCategory(incomeCategoryParam.getIncomeCategory()) - .setSalaryItemId(addUpRuleParam.getSalaryItemId()) - .setAddUpColumnDataIndex(addUpRuleParam.getAddUpColumnDataIndex()) - .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .setCreator((long) user.getUID()) - .setCreateTime(now) - .setUpdateTime(now); + SalarySobAddUpRulePO salarySobAddUpRulePO = new SalarySobAddUpRulePO(); + salarySobAddUpRulePO.setId(IdGenerator.generate()); + salarySobAddUpRulePO.setSalarySobId(saveParam.getSalarySobId()); + salarySobAddUpRulePO.setIncomeCategory(incomeCategoryParam.getIncomeCategory()); + salarySobAddUpRulePO.setSalaryItemId(addUpRuleParam.getSalaryItemId()); + salarySobAddUpRulePO.setAddUpColumnDataIndex(addUpRuleParam.getAddUpColumnDataIndex()); + salarySobAddUpRulePO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + salarySobAddUpRulePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + salarySobAddUpRulePO.setCreator((long) user.getUID()); + salarySobAddUpRulePO.setCreateTime(now); + salarySobAddUpRulePO.setUpdateTime(now); salarySobAddUpRulePOS.add(salarySobAddUpRulePO); } } @@ -167,8 +168,7 @@ public class SalarySobAddUpRuleServiceImpl extends Service implements SalarySobA @Override public void saveBatch(List salarySobAddUpRules) { if (CollectionUtils.isNotEmpty(salarySobAddUpRules)) { - salarySobAddUpRules.forEach(o->getSalarySobAddUpRuleMapper().insertIgnoreNull(o)); -// getSalarySobAddUpRuleMapper().batchInsert(salarySobAddUpRules); + salarySobAddUpRules.forEach(o -> getSalarySobAddUpRuleMapper().insertIgnoreNull(o)); } } } diff --git a/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java index d1ded8b46..e277bac7f 100644 --- a/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobInitServiceImpl.java @@ -344,17 +344,17 @@ public class SalarySobInitServiceImpl extends AbstractSalarySobInitService { if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class) || Objects.isNull(salarySobItem)) { continue; } - SalarySobAddUpRulePO salarySobAddUpRule = new SalarySobAddUpRulePO() - .setId(IdGenerator.generate()) - .setSalarySobId(env.getSalarySob().getId()) - .setIncomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue().toString()) - .setSalaryItemId(salarySobItem.getSalaryItemId()) - .setAddUpColumnDataIndex(declaredField.getName()) - .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .setCreator((long) env.getCurrentUser().getUID()) - .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .setCreateTime(now) - .setUpdateTime(now); + SalarySobAddUpRulePO salarySobAddUpRule = new SalarySobAddUpRulePO(); + salarySobAddUpRule.setId(IdGenerator.generate()); + salarySobAddUpRule.setSalarySobId(env.getSalarySob().getId()); + salarySobAddUpRule.setIncomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue().toString()); + salarySobAddUpRule.setSalaryItemId(salarySobItem.getSalaryItemId()); + salarySobAddUpRule.setAddUpColumnDataIndex(declaredField.getName()); + salarySobAddUpRule.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + salarySobAddUpRule.setCreator((long) env.getCurrentUser().getUID()); + salarySobAddUpRule.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + salarySobAddUpRule.setCreateTime(now); + salarySobAddUpRule.setUpdateTime(now); salarySobAddUpRules.add(salarySobAddUpRule); } if (CollectionUtils.isNotEmpty(salarySobAddUpRules)) { @@ -375,17 +375,17 @@ public class SalarySobInitServiceImpl extends AbstractSalarySobInitService { for (TaxReportColumnPO taxReportColumn : taxReportColumns) { SalarySobItemPO salarySobItem = salarySobItemMap.get(taxReportColumn.getIncomeCategory() + "-" + taxReportColumn.getReportColumnDataIndex()); if (Objects.nonNull(salarySobItem)) { - SalarySobTaxReportRulePO salarySobTaxReportRule = new SalarySobTaxReportRulePO() - .setId(IdGenerator.generate()) - .setSalarySobId(env.getSalarySob().getId()) - .setIncomeCategory(salarySobItem.getIncomeCategory()) - .setReportColumnDataIndex(taxReportColumn.getReportColumnDataIndex()) - .setSalaryItemId(salarySobItem.getSalaryItemId()) - .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .setCreator((long) env.getCurrentUser().getUID()) - .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .setCreateTime(now) - .setUpdateTime(now); + SalarySobTaxReportRulePO salarySobTaxReportRule = new SalarySobTaxReportRulePO(); + salarySobTaxReportRule.setId(IdGenerator.generate()); + salarySobTaxReportRule.setSalarySobId(env.getSalarySob().getId()); + salarySobTaxReportRule.setIncomeCategory(salarySobItem.getIncomeCategory()); + salarySobTaxReportRule.setReportColumnDataIndex(taxReportColumn.getReportColumnDataIndex()); + salarySobTaxReportRule.setSalaryItemId(salarySobItem.getSalaryItemId()); + salarySobTaxReportRule.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + salarySobTaxReportRule.setCreator((long) env.getCurrentUser().getUID()); + salarySobTaxReportRule.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + salarySobTaxReportRule.setCreateTime(now); + salarySobTaxReportRule.setUpdateTime(now); salarySobTaxReportRules.add(salarySobTaxReportRule); } } diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 0e58c83e3..20b0576be 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -9,7 +9,10 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO; -import com.engine.salary.entity.salarysob.bo.*; +import com.engine.salary.entity.salarysob.bo.SalarySobBackItemBO; +import com.engine.salary.entity.salarysob.bo.SalarySobCycleBO; +import com.engine.salary.entity.salarysob.bo.SalarySobDuplicateBO; +import com.engine.salary.entity.salarysob.bo.SalarySobItemBO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.param.*; import com.engine.salary.entity.salarysob.po.*; @@ -135,6 +138,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { return ServiceUtil.getService(SalarySobInitServiceImpl.class, user); } + private SalarySobAddUpRuleService getSalarySobAddUpRuleService(User user) { + return ServiceUtil.getService(SalarySobAddUpRuleServiceImpl.class, user); + } + + private SalarySobTaxReportRuleService getSalarySobTaxReportRuleService(User user) { + return ServiceUtil.getService(SalarySobTaxReportRuleServiceImpl.class, user); + } + @Override public SalarySobPO getById(Long id) { return salarySobMapper.getById(id); @@ -773,6 +784,52 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (CollectionUtils.isNotEmpty(result.getSalarySobCheckRules())) { getSalarySobCheckRuleService(user).batchSave(result.getSalarySobCheckRules()); } + + //复制累计字段对应 + + // 查询薪资账套的累计字段对应规则 + List originSalarySobAddUpRules = getSalarySobAddUpRuleService(user).listBySalarySobIds(Collections.singleton(duplicateParam.getId())); + if (CollectionUtils.isEmpty(originSalarySobAddUpRules)) { + return; + } + Date now = new Date(); + List newSalarySobAddUpRules = new ArrayList<>(); + for (SalarySobAddUpRulePO originSalarySobAddUpRule : originSalarySobAddUpRules) { + SalarySobAddUpRulePO newSalarySobAddUpRule = new SalarySobAddUpRulePO(); + BeanUtils.copyProperties(originSalarySobAddUpRule, newSalarySobAddUpRule); + newSalarySobAddUpRule.setId(IdGenerator.generate()); + newSalarySobAddUpRule.setSalarySobId(newSalarySob.getId()); + newSalarySobAddUpRule.setCreator((long)user.getUID()); + newSalarySobAddUpRule.setCreateTime(now); + newSalarySobAddUpRule.setUpdateTime(now); + newSalarySobAddUpRules.add(newSalarySobAddUpRule); + } + if (CollectionUtils.isNotEmpty(newSalarySobAddUpRules)) { + getSalarySobAddUpRuleService(user).saveBatch(newSalarySobAddUpRules); + } + + + //复制个税申报字段对应 + // 查询薪资账套的个税申报表字段对应规则 + List originSalarySobTaxReportRules = getSalarySobTaxReportRuleService(user).listBySalarySobIds(Collections.singleton(duplicateParam.getId())); + if (CollectionUtils.isEmpty(originSalarySobTaxReportRules)) { + return; + } + List newSalarySobTaxReportRules = new ArrayList<>(); + for (SalarySobTaxReportRulePO originSalarySobTaxReportRule : originSalarySobTaxReportRules) { + SalarySobTaxReportRulePO newSalarySobTaxReportRule = new SalarySobTaxReportRulePO(); + BeanUtils.copyProperties(originSalarySobTaxReportRule, newSalarySobTaxReportRule); + newSalarySobTaxReportRule.setId(IdGenerator.generate()); + newSalarySobTaxReportRule.setSalarySobId(newSalarySob.getId()); + newSalarySobTaxReportRule.setCreator((long)user.getUID()); + newSalarySobTaxReportRule.setCreateTime(now); + newSalarySobTaxReportRule.setUpdateTime(now); + newSalarySobTaxReportRules.add(newSalarySobTaxReportRule); + } + if (CollectionUtils.isNotEmpty(newSalarySobTaxReportRules)) { + getSalarySobTaxReportRuleService(user).saveBatch(newSalarySobTaxReportRules); + } + // // 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId("" + result.getSalarySob().getId()); diff --git a/src/com/engine/salary/service/impl/SalarySobTaxReportRuleServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobTaxReportRuleServiceImpl.java index 27ba515c8..4a1882e96 100644 --- a/src/com/engine/salary/service/impl/SalarySobTaxReportRuleServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobTaxReportRuleServiceImpl.java @@ -132,17 +132,17 @@ public class SalarySobTaxReportRuleServiceImpl extends Service implements Salary List salarySobTaxReportRules = Lists.newArrayList(); for (SalarySobTaxReportRuleSaveParam.TaxReportRuleIncomeCategoryParam incomeCategoryParam : saveParam.getIncomeCategoryParams()) { for (SalarySobTaxReportRuleSaveParam.TaxReportRuleParam taxReportRuleParam : incomeCategoryParam.getTaxReportRuleParams()) { - SalarySobTaxReportRulePO salarySobTaxReportRule = new SalarySobTaxReportRulePO() - .setId(IdGenerator.generate()) - .setSalarySobId(saveParam.getSalarySobId()) - .setIncomeCategory(incomeCategoryParam.getIncomeCategory()) - .setReportColumnDataIndex(taxReportRuleParam.getReportColumnDataIndex()) - .setSalaryItemId(taxReportRuleParam.getSalaryItemId()) - .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .setCreator((long) user.getUID()) - .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .setCreateTime(now) - .setUpdateTime(now); + SalarySobTaxReportRulePO salarySobTaxReportRule = new SalarySobTaxReportRulePO(); + salarySobTaxReportRule.setId(IdGenerator.generate()); + salarySobTaxReportRule.setSalarySobId(saveParam.getSalarySobId()); + salarySobTaxReportRule.setIncomeCategory(incomeCategoryParam.getIncomeCategory()); + salarySobTaxReportRule.setReportColumnDataIndex(taxReportRuleParam.getReportColumnDataIndex()); + salarySobTaxReportRule.setSalaryItemId(taxReportRuleParam.getSalaryItemId()); + salarySobTaxReportRule.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + salarySobTaxReportRule.setCreator((long) user.getUID()); + salarySobTaxReportRule.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + salarySobTaxReportRule.setCreateTime(now); + salarySobTaxReportRule.setUpdateTime(now); salarySobTaxReportRules.add(salarySobTaxReportRule); } } @@ -167,6 +167,5 @@ public class SalarySobTaxReportRuleServiceImpl extends Service implements Salary return; } salarySobTaxReportRules.forEach(salarySobTaxReportRuleMapper()::insertIgnoreNull); -// salarySobTaxReportRuleMapper().batchInsert(salarySobTaxReportRules); } }