This commit is contained in:
parent
f2cf03ebbf
commit
980415c8ca
|
|
@ -41,6 +41,17 @@ public class SalarySobItemGroupBiz {
|
|||
}
|
||||
}
|
||||
|
||||
public void insert(SalarySobItemGroupPO po) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class);
|
||||
mapper.insertIgnoreNull(po);
|
||||
} finally {
|
||||
sqlSession.commit();
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ alter table hrsa_attend_quote_sync_set modify id bigint auto_increment;
|
|||
alter table hrsa_salary_item modify id bigint auto_increment;
|
||||
alter table hrsa_salary_sob modify id bigint auto_increment;
|
||||
alter table hrsa_salary_sob_range modify id bigint auto_increment;
|
||||
alter table hrsa_salary_sob_item_group modify id bigint auto_increment;
|
||||
|
||||
|
||||
--福利方案主键自增增加
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@
|
|||
<if test="description != null and description != ''">
|
||||
AND description = #{description}
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null and updateTime != ''">
|
||||
<if test="updateTime != null ">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.SalarySobBiz;
|
||||
import com.engine.salary.biz.SalarySobItemBiz;
|
||||
import com.engine.salary.biz.SalarySobItemGroupBiz;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
|
||||
import com.engine.salary.entity.salarysob.bo.SalarySobItemSaveBO;
|
||||
|
|
@ -19,6 +21,8 @@ import com.engine.salary.util.SalaryEntityUtil;
|
|||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.weaver.excel.formula.api.entity.ExpressFormula;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -36,6 +40,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
|||
private SalarySobItemBiz salarySobItemMapper = new SalarySobItemBiz();
|
||||
private SalarySobBiz salarySobBiz = new SalarySobBiz();
|
||||
|
||||
private SalarySobItemGroupBiz salarySobItemGroupBiz = new SalarySobItemGroupBiz();
|
||||
|
||||
private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) {
|
||||
return (SalarySobEmpFieldService) ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -116,18 +122,23 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
|||
|
||||
@Override
|
||||
public void save(SalarySobItemSaveParam saveParam) {
|
||||
long employeeId = (long)user.getUID();
|
||||
Date now = new Date();
|
||||
|
||||
Long salarySobId = saveParam.getSalarySobId();
|
||||
|
||||
// 查询薪资账套
|
||||
SalarySobPO salarySobPO = salarySobBiz.getById(saveParam.getSalarySobId());
|
||||
SalarySobPO salarySobPO = salarySobBiz.getById(salarySobId);
|
||||
if (Objects.isNull(salarySobPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
|
||||
}
|
||||
//todo
|
||||
// 删除薪资账套的员工信息字段
|
||||
getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()));
|
||||
getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
|
||||
// 删除薪资账套的薪资项目副本
|
||||
deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()));
|
||||
deleteBySalarySobIds(Collections.singleton(salarySobId));
|
||||
// 删除薪资账套的薪资项目分类
|
||||
getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()));
|
||||
getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
|
||||
|
||||
// 处理保存参数
|
||||
SalarySobItemSaveBO.Result result = SalarySobItemSaveBO.handle(saveParam,(long)user.getUID());
|
||||
|
|
@ -136,19 +147,72 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
|||
// getSalarySobEmpFieldService(user).batchSave(result.getNeedInsertSalarySobEmpFields());
|
||||
}
|
||||
|
||||
|
||||
Collection<SalarySobItemPO> salarySobItems = new ArrayList<>();
|
||||
//先保存项目分类获取分类id
|
||||
List<SalarySobItemSaveParam.SalarySobItemGroupParam> itemGroups = saveParam.getItemGroups();
|
||||
// CollectionUtils.emptyIfNull()
|
||||
int sortedIndex = 0;
|
||||
for (SalarySobItemSaveParam.SalarySobItemGroupParam itemGroupParam : saveParam.getItemGroups()) {
|
||||
SalarySobItemGroupPO salarySobItemGroupPO = SalarySobItemGroupPO.builder()
|
||||
.salarySobId(salarySobId)
|
||||
.name(itemGroupParam.getName())
|
||||
.sortedIndex(sortedIndex++)
|
||||
.description(StringUtils.EMPTY)
|
||||
.creator(employeeId)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
salarySobItemGroupBiz.insert(salarySobItemGroupPO);
|
||||
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupBiz.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).name(itemGroupParam.getName()).build());
|
||||
Long salarySobItemGroupId = salarySobItemGroupPOS.get(0).getId();
|
||||
|
||||
|
||||
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : itemGroupParam.getItems()) {
|
||||
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder()
|
||||
.salarySobId(salarySobId)
|
||||
.salaryItemId(itemParam.getSalaryItemId())
|
||||
.salarySobItemGroupId(salarySobItemGroupId)
|
||||
.formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO))
|
||||
.sortedIndex(itemParam.getSortedIndex())
|
||||
.description(StringUtils.EMPTY)
|
||||
.creator(employeeId)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
salarySobItems.add(salarySobItemPO);
|
||||
}
|
||||
}
|
||||
|
||||
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : saveParam.getItems()) {
|
||||
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder()
|
||||
// .id(IdGenerator.generate())
|
||||
.salarySobId(salarySobId)
|
||||
.salaryItemId(itemParam.getSalaryItemId())
|
||||
.salarySobItemGroupId(NumberUtils.LONG_ZERO)
|
||||
.formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO))
|
||||
.sortedIndex(itemParam.getSortedIndex())
|
||||
.description(StringUtils.EMPTY)
|
||||
.creator(employeeId)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
salarySobItems.add(salarySobItemPO);
|
||||
}
|
||||
|
||||
|
||||
// 保存薪资账套的薪资项目副本
|
||||
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) {
|
||||
batchSave(result.getNeedInsertSalarySobItems());
|
||||
batchSave(salarySobItems);
|
||||
}
|
||||
// 保存薪资账套的薪资项目分类
|
||||
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) {
|
||||
getSalarySobItemGroupService(user).batchSave(result.getNeedInsertSalarySobItemGroups());
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) {
|
||||
// getSalarySobItemGroupService(user).batchSave(result.getNeedInsertSalarySobItemGroups());
|
||||
// }
|
||||
//todo 记录日志
|
||||
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
|
||||
// loggerContext.setTargetId("" + salarySobPO.getId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue