diff --git a/resource/sqlupgrade/Mysql/sql202512010103SHQZJRXXFW.sql b/resource/sqlupgrade/Mysql/sql202512010103SHQZJRXXFW.sql new file mode 100644 index 000000000..225184460 --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202512010103SHQZJRXXFW.sql @@ -0,0 +1 @@ +ALTER TABLE hrsa_bill_batch ADD COLUMN fc int(255) NULL; \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202512010103SHQZJRXXFW.sql b/resource/sqlupgrade/SQLServer/sql202512010103SHQZJRXXFW.sql new file mode 100644 index 000000000..af25ff5f3 --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202512010103SHQZJRXXFW.sql @@ -0,0 +1,2 @@ +alter table hrsa_bill_batch add fc int +GO \ No newline at end of file diff --git a/src/com/engine/salary/entity/siaccount/param/AccountBatParam.java b/src/com/engine/salary/entity/siaccount/param/AccountBatParam.java index fa9de96fc..ae3c955ea 100644 --- a/src/com/engine/salary/entity/siaccount/param/AccountBatParam.java +++ b/src/com/engine/salary/entity/siaccount/param/AccountBatParam.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.siaccount.param; +import com.engine.salary.enums.siaccount.FCEnum; import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; @@ -37,4 +38,6 @@ public class AccountBatParam { private List ids; + private FCEnum fc; + } diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java index 5b610e6da..38c074e89 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java @@ -143,6 +143,11 @@ public class InsuranceAccountBatchPO { private Long jobcallId; private String status; + /** + * 封存状态,0-未封存 1-已封存 + */ + private Integer fc; + private Set opts; diff --git a/src/com/engine/salary/enums/siaccount/FCEnum.java b/src/com/engine/salary/enums/siaccount/FCEnum.java new file mode 100644 index 000000000..bc6258cc7 --- /dev/null +++ b/src/com/engine/salary/enums/siaccount/FCEnum.java @@ -0,0 +1,44 @@ +package com.engine.salary.enums.siaccount; + +import com.engine.salary.enums.BaseEnum; + +import java.util.Objects; + +public enum FCEnum implements BaseEnum { + JF(0, "解封", 91870), + + FC(1, "封存", 91862); + + private Integer value; + + private String defaultLable; + + private Integer labelId; + + FCEnum(Integer value, String defaultLable, Integer labelId) { + this.value = value; + this.defaultLable = defaultLable; + this.labelId = labelId; + } + + public Integer getValue() { + return this.value; + } + + public Integer getLabelId() { + return this.labelId; + } + + public String getDefaultLabel() { + return this.defaultLable; + } + + public static FCEnum parseByValue(Integer value){ + for (FCEnum e : FCEnum.values()) { + if(Objects.equals(e.getValue(), value)){ + return e; + } + } + return JF; + } +} diff --git a/src/com/engine/salary/service/SIAccountService.java b/src/com/engine/salary/service/SIAccountService.java index 3f55aaad5..55a262586 100644 --- a/src/com/engine/salary/service/SIAccountService.java +++ b/src/com/engine/salary/service/SIAccountService.java @@ -364,5 +364,6 @@ public interface SIAccountService { XSSFWorkbook exportQZReport(QZInsuranceAccountBatchParam param); + String batFC(AccountBatParam batParam); } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index bcca1e74a..aff4aa957 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -1600,6 +1600,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { // if (num > 0) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "已被薪酬核算给核算过,无法重新核算!")); // } + //封存状态,不允许重新核算 + InsuranceAccountBatchPO po = getInsuranceAccountBatchMapper().getById(param.getId()); + Integer fc = po.getFc(); + if (FCEnum.parseByValue(fc) == FCEnum.FC) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "已封存,无法重新核算!")); + } + + param.setBillStatus(0); // getSiAccountBiz(user).updateById(param); updateById(param); @@ -7204,7 +7212,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } @Override - public Map qzReport(QZInsuranceAccountBatchParam param) { + public Map qzReport(QZInsuranceAccountBatchParam param) { List ids = param.getIds(); @@ -7230,7 +7238,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { List> list = getService(user).buildQzReport(dtos, (long) user.getUID(), false); - List columns = Lists.newArrayList(); columns.add(new WeaTableColumnGroup("150", "公司名称", "paymentOrganizationName")); columns.add(new WeaTableColumnGroup("150", "工号", "workcode")); @@ -7263,7 +7270,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { columns.add(new WeaTableColumnGroup("150", "单位超额-公积金合计", "", Lists.newArrayList(new WeaTableColumnGroup("150", "个人缴交额", "fundSpecialSum")))); columns.add(new WeaTableColumnGroup("150", "社保公积金单位合计", "", Lists.newArrayList(new WeaTableColumnGroup("150", "单位缴交额", "comSum"), new WeaTableColumnGroup("150", "单位补缴额", "bComSum")))); columns.add(new WeaTableColumnGroup("150", "社保公积金个人合计", "", Lists.newArrayList(new WeaTableColumnGroup("150", "个人缴交额", "perSum"), new WeaTableColumnGroup("150", "个人补缴额", "bPerSum")))); - columns.add(new WeaTableColumnGroup("150", "总计", "",Lists.newArrayList(new WeaTableColumnGroup("150", "总计", "total")))); + columns.add(new WeaTableColumnGroup("150", "总计", "", Lists.newArrayList(new WeaTableColumnGroup("150", "总计", "total")))); columns.add(new WeaTableColumnGroup("150", "服务费", "", Lists.newArrayList(new WeaTableColumnGroup("150", "单位缴交额", ""), new WeaTableColumnGroup("150", "单位补缴额", "")))); columns.add(new WeaTableColumnGroup("150", "服务费", "", Lists.newArrayList(new WeaTableColumnGroup("150", "个人缴交额", ""), new WeaTableColumnGroup("150", "个人补缴额", "")))); @@ -7275,17 +7282,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } @Override - public XSSFWorkbook exportQZReport(QZInsuranceAccountBatchParam param) { + public XSSFWorkbook exportQZReport(QZInsuranceAccountBatchParam param) { Map result = qzReport(param); List headerColumnGroup = Lists.newArrayList(); - List weaTableColumns = (List)result.get("columns"); + List weaTableColumns = (List) result.get("columns"); parseHeader(headerColumnGroup, weaTableColumns); List headerList = new ArrayList<>(weaTableColumns); - List> resultMapList = (List>)result.get("list"); - + List> resultMapList = (List>) result.get("list"); // excel导出的数据 @@ -7303,6 +7309,58 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return ExcelUtilPlus.genWorkbookWithChildTitleColumnWithExcelFormat(rows, sheetName, false); } + @Override + public String batFC(AccountBatParam batParam) { + List ids = batParam.getIds(); + String msg = ""; + int success = 0; + int fail = 0; + for (Long id : ids) { + try { + InsuranceAccountBatchPO po = getInsuranceAccountBatchMapper().getById(id); + fc(po.getBillMonth(), po.getPaymentOrganization(), batParam.getFc()); + success++; + } catch (Exception e) { + log.error("批量封存异常,param {}", batParam, e); + msg += e.getMessage(); + fail++; + } + } + return String.format("成功:" + success + "个,失败:" + fail + "个%s", fail == 0 ? "" : ",失败原因:" + msg); + } + + + public void fc(String billMonth, Long paymentOrganization, FCEnum fc) { + InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization); + encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class); + SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(0, "月份账单不存在")); + + + //封存 + if (fc == FCEnum.FC && !Objects.equals(insuranceAccountBatchPO.getBillStatus(), BillStatusEnum.ARCHIVED.getValue())) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "未归档")); + } + + insuranceAccountBatchPO.setFc(fc.getValue()); + encryptUtil.encrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class); + getInsuranceAccountBatchMapper().updateById(insuranceAccountBatchPO); + + + //记录操作日志 + encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class); + TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(insuranceAccountBatchPO.getPaymentOrganization()); + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + insuranceAccountBatchPO.getId()); + loggerContext.setTargetName(taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth()); + loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账-封存")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账-封存") + + ": " + taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth()); + loggerContext.setNewValues(insuranceAccountBatchPO); + SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext); + } + private void parseHeader(List headerList, List weaTableColumns) { for (WeaTableColumnGroup weaTableColumnGroup : weaTableColumns) { if (CollectionUtils.isEmpty(weaTableColumnGroup.getChildren())) { diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 61df28ccd..c8edfbe61 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -249,6 +249,14 @@ public class SIAccountController { return new ResponseResult(user).run(getService(user)::batSocialSecurityBenefitsRecalculate,batParam); } + @POST + @Path("/batFC") + @Produces(MediaType.APPLICATION_JSON) + public String batFC(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AccountBatParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getService(user)::batFC, param); + } + /** * 正常缴纳页核算