Merge branch 'feature/锁定人员' into release/2.14.3.2406.01

This commit is contained in:
钱涛 2024-05-30 17:06:57 +08:00
commit c86b53fd27
22 changed files with 176 additions and 81 deletions

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_status NUMBER(11, 0);
/

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_status NUMBER(11, 0);
/

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_status NUMBER(11, 0);
/

View File

@ -0,0 +1 @@
ALTER TABLE hrsa_salary_acct_emp ADD COLUMN lock_status int(0) NULL ;

View File

@ -0,0 +1,2 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_status NUMBER(11, 0)
/

View File

@ -0,0 +1 @@
ALTER TABLE hrsa_salary_acct_emp ADD COLUMN lock_status int NULL ;

View File

@ -0,0 +1,2 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_status int NULL
GO

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_status NUMBER(11, 0);
/

View File

@ -181,9 +181,9 @@ public class SalaryAcctResultBO {
List<WeaTableColumnGroup> childrenColumns = Lists.newArrayList();
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getDefaultLabel(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
} else {
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getDefaultLabel(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
}
}
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemGroupDTO.getName(), 0), salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
@ -192,18 +192,18 @@ public class SalaryAcctResultBO {
// 没有分类的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getDefaultLabel(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
} else {
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getDefaultLabel(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
}
}
// 回算的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getBackCalcItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getDefaultLabel(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
} else {
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getDefaultLabel(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
}
}
@ -288,6 +288,8 @@ public class SalaryAcctResultBO {
}
// 主键id
map.put("id", e.getId());
//锁定状态
map.put("lockStatus", LockStatusEnum.getByValue(e.getLockStatus()).getDefaultLabel());
//人员id
map.put("employeeId", e.getEmployeeId());
// 个税扣缴义务人
@ -552,7 +554,7 @@ public class SalaryAcctResultBO {
// .canEdit(Objects.equals(Optional.ofNullable(salaryItemPO).map(SalaryItemPO::getUseInEmployeeSalary).orElse(0), 0))
.canEdit(true)
.pattern(salarySobItemPO.getPattern())
.lockStatus(lockItems.contains(salarySobItemPO.getSalaryItemId()) ? LockStatusEnum.LOCK.getValue() : LockStatusEnum.UNLOCK.getValue())
.lockStatus(lockItems.contains(salarySobItemPO.getSalaryItemId()) ? LockStatusEnum.LOCK.getDefaultLabel() : LockStatusEnum.UNLOCK.getDefaultLabel())
.build();
}

View File

@ -21,19 +21,19 @@ import java.util.Set;
@AllArgsConstructor
@NoArgsConstructor
public class SalaryAcctResultUpdateLockStatusParam {
//锁定状态
private LockStatusEnum lockStatus;
//薪资项目的Id")
private Long salaryItemId;
//薪资核算人员的id")
// private Set<String> idStrSet;
//薪资核算记录的id
private Long salaryAcctRecordId;
//薪资项目的Id
private Long salaryItemId;
//薪资项目的IdList
private Set<Long> salaryItemIds;
//薪资核算记录的id")
private Long salaryAcctRecordId;
//薪资核算人员的id
private Set<Long> acctEmpIds;
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.salaryacct.po;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.hrmelog.annotation.ElogTransform;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -108,6 +108,11 @@ public class SalaryAcctEmployeePO {
@ElogTransform(name = "更新时间")
private Date updateTime;
@ElogTransform(name = "锁定状态")
private Integer lockStatus;
//--------条件----------
//主键id集合
private Collection<Long> ids;

View File

@ -3,25 +3,25 @@ package com.engine.salary.enums.salaryaccounting;
import com.engine.salary.enums.BaseEnum;
public enum LockStatusEnum implements BaseEnum<String> {
DEFAULT("DEFAULT", "默认", 0),
LOCK("LOCK", "锁定", 0),
UNLOCK("UNLOCK", "未锁定", 0);
public enum LockStatusEnum implements BaseEnum<Integer> {
LOCK(1, "LOCK", 0),
UNLOCK(0, "UNLOCK", 0);
private String value;
private Integer value;
private String defaultLabel;
private int labelId;
LockStatusEnum(String value, String defaultLabel, int labelId) {
LockStatusEnum(Integer value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
@Override
public String getValue() {
public Integer getValue() {
return value;
}
@ -34,4 +34,13 @@ public enum LockStatusEnum implements BaseEnum<String> {
public String getDefaultLabel() {
return defaultLabel;
}
public static LockStatusEnum getByValue(Integer value) {
for (LockStatusEnum lockStatusEnum : LockStatusEnum.values()) {
if (lockStatusEnum.getValue().equals(value)) {
return lockStatusEnum;
}
}
return UNLOCK;
}
}

View File

@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* 薪资核算人员
@ -16,7 +17,7 @@ import java.util.List;
* @author qiantao
* @version 1.0
**/
public interface SalaryAcctEmployeeMapper {
public interface SalaryAcctEmployeeMapper {
/**
* 批量插入
@ -117,4 +118,8 @@ public interface SalaryAcctEmployeeMapper {
* @return 返回记录没有返回null
*/
SalaryAcctEmployeePO getById(Long id);
void lockByAcctEmpIds(@Param("lockStatus") Integer lockStatus, @Param("acctEmpIds") Set<Long> acctEmpIds);
void lockByRecordId(@Param("lockStatus") Integer lockStatus, @Param("recordId") Long recordId);
}

View File

@ -15,6 +15,7 @@
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="employee_type" property="employeeType"/>
<result column="lock_status" property="lockStatus"/>
</resultMap>
<resultMap id="SalaryAccEmployeeCountMap"
@ -38,7 +39,8 @@
t.update_time,
t.delete_type,
t.tenant_key,
t.employee_type
t.employee_type,
t.lock_status
</sql>
<sql id="emp1Column">
@ -52,7 +54,7 @@
<insert id="batchInsert">
INSERT INTO hrsa_salary_acct_emp(
salary_acct_record_id, salary_sob_id, employee_id, tax_agent_id, salary_month,
creator, create_time, update_time, delete_type, tenant_key,employee_type)
creator, create_time, update_time, delete_type, tenant_key,employee_type,lock_status)
VALUES
<foreach collection="collection" item="emp" separator=",">
(
@ -66,14 +68,15 @@
#{emp.updateTime},
#{emp.deleteType},
#{emp.tenantKey},
#{emp.employeeType}
#{emp.employeeType},
#{emp.lockStatus}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_acct_emp(
salary_acct_record_id, salary_sob_id, employee_id, tax_agent_id, salary_month,
creator, create_time, update_time, delete_type, tenant_key,employee_type)
creator, create_time, update_time, delete_type, tenant_key,employee_type,lock_status)
<foreach collection="collection" item="emp" separator="union all">
select
@ -87,7 +90,8 @@
#{emp.updateTime,jdbcType=DATE},
#{emp.deleteType,jdbcType=INTEGER},
#{emp.tenantKey,jdbcType=VARCHAR},
#{emp.employeeType,jdbcType=INTEGER}
#{emp.employeeType,jdbcType=INTEGER},
#{emp.lockStatus,jdbcType=INTEGER}
from dual
</foreach>
</insert>
@ -95,7 +99,7 @@
<foreach collection="collection" item="emp" separator=";">
INSERT INTO hrsa_salary_acct_emp(
salary_acct_record_id, salary_sob_id, employee_id, tax_agent_id, salary_month,
creator, create_time, update_time, delete_type, tenant_key,employee_type)
creator, create_time, update_time, delete_type, tenant_key,employee_type,lock_status)
VALUES
(
#{emp.salaryAcctRecordId},
@ -108,7 +112,8 @@
#{emp.updateTime},
#{emp.deleteType},
#{emp.tenantKey},
#{emp.employeeType}
#{emp.employeeType},
#{emp.lockStatus}
)
</foreach>
</insert>
@ -1144,6 +1149,7 @@
<result column="update_time" property="updateTime"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="lock_status" property="lockStatus"/>
</resultMap>
<!-- 表字段 -->
@ -1162,6 +1168,7 @@
, t.delete_type
, t.tenant_key
, t.employee_type
, t.lock_status
</sql>
@ -1252,4 +1259,22 @@
FROM hrsa_salary_acct_emp t
WHERE id = #{id} AND delete_type = 0
</select>
<update id="lockByAcctEmpIds">
UPDATE hrsa_salary_acct_emp
SET lock_status = #{lockStatus}
WHERE delete_type = 0
AND id IN
<foreach collection="acctEmpIds" open="(" item="acctEmpId" separator="," close=")">
#{acctEmpId}
</foreach>
</update>
<update id="lockByRecordId">
UPDATE hrsa_salary_acct_emp
SET lock_status = #{lockStatus}
WHERE delete_type = 0
AND salary_acct_record_id =#{recordId}
</update>
</mapper>

View File

@ -256,4 +256,10 @@ public interface SalaryAcctEmployeeService {
*/
List<SalaryAcctEmployeePO> listByTaxAgentAndSalaryMonth(List<Long> taxAgentIds, Set<Date> salaryMonths);
/**
* 锁定人员
* @param updateParam
*/
void lockEmp(SalaryAcctResultUpdateLockStatusParam updateParam);
}

View File

@ -158,7 +158,7 @@ public interface SalaryAcctResultService {
List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndTaxAgentIds(Collection<Long> salaryAcctRecordIds, Collection<Long> taxAgentIds);
/**
* 更新锁定状态
* 锁定项目
*
* @param updateParam
*/

View File

@ -30,7 +30,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.ListUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -167,7 +166,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
}
//核算锁定的值
Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS());
List<Long> lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds());
sw.stop();
// 9查询相同税款所属期内涉及合并计税的其他薪资核算结果
sw.start("查询相同税款所属期内涉及合并计税的其他薪资核算结果");
@ -258,7 +256,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
// 处理小数点
resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap);
//是否锁定
if (lockSalaryItemIds.contains(salaryItemId) && salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) {
if (salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) {
resultValue = salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId).getResultValue();
}
// 将已经计算过的薪资项目的值转换成公式变量的值添加到集合中

View File

@ -18,6 +18,7 @@ import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
@ -208,7 +209,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
@Override
public List<SalaryAcctEmployeePO> listByParam(SalaryAcctEmployeeQueryParam queryParam) {
ValidUtil.doValidator(queryParam);
// ValidUtil.doValidator(queryParam);
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
@ -697,19 +698,19 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
// }
// list = list.stream().filter(po -> employeeIdsByPostionFilter.contains(po.getEmployeeId())).collect(Collectors.toList());
// }
// 人事状态过滤
if (CollectionUtils.isNotEmpty(param.getStatus())) {
Set<Long> employeeIdsByStatus = new HashSet<>();
employeeList.forEach(simpleEmployee -> {
if (simpleEmployee.getStatus() != null && param.getStatus().contains(simpleEmployee.getStatus())) {
employeeIdsByStatus.add(simpleEmployee.getEmployeeId());
}
});
if (CollectionUtils.isEmpty(employeeIdsByStatus)) {
return Lists.newArrayList();
}
list = list.stream().filter(po -> employeeIdsByStatus.contains(po.getEmployeeId())).collect(Collectors.toList());
}
// 人事状态过滤
if (CollectionUtils.isNotEmpty(param.getStatus())) {
Set<Long> employeeIdsByStatus = new HashSet<>();
employeeList.forEach(simpleEmployee -> {
if (simpleEmployee.getStatus() != null && param.getStatus().contains(simpleEmployee.getStatus())) {
employeeIdsByStatus.add(simpleEmployee.getEmployeeId());
}
});
if (CollectionUtils.isEmpty(employeeIdsByStatus)) {
return Lists.newArrayList();
}
list = list.stream().filter(po -> employeeIdsByStatus.contains(po.getEmployeeId())).collect(Collectors.toList());
}
// 入职日期
if (CollectionUtils.isNotEmpty(param.getHiredate())) {
Set<Long> employeeIdsByHiredate = new HashSet<>();
@ -754,4 +755,32 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
return getSalaryAcctEmployeeMapper().listSome(SalaryAcctEmployeePO.builder().taxAgentIds(taxAgentIds).salaryMonths(salaryMonths).build());
}
@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());
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
return;
}
LockStatusEnum lockStatus = updateParam.getLockStatus();
if (lockStatus == null) {
throw new SalaryRunTimeException("锁定状态异常!");
}
Set<Long> acctEmpIds = updateParam.getAcctEmpIds();
if (CollUtil.isNotEmpty(acctEmpIds)) {
//锁定指定人员
getSalaryAcctEmployeeMapper().lockByAcctEmpIds(lockStatus.getValue(), acctEmpIds);
} else {
//锁定全部
getSalaryAcctEmployeeMapper().lockByRecordId(lockStatus.getValue(), updateParam.getSalaryAcctRecordId());
}
}
}

View File

@ -1382,12 +1382,6 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
loggerContext.setOldValueList(list4log);
SalaryElogConfig.salaryAcctRecordLoggerTemplate.write(loggerContext);
// 存储薪资核算结果数据来源日志
new Thread() {
public void run() {
handleSalaryAcctResultLog(salaryAcctResults);
}
}.start();
//报表
getSalaryAcctReportService(user).batchSave(salaryAcctReports);
}

View File

@ -1,5 +1,6 @@
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;
@ -554,7 +555,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}
Map<String, SalaryAcctResultListColumnDTO> resultMap = Maps.newHashMap();
// 查询薪资核算使用的薪资账套下的薪资项目
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateByRecordId(salaryAcctRecordId,true);
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateByRecordId(salaryAcctRecordId, true);
for (SalarySobItemIncomeCategoryDTO incomeCategoryDTO : salarySobItemAggregateDTO.getIncomeCategories()) {
for (SalarySobItemGroupDTO salarySobItemGroupDTO : incomeCategoryDTO.getItemGroups()) {
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
@ -640,7 +641,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 存储薪资核算结果数据来源日志
salaryAcctResultPOS = getSalaryAcctRecordService(user).listBySalaryAcctEmpId(saveParam.getSalaryAcctEmpId());
saveSalaryAcctResultLog(salaryAcctResultPOSOld, salaryAcctResultPOS);
// 查询操作日志的targetName
String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(salaryAcctEmployeePO.getSalaryAcctRecordId());
@ -717,7 +717,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
@Override
public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) {
StopWatch stopWatch = new StopWatch("总核算耗时id"+calculateParam.getSalaryAcctRecordId());
StopWatch stopWatch = new StopWatch("总核算耗时id" + calculateParam.getSalaryAcctRecordId());
try {
stopWatch.start("数据准备");
// 1查询薪资核算记录
@ -759,15 +759,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 7查询考勤引用的所有字段
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
//核算锁定值
List<Long> lockSalaryItemIds = salaryAcctRecordPO.getLockSalaryItemIds();
Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()), lockSalaryItemIds);
// List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()));
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);
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
@ -790,6 +781,20 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
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("核算耗时");
@ -865,16 +870,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
stopWatch.stop();
log.info(stopWatch.prettyPrint());
// 存储薪资核算数据来源日志
new Thread() {
public void run() {
List<Long> exceptItemIds = new ArrayList<>();
List<Long> salaryAcctEmployeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
exceptItemIds.addAll(lockSalaryItemIds);
exceptItemIds.addAll(salaryItemPOS.stream().filter(PO -> Objects.equals(PO.getValueType(), NumberUtils.INTEGER_ONE) && Objects.equals(PO.getUseInEmployeeSalary(), 0)).map(SalaryItemPO::getId).collect(Collectors.toList()));
getSalaryAcctResultLogService(user).deleteBySalaryAcctEmpIdExceptItemIds(salaryAcctEmployeeIds, exceptItemIds);
}
}.start();
// 记录日志
// 查询操作日志的targetName
String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(calculateParam.getSalaryAcctRecordId());

View File

@ -467,7 +467,7 @@ public class SalaryAcctController {
}
//更新薪资核算结果的锁定状态
//更新薪资项目锁定状态
@POST
@Path("/acctresult/updateLockStatus")
@Produces(MediaType.APPLICATION_JSON)
@ -476,6 +476,14 @@ public class SalaryAcctController {
return new ResponseResult<SalaryAcctResultUpdateLockStatusParam, String>(user).run(getSalaryAcctResultWrapper(user)::updateLockStatusByParam, param);
}
@POST
@Path("/acctresult/lockEmp")
@Produces(MediaType.APPLICATION_JSON)
public String lock(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultUpdateLockStatusParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctResultUpdateLockStatusParam, String>(user).run(getSalaryAcctEmployeeWrapper(user)::lockEmp, param);
}
//批量更新
@POST
@Path("/acctresult/batchUpdate")

View File

@ -5,10 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeAddParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeDeleteParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeSaveParam;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.exception.SalaryRunTimeException;
@ -195,4 +192,7 @@ public class SalaryAcctEmployeeWrapper extends Service {
getSalaryAcctEmployeeService(user).refresh(salaryAcctRecordId);
}
public void lockEmp(SalaryAcctResultUpdateLockStatusParam salaryAcctResultUpdateLockStatusParam) {
getSalaryAcctEmployeeService(user).lockEmp(salaryAcctResultUpdateLockStatusParam);
}
}