Merge branch 'feature/231202-批量编辑' into release/2.9.10.2312.02
# Conflicts: # src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java
This commit is contained in:
commit
8164660ebf
|
|
@ -7,7 +7,6 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ public class WeaTableColumnGroup extends WeaTableColumn {
|
|||
*/
|
||||
private Integer pattern;
|
||||
|
||||
/**
|
||||
* 字段类型
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
private List<WeaTableColumnGroup> children;
|
||||
|
||||
public WeaTableColumnGroup() {
|
||||
|
|
@ -40,6 +45,13 @@ public class WeaTableColumnGroup extends WeaTableColumn {
|
|||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public WeaTableColumnGroup(String width, String text, String column, String lockStatus, Integer pattern, String dataType) {
|
||||
super(width, text, column);
|
||||
this.lockStatus = lockStatus;
|
||||
this.pattern = pattern;
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
|
||||
public WeaTableColumnGroup(String width, String text, String column, List<WeaTableColumnGroup> children) {
|
||||
super(width, text, column);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ public class SalaryAcctResultReportBO {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static List<SalaryAcctResultReportPO> convert2ReportPO(Collection<SalaryAcctResultTempPO> temps, Map<Long, DataCollectionEmployee> emps) {
|
||||
// Map<Long, DataCollectionEmployee> longDataCollectionEmployeeMap = SalaryEntityUtil.convert2Map(emps, DataCollectionEmployee::getEmployeeId);
|
||||
if (CollectionUtils.isEmpty(temps)) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.engine.salary.util.page.SalaryPageUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
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 org.springframework.beans.BeanUtils;
|
||||
|
|
@ -180,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()));
|
||||
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
|
||||
} else {
|
||||
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
|
||||
childrenColumns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
|
||||
}
|
||||
}
|
||||
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemGroupDTO.getName(), 0), salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
|
||||
|
|
@ -191,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()));
|
||||
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
|
||||
} else {
|
||||
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
|
||||
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), salarySobItemDTO.getWidth()), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), 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()));
|
||||
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
|
||||
} else {
|
||||
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
|
||||
columns.add(new WeaTableColumnGroup(SalaryPageUtil.selfAdaption(salarySobItemDTO.getName(), 0), salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern(), salarySobItemDTO.getDataType()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -417,7 +418,8 @@ public class SalaryAcctResultBO {
|
|||
List<SalarySobBackItemPO> salarySobBackItemPOS,
|
||||
List<SalaryItemPO> salaryBackItemPOS,
|
||||
Map<Long, String> salaryBackItemFormula,
|
||||
Map<String, SalaryAcctResultListColumnDTO> formulaContentMap) {
|
||||
Map<String, SalaryAcctResultListColumnDTO> formulaContentMap,
|
||||
List<Long> lockItems) {
|
||||
|
||||
// 员工信息字段
|
||||
Map<String, String> employeeFieldValueMap = SalaryAcctFormulaBO.convert2FormulaEmployee(simpleEmployee);
|
||||
|
|
@ -446,7 +448,7 @@ public class SalaryAcctResultBO {
|
|||
List<SalarySobItemPO> groupItems = salarySobItemPOMap.getOrDefault(groupPO.getId(), Collections.emptyList());
|
||||
if (CollectionUtils.isNotEmpty(groupItems)) {
|
||||
List<SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemDTO> items = groupItems.stream()
|
||||
.map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap))
|
||||
.map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap, lockItems))
|
||||
.collect(Collectors.toList());
|
||||
itemsByGroup.add(SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemByGroupDTO.builder()
|
||||
.salarySobItemGroupId(groupPO.getId())
|
||||
|
|
@ -459,7 +461,7 @@ public class SalaryAcctResultBO {
|
|||
List<SalarySobItemPO> noGroupItems = salarySobItemPOMap.getOrDefault(0L, Collections.emptyList());
|
||||
if (CollectionUtils.isNotEmpty(noGroupItems)) {
|
||||
List<SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemDTO> items = noGroupItems.stream()
|
||||
.map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap))
|
||||
.map(salarySobItemPO -> convert2SalaryAcctResultDetailItemDTO(salarySobItemPO, salaryItemMap.get(salarySobItemPO.getSalaryItemId()), resultValueMap, formulaContentMap, lockItems))
|
||||
.collect(Collectors.toList());
|
||||
itemsByGroup.add(SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemByGroupDTO.builder()
|
||||
.salarySobItemGroupId(0L)
|
||||
|
|
@ -529,7 +531,8 @@ public class SalaryAcctResultBO {
|
|||
private static SalaryAcctResultDetailDTO.SalaryAcctResultDetailItemDTO convert2SalaryAcctResultDetailItemDTO(SalarySobItemPO salarySobItemPO,
|
||||
SalaryItemPO salaryItemPO,
|
||||
Map<Long, String> resultValueMap,
|
||||
Map<String, SalaryAcctResultListColumnDTO> formulaContentMap) {
|
||||
Map<String, SalaryAcctResultListColumnDTO> formulaContentMap,
|
||||
List<Long> lockItems) {
|
||||
|
||||
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(Optional.ofNullable(salarySobItemPO).map(SalarySobItemPO::getValueType).orElse(0));
|
||||
String itemFormulaContent;
|
||||
|
|
@ -549,6 +552,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())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -615,6 +619,34 @@ public class SalaryAcctResultBO {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static List<SalaryAcctResultPO> batchEditConvert2PO(Map<String, String> salaryAcctResultOldPOMap,
|
||||
List<SalaryAcctResultSaveParam.SalaryAcctResultDetailItemParam> items,
|
||||
SalaryAcctEmployeePO salaryAcctEmployee,
|
||||
Long employeeId) {
|
||||
if (CollectionUtils.isEmpty(items) || ObjectUtils.isEmpty(salaryAcctEmployee)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Date now = new Date();
|
||||
return items.stream()
|
||||
.map(e -> SalaryAcctResultPO.builder()
|
||||
.salarySobId(salaryAcctEmployee.getSalarySobId())
|
||||
.salaryItemId(e.getSalaryItemId())
|
||||
.salaryAcctRecordId(salaryAcctEmployee.getSalaryAcctRecordId())
|
||||
.salaryAcctEmpId(salaryAcctEmployee.getId())
|
||||
.employeeId(salaryAcctEmployee.getEmployeeId())
|
||||
.taxAgentId(salaryAcctEmployee.getTaxAgentId())
|
||||
.resultValue(StringUtils.trim(e.getResultValue()))
|
||||
.originResultValue(salaryAcctResultOldPOMap.get(salaryAcctEmployee.getId() + "-" + e.getSalaryItemId()))
|
||||
.creator(employeeId)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static Map<String, String> buildEmployeeFieldName() {
|
||||
Field[] declaredFields = SalaryFormulaEmployeeDTO.class.getDeclaredFields();
|
||||
Map<String, String> employeeFieldNameMap = Maps.newHashMapWithExpectedSize(declaredFields.length);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ public class SalaryAcctResultDetailDTO {
|
|||
|
||||
// 保留小数位数
|
||||
private Integer pattern;
|
||||
|
||||
// 锁定状态
|
||||
private String lockStatus;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName SalaryAcctResultBatchUpdateParam
|
||||
* @author Harryxzy
|
||||
* @date 2023/12/4 13:48
|
||||
* @description 批量更新参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SalaryAcctResultBatchUpdateParam {
|
||||
|
||||
//薪资核算记录的id
|
||||
@DataCheck(require = true, message = "薪资核算记录ID不得为空")
|
||||
private Long salaryAcctRecordId;
|
||||
|
||||
//薪资项目的Id
|
||||
@DataCheck(require = true, message = "薪资项目id不得为空")
|
||||
private Long salaryItemId;
|
||||
|
||||
// 薪资核算人员id
|
||||
private List<Long> idList;
|
||||
|
||||
//薪资项目值
|
||||
private String value;
|
||||
|
||||
}
|
||||
|
|
@ -4,10 +4,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|||
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultUpdateLockStatusParam;
|
||||
import com.engine.salary.entity.salaryacct.param.*;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
|
|
@ -207,4 +204,10 @@ public interface SalaryAcctResultService {
|
|||
* @return
|
||||
*/
|
||||
Boolean checkAuth(Long salaryAcctRecordId);
|
||||
|
||||
/**
|
||||
* 薪资核算结果批量更新
|
||||
* @param param
|
||||
*/
|
||||
void batchUpdate(SalaryAcctResultBatchUpdateParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import com.api.formmode.mybatis.util.SqlProxyHandle;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.entity.salaryBill.po.SalarySendPO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctRecordBO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
|
||||
|
|
@ -12,6 +15,7 @@ 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.salarysob.dto.SalarySobCycleDTO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
|
|
@ -31,11 +35,14 @@ import com.engine.salary.util.db.MapperProxyFactory;
|
|||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
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.hrm.User;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -77,6 +84,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobItemService getSalarySobItemService(User user) {
|
||||
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// private SalaryCheckResultService salaryCheckResultService;
|
||||
//
|
||||
// private SalaryCheckResultDetailService salaryCheckResultDetailService;
|
||||
|
|
@ -102,6 +113,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalaryStatisticsReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SalaryAcctRecordPO getById(Long id) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
|
|
@ -46,15 +47,18 @@ 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.engine.salary.util.valid.ValidUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.weaver.util.threadPool.ThreadPoolUtil;
|
||||
import com.weaver.util.threadPool.constant.ModulePoolEnum;
|
||||
import com.weaver.util.threadPool.entity.LocalRunnable;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
|
@ -298,9 +302,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
TaxAgentPO taxAgent = getTaxAgentService(user).getById(salaryAcctEmployeePO.getTaxAgentId());
|
||||
// 查询公式
|
||||
Map<String, SalaryAcctResultListColumnDTO> formulaContentMap = getSalaryAcctResultService(user).getColumnBySalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId());
|
||||
List<Long> lockItems = byId.getLockSalaryItemIds() == null ? Collections.emptyList() : byId.getLockSalaryItemIds();
|
||||
|
||||
// 转换成薪资核算结果详情dto
|
||||
return SalaryAcctResultBO.convert2DetailDTO(simpleEmployee, taxAgent, salaryAcctEmployeePO, salarySobEmpFieldPOS, salarySobItemGroupPOS, salarySobItemPOS, salaryItemPOS, salaryAcctResultPOS, salarySobBackItemPOList, salaryBackItemPOS, salaryBackItemFormula, formulaContentMap);
|
||||
return SalaryAcctResultBO.convert2DetailDTO(simpleEmployee, taxAgent, salaryAcctEmployeePO, salarySobEmpFieldPOS, salarySobItemGroupPOS, salarySobItemPOS, salaryItemPOS, salaryAcctResultPOS, salarySobBackItemPOList, salaryBackItemPOS, salaryBackItemFormula, formulaContentMap, lockItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1088,4 +1093,107 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdate(SalaryAcctResultBatchUpdateParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
|
||||
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(param.getSalaryAcctRecordId());
|
||||
if (ObjectUtils.isEmpty(salaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException("薪资核算记录不存在,或已被删除");
|
||||
}
|
||||
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
|
||||
// 薪资账套中包含的薪资项目
|
||||
List<Long> salarySobItemIds = salarySobItemPOS.stream().map(SalarySobItemPO::getSalaryItemId).collect(Collectors.toList());
|
||||
if (!salarySobItemIds.contains(param.getSalaryItemId())) {
|
||||
throw new SalaryRunTimeException("该账套不包含该薪资项目或已被删除,请先检查账套");
|
||||
}
|
||||
// 获取需要更新的核算人员信息
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(param.getIdList())) {
|
||||
// 没有选择核算人员,更新核算记录中所有人员
|
||||
salaryAcctEmployeePOList.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salaryAcctRecordPO.getId()));
|
||||
} else {
|
||||
salaryAcctEmployeePOList.addAll(getSalaryAcctEmployeeService(user).listByIds(param.getIdList()));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployeePOList)) {
|
||||
List<Long> salaryAcctEmployeeIdList = SalaryEntityUtil.properties(salaryAcctEmployeePOList, SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
// 查询薪资核算结果
|
||||
List<SalaryAcctResultPO> resultPOS = listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmployeeIdList, Collections.singleton(param.getSalaryItemId()));
|
||||
Map<Long, SalaryAcctResultPO> salaryAcctResultPOMap = SalaryEntityUtil.convert2Map(resultPOS, SalaryAcctResultPO::getSalaryAcctEmpId);
|
||||
List<DataCollectionEmployee> dataCollectionEmployees = getSalaryEmployeeService(user).listAllForReport();
|
||||
Map<Long, DataCollectionEmployee> emps = SalaryEntityUtil.convert2Map(dataCollectionEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
List<SalaryAcctResultPO> needUpdateList = new ArrayList<>();
|
||||
List<SalaryAcctResultPO> needInsertList = new ArrayList<>();
|
||||
Date now = new Date();
|
||||
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = new ArrayList<>();
|
||||
salaryAcctEmployeePOList.forEach(salaryAcctEmployeePO -> {
|
||||
if (salaryAcctResultPOMap.containsKey(salaryAcctEmployeePO.getId())) {
|
||||
// 更新
|
||||
SalaryAcctResultPO po = salaryAcctResultPOMap.get(salaryAcctEmployeePO.getId());
|
||||
po.setResultValue(param.getValue());
|
||||
po.setUpdateTime(now);
|
||||
needUpdateList.add(po);
|
||||
} else {
|
||||
// 新增
|
||||
needInsertList.add(SalaryAcctResultPO.builder()
|
||||
.salarySobId(salaryAcctRecordPO.getSalarySobId())
|
||||
.salaryItemId(param.getSalaryItemId())
|
||||
.salaryAcctRecordId(param.getSalaryAcctRecordId())
|
||||
.salaryAcctEmpId(salaryAcctEmployeePO.getId())
|
||||
.employeeId(salaryAcctEmployeePO.getEmployeeId())
|
||||
.taxAgentId(salaryAcctEmployeePO.getTaxAgentId())
|
||||
.resultValue(param.getValue())
|
||||
.originResultValue("")
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build());
|
||||
}
|
||||
|
||||
// 报表
|
||||
SalaryAcctResultReportPO po = SalaryAcctResultReportPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.salarySobId(salaryAcctRecordPO.getSalarySobId())
|
||||
.salaryItemId(param.getSalaryItemId())
|
||||
.salaryAcctRecordId(param.getSalaryAcctRecordId())
|
||||
.salaryAcctEmpId(salaryAcctEmployeePO.getId().toString())
|
||||
.employeeId(salaryAcctEmployeePO.getEmployeeId().toString())
|
||||
.taxAgentId(salaryAcctEmployeePO.getTaxAgentId())
|
||||
.resultValue(param.getValue())
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
DataCollectionEmployee dataCollectionEmployee = emps.get(salaryAcctEmployeePO.getEmployeeId());
|
||||
if (dataCollectionEmployee != null) {
|
||||
po.setDepartmentId(dataCollectionEmployee.getDepartmentId());
|
||||
po.setSubcompanyId(dataCollectionEmployee.getSubcompanyid());
|
||||
po.setCostcenterId(dataCollectionEmployee.getCostcenterId());
|
||||
po.setJobtitleId(dataCollectionEmployee.getJobtitleId());
|
||||
po.setLocationId(dataCollectionEmployee.getLocationId());
|
||||
}
|
||||
salaryAcctResultReportPOS.add(po);
|
||||
});
|
||||
|
||||
// 入库
|
||||
if (CollectionUtils.isNotEmpty(needUpdateList)) {
|
||||
// 数据加密
|
||||
encryptUtil.encryptList(needUpdateList, SalaryAcctResultPO.class);
|
||||
List<List<SalaryAcctResultPO>> partition = Lists.partition(needUpdateList, 100);
|
||||
partition.forEach(getSalaryAcctResultMapper()::batchUpdate);
|
||||
}
|
||||
batchSave(needInsertList);
|
||||
|
||||
// 报表入库前先删除
|
||||
getSalaryAcctReportService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(param.getIdList(), Collections.singletonList(param.getSalaryItemId()) );
|
||||
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -158,6 +158,7 @@ public class SalaryAcctController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, String>(user).run(getSalaryAcctRecordWrapper(user)::backCalculate, param.getSalaryAcctRecordId());
|
||||
}
|
||||
|
||||
/* ********************************薪资核算记录相关 end*********************************/
|
||||
|
||||
|
||||
|
|
@ -448,6 +449,15 @@ public class SalaryAcctController {
|
|||
return new ResponseResult<SalaryAcctResultUpdateLockStatusParam, String>(user).run(getSalaryAcctResultWrapper(user)::updateLockStatusByParam, param);
|
||||
}
|
||||
|
||||
//批量更新
|
||||
@POST
|
||||
@Path("/acctresult/batchUpdate")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String batchUpdate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultBatchUpdateParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryAcctResultBatchUpdateParam, String>(user).run(getSalaryAcctResultWrapper(user)::batchUpdate, param);
|
||||
}
|
||||
|
||||
//薪资核算
|
||||
@POST
|
||||
@Path("/acctresult/accounting")
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ import com.engine.salary.entity.progress.ProgressDTO;
|
|||
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultListColumnDTO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctCalculateParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultUpdateLockStatusParam;
|
||||
import com.engine.salary.entity.salaryacct.param.*;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.*;
|
||||
|
|
@ -260,6 +257,13 @@ public class SalaryAcctResultWrapper extends Service {
|
|||
return getSalaryAcctResultService(user).checkAuth(salaryAcctRecordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪资核算结果批量更新
|
||||
* @param param
|
||||
*/
|
||||
public void batchUpdate(SalaryAcctResultBatchUpdateParam param) {
|
||||
getSalaryAcctResultService(user).batchUpdate(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪资核算-校验
|
||||
|
|
|
|||
Loading…
Reference in New Issue