单元格锁定
This commit is contained in:
parent
cede931b0d
commit
be2d6b693a
|
|
@ -4,7 +4,6 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
|||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||
|
|
@ -49,13 +48,6 @@ public class SalaryAcctCalculateBO {
|
|||
*/
|
||||
private SalarySobCycleDTO salarySobCycleDTO;
|
||||
|
||||
/**
|
||||
* 核算锁定值
|
||||
*/
|
||||
private Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS;
|
||||
private List<Long> lockSalaryItemIds;
|
||||
|
||||
|
||||
/**
|
||||
* 相同税款所属期内其他薪资核算记录(薪资类型为工资薪金的账套的)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -318,6 +318,8 @@ public class SalaryAcctResultBO {
|
|||
map.put("id", e.getId());
|
||||
//锁定状态
|
||||
map.put("lockStatus", LockStatusEnum.getByValue(e.getLockStatus()).getDefaultLabel());
|
||||
//锁定数据
|
||||
map.put("lockItems", e.getLockItems());
|
||||
//人员id
|
||||
map.put("employeeId", e.getEmployeeId());
|
||||
// 个税扣缴义务人
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 薪资数据单元格锁定
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SalaryAcctResultLockParam {
|
||||
//锁定状态
|
||||
@DataCheck(require = true,message = "锁定状态不能为空")
|
||||
private LockStatusEnum lockStatus;
|
||||
|
||||
//薪资核算人员Id
|
||||
@DataCheck(require = true,message = "薪资核算人员不能为空")
|
||||
private Long acctEmpId;
|
||||
|
||||
//薪资项目的Id
|
||||
@DataCheck(require = true,message = "薪资项目不能为空")
|
||||
private Long salaryItemId;
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 薪资核算人员
|
||||
|
|
@ -110,6 +111,7 @@ public class SalaryAcctEmployeePO {
|
|||
private Date updateTime;
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ElogTransform(name = "锁定状态")
|
||||
private Integer lockStatus;
|
||||
|
||||
|
|
@ -142,6 +144,9 @@ public class SalaryAcctEmployeePO {
|
|||
*/
|
||||
private String status;
|
||||
|
||||
//锁定的项目
|
||||
private List<Long> lockItems;
|
||||
|
||||
|
||||
//--------条件----------
|
||||
//主键id集合
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ public class SalaryAcctRecordPO {
|
|||
/**
|
||||
* 锁定的薪资项目
|
||||
*/
|
||||
@Deprecated
|
||||
private List<Long> lockSalaryItemIds;
|
||||
|
||||
//查询条件-------------------------------
|
||||
|
|
|
|||
|
|
@ -261,8 +261,11 @@ public class SalaryAcctManager extends Service {
|
|||
// 7、查询考勤引用的所有字段
|
||||
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
|
||||
|
||||
// //核算锁定值
|
||||
// List<Long> lockSalaryItemIds = salaryAcctRecordPO.getLockSalaryItemIds();
|
||||
//fixme 先全部锁定
|
||||
|
||||
// //将除重新核算的项目外的所有的值都锁定
|
||||
// List<Long> salaryItemIds = calculateParam.getSalaryItemIds();
|
||||
// List<Long> lockSalaryItemIds = salaryItemPOS.stream().map(SalaryItemPO::getId).filter(id -> !salaryItemIds.contains(id)).collect(Collectors.toList());
|
||||
// Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
|
||||
// if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
|
||||
// List<SalaryAcctResultPO> acctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
|
||||
|
|
@ -273,19 +276,6 @@ public class SalaryAcctManager extends Service {
|
|||
// .collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
|
||||
// }
|
||||
|
||||
//将除重新核算的项目外的所有的值都锁定
|
||||
List<Long> salaryItemIds = calculateParam.getSalaryItemIds();
|
||||
List<Long> lockSalaryItemIds = salaryItemPOS.stream().map(SalaryItemPO::getId).filter(id -> !salaryItemIds.contains(id)).collect(Collectors.toList());
|
||||
Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
|
||||
List<SalaryAcctResultPO> acctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
// 8、查询公式详情
|
||||
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
|
||||
|
|
@ -323,8 +313,6 @@ public class SalaryAcctManager extends Service {
|
|||
.setSalarySobPO(salarySobPO)
|
||||
.setSalarySobCycleDTO(salarySobCycleDTO)
|
||||
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
|
||||
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
|
||||
.setLockSalaryItemIds(lockSalaryItemIds)
|
||||
.setSalarySobItemPOS(salarySobItemPOS)
|
||||
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
|
||||
.setExpressFormulas(expressFormulas)
|
||||
|
|
|
|||
|
|
@ -124,4 +124,6 @@ public interface SalaryAcctEmployeeMapper {
|
|||
void lockByRecordId(@Param("lockStatus") Integer lockStatus, @Param("recordId") Long recordId);
|
||||
|
||||
void updateIgnoreNull(@Param("salaryAcctEmployeePO")SalaryAcctEmployeePO salaryAcctEmployeePO);
|
||||
|
||||
void lock(SalaryAcctEmployeePO salaryAcctEmployeePO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
<result column="jobcall" property="jobcall"/>
|
||||
<result column="jobcall_id" property="jobcallId"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="lock_items" property="lockItems" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="SalaryAccEmployeeCountMap"
|
||||
|
|
@ -58,7 +59,8 @@
|
|||
t.jobtitle_id,
|
||||
t.jobcall,
|
||||
t.jobcall_id,
|
||||
t.status
|
||||
t.status,
|
||||
t.lock_items
|
||||
</sql>
|
||||
|
||||
<sql id="emp1Column">
|
||||
|
|
@ -966,6 +968,7 @@
|
|||
<result column="jobcall" property="jobcall"/>
|
||||
<result column="jobcall_id" property="jobcallId"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="lock_items" property="lockItems" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
|
|
@ -994,6 +997,7 @@
|
|||
, t.jobcall
|
||||
, t.jobcall_id
|
||||
, t.status
|
||||
, t.lock_items
|
||||
</sql>
|
||||
|
||||
|
||||
|
|
@ -1166,4 +1170,13 @@
|
|||
WHERE id = #{salaryAcctEmployeePO.id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<update id="lock" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO">
|
||||
UPDATE hrsa_salary_acct_emp
|
||||
<set>
|
||||
lock_items =
|
||||
#{lockItems, jdbcType=ARRAY, typeHandler=com.engine.salary.handle.SalaryListTypeHandler},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -267,4 +267,6 @@ public interface SalaryAcctEmployeeService {
|
|||
* @param salaryAcctEmployeePO
|
||||
*/
|
||||
void updateIgnoreNull(SalaryAcctEmployeePO salaryAcctEmployeePO);
|
||||
|
||||
void lock(SalaryAcctEmployeePO salaryAcctEmployeePO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,13 @@ public interface SalaryAcctResultService {
|
|||
*/
|
||||
List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndTaxAgentIds(Collection<Long> salaryAcctRecordIds, Collection<Long> taxAgentIds);
|
||||
|
||||
/**
|
||||
* 锁定单元格
|
||||
* @param param
|
||||
*/
|
||||
void lock(SalaryAcctResultLockParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 锁定项目
|
||||
*
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import com.engine.salary.util.SalaryEntityUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
|
@ -162,6 +161,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
sw.start("查询薪资核算人员的薪资核算结果");
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
Map<String, String> empItemValueMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOS, p -> p.getSalaryAcctEmpId() + "_" + p.getSalaryItemId(), SalaryAcctResultPO::getResultValue);
|
||||
sw.stop();
|
||||
// 查询浮动薪资
|
||||
sw.start("查询浮动薪资");
|
||||
|
|
@ -174,8 +174,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) {
|
||||
salaryAcctResultPOMap.put(et.getKey(), et.getValue().get(0).getOriginResultValue());
|
||||
}
|
||||
//核算锁定的值
|
||||
Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS());
|
||||
sw.stop();
|
||||
// 9、查询相同税款所属期内涉及合并计税的其他薪资核算结果
|
||||
sw.start("查询相同税款所属期内涉及合并计税的其他薪资核算结果");
|
||||
|
|
@ -210,6 +208,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
StringBuffer noticeMsg = new StringBuffer();
|
||||
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
|
||||
Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId();
|
||||
List<Long> lockItems = salaryAcctEmployeePO.getLockItems();
|
||||
//1 获取当前薪资核算人员的公式中的变量的值
|
||||
List<CalculateFormulaVarBO.FormulaVarValue> formulaVarValues = formulaVarMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
|
||||
//2 人员信息
|
||||
|
|
@ -272,9 +271,10 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
|
||||
// 处理小数点
|
||||
resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap);
|
||||
|
||||
//是否锁定
|
||||
if (salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) {
|
||||
resultValue = salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId).getResultValue();
|
||||
if (lockItems != null && lockItems.contains(salaryItemId)) {
|
||||
resultValue = empItemValueMap.get(salaryAcctEmployeePOId + "_" + salaryItemId);
|
||||
}
|
||||
// 将已经计算过的薪资项目的值转换成公式变量的值添加到集合中
|
||||
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.engine.hrmelog.entity.dto.LoggerContext;
|
|||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctEmployeeCountDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.*;
|
||||
|
|
@ -16,6 +17,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
|||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
|
|
@ -108,6 +110,11 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
private boolean isRealOrg = "1".equals(getSalaryCacheService(user).get(REPORT_ORGANIZATIN_TYPE));
|
||||
|
||||
@Override
|
||||
|
|
@ -769,12 +776,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
|
||||
@Override
|
||||
public void lockEmp(SalaryAcctResultUpdateLockStatusParam updateParam) {
|
||||
// 查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(updateParam.getSalaryAcctRecordId());
|
||||
if (CollectionUtils.isEmpty(salaryAcctRecord.getLockSalaryItemIds())) {
|
||||
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<>());
|
||||
}
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = listByIds(updateParam.getAcctEmpIds());
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -784,13 +786,20 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
throw new SalaryRunTimeException("锁定状态异常!");
|
||||
}
|
||||
|
||||
Set<Long> acctEmpIds = updateParam.getAcctEmpIds();
|
||||
if (CollUtil.isNotEmpty(acctEmpIds)) {
|
||||
//锁定指定人员
|
||||
getSalaryAcctEmployeeMapper().lockByAcctEmpIds(lockStatus.getValue(), acctEmpIds);
|
||||
} else {
|
||||
//锁定全部
|
||||
getSalaryAcctEmployeeMapper().lockByRecordId(lockStatus.getValue(), updateParam.getSalaryAcctRecordId());
|
||||
if (updateParam.getLockStatus() == LockStatusEnum.LOCK){
|
||||
SalaryAcctConfig salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(updateParam.getSalaryAcctRecordId());
|
||||
List<SalarySobItemPO> salarySobItems = salaryAcctSobConfig.getSalarySobItems();
|
||||
List<Long> itemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId,Collectors.toList());
|
||||
|
||||
salaryAcctEmployees.forEach(salaryAcctEmployeePO -> {
|
||||
salaryAcctEmployeePO.setLockItems(itemIds);
|
||||
lock(salaryAcctEmployeePO);
|
||||
});
|
||||
}else {
|
||||
salaryAcctEmployees.forEach(salaryAcctEmployeePO -> {
|
||||
salaryAcctEmployeePO.setLockItems(new ArrayList<>());
|
||||
lock(salaryAcctEmployeePO);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -798,4 +807,9 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
public void updateIgnoreNull(SalaryAcctEmployeePO salaryAcctEmployeePO) {
|
||||
getSalaryAcctEmployeeMapper().updateIgnoreNull(salaryAcctEmployeePO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lock(SalaryAcctEmployeePO salaryAcctEmployeePO) {
|
||||
getSalaryAcctEmployeeMapper().lock(salaryAcctEmployeePO);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
|
|
@ -831,21 +830,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
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(calculateParam.getSalaryAcctRecordId()), 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);
|
||||
}
|
||||
|
||||
stopWatch.stop();
|
||||
stopWatch.start("核算耗时");
|
||||
|
||||
|
|
@ -874,8 +858,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
.setSalarySobPO(salarySobPO)
|
||||
.setSalarySobCycleDTO(salarySobCycleDTO)
|
||||
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
|
||||
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
|
||||
.setLockSalaryItemIds(lockSalaryItemIds)
|
||||
.setSalarySobItemPOS(salarySobItemPOS)
|
||||
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
|
||||
.setExpressFormulas(expressFormulas)
|
||||
|
|
@ -1018,13 +1000,32 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
// return salaryAcctEmployeeService.filterByAuthority(salaryAcctEmployees, employeeId);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void lock(SalaryAcctResultLockParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
|
||||
SalaryAcctEmployeePO salaryAcctEmployeePO = getSalaryAcctEmployeeService(user).getById(param.getAcctEmpId());
|
||||
if (salaryAcctEmployeePO == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> lockItemIds = salaryAcctEmployeePO.getLockItems() == null ? new ArrayList<>() : salaryAcctEmployeePO.getLockItems();
|
||||
Long salaryItemId = param.getSalaryItemId();
|
||||
|
||||
if (param.getLockStatus() == LockStatusEnum.LOCK) {
|
||||
lockItemIds.add(salaryItemId);
|
||||
} else {
|
||||
lockItemIds.remove(salaryItemId);
|
||||
}
|
||||
|
||||
salaryAcctEmployeePO.setLockItems(lockItemIds);
|
||||
|
||||
getSalaryAcctEmployeeService(user).lock(salaryAcctEmployeePO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam) {
|
||||
// 查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(updateParam.getSalaryAcctRecordId());
|
||||
if (CollectionUtils.isEmpty(salaryAcctRecord.getLockSalaryItemIds())) {
|
||||
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<>());
|
||||
}
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
|
||||
return;
|
||||
|
|
@ -1036,15 +1037,18 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
} else {
|
||||
salaryItemIds = Collections.singleton(updateParam.getSalaryItemId());
|
||||
}
|
||||
if (updateParam.getLockStatus() == LockStatusEnum.LOCK) {
|
||||
Set<Long> lockSalaryItemIds = new HashSet<>();
|
||||
lockSalaryItemIds.addAll(salaryAcctRecord.getLockSalaryItemIds());
|
||||
lockSalaryItemIds.addAll(salaryItemIds);
|
||||
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<Long>(lockSalaryItemIds));
|
||||
} else {
|
||||
salaryAcctRecord.getLockSalaryItemIds().removeAll(salaryItemIds);
|
||||
}
|
||||
getSalaryAcctRecordService(user).updateLockSalaryItemIds(salaryAcctRecord);
|
||||
|
||||
salaryAcctEmployees.forEach(salaryAcctEmployeePO -> {
|
||||
List<Long> lockItemIds = salaryAcctEmployeePO.getLockItems() == null ? new ArrayList<>() : salaryAcctEmployeePO.getLockItems();
|
||||
|
||||
if (updateParam.getLockStatus() == LockStatusEnum.LOCK) {
|
||||
lockItemIds.addAll(salaryItemIds);
|
||||
} else {
|
||||
lockItemIds.removeAll(salaryItemIds);
|
||||
}
|
||||
salaryAcctEmployeePO.setLockItems(lockItemIds);
|
||||
getSalaryAcctEmployeeService(user).lock(salaryAcctEmployeePO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -464,6 +464,14 @@ public class SalaryAcctController {
|
|||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/acctresult/lock")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String lock(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultLockParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryAcctResultLockParam, String>(user).run(getSalaryAcctResultWrapper(user)::lock, param);
|
||||
}
|
||||
|
||||
//更新薪资项目锁定状态
|
||||
@POST
|
||||
@Path("/acctresult/updateLockStatus")
|
||||
|
|
|
|||
|
|
@ -189,6 +189,11 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
|
|||
getSalaryAcctResultService(user).save(saveParam);
|
||||
}
|
||||
|
||||
|
||||
public void lock(SalaryAcctResultLockParam param) {
|
||||
getSalaryAcctResultService(user).lock(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新薪资核算结果的值的锁定状态
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue