Merge remote-tracking branch 'remotes/origin/release/2.9.6.2310.01' into feature/salary_i18

# Conflicts:
#	src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java
This commit is contained in:
sy 2023-10-09 18:00:40 +08:00
commit 92b81923f4
16 changed files with 315 additions and 81 deletions

View File

@ -0,0 +1,26 @@
一、删除指定扣缴义务人下的档案
操作前做好数据备份
删除扣缴义务人下的档案(注意删除后,再添加进扣缴义务人,不会自动生成档案)
1、查询hrsa_tax_agent表对应扣缴义务人id
select id from hrsa_tax_agent
2、删除社保福利档案
update hrsa_insurance_base_info set delete_type=3 where payment_organization = 扣缴义务人id
update hrsa_social_archives set delete_type=3 where payment_organization = 扣缴义务人id
update hrsa_fund_archives set delete_type=3 where payment_organization = 扣缴义务人id
update hrsa_other_archives set delete_type=3 where payment_organization = 扣缴义务人id
3、删除薪资档案
update hrsa_salary_archive set delete_type=3 where tax_agent_id=扣缴义务人id
二、删除停薪员工档案
update hrsa_salary_archive set delete_type=3 where run_status in ('STOP_FROM_PENDING','STOP_FROM_SUSPEND')
.\wkhtmltopdf.exe http://127.0.0.1:8080/spa/hrmSalary/static/index.html#/main/hrmSalary/mobilepayroll?id=1694053661638&recipient=92&type=phone C:\baidu.pdf

View File

@ -2400,23 +2400,6 @@ public class SIAccountBiz extends Service {
dto.setSocialPaySum(socialPaySum.toPlainString());
}
private List<InsuranceSchemeDetailPO> encryptSchemeDetail(List<InsuranceSchemeDetailPO> source) {
source.forEach(item -> {
item.setUpperLimit(AESEncryptUtil.encrypt(item.getUpperLimit()));
item.setFixedCost(AESEncryptUtil.encrypt(item.getFixedCost()));
item.setLowerLimit(AESEncryptUtil.encrypt(item.getLowerLimit()));
});
return source;
}
private List<InsuranceSchemeDetailPO> decryptSchemeDetail(List<InsuranceSchemeDetailPO> encryptList) {
encryptList.forEach(item -> {
item.setUpperLimit(AESEncryptUtil.decrypt(item.getUpperLimit()));
item.setFixedCost(AESEncryptUtil.decrypt(item.getFixedCost()));
item.setLowerLimit(AESEncryptUtil.decrypt(item.getLowerLimit()));
});
return encryptList;
}
/**
* 查询台账id是否已经薪资核算核算过

View File

@ -475,15 +475,6 @@ public class SISchemeBiz extends Service {
}
private List<InsuranceSchemeDetailPO> encryptSchemeDetailList(List<InsuranceSchemeDetailPO> source) {
source.forEach(item -> {
item.setUpperLimit(AESEncryptUtil.encrypt(item.getUpperLimit()));
item.setFixedCost(AESEncryptUtil.encrypt(item.getFixedCost()));
item.setLowerLimit(AESEncryptUtil.encrypt(item.getLowerLimit()));
});
return source;
}
private List<InsuranceSchemeDetailPO> decryptSchemeDetailList(List<InsuranceSchemeDetailPO> encryptList) {
encryptList.forEach(item -> {
item.setUpperLimit(AESEncryptUtil.decrypt(item.getUpperLimit()));
@ -493,20 +484,6 @@ public class SISchemeBiz extends Service {
return encryptList;
}
private InsuranceSchemeDetailPO encryptSchemeDetail(InsuranceSchemeDetailPO item) {
item.setUpperLimit(AESEncryptUtil.encrypt(item.getUpperLimit()));
item.setFixedCost(AESEncryptUtil.encrypt(item.getFixedCost()));
item.setLowerLimit(AESEncryptUtil.encrypt(item.getLowerLimit()));
return item;
}
private InsuranceSchemeDetailPO decryptSchemeDetail(InsuranceSchemeDetailPO item) {
item.setUpperLimit(AESEncryptUtil.decrypt(item.getUpperLimit()));
item.setFixedCost(AESEncryptUtil.decrypt(item.getFixedCost()));
item.setLowerLimit(AESEncryptUtil.decrypt(item.getLowerLimit()));
return item;
}
public int checkBeforeDeleteSocialscheme(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteSocialscheme((Collection<Long>) params.get("ids")).get(0).getNum();
}

View File

@ -4,7 +4,6 @@ import com.engine.salary.sys.constant.SalarySysConstant;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.enums.OpenEnum;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.wbi.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.general.AES;
import weaver.general.BaseBean;
@ -30,26 +29,13 @@ public class AESEncryptUtil {
* @return 加密数据
*/
public static String encrypt(String source) {
String isEncrypt = getSalarySysConfigValue();
//防止初始化老数据时二次加密
if (StringUtils.isNotBlank(source) && OpenEnum.OPEN.getValue().equals(isEncrypt) && !source.startsWith(SalarySysConstant.PRE_SIGN_ENCRYPT)) {
if (StringUtils.isNotBlank(source) && !source.startsWith(SalarySysConstant.PRE_SIGN_ENCRYPT)) {
return SalarySysConstant.PRE_SIGN_ENCRYPT + AES.encrypt(source, aesEncryptScrect);
}
return source;
}
/**
* 应用设置是否开启加密
*
* @return
*/
private static String getSalarySysConfigValue() {
SalarySysConfPO sysConfPO = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
if (sysConfPO == null) {
return "1";
}
return sysConfPO.getConfValue();
}
/**
* AES解密
@ -58,15 +44,11 @@ public class AESEncryptUtil {
* @return 解密字符串
*/
public static String decrypt(String encryptStr) {
SalarySysConfPO sysConfPo = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
if (StringUtils.isNotBlank(encryptStr)) {
if (encryptStr.startsWith(SalarySysConstant.PRE_SIGN_ENCRYPT)) {
encryptStr = encryptStr.substring(4, encryptStr.length());
return AES.decrypt(encryptStr, aesEncryptScrect);
}
//第一版没有加AES_前缀为加密标识所以初始解密时需要根据是否有配置判断是否需要解密
//未配置加密设置时,需要解密
if (sysConfPo == null) {
} else {
return AES.decrypt(encryptStr, aesEncryptScrect);
}
}
@ -81,13 +63,6 @@ public class AESEncryptUtil {
*/
public static String closeEncryptSetting(String encryptStr) {
SalarySysConfPO sysConfPo = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
// if (StringUtils.isNotBlank(encryptStr) && encryptStr.startsWith(SalarySysConstant.PRE_SIGN_ENCRYPT)) {
// encryptStr = encryptStr.substring(4, encryptStr.length());
// return AES.decrypt(encryptStr, aesEncryptScrect);
// } else if (sysConfPo == null && StringUtils.isNotBlank(encryptStr)) {
// return AES.decrypt(encryptStr, aesEncryptScrect);
// }
// return encryptStr;
if (encryptStr == null) {
return null;
} else {

View File

@ -70,6 +70,7 @@ public class DataCollectionEmployee {
@SalaryFormulaVar(defaultLabel = "状态编码", labelId = 544644, dataType = "string")
private String status;
private String statusName;
//工号
@SalaryFormulaVar(defaultLabel = "工号", labelId = 1933, dataType = "string")

View File

@ -46,4 +46,9 @@ public class SalarySendBaseInfoDTO {
// 能否发送
private Boolean canSend;
/**
* 是否支持导出工资单pdf
*/
private Boolean showPdfBtn;
}

View File

@ -107,6 +107,7 @@ public class SalaryAcctFormulaBO {
.telephone(simpleEmployee.getTelephone())
.sex(sexName)
.status(simpleEmployee.getStatus())
.statusName(simpleEmployee.getStatusName())
.departmentName(simpleEmployee.getDepartmentName())
.departmentId(simpleEmployee.getDepartmentId())
.subcompanyName(simpleEmployee.getSubcompanyName())

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.enums.common.FilterEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
@ -27,7 +28,7 @@ import java.util.List;
public class SalaryAcctResultQueryParam extends BaseQueryParam {
//薪资核算记录id
@DataCheck(require = true,message = "参数错误薪资核算记录ID不能为空")
@DataCheck(require = true, message = "参数错误薪资核算记录ID不能为空")
private Long salaryAcctRecordId;
//人员姓名
@ -63,4 +64,17 @@ public class SalaryAcctResultQueryParam extends BaseQueryParam {
//薪资项目id
private Collection<Long> salaryItemIds;
//其他条件
private List<OtherCondition> otherConditions;
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class OtherCondition {
private Long itemId;
private FilterEnum filter;
private List<String> params;
}
}

View File

@ -60,8 +60,12 @@ public class SalaryFormulaEmployeeDTO {
private String dissmissdate;
//状态
@SalaryFormulaVar(defaultLabel = "状态", labelId = 98621, dataType = "string")
private String status;
@SalaryFormulaVar(defaultLabel = "状态", labelId = 98622, dataType = "string")
private String statusName;
//工号
@SalaryFormulaVar(defaultLabel = "工号", labelId = 1933, dataType = "string")
private String workcode;

View File

@ -113,5 +113,13 @@ public enum UserStatusEnum implements BaseEnum {
.map(v -> HrmStatus.builder().id(v.value.toString()).name(v.defaultLabel).build()).collect(Collectors.toList());
}
public static UserStatusEnum parseByValue(Integer value) {
for (UserStatusEnum statusEnum : UserStatusEnum.values()) {
if (Objects.equals(statusEnum.getValue(), value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,120 @@
package com.engine.salary.enums.common;
import com.engine.salary.enums.BaseEnum;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.math.BigDecimal;
import java.util.List;
import java.util.function.Predicate;
public enum FilterEnum implements BaseEnum<String> {
BT("BT", "包含", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> a.contentEquals(params.get(0));
}
},
EQ("EQ", "等于", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> a.equals(params.get(0));
}
},
NE("NE", "不等于", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> !a.equals(params.get(0));
}
},
GT("GT", "大于", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> {
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params.get(0))) {
return new BigDecimal(a).compareTo(new BigDecimal(params.get(0))) > 0;
}
return false;
};
}
},
LT("LT", "小于", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> {
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params.get(0))) {
return new BigDecimal(a).compareTo(new BigDecimal(params.get(0))) < 0;
}
return false;
};
}
},
GE("GE", "大于等于", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> {
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params.get(0))) {
return new BigDecimal(a).compareTo(new BigDecimal(params.get(0))) >= 0;
}
return false;
};
}
},
LE("LE", "小于等于", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return a -> {
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params.get(0))) {
return new BigDecimal(a).compareTo(new BigDecimal(params.get(0))) <= 0;
}
return false;
};
}
},
ISEMPTY("ISEMPTY", "为空", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return StringUtils::isEmpty;
}
},
ISNOTEMPTY("ISNOTEMPTY", "包含", 1) {
@Override
public Predicate<String> filter(List<String> params) {
return StringUtils::isNotEmpty;
}
};
FilterEnum(String value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
private String value;
private String defaultLabel;
private int labelId;
public abstract Predicate<String> filter(List<String> params);
@Override
public String getValue() {
return value;
}
@Override
public Integer getLabelId() {
return labelId;
}
@Override
public String getDefaultLabel() {
return defaultLabel;
}
}

View File

@ -23,6 +23,8 @@ import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.common.FilterEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctResultDataSourceEnum;
@ -43,6 +45,7 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@ -303,8 +306,35 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
@Override
public PageInfo<Map<String, Object>> listPageByParam(SalaryAcctResultQueryParam queryParam) {
// 查询薪资核算人员分页
PageInfo<SalaryAcctEmployeePO> page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
PageInfo<SalaryAcctEmployeePO> page = null;
//其他条件
List<SalaryAcctResultQueryParam.OtherCondition> otherConditions = queryParam.getOtherConditions();
if (CollectionUtils.isNotEmpty(otherConditions)) {
List<Long> items = SalaryEntityUtil.properties(otherConditions, SalaryAcctResultQueryParam.OtherCondition::getItemId, Collectors.toList());
List<SalaryAcctResultPO> list = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singletonList(queryParam.getSalaryAcctRecordId()), items);
for (int i = 0; i < otherConditions.size(); i++) {
SalaryAcctResultQueryParam.OtherCondition otherCondition = otherConditions.get(i);
Long itemId = otherCondition.getItemId();
FilterEnum filter = otherCondition.getFilter();
List<String> params = otherCondition.getParams();
list = list.stream().filter(a -> Objects.equals(a.getSalaryItemId(), itemId)).filter(a -> filter.filter(params).test(a.getResultValue())).collect(Collectors.toList());
}
List<Long> salaryAcctEmpId = SalaryEntityUtil.properties(list, SalaryAcctResultPO::getSalaryAcctEmpId, Collectors.toList());
if (CollectionUtils.isEmpty(salaryAcctEmpId)) {
//条件不满足直接返回空列表
page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), new ArrayList<>(), SalaryAcctEmployeePO.class);
} else {
queryParam.setIds(salaryAcctEmpId);
// 查询薪资核算人员分页
page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
}
} else {
// 查询薪资核算人员分页
page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
}
// 查询薪资核算结果
List<Map<String, Object>> data = listBySalaryAcctEmployees(page.getList(), queryParam);
// 薪资核算结果的分页结果
@ -397,6 +427,12 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
simpleEmployees.forEach(e -> {
UserStatusEnum userStatusEnum = UserStatusEnum.parseByValue(Integer.parseInt(e.getStatus()));
if (userStatusEnum != null) {
e.setStatusName(userStatusEnum.getDefaultLabel());
}
});
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);

View File

@ -32,7 +32,6 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.hrm.User;
@ -435,7 +434,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
ValidUtil.doValidator(param);
// 获取薪资项目信息
SalaryItemPO salaryItemPO = salaryItemBiz.getById(param.getSalaryItemId());
if (ObjectUtils.isEmpty(salaryItemPO)) {
if (salaryItemPO == null) {
throw new SalaryRunTimeException("薪资项目不存在或已被删除");
}
// 获取薪资账套中薪资项目信息

View File

@ -88,6 +88,7 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.cache.SalaryCacheKey.SALARY_CACHE_SMS_CODE;
import static com.engine.salary.constant.HrmSalaryPayrollConf.GEN_PDF;
/**
* @Description: 工资单发放
@ -456,6 +457,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
.sendNum(salarySend.getSendNum())
.sendTotal(salarySend.getSendTotal())
.canSend(canSend)
.showPdfBtn(GEN_PDF)
// .salaryAcctType(salarySend.getSalaryAcctType().toString())
// .haveBackCalc(haveBackCalc ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)
.build();

View File

@ -26,8 +26,8 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.valid.ValidUtil;
import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
@ -45,6 +45,7 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Slf4j
public class SalarySobItemServiceImpl extends Service implements SalarySobItemService {
private SalarySobItemBiz salarySobItemMapper = new SalarySobItemBiz();
@ -646,7 +647,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
private SalaryItemPO checkItemExists(Long salaryItemId, Map<Long, SalaryItemPO> salaryItemsMap) {
SalaryItemPO salaryItemPO = salaryItemsMap.get(salaryItemId);
if (ObjectUtils.isEmpty(salaryItemPO)){
if (salaryItemPO == null) {
log.error("薪资项目:{}不存在", salaryItemId);
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544765,"保存失败!存在薪资项目不存在或已被删除"));
}
return salaryItemPO;
@ -737,7 +739,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
SalarySobItemFormDTO salarySobItemFormDTO = new SalarySobItemFormDTO();
salarySobItemFormDTO.setCanEdit(1);
// 默认可以编辑
if (ObjectUtils.isNotEmpty(param.getSalarySobId()) && ObjectUtils.isNotEmpty(param.getSalaryItemId())) {
if (param.getSalarySobId() != null && param.getSalaryItemId() != null) {
// 查询薪资账套
SalarySobPO salarySobPO = salarySobBiz.getById(param.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
@ -745,19 +747,19 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
// 查询薪资项目
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemMapper().listSome(SalarySobItemPO.builder().salarySobId(param.getSalarySobId()).salaryItemId(param.getSalaryItemId()).build());
if (CollectionUtils.isEmpty(salarySobItemPOS)){
if (CollectionUtils.isEmpty(salarySobItemPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544766,"账套中薪资项目不存在"));
}
SalarySobItemPO salarySobItemPO = salarySobItemPOS.get(0);
SalaryItemPO salaryItemPO = getSalaryItemService(user).getById(salarySobItemPO.getSalaryItemId());
if (ObjectUtils.isEmpty(salaryItemPO)){
if (salaryItemPO == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(user.getLanguage(),544767,"薪资项目不存在或已被删除"));
}
//获取系统值
List<SalarySobDefaultItemPO> salarySobDefaultItemPOS = getSalarySobDefaultItemMapper().listAll();
salarySobDefaultItemPOS = salarySobDefaultItemPOS.stream().filter(po -> po.getSysSalaryItemId() != 0).collect(Collectors.toList());
Map<Long, Integer> longIntegerMap = SalaryEntityUtil.convert2Map(salarySobDefaultItemPOS, SalarySobDefaultItemPO::getSysSalaryItemId, SalarySobDefaultItemPO::getCanDelete);
if (salaryItemPO.getSysSalaryItemId() != null){
if (salaryItemPO.getSysSalaryItemId() != null) {
salarySobItemPO.setCanDelete(longIntegerMap.getOrDefault(salaryItemPO.getSysSalaryItemId(), 1));
}
// 获取薪资项目公式
@ -773,7 +775,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.build());
String formulaContent = CollectionUtils.isEmpty(expressFormulas) ? "" : expressFormulas.get(0).getFormula();
Integer valueType = ObjectUtils.isEmpty(salarySobItemPO.getValueType()) ? salaryItemPO.getValueType() : salarySobItemPO.getValueType();
Integer valueType = salarySobItemPO.getValueType() == null ? salaryItemPO.getValueType() : salarySobItemPO.getValueType();
//获取name多语言
String name = "";
name = salaryItemPO.getLabelId() != null ? SalaryI18nUtil.getI18nLabel(user.getLanguage(),salaryItemPO.getLabelId(),salaryItemPO.getName()) : salaryItemPO.getName();
@ -782,8 +784,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.setName(name)
.setItemHide(hideItemIds.contains(salaryItemPO.getId()) ? 1 : 0)
.setDataType(salaryItemPO.getDataType())
.setRoundingMode(ObjectUtils.isEmpty(salarySobItemPO.getRoundingMode()) ? salaryItemPO.getRoundingMode() : salarySobItemPO.getRoundingMode())
.setPattern(ObjectUtils.isEmpty(salarySobItemPO.getPattern()) ? salaryItemPO.getPattern() : salarySobItemPO.getPattern())
.setRoundingMode(salarySobItemPO.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : salarySobItemPO.getRoundingMode())
.setPattern(salarySobItemPO.getPattern() == null ? salaryItemPO.getPattern() : salarySobItemPO.getPattern())
.setValueType(valueType)
.setFormulaId(salarySobItemPO.getFormulaId())
.setFormulaContent(CollectionUtils.isNotEmpty(expressFormulas) ? formulaContent : "")

View File

@ -0,0 +1,81 @@
package com.engine.salary.timer;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.datacollection.param.AttendQuoteCheckOperationParam;
import com.engine.salary.entity.datacollection.param.AttendQuoteDataSyncParam;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.service.SalarySobService;
import com.engine.salary.service.impl.SalarySobServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.wrapper.AttendQuoteDataWrapper;
import com.engine.salary.wrapper.AttendQuoteWrapper;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
* @author Harryxzy
* @ClassName AutoSyncAttendQuoteData
* @date 2023/08/11 9:53
* @description 自动同步所有薪资账套的考勤引用
*/
public class AutoSyncAttendQuoteJob extends BaseCronJob {
private String preMonth;
private SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private AttendQuoteWrapper getAttendQuoteWrapper(User user) {
return ServiceUtil.getService(AttendQuoteWrapper.class, user);
}
private AttendQuoteDataWrapper getAttendQuoteDataWrapper(User user) {
return ServiceUtil.getService(AttendQuoteDataWrapper.class, user);
}
@Override
public void execute() {
User tempUser = new User();
tempUser.setUid(1);
tempUser.setLoginid("sysadmin");
// 获取所有的薪资账套
List<SalarySobPO> salarySobList = getSalarySobService(tempUser).listAll();
LocalDate localDate = SalaryDateUtil.dateToLocalDate(new Date());
int preMonthValue = -1;
if (preMonth != null && NumberUtils.isCreatable(preMonth)) {
preMonthValue = -1 * Integer.valueOf(preMonth);
}
localDate = localDate.plusMonths(preMonthValue);
String dateStr = SalaryDateUtil.getFormatYearMonth(localDate);
BaseBean baseBean = new BaseBean();
// 循环所有的账套
salarySobList.stream().forEach(sob -> {
// 校验是否可以操作
Boolean canSync = getAttendQuoteWrapper(tempUser).checkOperation(AttendQuoteCheckOperationParam.builder()
.salarySobId(sob.getId())
.salaryYearMonthStr(dateStr)
.build());
if (canSync) {
// 同步数据
try {
baseBean.writeLog("自动同步考勤数据开始:"+ sob.getId()+","+dateStr);
getAttendQuoteDataWrapper(tempUser).syncAttendQuoteData(AttendQuoteDataSyncParam.builder()
.salarySobId(sob.getId())
.salaryYearMonth(dateStr)
.build());
baseBean.writeLog("自动同步考勤数据结束:"+ sob.getId()+","+dateStr);
} catch (Exception e) {
baseBean.writeLog("自动同步考勤数据出错:"+ e);
}
}
});
}
}