账套快照-工资单模板

This commit is contained in:
钱涛 2024-05-06 17:41:39 +08:00
parent 3428de9e33
commit 1cb89a9d1b
5 changed files with 31 additions and 53 deletions

View File

@ -88,7 +88,7 @@ public class SalaryTemplateBO {
.build();
}
public static List<SalaryTemplateSalaryItemSetListDTO> convertSalarySobItemAggregateToSalaryItemSet(SalarySobItemAggregateDTO salarySobItemAggregateDTO, Long currentEmployeeId, boolean isReplenish) {
public static List<SalaryTemplateSalaryItemSetListDTO> convertSalarySobItemAggregateToSalaryItemSet(SalarySobItemAggregateDTO salarySobItemAggregateDTO, boolean isReplenish) {
List<SalaryTemplateSalaryItemSetListDTO> groups = new LinkedList<>();
if (salarySobItemAggregateDTO!=null) {
// 1.员工信息

View File

@ -4,6 +4,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import java.util.List;
@Deprecated
public interface SalarySobItemHideService {
/**

View File

@ -189,9 +189,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}
private SalaryCheckResultService salaryCheckResultService;
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
@Override
public List<SalaryAcctResultPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
@ -247,16 +249,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98831, "薪资核算人员不存在或已被删除"));
}
// 查询是否是回算
SalaryAcctRecordPO byId = getSalaryAcctRecordService(user).getById(salaryAcctEmployeePO.getSalaryAcctRecordId());
boolean isBackCal = Objects.equals(byId.getBackCalcStatus(), 1);
//----------------------------------------------
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctEmployeePO.getSalaryAcctRecordId());
boolean isBackCal = Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctEmployeePO.getSalarySobId());
// 获取关闭显示的分类
List<Long> hideGroupIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salaryAcctEmployeePO.getSalarySobId()).isGroup(1).build());
// 过滤关闭显示的薪资项目分类
salarySobItemGroupPOS = salarySobItemGroupPOS.stream().filter(group -> !(hideGroupIDs.contains(group.getId()))).collect(Collectors.toList());
salarySobItemGroupPOS = salarySobItemGroupPOS.stream().filter(group -> group.getItemHide() == null || group.getItemHide().equals(0L)).collect(Collectors.toList());
// 获取薪资项目分类ID
List<Long> salarySobItemGroupIds = salarySobItemGroupPOS.stream().map(SalarySobItemGroupPO::getId).collect(Collectors.toList());
//加上未分类
@ -264,14 +263,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 查询薪资账套的薪资项目副本(已经过滤关闭分类显示按钮的薪资项目)
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobIdAndGroupId(salaryAcctEmployeePO.getSalarySobId(), salarySobItemGroupIds);
//----------------------------------------------
// 查询薪资核算所用薪资账套的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctEmployeePO.getSalarySobId());
// 获取关闭显示的薪资项目
List<Long> hideItemIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salaryAcctEmployeePO.getSalarySobId()).isGroup(0).build());
// 过滤薪资项目
salarySobItemPOS = salarySobItemPOS.stream().filter(item -> !(hideItemIDs.contains(item.getSalaryItemId()))).collect(Collectors.toList());
salarySobItemPOS = salarySobItemPOS.stream().filter(item -> item.getItemHide() == null || item.getItemHide().equals(0L)).collect(Collectors.toList());
// 查询已发补发薪资项目
List<SalarySobBackItemPO> salarySobBackItemPOList = Collections.emptyList();
@ -279,7 +272,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// key:账套中回算薪资项目的薪资项目id value:账套中回算薪资项目所对应的公式内容
Map<Long, String> salaryBackItemFormula = new HashMap<>();
if (isBackCal) {
salarySobBackItemPOList = getSalarySobBackItemService(user).listBySalarySobId(byId.getSalarySobId());
salarySobBackItemPOList = getSalarySobBackItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
Set<Long> salarySobBackItemIds = SalaryEntityUtil.properties(salarySobBackItemPOList, SalarySobBackItemPO::getSalaryItemId);
salaryBackItemPOS = getSalaryItemService(user).listByIds(salarySobBackItemIds);
// 查询薪资账套中已发补发的公式内容
@ -304,7 +297,7 @@ 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();
List<Long> lockItems = salaryAcctRecordPO.getLockSalaryItemIds() == null ? Collections.emptyList() : salaryAcctRecordPO.getLockSalaryItemIds();
// 转换成薪资核算结果详情dto
return SalaryAcctResultBO.convert2DetailDTO(simpleEmployee, taxAgent, salaryAcctEmployeePO, salarySobEmpFieldPOS, salarySobItemGroupPOS, salarySobItemPOS, salaryItemPOS, salaryAcctResultPOS, salarySobBackItemPOList, salaryBackItemPOS, salaryBackItemFormula, formulaContentMap, lockItems);
@ -756,7 +749,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 回算薪资项目
List<SalarySobBackItemPO> salarySobBackItems = Collections.emptyList();
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) {
salarySobBackItems = salaryAcctSobConfig.getSalarySobBackItems();
salarySobBackItems = salaryAcctSobConfig.getSalarySobBackItems();
}
// 4查询当前租户的所有薪资项目
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listAll();

View File

@ -622,19 +622,13 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 强制开启账套的公式配置
BaseBean baseBean = new BaseBean();
final Boolean openFormulaForcedEditing = "true".equals(baseBean.getPropValue("hrmSalary", "openFormulaForcedEditing"));
// 获取核算时隐藏的薪资项目id
List<Long> hideItemIds = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder()
.salarySobId(param.getSalarySobId())
.isGroup(new Integer(0))
.salaryItemId(param.getSalaryItemId())
.build());
String formulaContent = CollectionUtils.isEmpty(expressFormulas) ? "" : expressFormulas.get(0).getFormula();
Integer valueType = salarySobItemPO.getValueType() == null ? salaryItemPO.getValueType() : salarySobItemPO.getValueType();
salarySobItemFormDTO
.setId(salarySobItemPO.getId())
.setName(salaryItemPO.getName())
.setItemHide(hideItemIds.contains(salaryItemPO.getId()) ? 1 : 0)
.setItemHide(Integer.valueOf(salarySobItemPO.getItemHide().toString()))
.setDataType(salaryItemPO.getDataType())
.setRoundingMode(salarySobItemPO.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : salarySobItemPO.getRoundingMode())
.setPattern(salarySobItemPO.getPattern() == null ? salaryItemPO.getPattern() : salarySobItemPO.getPattern())

View File

@ -6,10 +6,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.biz.SalaryTemplateBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.salaryBill.bo.SalaryTemplateBO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateListDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemListDTO;
@ -24,7 +24,6 @@ import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.OperateTypeEnum;
@ -127,8 +126,8 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
loggerContext.setTargetId(String.valueOf(salaryTemplateNew.getId()));
loggerContext.setTargetName(salaryTemplateNew.getName());
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "设为默认使用"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "设为默认使用"));
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "设为默认使用"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "设为默认使用"));
SalaryElogConfig.salaryTemplateLoggerTemplate.write(loggerContext);
return "";
}
@ -178,8 +177,8 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
loggerContext.setTargetId(String.valueOf(salaryTemplate.getId()));
loggerContext.setTargetName(salaryTemplate.getName());
loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "新增工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "新增工资单模板"));
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新增工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新增工资单模板"));
loggerContext.setNewValues(salaryTemplate);
SalaryElogConfig.salaryTemplateLoggerTemplate.write(loggerContext);
@ -269,8 +268,8 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
loggerContext.setTargetId(String.valueOf(salaryTemplateNew.getId()));
loggerContext.setTargetName(salaryTemplateNew.getName());
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "编辑工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "编辑工资单模板"));
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "编辑工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "编辑工资单模板"));
loggerContext.setOldValues(salaryTemplate);
loggerContext.setNewValues(salaryTemplateNew);
SalaryElogConfig.salaryTemplateLoggerTemplate.write(loggerContext);
@ -325,7 +324,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
}
}
salaryItemSetting.setItems(newItems);
} else if (salaryItemSetting.getItems() != null){
} else if (salaryItemSetting.getItems() != null) {
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
if (salaryItemIdList.contains(Long.valueOf(templateItem.getSalaryItemId()))) {
@ -336,7 +335,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
}
}
List<SalaryTemplateSalaryItemSetListDTO> replenishSalaryItemSettingList = StrUtil.isNotBlank(salaryTemplate.getReplenishSalaryItemSetting())
? JSONArray.parseArray(salaryTemplate.getReplenishSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class): new ArrayList<>();
? JSONArray.parseArray(salaryTemplate.getReplenishSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class) : new ArrayList<>();
for (SalaryTemplateSalaryItemSetListDTO salaryItemSetting : replenishSalaryItemSettingList) {
if ("111111111111111111".equals(salaryItemSetting.getGroupId()) && salaryItemSetting.getItems() != null) {
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
@ -349,7 +348,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
}
}
salaryItemSetting.setItems(newItems);
} else if (!"333333333333333333".equals(salaryItemSetting.getGroupId()) && salaryItemSetting.getItems() != null){
} else if (!"333333333333333333".equals(salaryItemSetting.getGroupId()) && salaryItemSetting.getItems() != null) {
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
if (salaryItemIdList.contains(Long.valueOf(templateItem.getSalaryItemId()))) {
@ -386,8 +385,8 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
loggerContext.setTargetId(String.valueOf(salaryTemplateNew.getId()));
loggerContext.setTargetName(salaryTemplateNew.getName());
loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "复制工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "复制工资单模板"));
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "复制工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "复制工资单模板"));
loggerContext.setNewValues(salaryTemplateNew);
SalaryElogConfig.salaryTemplateLoggerTemplate.write(loggerContext);
@ -414,8 +413,8 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
loggerContext.setTargetId(String.valueOf(template.getId()));
loggerContext.setTargetName(template.getName() + ":" + template.getId());
loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "删除工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "删除工资单模板"));
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除工资单模板"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除工资单模板"));
SalaryElogConfig.salaryTemplateLoggerTemplate.write(loggerContext);
});
return "";
@ -437,25 +436,16 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
public List<SalaryTemplateSalaryItemSetListDTO> getSalaryItemSet(Long salarySobId, boolean isReplenish) {
SalarySobItemAggregateDTO salarySobItemAggregate = getSalarySobItemService(user).getAggregateBySalarySobId(salarySobId);
// 处理薪资账套中隐藏的分类和项目
// 获取关闭显示的分类
List<Long> hideGroupIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(1).build());
// 过滤关闭显示的薪资项目分类
List<SalarySobItemGroupDTO> itemGroupDTOS = salarySobItemAggregate.getItemGroups().stream().filter(group -> !(hideGroupIDs.contains(group.getId()))).collect(Collectors.toList());
List<SalarySobItemGroupDTO> itemGroupDTOS = salarySobItemAggregate.getItemGroups().stream().filter(group -> group.getItemHide() == null || group.getItemHide().equals(0L)).collect(Collectors.toList());
// 获取关闭显示的薪资项目
List<Long> hideItemIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(0).build());
for (SalarySobItemGroupDTO DTO : itemGroupDTOS) {
List<SalarySobItemDTO> items = DTO.getItems();
DTO.setItems(items.stream().filter(item -> !(hideItemIDs.contains(item.getSalaryItemId()))).collect(Collectors.toList()));
DTO.setItems(items.stream().filter(item -> item.getItemHide() == null || item.getItemHide().equals(0L)).collect(Collectors.toList()));
}
itemGroupDTOS = itemGroupDTOS.stream().filter(DTO -> CollectionUtils.isNotEmpty(DTO.getItems())).collect(Collectors.toList());
salarySobItemAggregate.setItemGroups(itemGroupDTOS);
if (hideGroupIDs.contains(0L)) {
// 隐藏了未分类
salarySobItemAggregate.setItems(Collections.emptyList());
} else {
salarySobItemAggregate.setItems(salarySobItemAggregate.getItems().stream().filter(item -> !(hideItemIDs.contains(item.getSalaryItemId()))).collect(Collectors.toList()));
}
return SalaryTemplateBO.convertSalarySobItemAggregateToSalaryItemSet(salarySobItemAggregate, new Long(user.getUID()), isReplenish);
salarySobItemAggregate.setItems(salarySobItemAggregate.getItems().stream().filter(item -> item.getItemHide() == null || item.getItemHide().equals(0L)).collect(Collectors.toList()));
return SalaryTemplateBO.convertSalarySobItemAggregateToSalaryItemSet(salarySobItemAggregate, isReplenish);
}
@Override
@ -472,7 +462,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
Map<Long, String> itemShowNameMap = SalaryEntityUtil.convert2Map(billItemNameList, SalaryBillItemNamePO::getSalaryItemId, SalaryBillItemNamePO::getSalaryItemShowName);
List<SalaryTemplateSalaryItemSetListDTO> salaryTemplateSalaryItemSetListDTOS = SalaryTemplateBO.convertSalarySobItemAggregateToSalaryItemSet(salarySobItemAggregate, new Long(user.getUID()), isReplenish);
List<SalaryTemplateSalaryItemSetListDTO> salaryTemplateSalaryItemSetListDTOS = SalaryTemplateBO.convertSalarySobItemAggregateToSalaryItemSet(salarySobItemAggregate, isReplenish);
salaryTemplateSalaryItemSetListDTOS.stream()
.filter(data -> !StringUtils.equals(data.getGroupId(), "111111111111111111"))
.forEach(data -> {