薪酬迁移工具
This commit is contained in:
parent
845f117d9c
commit
9d26e1228f
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.entity.config;
|
||||
|
||||
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
|
||||
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
||||
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
|
||||
import com.engine.salary.entity.taxagent.config.TaxAgentConfig;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentBasePO;
|
||||
|
|
@ -31,10 +30,6 @@ public class SalaryConfig {
|
|||
|
||||
//社保方案
|
||||
|
||||
//公式配置
|
||||
@XStreamAlias("FormluaConfig")
|
||||
private FormluaConfig formluaConfig;
|
||||
|
||||
//薪资项目
|
||||
@XStreamAlias("SalaryItemConfig")
|
||||
private SalaryItemAllConfig salaryItemConfig;
|
||||
|
|
@ -43,6 +38,7 @@ public class SalaryConfig {
|
|||
@XStreamAlias("ArchiveFieldConfig")
|
||||
private ArchiveFieldConfig archiveFieldConfig;
|
||||
|
||||
//分权基础设置
|
||||
@XStreamAlias("TaxAgentBaseConfig")
|
||||
private TaxAgentBasePO taxAgentBaseConfig;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.entity.salaryformula.po;
|
|||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -9,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
|
|
@ -111,4 +113,8 @@ public class FormulaPO {
|
|||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
|
||||
|
||||
@XStreamImplicit
|
||||
private List<FormulaVar> formulaVars;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.entity.salaryitem.po;
|
||||
|
||||
import com.engine.hrmelog.annotation.ElogTransform;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
|
|
@ -252,4 +253,7 @@ public class SalaryItemPO {
|
|||
@XStreamAlias("defaultValue")
|
||||
@XStreamAsAttribute
|
||||
private String defaultValue;
|
||||
|
||||
@XStreamAlias("Formula")
|
||||
FormulaPO formula;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.salary.entity.salarysob.po;
|
||||
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
|
|
@ -156,6 +158,11 @@ public class SalarySobBackItemPO{
|
|||
|
||||
|
||||
|
||||
@XStreamAlias("SalaryItem")
|
||||
private SalaryItemPO salaryItem;
|
||||
|
||||
@XStreamAlias("Formula")
|
||||
FormulaPO formula;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.entity.salarysob.po;
|
|||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -106,6 +107,9 @@ public class SalarySobItemGroupPO {
|
|||
@XStreamAsAttribute
|
||||
private Date updateTime;
|
||||
|
||||
@XStreamImplicit
|
||||
private List<SalarySobItemPO> salarySobItems;
|
||||
|
||||
|
||||
Collection<Long> ids;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.engine.salary.entity.salarysob.po;
|
||||
|
||||
import com.engine.hrmelog.annotation.ElogTransform;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
|
@ -164,6 +166,12 @@ public class SalarySobItemPO {
|
|||
@XStreamAsAttribute
|
||||
private Date updateTime;
|
||||
|
||||
@XStreamAlias("SalaryItem")
|
||||
private SalaryItemPO salaryItem;
|
||||
|
||||
@XStreamAlias("Formula")
|
||||
private FormulaPO formula;
|
||||
|
||||
//in
|
||||
Collection<Long> ids;
|
||||
Collection<Long> salarySobIds;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ public interface FormulaMapper {
|
|||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<FormulaPO> listAll();
|
||||
|
||||
|
||||
List<FormulaPO> list2All();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@
|
|||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="list2All" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_formula t
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -56,9 +56,13 @@ public interface SalaryFormulaService {
|
|||
|
||||
List<FormulaPO> listByIds(List<Long> formulaIds);
|
||||
|
||||
List<FormulaPO> listAll();
|
||||
|
||||
List<FormulaVar> listAllVar();
|
||||
|
||||
void update(FormulaPO formulaPO);
|
||||
|
||||
FormluaConfig getConfig();
|
||||
|
||||
void parseConfig(FormluaConfig config);
|
||||
Long add(FormulaPO formula);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,4 +66,7 @@ public interface SalarySobBackItemService {
|
|||
int deleteBySalarySobIds(Collection<Long> salarySobIds);
|
||||
|
||||
List<SalarySobBackItemPO> listBySalaryItemIds(Collection<Long> salaryItemIds);
|
||||
|
||||
List<SalarySobBackItemPO> getConfig(Long salarySobId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,4 +44,6 @@ public interface SalarySobItemGroupService {
|
|||
* @param salarySobIds 薪资账套id
|
||||
*/
|
||||
void deleteBySalarySobIds(Collection<Long> salarySobIds);
|
||||
|
||||
List<SalarySobItemGroupPO> getConfig(Long salarySobId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
|
||||
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO;
|
||||
|
|
@ -128,4 +126,6 @@ public interface SalarySobItemService {
|
|||
SalarySobItemFormDTO getSalaryItemForm(SalarySobItemPO param);
|
||||
|
||||
void update(SalarySobItemPO po);
|
||||
|
||||
List<SalarySobItemPO> getConfig(Long salarySobId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,6 @@ public interface TaxAgentService {
|
|||
*/
|
||||
Collection<Long> listEmployeeIdsInTaxAgent(Long taxAgentId);
|
||||
|
||||
|
||||
List<TaxAgentConfig> getConfig();
|
||||
|
||||
void parseConfig(List<TaxAgentConfig> configs);
|
||||
|
|
|
|||
|
|
@ -762,16 +762,22 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
.orElse(new ArrayList<>())
|
||||
.forEach(itemPO -> {
|
||||
if (idMap.containsKey(itemPO.getId())) {
|
||||
itemPO.setCode(null);
|
||||
itemPO.setName(null);
|
||||
itemPO.setCreator(uid);
|
||||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else if (nameMap.containsKey(itemPO.getName())) {
|
||||
SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName());
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改code
|
||||
itemPO.setCode(null);
|
||||
itemPO.setCreator(uid);
|
||||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
|
||||
} else if (codeMap.containsKey(itemPO.getCode())) {
|
||||
SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode());
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改名字
|
||||
itemPO.setName(null);
|
||||
itemPO.setCreator(uid);
|
||||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
|
|
@ -20,11 +21,10 @@ import com.engine.salary.service.FormulaRunService;
|
|||
import com.engine.salary.service.RemoteExcelService;
|
||||
import com.engine.salary.service.SalaryFormulaService;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -398,6 +398,16 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
return getFormulaMapper().listByIds(formulaIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FormulaPO> listAll() {
|
||||
return getFormulaMapper().listAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FormulaVar> listAllVar() {
|
||||
return getFormulaVarMapper().listAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(FormulaPO formulaPO) {
|
||||
getFormulaMapper().updateIgnoreNull(formulaPO);
|
||||
|
|
@ -411,29 +421,30 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(FormluaConfig config) {
|
||||
List<FormulaPO> formulaPOS = getFormulaMapper().listAll();
|
||||
Set<Long> formulas = SalaryEntityUtil.properties(formulaPOS, FormulaPO::getId);
|
||||
public Long add(FormulaPO formula) {
|
||||
if (formula == null) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
Optional.ofNullable(config.getFormulas())
|
||||
.orElse(new ArrayList<>())
|
||||
.forEach(formulaPO -> {
|
||||
Long id = formulaPO.getId();
|
||||
if (!formulas.contains(id)) {
|
||||
getFormulaMapper().insertIgnoreNull(formulaPO);
|
||||
}
|
||||
});
|
||||
long uid = user.getUID();
|
||||
Date now = new Date();
|
||||
long formulaId = IdGenerator.generate();
|
||||
formula.setId(formulaId);
|
||||
formula.setCreator(uid);
|
||||
formula.setCreateTime(now);
|
||||
|
||||
List<FormulaVar> formulaVarPOs = getFormulaVarMapper().listAll();
|
||||
Set<Long> formulaVars = SalaryEntityUtil.properties(formulaVarPOs, FormulaVar::getId);
|
||||
Optional.ofNullable(config.getFormulaVars())
|
||||
.orElse(new ArrayList<>())
|
||||
.forEach(po -> {
|
||||
Long id = po.getId();
|
||||
if (!formulaVars.contains(id)) {
|
||||
getFormulaVarMapper().insertIgnoreNull(po);
|
||||
}
|
||||
});
|
||||
getFormulaMapper().insertIgnoreNull(formula);
|
||||
|
||||
List<FormulaVar> formulaVars = formula.getFormulaVars();
|
||||
if (CollectionUtil.isNotEmpty(formulaVars)) {
|
||||
formulaVars.forEach(v -> {
|
||||
v.setId(IdGenerator.generate());
|
||||
v.setFormulaId(formulaId);
|
||||
v.setCreator(uid);
|
||||
v.setCreateTime(now);
|
||||
getFormulaVarMapper().insertIgnoreNull(v);
|
||||
});
|
||||
}
|
||||
return formulaId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -721,9 +721,9 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(Integer.parseInt(e.getValueType())).getDefaultLabel());
|
||||
row.add(e.getFormula() == null ? "" : e.getFormula());
|
||||
String sqlReturnKey = "";
|
||||
if(e.getExtendParam() != null){
|
||||
if (e.getExtendParam() != null) {
|
||||
sqlReturnKey = JsonUtil.parseMap(Util.null2String(e.getExtendParam()), String.class).getOrDefault("sqlReturnKey", "");
|
||||
if("null".equals(sqlReturnKey)){
|
||||
if ("null".equals(sqlReturnKey)) {
|
||||
sqlReturnKey = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
row.add(e.getSortedIndex() == null ? "" : e.getSortedIndex());
|
||||
row.add(e.getWidth() == null ? "" : e.getWidth());
|
||||
row.add(e.getDefaultValue() == null ? "" : e.getDefaultValue());
|
||||
row.add(e.getDescription()== null ? "" : e.getDescription());
|
||||
row.add(e.getDescription() == null ? "" : e.getDescription());
|
||||
rows.add(row);
|
||||
});
|
||||
|
||||
|
|
@ -760,9 +760,9 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(Integer.parseInt(e.getValueType())).getDefaultLabel());
|
||||
row.add(e.getFormula() == null ? "" : e.getFormula());
|
||||
String sqlReturnKey = "";
|
||||
if(e.getExtendParam() != null){
|
||||
if (e.getExtendParam() != null) {
|
||||
sqlReturnKey = JsonUtil.parseMap(Util.null2String(e.getExtendParam()), String.class).getOrDefault("sqlReturnKey", "");
|
||||
if("null".equals(sqlReturnKey)){
|
||||
if ("null".equals(sqlReturnKey)) {
|
||||
sqlReturnKey = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -770,7 +770,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
row.add(e.getSortedIndex() == null ? "" : e.getSortedIndex());
|
||||
row.add(e.getWidth() == null ? "" : e.getWidth());
|
||||
row.add(e.getDefaultValue() == null ? "" : e.getDefaultValue());
|
||||
row.add(e.getDescription()== null ? "" : e.getDescription());
|
||||
row.add(e.getDescription() == null ? "" : e.getDescription());
|
||||
rows.add(row);
|
||||
});
|
||||
}
|
||||
|
|
@ -780,6 +780,21 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
@Override
|
||||
public SalaryItemAllConfig getConfig() {
|
||||
List<SalaryItemPO> salaryItemPOList = listByParam(SalaryItemSearchParam.builder().useInEmployeeSalary(0).build());
|
||||
List<FormulaPO> formulaPOS = getSalaryFormulaService(user).listAll();
|
||||
Map<Long, FormulaPO> formulaMap = SalaryEntityUtil.convert2Map(formulaPOS, FormulaPO::getId);
|
||||
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listAllVar();
|
||||
Map<Long, List<FormulaVar>> varListMap = SalaryEntityUtil.group2Map(formulaVars, FormulaVar::getFormulaId);
|
||||
|
||||
salaryItemPOList.forEach(itemPO -> {
|
||||
if (itemPO.getFormulaId() != null) {
|
||||
FormulaPO formulaPO = formulaMap.get(itemPO.getFormulaId());
|
||||
if (formulaPO != null) {
|
||||
formulaPO.setFormulaVars(varListMap.get(itemPO.getFormulaId()));
|
||||
itemPO.setFormula(formulaPO);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return SalaryItemAllConfig.builder().salaryItems(salaryItemPOList).build();
|
||||
}
|
||||
|
||||
|
|
@ -794,16 +809,27 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
Optional.ofNullable(salaryItemConfig.getSalaryItems())
|
||||
.orElse(new ArrayList<>())
|
||||
.forEach(itemPO -> {
|
||||
|
||||
Long formulaId = getSalaryFormulaService(user).add(itemPO.getFormula());
|
||||
itemPO.setFormulaId(formulaId);
|
||||
|
||||
if (idMap.containsKey(itemPO.getId())) {
|
||||
itemPO.setCode(null);
|
||||
itemPO.setName(null);
|
||||
itemPO.setCreator(uid);
|
||||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else if (nameMap.containsKey(itemPO.getName())) {
|
||||
SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName());
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改code
|
||||
itemPO.setCode(null);
|
||||
itemPO.setCreator(uid);
|
||||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else if (codeMap.containsKey(itemPO.getCode())) {
|
||||
SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode());
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改名字
|
||||
itemPO.setName(null);
|
||||
itemPO.setCreator(uid);
|
||||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.bo.SalarySobBackItemBO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobBackItemDTO;
|
||||
|
|
@ -17,6 +21,7 @@ import com.engine.salary.service.SalaryItemService;
|
|||
import com.engine.salary.service.SalarySobBackItemService;
|
||||
import com.engine.salary.service.SalarySobService;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
|
|
@ -24,10 +29,7 @@ import org.apache.commons.lang3.math.NumberUtils;
|
|||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
|
|
@ -117,4 +119,36 @@ public class SalarySobBackItemServiceImpl extends Service implements SalarySobBa
|
|||
return getSalarySobBackItemMapper().listSome(SalarySobBackItemPO.builder().salaryItemIds(salaryItemIds).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobBackItemPO> getConfig(Long salarySobId) {
|
||||
List<SalarySobBackItemPO> salarySobBackItemPOS = listBySalarySobId(salarySobId);
|
||||
if (CollectionUtil.isNotEmpty(salarySobBackItemPOS)) {
|
||||
FormluaConfig config = getSalaryFormulaService(user).getConfig();
|
||||
List<FormulaPO> formulaPOS = config.getFormulas();
|
||||
Map<Long, FormulaPO> formulaMap = SalaryEntityUtil.convert2Map(formulaPOS, FormulaPO::getId);
|
||||
List<FormulaVar> formulaVars = config.getFormulaVars();
|
||||
Map<Long, List<FormulaVar>> varListMap = SalaryEntityUtil.group2Map(formulaVars, FormulaVar::getFormulaId);
|
||||
|
||||
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listAll();
|
||||
Map<Long, SalaryItemPO> itemIdMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
|
||||
|
||||
salarySobBackItemPOS.forEach(po -> {
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(po.getFormulaId())) {
|
||||
FormulaPO formulaPO = formulaMap.get(po.getFormulaId());
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(formulaPO)) {
|
||||
List<FormulaVar> formulaVarList = varListMap.getOrDefault(formulaPO.getId(), new ArrayList<>());
|
||||
formulaPO.setFormulaVars(formulaVarList);
|
||||
}
|
||||
po.setFormula(formulaPO);
|
||||
}
|
||||
if(SalaryEntityUtil.isNotNullOrEmpty(po.getSalaryItemId())){
|
||||
SalaryItemPO salaryItemPO = itemIdMap.get(po.getSalaryItemId());
|
||||
po.setSalaryItem(salaryItemPO);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return salarySobBackItemPOS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,26 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.SalarySobItemGroupBiz;
|
||||
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.service.SalaryFormulaService;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.service.SalarySobItemGroupService;
|
||||
import com.engine.salary.service.SalarySobItemService;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 薪资账套中的薪资项目分类
|
||||
|
|
@ -20,6 +34,19 @@ public class SalarySobItemGroupServiceImpl extends Service implements SalarySobI
|
|||
|
||||
private SalarySobItemGroupBiz salarySobItemGroupMapper = new SalarySobItemGroupBiz();
|
||||
|
||||
private SalarySobItemService getSalarySobItemService(User user) {
|
||||
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||||
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryItemService getSalaryItemService(User user) {
|
||||
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SalarySobItemGroupPO getById(Long id) {
|
||||
return salarySobItemGroupMapper.getById(id);
|
||||
|
|
@ -39,4 +66,44 @@ public class SalarySobItemGroupServiceImpl extends Service implements SalarySobI
|
|||
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
|
||||
salarySobItemGroupMapper.deleteBySalarySobIds(salarySobIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobItemGroupPO> getConfig(Long salarySobId) {
|
||||
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupMapper.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build());
|
||||
if (CollectionUtil.isNotEmpty(salarySobItemGroupPOS)) {
|
||||
List<SalarySobItemPO> sobItemPOS = getSalarySobItemService(user).listBySalarySobId(salarySobId);
|
||||
Map<Long, List<SalarySobItemPO>> itemListMap = SalaryEntityUtil.group2Map(sobItemPOS, SalarySobItemPO::getSalarySobItemGroupId);
|
||||
|
||||
FormluaConfig config = getSalaryFormulaService(user).getConfig();
|
||||
List<FormulaPO> formulaPOS = config.getFormulas();
|
||||
Map<Long, FormulaPO> formulaMap = SalaryEntityUtil.convert2Map(formulaPOS, FormulaPO::getId);
|
||||
List<FormulaVar> formulaVars = config.getFormulaVars();
|
||||
Map<Long, List<FormulaVar>> varListMap = SalaryEntityUtil.group2Map(formulaVars, FormulaVar::getFormulaId);
|
||||
|
||||
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listAll();
|
||||
Map<Long, SalaryItemPO> itemIdMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
|
||||
|
||||
|
||||
salarySobItemGroupPOS.forEach(salarySobItemGroupPO -> {
|
||||
List<SalarySobItemPO> salarySobItemPOS = itemListMap.getOrDefault(salarySobItemGroupPO.getId(), new ArrayList<>());
|
||||
salarySobItemPOS.forEach(po -> {
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(po.getFormulaId())) {
|
||||
FormulaPO formulaPO = formulaMap.get(po.getFormulaId());
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(formulaPO)) {
|
||||
List<FormulaVar> formulaVarList = varListMap.getOrDefault(formulaPO.getId(), new ArrayList<>());
|
||||
formulaPO.setFormulaVars(formulaVarList);
|
||||
}
|
||||
po.setFormula(formulaPO);
|
||||
}
|
||||
if(SalaryEntityUtil.isNotNullOrEmpty(po.getSalaryItemId())){
|
||||
SalaryItemPO salaryItemPO = itemIdMap.get(po.getSalaryItemId());
|
||||
po.setSalaryItem(salaryItemPO);
|
||||
}
|
||||
});
|
||||
salarySobItemGroupPO.setSalarySobItems(salarySobItemPOS);
|
||||
});
|
||||
}
|
||||
|
||||
return salarySobItemGroupPOS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ import com.engine.hrmelog.entity.dto.LoggerContext;
|
|||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
|
||||
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
|
|
@ -533,6 +536,37 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
|||
salarySobItemMapper.update(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobItemPO> getConfig(Long salarySobId) {
|
||||
List<SalarySobItemPO> salarySobItemPOS = salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).salarySobItemGroupId(0L).build());
|
||||
if (CollectionUtils.isNotEmpty(salarySobItemPOS)) {
|
||||
FormluaConfig config = getSalaryFormulaService(user).getConfig();
|
||||
List<FormulaPO> formulaPOS = config.getFormulas();
|
||||
Map<Long, FormulaPO> formulaMap = SalaryEntityUtil.convert2Map(formulaPOS, FormulaPO::getId);
|
||||
List<FormulaVar> formulaVars = config.getFormulaVars();
|
||||
Map<Long, List<FormulaVar>> varListMap = SalaryEntityUtil.group2Map(formulaVars, FormulaVar::getFormulaId);
|
||||
|
||||
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listAll();
|
||||
Map<Long, SalaryItemPO> itemIdMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
|
||||
|
||||
salarySobItemPOS.forEach(salarySobItemPO -> {
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(salarySobItemPO.getFormulaId())) {
|
||||
FormulaPO formulaPO = formulaMap.get(salarySobItemPO.getFormulaId());
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(formulaPO)) {
|
||||
List<FormulaVar> formulaVarList = varListMap.getOrDefault(formulaPO.getId(), new ArrayList<>());
|
||||
formulaPO.setFormulaVars(formulaVarList);
|
||||
}
|
||||
salarySobItemPO.setFormula(formulaPO);
|
||||
}
|
||||
if(SalaryEntityUtil.isNotNullOrEmpty(salarySobItemPO.getSalaryItemId())){
|
||||
SalaryItemPO salaryItemPO = itemIdMap.get(salarySobItemPO.getSalaryItemId());
|
||||
salarySobItemPO.setSalaryItem(salaryItemPO);
|
||||
}
|
||||
});
|
||||
}
|
||||
return salarySobItemPOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalarySobItemFormDTO getSalaryItemForm(SalarySobItemPO param) {
|
||||
SalarySobItemFormDTO salarySobItemFormDTO = new SalarySobItemFormDTO();
|
||||
|
|
@ -587,6 +621,4 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
|||
}
|
||||
return salarySobItemFormDTO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
|
|
@ -34,6 +35,7 @@ import com.engine.salary.sys.service.SalarySysConfService;
|
|||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
|
|
@ -96,6 +98,10 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||||
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
private SalarySobMapper getSalarySobMapper() {
|
||||
return MapperProxyFactory.getProxy(SalarySobMapper.class);
|
||||
|
|
@ -243,8 +249,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return page;
|
||||
} else {
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(build);
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
|
||||
salarySobPOS, SalarySobPO.class);
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salarySobPOS, SalarySobPO.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,10 +370,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listBySysSalaryItemIds(defaultSysSalaryItemIds);
|
||||
Set<Long> sysSalaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getSysSalaryItemId);
|
||||
// 2.2、需要添加进薪资项目中的系统薪资项目id
|
||||
Set<Long> needAddSysSalaryItemIds = salarySobDefaultItemPOS.stream()
|
||||
.map(SalarySobDefaultItemPO::getSysSalaryItemId)
|
||||
.filter(sysSalaryItemId -> !sysSalaryItemIds.contains(sysSalaryItemId))
|
||||
.collect(Collectors.toSet());
|
||||
Set<Long> needAddSysSalaryItemIds = salarySobDefaultItemPOS.stream().map(SalarySobDefaultItemPO::getSysSalaryItemId).filter(sysSalaryItemId -> !sysSalaryItemIds.contains(sysSalaryItemId)).collect(Collectors.toSet());
|
||||
// 需要添加进薪资项目中的回算薪资项目
|
||||
needAddSysSalaryItemIds.addAll(SalarySobBackItemIds.stream().filter(salarySobBackItemId -> !sysSalaryItemIds.contains(salarySobBackItemId)).collect(Collectors.toList()));
|
||||
List<SysSalaryItemPO> needAddSysSalaryItemPOS = getSysSalaryItemService(user).listByIds(needAddSysSalaryItemIds);
|
||||
|
|
@ -391,9 +393,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
SalarySobItemBO.Result result = SalarySobItemBO.initSalarySobItem(salarySobPO.getId(), salarySobDefaultItemGroupPOS, salarySobDefaultItemPOS, defaultSalaryItemPOS, (long) user.getUID(), SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) {
|
||||
|
||||
List<SalarySobItemPO> list = new ArrayList<>(result.getNeedInsertSalarySobItems().stream()
|
||||
.collect(Collectors.toMap(SalarySobItemPO::getSalaryItemId, Function.identity(), (oldValue, newValue) -> oldValue))
|
||||
.values());
|
||||
List<SalarySobItemPO> list = new ArrayList<>(result.getNeedInsertSalarySobItems().stream().collect(Collectors.toMap(SalarySobItemPO::getSalaryItemId, Function.identity(), (oldValue, newValue) -> oldValue)).values());
|
||||
|
||||
salarySobItemService.batchInsert(list);
|
||||
}
|
||||
|
|
@ -454,34 +454,12 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
ArrayList<SalarySobRangePO> result = new ArrayList<SalarySobRangePO>();
|
||||
// 关联人员范围
|
||||
includeList.stream().forEach(item -> {
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
|
||||
.salarySobId(salarySobID)
|
||||
.targetType(item.getTargetType().getValue())
|
||||
.targetId(item.getTargetId())
|
||||
.employeeStatuses(item.getEmployeeStatus())
|
||||
.includeType(1)
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.deleteType(0)
|
||||
.build();
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder().salarySobId(salarySobID).targetType(item.getTargetType().getValue()).targetId(item.getTargetId()).employeeStatuses(item.getEmployeeStatus()).includeType(1).creator(Long.valueOf(user.getUID())).createTime(now).updateTime(now).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).deleteType(0).build();
|
||||
result.add(salarySobRangePO);
|
||||
});
|
||||
// 从范围中排除
|
||||
excludeList.stream().forEach(item -> {
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
|
||||
.salarySobId(salarySobID)
|
||||
.targetType(item.getTargetType().getValue())
|
||||
.targetId(item.getTargetId())
|
||||
.employeeStatuses(item.getEmployeeStatus())
|
||||
.includeType(0)
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.deleteType(0)
|
||||
.build();
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder().salarySobId(salarySobID).targetType(item.getTargetType().getValue()).targetId(item.getTargetId()).employeeStatuses(item.getEmployeeStatus()).includeType(0).creator(Long.valueOf(user.getUID())).createTime(now).updateTime(now).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).deleteType(0).build();
|
||||
result.add(salarySobRangePO);
|
||||
});
|
||||
return result;
|
||||
|
|
@ -530,18 +508,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
// 更新薪资账套
|
||||
SalarySobPO newSalarySobPO = new SalarySobPO();
|
||||
BeanUtils.copyProperties(salarySobPO, newSalarySobPO);
|
||||
newSalarySobPO.setId(saveParam.getId())
|
||||
.setName(saveParam.getName())
|
||||
.setTaxAgentId(saveParam.getTaxAgentId())
|
||||
.setIncomeCategory(saveParam.getTaxableItems())
|
||||
.setSalaryCycleType(saveParam.getSalaryCycleType())
|
||||
.setSalaryCycleFromDay(saveParam.getSalaryCycleFromDay())
|
||||
.setTaxCycleType(saveParam.getTaxCycleType())
|
||||
.setAttendCycleType(saveParam.getAttendCycleType())
|
||||
.setAttendCycleFromDay(saveParam.getAttendCycleFromDay())
|
||||
.setSocialSecurityCycleType(saveParam.getSocialSecurityCycleType())
|
||||
.setDescription(saveParam.getDescription())
|
||||
.setUpdateTime(new Date());
|
||||
newSalarySobPO.setId(saveParam.getId()).setName(saveParam.getName()).setTaxAgentId(saveParam.getTaxAgentId()).setIncomeCategory(saveParam.getTaxableItems()).setSalaryCycleType(saveParam.getSalaryCycleType()).setSalaryCycleFromDay(saveParam.getSalaryCycleFromDay()).setTaxCycleType(saveParam.getTaxCycleType()).setAttendCycleType(saveParam.getAttendCycleType()).setAttendCycleFromDay(saveParam.getAttendCycleFromDay()).setSocialSecurityCycleType(saveParam.getSocialSecurityCycleType()).setDescription(saveParam.getDescription()).setUpdateTime(new Date());
|
||||
salarySobMapper.updateById(newSalarySobPO);
|
||||
// 记录日志
|
||||
SalarySobPO salarySobPO4log = getSalarySobMapper().getById(newSalarySobPO.getId());
|
||||
|
|
@ -573,8 +540,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
salarySobPO.setUpdateTime(new Date());
|
||||
salarySobMapper.updateById(salarySobPO);
|
||||
// 记录日志
|
||||
String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ?
|
||||
SalaryI18nUtil.getI18nLabel(0, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(0, "启用薪资账套");
|
||||
String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ? SalaryI18nUtil.getI18nLabel(0, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(0, "启用薪资账套");
|
||||
LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
|
||||
loggerContext.setUser(user);
|
||||
loggerContext.setTargetId("" + salarySobPO.getId());
|
||||
|
|
@ -694,27 +660,10 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
|
||||
|
||||
// 复制薪资账套的基础设置
|
||||
SalarySobPO newSalarySob = SalarySobPO.builder()
|
||||
.name(duplicateParam.getName())
|
||||
.taxAgentId(duplicateParam.getTaxAgentId())
|
||||
.incomeCategory(salarySobPO.getIncomeCategory())
|
||||
.salaryCycleType(salarySobPO.getSalaryCycleType())
|
||||
.salaryCycleFromDay(salarySobPO.getSalaryCycleFromDay())
|
||||
.taxCycleType(salarySobPO.getTaxCycleType())
|
||||
.attendCycleType(salarySobPO.getAttendCycleType())
|
||||
.attendCycleFromDay(salarySobPO.getAttendCycleFromDay())
|
||||
.socialSecurityCycleType(salarySobPO.getSocialSecurityCycleType())
|
||||
.disable(salarySobPO.getDisable())
|
||||
.creator((long) user.getUID())
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.build();
|
||||
SalarySobPO newSalarySob = SalarySobPO.builder().name(duplicateParam.getName()).taxAgentId(duplicateParam.getTaxAgentId()).incomeCategory(salarySobPO.getIncomeCategory()).salaryCycleType(salarySobPO.getSalaryCycleType()).salaryCycleFromDay(salarySobPO.getSalaryCycleFromDay()).taxCycleType(salarySobPO.getTaxCycleType()).attendCycleType(salarySobPO.getAttendCycleType()).attendCycleFromDay(salarySobPO.getAttendCycleFromDay()).socialSecurityCycleType(salarySobPO.getSocialSecurityCycleType()).disable(salarySobPO.getDisable()).creator((long) user.getUID()).createTime(new Date()).updateTime(new Date()).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).deleteType(NumberUtils.INTEGER_ZERO).build();
|
||||
salarySobMapper.insert(newSalarySob);
|
||||
// 复制
|
||||
SalarySobDuplicateBO salarySobDuplicateBO = new SalarySobDuplicateBO(newSalarySob, salarySobEmpFieldPOS, salarySobItemPOS,
|
||||
salarySobItemGroupPOS, salarySobAdjustRulePOS, salarySobCheckRulePOS, salarySobBackItemPOS);
|
||||
SalarySobDuplicateBO salarySobDuplicateBO = new SalarySobDuplicateBO(newSalarySob, salarySobEmpFieldPOS, salarySobItemPOS, salarySobItemGroupPOS, salarySobAdjustRulePOS, salarySobCheckRulePOS, salarySobBackItemPOS);
|
||||
SalarySobDuplicateBO.Result result = salarySobDuplicateBO.duplicate((long) user.getUID());
|
||||
// 复制薪资账套的员工信息字段
|
||||
if (CollectionUtils.isNotEmpty(result.getSalarySobEmpFields())) {
|
||||
|
|
@ -808,18 +757,11 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return salarySobPOS.stream().map(salarySobPO -> {
|
||||
Long salarySobId = salarySobPO.getId();
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId);
|
||||
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salarySobId);
|
||||
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salarySobId);
|
||||
List<SalarySobBackItemPO> salarySobBackItemPOS = getSalarySobBackItemService(user).listBySalarySobId(salarySobId);
|
||||
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).getConfig(salarySobId);
|
||||
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).getConfig(salarySobId);
|
||||
List<SalarySobBackItemPO> salarySobBackItemPOS = getSalarySobBackItemService(user).getConfig(salarySobId);
|
||||
List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = getSalarySobAdjustRuleService(user).listBySalarySobId(salarySobId);
|
||||
return SalarySobConfig.builder()
|
||||
.salarySob(salarySobPO)
|
||||
.salarySobEmpFields(salarySobEmpFieldPOS)
|
||||
.salarySobItemGroups(salarySobItemGroupPOS)
|
||||
.salarySobItems(salarySobItemPOS)
|
||||
.salarySobBackItems(salarySobBackItemPOS)
|
||||
.salarySobAdjustRules(salarySobAdjustRulePOS)
|
||||
.build();
|
||||
return SalarySobConfig.builder().salarySob(salarySobPO).salarySobEmpFields(salarySobEmpFieldPOS).salarySobItemGroups(salarySobItemGroupPOS).salarySobItems(salarySobItemPOS).salarySobBackItems(salarySobBackItemPOS).salarySobAdjustRules(salarySobAdjustRulePOS).build();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
@ -829,53 +771,94 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
List<SalarySobPO> salarySobPOS = listByTaxAgentId(taxAgentId);
|
||||
Map<String, SalarySobPO> sobPOMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getName);
|
||||
|
||||
Optional.ofNullable(salarySobConfigs)
|
||||
.orElse(new ArrayList<>())
|
||||
.forEach(salarySobConfig -> {
|
||||
SalarySobPO salarySobPO = salarySobConfig.getSalarySob();
|
||||
String sobPOName = salarySobPO.getName();
|
||||
if (sobPOMap.containsKey(sobPOName)) {
|
||||
salarySobPO = sobPOMap.get(sobPOName);
|
||||
} else {
|
||||
salarySobPO.setCreator(uid);
|
||||
getSalarySobMapper().insertIgnoreNull(salarySobPO);
|
||||
}
|
||||
Optional.ofNullable(salarySobConfigs).orElse(new ArrayList<>()).forEach(salarySobConfig -> {
|
||||
SalarySobPO salarySobPO = salarySobConfig.getSalarySob();
|
||||
String sobPOName = salarySobPO.getName();
|
||||
if (sobPOMap.containsKey(sobPOName)) {
|
||||
SalarySobPO oldSob = sobPOMap.get(sobPOName);
|
||||
salarySobPO.setId(oldSob.getId());
|
||||
salarySobPO.setCreator(uid);
|
||||
getSalarySobMapper().updateIgnoreNull(salarySobPO);
|
||||
} else {
|
||||
salarySobPO.setCreator(uid);
|
||||
getSalarySobMapper().insertIgnoreNull(salarySobPO);
|
||||
}
|
||||
|
||||
List<SalarySobItemPO> salarySobItems = salarySobConfig.getSalarySobItems();
|
||||
for (SalarySobItemPO salarySobItem : salarySobItems) {
|
||||
salarySobItem.setSalarySobId(salarySobPO.getId());
|
||||
salarySobItem.setCreator(uid);
|
||||
}
|
||||
getSalarySobItemService(user).batchSave(salarySobItems);
|
||||
Long sobId = salarySobPO.getId();
|
||||
getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFields = salarySobConfig.getSalarySobEmpFields();
|
||||
if (CollectionUtil.isNotEmpty(salarySobEmpFields)) {
|
||||
for (SalarySobEmpFieldPO salarySobEmpField : salarySobEmpFields) {
|
||||
salarySobEmpField.setSalarySobId(sobId);
|
||||
salarySobEmpField.setCreator(uid);
|
||||
}
|
||||
getSalarySobEmpFieldService(user).batchSave(salarySobEmpFields);
|
||||
}
|
||||
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFields = salarySobConfig.getSalarySobEmpFields();
|
||||
for (SalarySobEmpFieldPO salarySobEmpField : salarySobEmpFields) {
|
||||
salarySobEmpField.setSalarySobId(salarySobPO.getId());
|
||||
salarySobEmpField.setCreator(uid);
|
||||
}
|
||||
getSalarySobEmpFieldService(user).batchSave(salarySobEmpFields);
|
||||
|
||||
List<SalarySobItemGroupPO> salarySobItemGroups = salarySobConfig.getSalarySobItemGroups();
|
||||
for (SalarySobItemGroupPO salarySobItemGroup : salarySobItemGroups) {
|
||||
salarySobItemGroup.setSalarySobId(salarySobPO.getId());
|
||||
salarySobItemGroup.setCreator(uid);
|
||||
}
|
||||
getSalarySobItemGroupService(user).batchSave(salarySobItemGroups);
|
||||
|
||||
List<SalarySobBackItemPO> salarySobBackItems = salarySobConfig.getSalarySobBackItems();
|
||||
for (SalarySobBackItemPO salarySobBackItem : salarySobBackItems) {
|
||||
salarySobBackItem.setSalarySobId(salarySobPO.getId());
|
||||
salarySobBackItem.setCreator(uid);
|
||||
}
|
||||
getSalarySobBackItemService(user).batchInsert(salarySobBackItems);
|
||||
|
||||
List<SalarySobAdjustRulePO> salarySobAdjustRules = salarySobConfig.getSalarySobAdjustRules();
|
||||
for (SalarySobAdjustRulePO salarySobAdjustRule : salarySobAdjustRules) {
|
||||
salarySobAdjustRule.setSalarySobId(salarySobPO.getId());
|
||||
salarySobAdjustRule.setCreator(uid);
|
||||
}
|
||||
getSalarySobAdjustRuleService(user).batchSave(salarySobAdjustRules);
|
||||
getSalarySobItemService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobItemPO> salarySobItems = salarySobConfig.getSalarySobItems();
|
||||
if (CollectionUtil.isNotEmpty(salarySobItems)) {
|
||||
salarySobItems.forEach(sobItem -> {
|
||||
sobItem.setId(IdGenerator.generate());
|
||||
sobItem.setSalarySobId(sobId);
|
||||
sobItem.setCreator(uid);
|
||||
Long formulaId = getSalaryFormulaService(user).add(sobItem.getFormula());
|
||||
sobItem.setFormulaId(formulaId);
|
||||
});
|
||||
getSalarySobItemService(user).batchSave(salarySobItems);
|
||||
}
|
||||
|
||||
getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobItemGroupPO> salarySobItemGroups = salarySobConfig.getSalarySobItemGroups();
|
||||
if (CollectionUtil.isNotEmpty(salarySobItemGroups)) {
|
||||
for (SalarySobItemGroupPO salarySobItemGroup : salarySobItemGroups) {
|
||||
long groupId = IdGenerator.generate();
|
||||
salarySobItemGroup.setId(groupId);
|
||||
salarySobItemGroup.setSalarySobId(sobId);
|
||||
salarySobItemGroup.setCreator(uid);
|
||||
|
||||
List<SalarySobItemPO> sobItems = salarySobItemGroup.getSalarySobItems();
|
||||
if(CollectionUtil.isNotEmpty(sobItems)){
|
||||
sobItems.forEach(sobItem -> {
|
||||
sobItem.setId(IdGenerator.generate());
|
||||
sobItem.setSalarySobId(sobId);
|
||||
sobItem.setSalarySobItemGroupId(groupId);
|
||||
sobItem.setCreator(uid);
|
||||
Long formulaId = getSalaryFormulaService(user).add(sobItem.getFormula());
|
||||
sobItem.setFormulaId(formulaId);
|
||||
});
|
||||
getSalarySobItemService(user).batchSave(salarySobItems);
|
||||
}
|
||||
}
|
||||
getSalarySobItemGroupService(user).batchSave(salarySobItemGroups);
|
||||
}
|
||||
|
||||
getSalarySobBackItemService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobBackItemPO> salarySobBackItems = salarySobConfig.getSalarySobBackItems();
|
||||
if (CollectionUtil.isNotEmpty(salarySobBackItems)) {
|
||||
for (SalarySobBackItemPO salarySobBackItem : salarySobBackItems) {
|
||||
salarySobBackItem.setId(IdGenerator.generate());
|
||||
salarySobBackItem.setSalarySobId(sobId);
|
||||
salarySobBackItem.setCreator(uid);
|
||||
|
||||
Long formulaId = getSalaryFormulaService(user).add(salarySobBackItem.getFormula());
|
||||
salarySobBackItem.setFormulaId(formulaId);
|
||||
}
|
||||
getSalarySobBackItemService(user).batchInsert(salarySobBackItems);
|
||||
}
|
||||
|
||||
getSalarySobAdjustRuleService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobAdjustRulePO> salarySobAdjustRules = salarySobConfig.getSalarySobAdjustRules();
|
||||
if (CollectionUtil.isNotEmpty(salarySobAdjustRules)) {
|
||||
for (SalarySobAdjustRulePO salarySobAdjustRule : salarySobAdjustRules) {
|
||||
salarySobAdjustRule.setId(IdGenerator.generate());
|
||||
salarySobAdjustRule.setSalarySobId(sobId);
|
||||
salarySobAdjustRule.setCreator(uid);
|
||||
}
|
||||
getSalarySobAdjustRuleService(user).batchSave(salarySobAdjustRules);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -829,7 +829,6 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
|||
taxAgent = agentPOMap.get(name);
|
||||
} else {
|
||||
//新增扣缴义务人
|
||||
taxAgent.setId(null);
|
||||
taxAgent.setCreator((long) user.getUID());
|
||||
getTaxAgentMapper().insertIgnoreNull(taxAgent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -531,6 +531,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
salarySysConfs.forEach(po -> {
|
||||
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey());
|
||||
if (sysConfPO == null) {
|
||||
po.setId(IdGenerator.generate());
|
||||
getSalarySysConfMapper().insertIgnoreNull(po);
|
||||
} else {
|
||||
sysConfPO.setConfValue(po.getConfValue());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.config.SalaryConfig;
|
||||
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
|
||||
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
|
||||
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
|
||||
import com.engine.salary.entity.taxagent.config.TaxAgentConfig;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentBasePO;
|
||||
|
|
@ -32,9 +31,15 @@ import weaver.file.ImageFileManager;
|
|||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 累计专项附加扣除
|
||||
|
|
@ -211,8 +216,8 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
SysConfig sysConfig = getSalarySysConfService(user).getConfig();
|
||||
salaryConfig.setSysConfig(sysConfig);
|
||||
|
||||
FormluaConfig formluaConfig = getSalaryFormulaService(user).getConfig();
|
||||
salaryConfig.setFormluaConfig(formluaConfig);
|
||||
// FormluaConfig formluaConfig = getSalaryFormulaService(user).getConfig();
|
||||
// salaryConfig.setFormluaConfig(formluaConfig);
|
||||
|
||||
SalaryItemAllConfig salaryItemConfig = getSalaryItemService(user).getConfig();
|
||||
salaryConfig.setSalaryItemConfig(salaryItemConfig);
|
||||
|
|
@ -252,8 +257,6 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
|
||||
getSalarySysConfService(user).parseConfig(config.getSysConfig());
|
||||
|
||||
getSalaryFormulaService(user).parseConfig(config.getFormluaConfig());
|
||||
|
||||
getSalaryItemService(user).parseConfig(config.getSalaryItemConfig());
|
||||
|
||||
getSalaryArchiveItemService(user).parseConfig(config.getArchiveFieldConfig());
|
||||
|
|
@ -263,7 +266,7 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs());
|
||||
|
||||
return response;
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
response.setErrorData(Collections.singletonList(ImportExcelResponse.Error.builder().message("文件读取失败!").build()));
|
||||
return response;
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in New Issue