税后工资接口
This commit is contained in:
parent
e45ee09c7e
commit
46b3dde438
|
|
@ -15,6 +15,11 @@ public class SalaryCacheKey {
|
|||
*/
|
||||
public final static String ACCT_PROGRESS = "ACCT_PROGRESS_";
|
||||
|
||||
/**
|
||||
* 核算税后工资进度
|
||||
*/
|
||||
public final static String AFTER_TAXA_CCT_PROGRESS = "AFTER_TAX_ACCT_PROGRESS_";
|
||||
|
||||
/**
|
||||
* 薪资核算的账套配置
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 税后薪资核算的参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryAfterTaxAcctCalculateParam {
|
||||
@DataCheck(require = true,message = "参数错误,薪资核算记录ID不能为空")
|
||||
private Long salaryAcctRecordId;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface SalaryAcctResultMapper {
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ public interface SalaryAcctResultService {
|
|||
*/
|
||||
void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee);
|
||||
|
||||
/**
|
||||
* 核算税后
|
||||
* @param calculateParam
|
||||
* @param simpleEmployee
|
||||
*/
|
||||
void afterTaxAccounting(SalaryAfterTaxAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee);
|
||||
|
||||
/**
|
||||
* 根据薪资核算记录的id、个税扣缴义务人查询薪资核算结果
|
||||
*
|
||||
|
|
@ -224,4 +231,5 @@ public interface SalaryAcctResultService {
|
|||
void writeBatchLog(SalaryAcctRecordPO salaryAcctRecord,
|
||||
Map<String, String> newResultValueMap,
|
||||
SalaryLogOperateTypeEnum operateType);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -919,6 +919,181 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterTaxAccounting(SalaryAfterTaxAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) {
|
||||
Long salaryAcctRecordId = calculateParam.getSalaryAcctRecordId();
|
||||
try {
|
||||
// 1、查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
|
||||
if (Objects.isNull(salaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
|
||||
}
|
||||
//查询对应账套
|
||||
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||
if (Objects.isNull(salarySobPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资账套不存在或已被删除"));
|
||||
}
|
||||
|
||||
// 不是查询薪资账套下实时的薪资项目,而是查询发起薪资核算时存储的薪资项目快照
|
||||
SalaryAcctConfig salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(salaryAcctRecordId);
|
||||
|
||||
// 1.1、如果薪资核算记录已经归档了,就不能继续核算
|
||||
if (!Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99148, "当前薪资核算记录已归档,请重新打开后再进行核算"));
|
||||
}
|
||||
// 2、查询薪资核算记录的薪资周期、考勤周期等
|
||||
SalarySobCycleDTO salarySobCycleDTO = getSalaryAcctRecordService(user).getSalarySobCycleById(salaryAcctRecordId);
|
||||
// 3、查询薪资核算记录所用薪资账套的薪资项目副本
|
||||
List<SalarySobItemPO> salarySobItemPOS = salaryAcctSobConfig.getSalarySobItems();
|
||||
if (CollectionUtils.isEmpty(salarySobItemPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99151, "当前所用的薪资账套未选择任何薪资项目,无法核算"));
|
||||
}
|
||||
// 回算薪资项目
|
||||
List<SalarySobBackItemPO> salarySobBackItems = Collections.emptyList();
|
||||
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) {
|
||||
salarySobBackItems = salaryAcctSobConfig.getSalarySobBackItems();
|
||||
}
|
||||
// 4、查询当前租户的所有薪资项目
|
||||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listAll();
|
||||
// 5、查询薪资核算记录所用薪资账套的调薪计薪规则
|
||||
List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = getSalarySobAdjustRuleService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
|
||||
// 6、查询社保福利的所有字段
|
||||
Map<String, String> welfareColumns = getSIAccountService(user).welfareColumns();
|
||||
// 7、查询考勤引用的所有字段
|
||||
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
|
||||
|
||||
// 8、查询公式详情
|
||||
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
|
||||
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
|
||||
formulaIds.addAll(SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getFormulaId));
|
||||
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
|
||||
// 本次运算的回算薪资项目所涉及的变量
|
||||
Set<String> issuedFieldIds = getIssuedFieldIds(salarySobBackItems);
|
||||
// 9、计算薪资项目的运算优先级
|
||||
List<Long> salarySobItemsWithPriority = sortItems(salarySobItemPOS, salarySobBackItems, salaryItemPOS, expressFormulas);
|
||||
|
||||
//核算税后逻辑,去除非税后项目
|
||||
List<Long> afterTaxItems = new ArrayList<>();
|
||||
afterTaxItems.add(1695204436147L);
|
||||
salarySobItemsWithPriority = salarySobItemsWithPriority.stream().filter(afterTaxItems::contains).collect(Collectors.toList());
|
||||
|
||||
//账套中配置的个税字段,不需要系统算
|
||||
List<SalarySobTaxRulePO> salarySobTaxRulePOS = getSalarySobTaxRuleService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
|
||||
List<Long> taxIds = SalaryEntityUtil.properties(salarySobTaxRulePOS, SalarySobTaxRulePO::getSalaryItemId, Collectors.toList());
|
||||
|
||||
// 10、根据id查询其他合并计税的薪资核算记录
|
||||
List<SalaryAcctRecordPO> otherSalaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4OtherConsolidatedTax(salaryAcctRecordPO.getId());
|
||||
// 11、查询本次核算人员
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salaryAcctRecordPO.getId());
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空"));
|
||||
}
|
||||
|
||||
//核算锁定值
|
||||
List<Long> lockSalaryItemIds = salaryAcctRecordPO.getLockSalaryItemIds();
|
||||
Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(lockSalaryItemIds)) {
|
||||
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singleton(salaryAcctRecordId), lockSalaryItemIds);
|
||||
acctResults = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId())).collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
|
||||
}
|
||||
List<Long> lockEmpIds = salaryAcctEmployeePOS.stream().filter(po -> LockStatusEnum.LOCK.getValue().equals(po.getLockStatus())).map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(lockEmpIds)) {
|
||||
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctEmployeeIds(lockEmpIds);
|
||||
Map<String, SalaryAcctResultPO> acctResultMaps = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
|
||||
acctResults.putAll(acctResultMaps);
|
||||
}
|
||||
|
||||
|
||||
// 11.1、初始化进度
|
||||
ProgressDTO initProgress = new ProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY);
|
||||
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.AFTER_TAXA_CCT_PROGRESS + salaryAcctRecordId, initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 100);
|
||||
// 12.1、监控子线程的任务执行
|
||||
CountDownLatch childMonitor = new CountDownLatch(partition.size());
|
||||
// 12.2、记录子线程的执行结果
|
||||
BlockingDeque<SalaryAcctCalculateBO.Result> calculateResults = new LinkedBlockingDeque<>(partition.size());
|
||||
// 12.3、生成本次运算的key
|
||||
String calculateKey = UUID.randomUUID().toString();
|
||||
// 12.4、是否采用系统算税
|
||||
TaxDeclarationFunctionEnum taxDeclarationFunction = getSalarySysConfService(user).getTaxDeclaration();
|
||||
// 12.5、多线程运算,运算结果存放在临时表中
|
||||
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
|
||||
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
|
||||
.setSalaryAcctRecordPO(salaryAcctRecordPO)
|
||||
.setSalarySobPO(salarySobPO)
|
||||
.setSalarySobCycleDTO(salarySobCycleDTO)
|
||||
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
|
||||
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
|
||||
.setLockSalaryItemIds(lockSalaryItemIds)
|
||||
.setSalarySobItemPOS(salarySobItemPOS)
|
||||
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
|
||||
.setExpressFormulas(expressFormulas)
|
||||
.setSalaryItemPOS(salaryItemPOS)
|
||||
.setSalarySobAdjustRulePOS(salarySobAdjustRulePOS)
|
||||
.setWelfareColumns(MapUtils.emptyIfNull(welfareColumns))
|
||||
.setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS)
|
||||
.setSalaryAcctEmployeePOS(acctEmployeePOS)
|
||||
.setIssuedFieldIds(issuedFieldIds)
|
||||
.setChildMonitor(childMonitor)
|
||||
.setResults(calculateResults)
|
||||
.setCalculateKey(calculateKey)
|
||||
.setTaxDeclarationFunction(taxDeclarationFunction)
|
||||
.setTaxIds(taxIds);
|
||||
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
|
||||
LocalRunnable localRunnable = new LocalRunnable() {
|
||||
@Override
|
||||
public void execute() {
|
||||
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
|
||||
}
|
||||
};
|
||||
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculate", localRunnable);
|
||||
}
|
||||
// 13、等待所有子线程执行完毕
|
||||
childMonitor.await();
|
||||
|
||||
|
||||
// 14、判断子线程执行结果
|
||||
boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus);
|
||||
if (!allSuccess) {
|
||||
// 薪资核算实现的线程的错误信息
|
||||
String errorMsg = calculateResults.stream().filter(result -> !result.isStatus()).map(SalaryAcctCalculateBO.Result::getErrMsg).collect(Collectors.joining("|"));
|
||||
getSalaryAcctProgressService(user).fail(SalaryCacheKey.AFTER_TAXA_CCT_PROGRESS + salaryAcctRecordId, errorMsg);
|
||||
// 删除薪资核算临时存储表中的数据
|
||||
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);
|
||||
return;
|
||||
}
|
||||
// 15、处理核算结果临时表数据
|
||||
handleSalaryAfterTaxAcctResultTemp(salaryAcctRecordId, calculateKey, afterTaxItems);
|
||||
// 16、开始运行校验规则
|
||||
// SalaryAcctCheckParam salaryAcctCheckParam = new SalaryAcctCheckParam()
|
||||
// .setSalaryAcctRecordId(calculateParam.getSalaryAcctRecordId())
|
||||
// .setIds(calculateParam.getIds());
|
||||
// salaryCheckResultService.check(salaryAcctCheckParam, true, simpleEmployee);
|
||||
// Thread.sleep(10);
|
||||
getSalaryAcctProgressService(user).finish(SalaryCacheKey.AFTER_TAXA_CCT_PROGRESS + salaryAcctRecordId, true);
|
||||
|
||||
|
||||
// 记录日志
|
||||
// 查询操作日志的targetName
|
||||
String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(salaryAcctRecordId);
|
||||
LoggerContext<SalaryCheckResultPO> loggerContext = new LoggerContext<>();
|
||||
loggerContext.setUser(user);
|
||||
loggerContext.setTargetId(String.valueOf(salaryAcctRecordId));
|
||||
loggerContext.setTargetName(targetName);
|
||||
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
||||
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "核算税后薪资"));
|
||||
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "核算税后薪资"));
|
||||
SalaryElogConfig.salaryAcctRecordLoggerTemplate.write(loggerContext);
|
||||
} catch (Exception e) {
|
||||
log.info("核算税后薪资出错:{}", e.getMessage(), e);
|
||||
getSalaryAcctProgressService(user).fail(SalaryCacheKey.AFTER_TAXA_CCT_PROGRESS + salaryAcctRecordId, SalaryI18nUtil.getI18nLabel(99642, "薪资核算出错") + ": " + e.getMessage());
|
||||
} finally {
|
||||
// 数据库字段加密用
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<Long> sortItems(List<SalarySobItemPO> salarySobItemPOS, List<SalarySobBackItemPO> salarySobBackItems, List<SalaryItemPO> salaryItemPOS, List<ExpressFormula> expressFormulas) {
|
||||
|
||||
|
|
@ -999,6 +1174,19 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
log.info(sw.prettyPrint());
|
||||
}
|
||||
|
||||
|
||||
private void handleSalaryAfterTaxAcctResultTemp(Long salaryAcctRecordId, String calculateKey, List<Long> afterTaxItemIds) {
|
||||
// 查询薪资核算结果的临时存储
|
||||
List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = getSalaryAcctResultTempService(user).listByCalculateKey(calculateKey);
|
||||
// 删除原来的薪资核算结果
|
||||
getSalaryAcctResultMapper().deleteBySalaryAcctRecordIdAndSalaryItemIds(salaryAcctRecordId, afterTaxItemIds);
|
||||
// 保存薪资的薪资核算结果
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = SalaryAcctResultBO.convert2ResultPO(salaryAcctResultTempPOS);
|
||||
batchSave(salaryAcctResultPOS);
|
||||
// 删除薪资核算临时存储表中的数据
|
||||
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndTaxAgentIds(Collection<Long> salaryAcctRecordIds, Collection<Long> taxAgentIds) {
|
||||
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
|
||||
|
|
@ -1254,8 +1442,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
LoggerContext<Map<String, String>> context = new LoggerContext<>();
|
||||
context.setUser(user);
|
||||
context.setTargetId(salaryAcctRecord.getId().toString());
|
||||
context.setTargetName(SalaryI18nUtil.getI18nLabel( 268573, "全部人员"));
|
||||
context.setOperator(user.getUID()+"");
|
||||
context.setTargetName(SalaryI18nUtil.getI18nLabel(268573, "全部人员"));
|
||||
context.setOperator(user.getUID() + "");
|
||||
context.setOperateType(operateType.getValue());
|
||||
context.setOperateTypeName(operateType.getDefaultLabel());
|
||||
context.setGroupId(SalaryLogGroupTypeEnum.SALARY_ACCT_RESULT_VALUE.getValue());
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@ package com.engine.salary.service.impl;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.constant.SzyhApiConstant;
|
||||
import com.engine.salary.entity.datacollection.response.QuerySpecialAmountFeedbackResponse;
|
||||
import com.engine.salary.entity.taxagent.response.SzyhResponseHead;
|
||||
import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO;
|
||||
import com.engine.salary.entity.taxapiflow.param.TaxDeclarationBillingConfigSaveParam;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiProfilePO;
|
||||
import com.engine.salary.enums.SalaryOnOffEnum;
|
||||
import com.engine.salary.enums.taxdeclaration.TaxDeclareApiProfileEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationApiProfileMapper;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclareApiConfigMapper;
|
||||
import com.engine.salary.service.TaxDeclarationApiConfigService;
|
||||
|
|
@ -19,7 +17,10 @@ import com.engine.salary.util.db.MapperProxyFactory;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* chengliming
|
||||
|
|
@ -97,17 +98,6 @@ public class TaxDeclarationApiConfigServiceImpl extends Service implements TaxDe
|
|||
config.setHost(getApiHost());
|
||||
insert(config);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(config.getAppKey()) && StringUtils.isNotEmpty(config.getAppSecret())) {
|
||||
QuerySpecialAmountFeedbackResponse response = getQuerySpecialAmountFeedbackResponse(config);
|
||||
// 校验请求结果
|
||||
String responseCode = Optional.ofNullable(response).map(QuerySpecialAmountFeedbackResponse::getHead).map(SzyhResponseHead::getCode).orElse(null);
|
||||
|
||||
if (SzyhApiConstant.ERROR_CODE.equals(responseCode)
|
||||
|| SzyhApiConstant.APP_DISABLED_CODE.equals(responseCode)
|
||||
|| SzyhApiConstant.APP_PAUSED_CODE.equals(responseCode)) {
|
||||
throw new SalaryRunTimeException("账号密码错误或账号已停用");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getApiHost() {
|
||||
|
|
|
|||
|
|
@ -541,6 +541,15 @@ public class SalaryAcctController {
|
|||
return new ResponseResult<SalaryCalcTaxParam, SalaryCalcTaxInfoDTO>(user).run(getSalaryAcctResultWrapper(user)::calcTaxFeedback, salaryCalcTaxParam);
|
||||
}
|
||||
|
||||
//计算税后工资
|
||||
@POST
|
||||
@Path("/acctresult/afterTaxAccounting")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String afterTaxAccounting(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAfterTaxAcctCalculateParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryAfterTaxAcctCalculateParam, String>(user).run(getSalaryAcctResultWrapper(user)::afterTaxAccounting, param);
|
||||
}
|
||||
|
||||
//导出核算结果
|
||||
@GET
|
||||
@Path("/acctresult/export")
|
||||
|
|
|
|||
|
|
@ -236,14 +236,6 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
|
|||
.setStatus(true)
|
||||
.setMessage(StringUtils.EMPTY);
|
||||
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
|
||||
// 异步执行薪资核算
|
||||
// LocalRunnable localRunnable = new LocalRunnable() {
|
||||
// @Override
|
||||
// public void execute() {
|
||||
// getSalaryAcctResultService(user).calculate(calculateParam, simpleEmployee);
|
||||
// }
|
||||
// };
|
||||
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculateV1", localRunnable);
|
||||
new Thread() {
|
||||
public void run() {
|
||||
getSalaryAcctResultService(user).calculate(calculateParam, simpleEmployee);
|
||||
|
|
@ -252,6 +244,41 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 核算税后
|
||||
*
|
||||
* @param calculateParam 薪资核算的参数
|
||||
*/
|
||||
public void afterTaxAccounting(SalaryAfterTaxAcctCalculateParam calculateParam) {
|
||||
//当前登陆人员
|
||||
DataCollectionEmployee simpleEmployee = new DataCollectionEmployee();
|
||||
simpleEmployee.setEmployeeId((long) user.getUID());
|
||||
// 检查薪资核算人员的个税扣缴义务人
|
||||
getSalaryAcctEmployeeWrapper(user).checkTaxAgent(calculateParam.getSalaryAcctRecordId());
|
||||
// 检查是否正在核算中
|
||||
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.AFTER_TAXA_CCT_PROGRESS + calculateParam.getSalaryAcctRecordId());
|
||||
if (Objects.nonNull(salaryAcctProgressDTO) && salaryAcctProgressDTO.isStatus() && Optional.ofNullable(salaryAcctProgressDTO.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) {
|
||||
return;
|
||||
}
|
||||
// 初始化进度
|
||||
ProgressDTO initProgress = new ProgressDTO()
|
||||
.setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中"))
|
||||
.setTitleLabelId(97515L)
|
||||
.setTotalQuantity(NumberUtils.INTEGER_ONE)
|
||||
.setCalculatedQuantity(NumberUtils.INTEGER_ZERO)
|
||||
.setProgress(BigDecimal.ZERO)
|
||||
.setStatus(true)
|
||||
.setMessage(StringUtils.EMPTY);
|
||||
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.AFTER_TAXA_CCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
|
||||
new Thread() {
|
||||
public void run() {
|
||||
getSalaryAcctResultService(user).afterTaxAccounting(calculateParam, simpleEmployee);
|
||||
}
|
||||
}.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否有薪资核算结果的查看权限
|
||||
* @param salaryAcctRecordId
|
||||
|
|
|
|||
|
|
@ -19,5 +19,7 @@ public interface SalaryAcctResultWrapperProxy {
|
|||
|
||||
void calculate(SalaryAcctCalculateParam calculateParam);
|
||||
|
||||
void afterTaxAccounting(SalaryAfterTaxAcctCalculateParam calculateParam);
|
||||
|
||||
void batchUpdate(SalaryAcctResultBatchUpdateParam param);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue