Compare commits
4 Commits
9486682b52
...
51c09ea28d
| Author | SHA1 | Date |
|---|---|---|
|
|
51c09ea28d | |
|
|
fd9ab50194 | |
|
|
f5f84a9ec3 | |
|
|
e3d6cbe5a1 |
|
|
@ -5,6 +5,7 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +32,10 @@ public class SalaryArchiveItemFormDTO {
|
|||
//薪资项目调整明细")
|
||||
private Map<String,Object> salaryArchiveItemDetail;
|
||||
|
||||
List<Map<String, Object>> currentEffectiveList;
|
||||
|
||||
//是否可以编辑
|
||||
private boolean canOperator;
|
||||
|
||||
private String sumVal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1052,7 +1052,14 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
@Override
|
||||
public void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam) {
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
|
||||
Set<Long> acctEmpIds = updateParam.getAcctEmpIds();
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees;
|
||||
if (CollUtil.isNotEmpty(acctEmpIds)) {
|
||||
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listByIds(acctEmpIds);
|
||||
} else {
|
||||
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -436,6 +436,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
|
||||
List<Long> effectiveSalaryItemDels = Lists.newArrayList();
|
||||
List<SalaryArchiveItemPO> salaryArchiveItemNews = Lists.newArrayList();
|
||||
final int[] sumValCount = {0};
|
||||
salaryArchiveItems.forEach(e -> {
|
||||
// 已生效
|
||||
List<SalaryArchiveItemPO> effectiveList = effectiveSalaryItems.stream().filter(i -> i.getSalaryItemId().equals(e.getSalaryItemId())).collect(Collectors.toList());
|
||||
|
|
@ -447,6 +448,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
Optional<SalaryArchiveItemPO> optionalIneffective = ineffectiveSalaryItems.stream().filter(i -> i.getSalaryItemId().equals(e.getSalaryItemId())).findFirst();
|
||||
SalaryArchiveItemPO ineffectiveSalaryItem = optionalIneffective.orElse(null);
|
||||
|
||||
boolean isSame = false;
|
||||
// 1.检验是否可以调整
|
||||
if (effectiveSalaryItem != null) {
|
||||
// 当前已经生效的时间
|
||||
|
|
@ -457,7 +459,8 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
// 1.2 如果等于当前已生效 fixme 日期比较可能有bug
|
||||
} else if (saveEffectiveTime.equals(effectiveTime)) {
|
||||
if (effectiveBeforeSalaryItem != null && effectiveBeforeSalaryItem.getItemValue().equals(e.getAdjustValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"));
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"));
|
||||
isSame = true;
|
||||
}
|
||||
if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(e.getAdjustValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"));
|
||||
|
|
@ -465,18 +468,23 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
// 1.3 如果>已经生效且<=今天
|
||||
} else if (saveEffectiveTime.after(effectiveTime) && !saveEffectiveTime.after(today)) {
|
||||
if (effectiveSalaryItem.getItemValue().equals(e.getAdjustValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"));
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"));
|
||||
isSame = true;
|
||||
}
|
||||
if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(e.getAdjustValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"));
|
||||
}
|
||||
// 1.4 如果>今天
|
||||
} else if (saveEffectiveTime.after(today) && effectiveSalaryItem.getItemValue().equals(e.getAdjustValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"));
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"));
|
||||
isSame = true;
|
||||
}
|
||||
} else if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(e.getAdjustValue())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"));
|
||||
}
|
||||
if (isSame) {
|
||||
sumValCount[0] = sumValCount[0] +1;
|
||||
}
|
||||
// 2.数据处理
|
||||
if (effectiveSalaryItem != null && saveEffectiveTime.equals(effectiveSalaryItem.getEffectiveTime())) {
|
||||
effectiveSalaryItemDels.add(effectiveSalaryItem.getId());
|
||||
|
|
@ -484,9 +492,15 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
if (ineffectiveSalaryItem != null && saveEffectiveTime.after(today)) {
|
||||
effectiveSalaryItemDels.add(ineffectiveSalaryItem.getId());
|
||||
}
|
||||
salaryArchiveItemNews.add(buildInsert(salaryArchive, e.getSalaryItemId(), e.getAdjustValue(), saveParam, nowTime));
|
||||
if (!isSame) {
|
||||
salaryArchiveItemNews.add(buildInsert(salaryArchive, e.getSalaryItemId(), e.getAdjustValue(), saveParam, nowTime));
|
||||
}
|
||||
});
|
||||
|
||||
if (sumValCount[0] == salaryArchiveItems.size()) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100433, "调整前后不可全部相同"));
|
||||
}
|
||||
|
||||
// 落库处理
|
||||
if (CollectionUtils.isNotEmpty(effectiveSalaryItemDels)) {
|
||||
salaryArchiveItemMapper.deleteBatchIds(effectiveSalaryItemDels);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO;
|
|||
import com.engine.salary.entity.salaryarchive.dto.SingleSalaryItemAdjustRecordListDTO;
|
||||
import com.engine.salary.entity.salaryarchive.param.*;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
|
|
@ -33,6 +34,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -134,10 +136,41 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt
|
|||
// 调整明细数据
|
||||
List<Map<String, Object>> tableData = Lists.newArrayList();
|
||||
|
||||
SalaryArchivePO salaryArchive = getSalaryArchiveService(user).getById(salaryArchiveId);
|
||||
if (salaryArchive == null) {
|
||||
// throw new SalaryRunTimeException("薪资档案不存在");
|
||||
}
|
||||
BigDecimal[] sumVal = {new BigDecimal("0")};
|
||||
List<Map<String, Object>> currentEffectiveList = new ArrayList<>();
|
||||
// 获取所有可被引用的薪资项目
|
||||
if (salaryArchive!= null) {
|
||||
List<SalaryItemPO> salaryItemList = getSalaryArchiveItemService(user).getCanAdjustSalaryItems()
|
||||
.stream().filter(item -> getSalaryItemService(user).filterInRange(Collections.singleton(salaryArchive.getTaxAgentId()), item))
|
||||
.collect(Collectors.toList());
|
||||
Collection<Long> salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
List<SalaryArchiveItemPO> salaryArchiveItemList = getSalaryArchiveService(user).getCurrentEffectiveItemList(Collections.singletonList(salaryArchiveId), salaryItemIds);
|
||||
salaryItemList.forEach(s -> {
|
||||
Optional<SalaryArchiveItemPO> optionalItem = salaryArchiveItemList.stream().filter(f -> f.getSalaryItemId().equals(s.getId())).findFirst();
|
||||
Map<String, Object> salaryItemMap = new LinkedHashMap<>();
|
||||
salaryItemMap.put("id", s.getId());
|
||||
salaryItemMap.put("name", s.getName());
|
||||
String value = optionalItem.isPresent() ? optionalItem.get().getItemValue() : "";
|
||||
salaryItemMap.put("value", value);
|
||||
if (NumberUtils.isCreatable( value)) {
|
||||
sumVal[0] = sumVal[0].add(new BigDecimal(value));
|
||||
}
|
||||
currentEffectiveList.add(salaryItemMap);
|
||||
});
|
||||
// 计算总额
|
||||
}
|
||||
|
||||
|
||||
return SalaryArchiveItemFormDTO.builder()
|
||||
.salaryArchiveId(salaryArchiveId)
|
||||
.salaryArchiveItemForm(buildSalaryArchiveItemForm(null, null, null))
|
||||
.salaryArchiveItemDetail(buildSalaryArchiveItemAdjustDetailTable(tableData))
|
||||
.currentEffectiveList(currentEffectiveList)
|
||||
.sumVal(sumVal[0].toPlainString())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,12 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -384,16 +387,26 @@ public class SalaryArchiveWrapper extends Service {
|
|||
.collect(Collectors.toList());
|
||||
Collection<Long> salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
List<SalaryArchiveItemPO> salaryArchiveItemList = getSalaryArchiveService(user).getCurrentEffectiveItemList(Collections.singletonList(salaryArchiveId), salaryItemIds);
|
||||
List<String> valueList = new ArrayList<>();
|
||||
salaryItemList.forEach(s -> {
|
||||
Optional<SalaryArchiveItemPO> optionalItem = salaryArchiveItemList.stream().filter(f -> f.getSalaryItemId().equals(s.getId())).findFirst();
|
||||
Map<String, Object> salaryItemMap = new LinkedHashMap<>();
|
||||
salaryItemMap.put("id", s.getId());
|
||||
salaryItemMap.put("name", s.getName());
|
||||
salaryItemMap.put("value", optionalItem.isPresent() ? optionalItem.get().getItemValue() : "");
|
||||
valueList.add(Utils.null2String(optionalItem.isPresent() ? optionalItem.get().getItemValue() : ""));
|
||||
salaryItemMap.put("dataType", s.getDataType());
|
||||
salaryItemMap.put("pattern", s.getPattern());
|
||||
salaryItems.add(salaryItemMap);
|
||||
});
|
||||
// 合计值
|
||||
BigDecimal sumVal = valueList.stream().filter(NumberUtils::isCreatable).map(BigDecimal::new)
|
||||
.reduce(new BigDecimal("0"), BigDecimal::add);
|
||||
Map<String, Object> sumValSalaryItemMap = new LinkedHashMap<>();
|
||||
sumValSalaryItemMap.put("id", "111111111");
|
||||
sumValSalaryItemMap.put("name", "工资总额");
|
||||
sumValSalaryItemMap.put("value", sumVal.toPlainString());
|
||||
salaryItems.add(sumValSalaryItemMap);
|
||||
|
||||
return SalaryArchiveFormDTO.builder()
|
||||
.id(salaryArchiveId)
|
||||
|
|
|
|||
Loading…
Reference in New Issue