钱智封存功能

This commit is contained in:
钱涛 2025-12-01 15:07:00 +08:00
parent c3b2dc2982
commit 37e9e06c56
8 changed files with 129 additions and 7 deletions

View File

@ -0,0 +1 @@
ALTER TABLE hrsa_bill_batch ADD COLUMN fc int(255) NULL;

View File

@ -0,0 +1,2 @@
alter table hrsa_bill_batch add fc int
GO

View File

@ -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<Long> ids;
private FCEnum fc;
}

View File

@ -143,6 +143,11 @@ public class InsuranceAccountBatchPO {
private Long jobcallId;
private String status;
/**
* 封存状态0-未封存 1-已封存
*/
private Integer fc;
private Set<String> opts;

View File

@ -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<Integer> {
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;
}
}

View File

@ -364,5 +364,6 @@ public interface SIAccountService {
XSSFWorkbook exportQZReport(QZInsuranceAccountBatchParam param);
String batFC(AccountBatParam batParam);
}

View File

@ -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<String, Object> qzReport(QZInsuranceAccountBatchParam param) {
public Map<String, Object> qzReport(QZInsuranceAccountBatchParam param) {
List<Long> ids = param.getIds();
@ -7230,7 +7238,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<Map<String, Object>> list = getService(user).buildQzReport(dtos, (long) user.getUID(), false);
List<WeaTableColumnGroup> 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<String, Object> result = qzReport(param);
List<WeaTableColumnGroup> headerColumnGroup = Lists.newArrayList();
List<WeaTableColumnGroup> weaTableColumns = (List<WeaTableColumnGroup>)result.get("columns");
List<WeaTableColumnGroup> weaTableColumns = (List<WeaTableColumnGroup>) result.get("columns");
parseHeader(headerColumnGroup, weaTableColumns);
List<Object> headerList = new ArrayList<>(weaTableColumns);
List<Map<String, Object>> resultMapList = (List<Map<String, Object>>)result.get("list");
List<Map<String, Object>> resultMapList = (List<Map<String, Object>>) 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<Long> 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<InsuranceAccountBatchPO> 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<WeaTableColumnGroup> headerList, List<WeaTableColumnGroup> weaTableColumns) {
for (WeaTableColumnGroup weaTableColumnGroup : weaTableColumns) {
if (CollectionUtils.isEmpty(weaTableColumnGroup.getChildren())) {

View File

@ -249,6 +249,14 @@ public class SIAccountController {
return new ResponseResult<AccountBatParam, String>(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<AccountBatParam, String>(user).run(getService(user)::batFC, param);
}
/**
* 正常缴纳页核算