公共进度条功能
This commit is contained in:
parent
4582ab1e51
commit
993db67601
|
|
@ -10,7 +10,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
|||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
|
||||
import com.engine.salary.entity.siaccount.dto.SIAccountUtilDTO;
|
||||
import com.engine.salary.entity.siaccount.param.*;
|
||||
|
|
@ -28,10 +28,10 @@ import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
|
|||
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
||||
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
||||
import com.engine.salary.service.SalaryAcctProgressService;
|
||||
import com.engine.salary.service.ProgressService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.impl.SalaryAcctProgressServiceImpl;
|
||||
import com.engine.salary.service.impl.ProgressServiceImpl;
|
||||
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
|
|
@ -113,8 +113,8 @@ public class SIAccountBiz extends Service {
|
|||
return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return (SalaryAcctProgressService) ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
private ProgressService getSalaryAcctProgressService(User user) {
|
||||
return (ProgressService) ServiceUtil.getService(ProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SIAccountDetailTempMapper getSIAccountDetailTempMapper() {
|
||||
|
|
@ -251,13 +251,13 @@ public class SIAccountBiz extends Service {
|
|||
|
||||
public void accounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
|
||||
//薪资核算进度暂未实现
|
||||
SalaryAcctProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth());
|
||||
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth());
|
||||
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO()
|
||||
ProgressDTO initProgress = new ProgressDTO()
|
||||
.setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中"))
|
||||
.setTitleLabelId(97515L)
|
||||
.setTotalQuantity(NumberUtils.INTEGER_ONE)
|
||||
|
|
@ -341,7 +341,7 @@ public class SIAccountBiz extends Service {
|
|||
//salaryAcctProgressService.initProgress(tenantKey + param.getBillMonth(), salaryAcctProgressDTO, employeeId, tenantKey);
|
||||
|
||||
// 初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO()
|
||||
ProgressDTO initProgress = new ProgressDTO()
|
||||
.setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中"))
|
||||
.setTitleLabelId(97515L)
|
||||
.setTotalQuantity(ids.size())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.engine.salary.entity.salaryacct.dto;
|
||||
package com.engine.salary.entity.progress;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -10,18 +10,19 @@ import java.io.Serializable;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description: 核算进度
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 12/13/21 1:34 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
* 进度
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryAcctProgressDTO implements Serializable {
|
||||
public class ProgressDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 当前步骤名称
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
//package com.engine.salary.entity.salaryacct.dto;
|
||||
//
|
||||
//import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
//import com.weaver.hrm.salary.common.WeaTableColumnWapper;
|
||||
//import io.swagger.annotations.ApiModel;
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Builder;
|
||||
//import lombok.Data;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
///**
|
||||
// * @description: 核算结果列表
|
||||
// * @author: xiajun
|
||||
// * @modified By: xiajun
|
||||
// * @date: Created in 12/6/21 6:53 PM
|
||||
// * @version:v1.0
|
||||
// */
|
||||
//@Data
|
||||
//@Builder
|
||||
//@NoArgsConstructor
|
||||
//@AllArgsConstructor
|
||||
////"核算结果列表")
|
||||
//public class SalaryAccResultListDTO {
|
||||
//
|
||||
// //动态表头")
|
||||
// private List<WeaTableColumnWapper> columns;
|
||||
//
|
||||
// //列表数据")
|
||||
// private List<Map<String, Object>> data;
|
||||
//
|
||||
// @JsonSerialize(using = ToStringSerializer.class)
|
||||
// //列表总数")
|
||||
// private Long total;
|
||||
//}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
//package com.engine.salary.entity.salaryacct.dto;
|
||||
//
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Builder;
|
||||
//import lombok.Data;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//
|
||||
///**
|
||||
// * @description: 薪资核算
|
||||
// * @author: xiajun
|
||||
// * @modified By: xiajun
|
||||
// * @date: Created in 12/16/21 8:40 PM
|
||||
// * @version:v1.0
|
||||
// */
|
||||
//@Data
|
||||
//@Builder
|
||||
//@NoArgsConstructor
|
||||
//@AllArgsConstructor
|
||||
//public class SalaryAcctDTO {
|
||||
//
|
||||
// //是否正在核算")
|
||||
// private boolean acctInProgress;
|
||||
//}
|
||||
|
|
@ -6,7 +6,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
|
|
@ -109,8 +109,8 @@ public class SalaryAcctManager extends Service {
|
|||
return ServiceUtil.getService(SalaryAcctCalculateServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
private ProgressService getSalaryAcctProgressService(User user) {
|
||||
return ServiceUtil.getService(ProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private DataSourceTransactionManager dataSourceTransactionManager;
|
||||
|
|
@ -202,12 +202,12 @@ public class SalaryAcctManager extends Service {
|
|||
simpleEmployee.setEmployeeId((long) user.getUID());
|
||||
|
||||
// 检查是否正在核算中
|
||||
SalaryAcctProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress("SUPPLEMENT_ACCT_PROGRESS_" + salaryAcctRecordId);
|
||||
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress("SUPPLEMENT_ACCT_PROGRESS_" + salaryAcctRecordId);
|
||||
if (Objects.nonNull(salaryAcctProgressDTO) && salaryAcctProgressDTO.isStatus() && Optional.ofNullable(salaryAcctProgressDTO.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) {
|
||||
return;
|
||||
}
|
||||
// 初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO()
|
||||
ProgressDTO initProgress = new ProgressDTO()
|
||||
.setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中"))
|
||||
.setTitleLabelId(97515L)
|
||||
.setTotalQuantity(NumberUtils.INTEGER_ONE)
|
||||
|
|
@ -297,7 +297,7 @@ public class SalaryAcctManager extends Service {
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空"));
|
||||
}
|
||||
// 11.1、初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY);
|
||||
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("SUPPLEMENT_ACCT_PROGRESS_" + salaryAcctRecordId, initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 5000);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 核算进度
|
||||
* 进度条
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface SalaryAcctProgressService {
|
||||
public interface ProgressService {
|
||||
|
||||
/**
|
||||
* 初始化核算进度条
|
||||
|
|
@ -20,7 +20,7 @@ public interface SalaryAcctProgressService {
|
|||
* @param salaryAcctProgress
|
||||
* @return
|
||||
*/
|
||||
void initProgress(String cacheKey, SalaryAcctProgressDTO salaryAcctProgress);
|
||||
void initProgress(String cacheKey, ProgressDTO salaryAcctProgress);
|
||||
|
||||
/**
|
||||
* 更新进度条
|
||||
|
|
@ -31,7 +31,12 @@ public interface SalaryAcctProgressService {
|
|||
void getAndAddCalculatedQty(String cacheKey, Integer calculatedQuantity);
|
||||
|
||||
|
||||
//
|
||||
/**
|
||||
* 更新进度条
|
||||
* @param cacheKey
|
||||
* @param calculatedQuantity
|
||||
* @param message
|
||||
*/
|
||||
void getAndAddCalculatedQty(String cacheKey, Integer calculatedQuantity, String message);
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +66,7 @@ public interface SalaryAcctProgressService {
|
|||
* 获取进度条
|
||||
* @return
|
||||
*/
|
||||
SalaryAcctProgressDTO getProgress(String cacheKey);
|
||||
ProgressDTO getProgress(String cacheKey);
|
||||
|
||||
/**
|
||||
* 删除redis中的缓存
|
||||
|
|
@ -69,5 +74,5 @@ public interface SalaryAcctProgressService {
|
|||
* @param cacheKey
|
||||
* @return
|
||||
*/
|
||||
SalaryAcctProgressDTO del(String cacheKey);
|
||||
ProgressDTO del(String cacheKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.service.ProgressService;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 进度条
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class ProgressServiceImpl extends Service implements ProgressService {
|
||||
|
||||
|
||||
@Override
|
||||
public void initProgress(String cacheKey, ProgressDTO progressDTO) {
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(progressDTO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void getAndAddCalculatedQty(String cacheKey, Integer calculatedQuantity) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
ProgressDTO progressDTO = JsonUtil.parseObject(resultStr, ProgressDTO.class);
|
||||
if (progressDTO == null || !progressDTO.isStatus()) {
|
||||
return;
|
||||
}
|
||||
Integer currentCalculatedQuantity = progressDTO.getCalculatedQuantity() + calculatedQuantity;
|
||||
progressDTO.setCalculatedQuantity(
|
||||
currentCalculatedQuantity > progressDTO.getTotalQuantity() ? progressDTO.getTotalQuantity() : currentCalculatedQuantity);
|
||||
BigDecimal progress = BigDecimal.valueOf(progressDTO.getCalculatedQuantity())
|
||||
.divide(BigDecimal.valueOf(progressDTO.getTotalQuantity()), 4, RoundingMode.HALF_DOWN);
|
||||
progressDTO.setProgress(progress.compareTo(BigDecimal.ONE) > 0 ? BigDecimal.ONE : progress);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(progressDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void getAndAddCalculatedQty(String cacheKey, Integer calculatedQuantity, String message) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
ProgressDTO progressDTO = JsonUtil.parseObject(resultStr, ProgressDTO.class);
|
||||
if (progressDTO == null || !progressDTO.isStatus()) {
|
||||
return;
|
||||
}
|
||||
Integer currentCalculatedQuantity = progressDTO.getCalculatedQuantity() + calculatedQuantity;
|
||||
progressDTO.setCalculatedQuantity(
|
||||
currentCalculatedQuantity > progressDTO.getTotalQuantity() ? progressDTO.getTotalQuantity() : currentCalculatedQuantity);
|
||||
BigDecimal progress = BigDecimal.valueOf(progressDTO.getCalculatedQuantity())
|
||||
.divide(BigDecimal.valueOf(progressDTO.getTotalQuantity()), 4, RoundingMode.HALF_DOWN);
|
||||
progressDTO.setProgress(progress.compareTo(BigDecimal.ONE) > 0 ? BigDecimal.ONE : progress);
|
||||
|
||||
if (StringUtils.isNotBlank(message)) {
|
||||
progressDTO.setMessage(Utils.null2String(progressDTO.getMessage()) + message);
|
||||
}
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(progressDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String cacheKey, String message) {
|
||||
ProgressDTO progressDTO = new ProgressDTO();
|
||||
progressDTO.setStatus(false);
|
||||
progressDTO.setMessage(message);
|
||||
progressDTO.setCheckStatus(true);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(progressDTO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish(String cacheKey, boolean checkStatus) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
ProgressDTO progressDTO = JsonUtil.parseObject(resultStr, ProgressDTO.class);
|
||||
if (progressDTO == null || !progressDTO.isStatus()) {
|
||||
return;
|
||||
}
|
||||
progressDTO.setTitle("操作完成");
|
||||
progressDTO.setCalculatedQuantity(progressDTO.getTotalQuantity());
|
||||
progressDTO.setProgress(BigDecimal.ONE);
|
||||
progressDTO.setCheckStatus(checkStatus);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(progressDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(String cacheKey, BigDecimal progress, boolean checkStatus) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
ProgressDTO progressDTO = JsonUtil.parseObject(resultStr, ProgressDTO.class);
|
||||
if (progressDTO == null || !progressDTO.isStatus()) {
|
||||
return;
|
||||
}
|
||||
progressDTO.setTitle("处理中");
|
||||
progressDTO.setCalculatedQuantity(progressDTO.getTotalQuantity());
|
||||
progressDTO.setProgress(progress);
|
||||
progressDTO.setCheckStatus(checkStatus);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(progressDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProgressDTO getProgress(String cacheKey) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isEmpty(resultStr)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtil.parseObject(resultStr, ProgressDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProgressDTO del(String cacheKey) {
|
||||
Util_DataCache.clearVal(cacheKey);
|
||||
ProgressDTO salaryAcctProgressDTO = new ProgressDTO();
|
||||
salaryAcctProgressDTO.setMessage("操作失败");
|
||||
salaryAcctProgressDTO.setStatus(false);
|
||||
return salaryAcctProgressDTO;
|
||||
}
|
||||
}
|
||||
|
|
@ -97,8 +97,8 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
return (SalaryAcctResultTempService) ServiceUtil.getService(SalaryAcctResultTempServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return (SalaryAcctProgressService) ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
private ProgressService getSalaryAcctProgressService(User user) {
|
||||
return (ProgressService) ServiceUtil.getService(ProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
|
||||
|
|
|
|||
|
|
@ -1,128 +0,0 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.service.SalaryAcctProgressService;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 核算进度条
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class SalaryAcctProgressServiceImpl extends Service implements SalaryAcctProgressService {
|
||||
|
||||
|
||||
@Override
|
||||
public void initProgress(String cacheKey, SalaryAcctProgressDTO salaryAcctProgress) {
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void getAndAddCalculatedQty(String cacheKey, Integer calculatedQuantity) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
SalaryAcctProgressDTO salaryAcctProgress = JsonUtil.parseObject(resultStr, SalaryAcctProgressDTO.class);
|
||||
if (salaryAcctProgress == null || !salaryAcctProgress.isStatus()) {
|
||||
return;
|
||||
}
|
||||
Integer currentCalculatedQuantity = salaryAcctProgress.getCalculatedQuantity() + calculatedQuantity;
|
||||
salaryAcctProgress.setCalculatedQuantity(
|
||||
currentCalculatedQuantity > salaryAcctProgress.getTotalQuantity() ? salaryAcctProgress.getTotalQuantity() : currentCalculatedQuantity);
|
||||
BigDecimal progress = BigDecimal.valueOf(salaryAcctProgress.getCalculatedQuantity())
|
||||
.divide(BigDecimal.valueOf(salaryAcctProgress.getTotalQuantity()), 4, RoundingMode.HALF_DOWN);
|
||||
salaryAcctProgress.setProgress(progress.compareTo(BigDecimal.ONE) > 0 ? BigDecimal.ONE : progress);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void getAndAddCalculatedQty(String cacheKey, Integer calculatedQuantity, String message) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
SalaryAcctProgressDTO salaryAcctProgress = JsonUtil.parseObject(resultStr, SalaryAcctProgressDTO.class);
|
||||
if (salaryAcctProgress == null || !salaryAcctProgress.isStatus()) {
|
||||
return;
|
||||
}
|
||||
Integer currentCalculatedQuantity = salaryAcctProgress.getCalculatedQuantity() + calculatedQuantity;
|
||||
salaryAcctProgress.setCalculatedQuantity(
|
||||
currentCalculatedQuantity > salaryAcctProgress.getTotalQuantity() ? salaryAcctProgress.getTotalQuantity() : currentCalculatedQuantity);
|
||||
BigDecimal progress = BigDecimal.valueOf(salaryAcctProgress.getCalculatedQuantity())
|
||||
.divide(BigDecimal.valueOf(salaryAcctProgress.getTotalQuantity()), 4, RoundingMode.HALF_DOWN);
|
||||
salaryAcctProgress.setProgress(progress.compareTo(BigDecimal.ONE) > 0 ? BigDecimal.ONE : progress);
|
||||
|
||||
if (StringUtils.isNotBlank(message)) {
|
||||
salaryAcctProgress.setMessage(Utils.null2String(salaryAcctProgress.getMessage()) + message);
|
||||
}
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(String cacheKey, String message) {
|
||||
SalaryAcctProgressDTO salaryAcctProgress = new SalaryAcctProgressDTO();
|
||||
salaryAcctProgress.setStatus(false);
|
||||
salaryAcctProgress.setMessage(message);
|
||||
salaryAcctProgress.setCheckStatus(true);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish(String cacheKey, boolean checkStatus) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
SalaryAcctProgressDTO salaryAcctProgress = JsonUtil.parseObject(resultStr, SalaryAcctProgressDTO.class);
|
||||
if (salaryAcctProgress == null || !salaryAcctProgress.isStatus()) {
|
||||
return;
|
||||
}
|
||||
salaryAcctProgress.setTitle("核算完成");
|
||||
salaryAcctProgress.setCalculatedQuantity(salaryAcctProgress.getTotalQuantity());
|
||||
salaryAcctProgress.setProgress(BigDecimal.ONE);
|
||||
salaryAcctProgress.setCheckStatus(checkStatus);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(String cacheKey, BigDecimal progress, boolean checkStatus) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
SalaryAcctProgressDTO salaryAcctProgress = JsonUtil.parseObject(resultStr, SalaryAcctProgressDTO.class);
|
||||
if (salaryAcctProgress == null || !salaryAcctProgress.isStatus()) {
|
||||
return;
|
||||
}
|
||||
salaryAcctProgress.setTitle("核算中");
|
||||
salaryAcctProgress.setCalculatedQuantity(salaryAcctProgress.getTotalQuantity());
|
||||
salaryAcctProgress.setProgress(progress);
|
||||
salaryAcctProgress.setCheckStatus(checkStatus);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalaryAcctProgressDTO getProgress(String cacheKey) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isEmpty(resultStr)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtil.parseObject(resultStr, SalaryAcctProgressDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalaryAcctProgressDTO del(String cacheKey) {
|
||||
Util_DataCache.clearVal(cacheKey);
|
||||
SalaryAcctProgressDTO salaryAcctProgressDTO = new SalaryAcctProgressDTO();
|
||||
salaryAcctProgressDTO.setMessage("核算失败");
|
||||
salaryAcctProgressDTO.setStatus(false);
|
||||
return salaryAcctProgressDTO;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ import com.engine.salary.entity.report.bo.SalaryAcctResultReportBO;
|
|||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.entity.salaryacct.bo.*;
|
||||
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.*;
|
||||
|
|
@ -120,8 +120,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalaryAcctCalculateServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
private ProgressService getSalaryAcctProgressService(User user) {
|
||||
return ServiceUtil.getService(ProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private DataSourceTransactionManager dataSourceTransactionManager;
|
||||
|
|
@ -720,7 +720,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空"));
|
||||
}
|
||||
// 11.1、初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY);
|
||||
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.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 5000);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.service.SalaryAcctProgressService;
|
||||
import com.engine.salary.service.impl.SalaryAcctProgressServiceImpl;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.service.ProgressService;
|
||||
import com.engine.salary.service.impl.ProgressServiceImpl;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -27,8 +27,8 @@ import javax.ws.rs.core.MediaType;
|
|||
**/
|
||||
public class SalaryProgressController {
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return (SalaryAcctProgressService) ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
private ProgressService getSalaryAcctProgressService(User user) {
|
||||
return (ProgressService) ServiceUtil.getService(ProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
//获取进度条
|
||||
|
|
@ -37,7 +37,7 @@ public class SalaryProgressController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getRate(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "cacheKey") String cacheKey) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, SalaryAcctProgressDTO>(user).run(getSalaryAcctProgressService(user)::getProgress, cacheKey);
|
||||
return new ResponseResult<String, ProgressDTO>(user).run(getSalaryAcctProgressService(user)::getProgress, cacheKey);
|
||||
}
|
||||
|
||||
// @ApiOperation("获取进度条")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.engine.salary.cache.SalaryCacheKey;
|
|||
import com.engine.salary.component.WeaTableColumnGroup;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
|
|
@ -62,8 +62,8 @@ public class SalaryAcctResultWrapper extends Service {
|
|||
return ServiceUtil.getService(SalaryAcctEmployeeWrapper.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
private ProgressService getSalaryAcctProgressService(User user) {
|
||||
return ServiceUtil.getService(ProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// private SalaryCheckResultService salaryCheckResultService;
|
||||
|
|
@ -225,12 +225,12 @@ public class SalaryAcctResultWrapper extends Service {
|
|||
// 检查薪资核算人员的个税扣缴义务人
|
||||
getSalaryAcctEmployeeWrapper(user).checkTaxAgent(calculateParam.getSalaryAcctRecordId());
|
||||
// 检查是否正在核算中
|
||||
SalaryAcctProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId());
|
||||
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId());
|
||||
if (Objects.nonNull(salaryAcctProgressDTO) && salaryAcctProgressDTO.isStatus() && Optional.ofNullable(salaryAcctProgressDTO.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) {
|
||||
return;
|
||||
}
|
||||
// 初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO()
|
||||
ProgressDTO initProgress = new ProgressDTO()
|
||||
.setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中"))
|
||||
.setTitleLabelId(97515L)
|
||||
.setTotalQuantity(NumberUtils.INTEGER_ONE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue