diff --git a/src/com/engine/salary/biz/SalarySobItemBiz.java b/src/com/engine/salary/biz/SalarySobItemBiz.java index 1b998434a..233eae306 100644 --- a/src/com/engine/salary/biz/SalarySobItemBiz.java +++ b/src/com/engine/salary/biz/SalarySobItemBiz.java @@ -1,6 +1,5 @@ package com.engine.salary.biz; -import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import com.engine.salary.mapper.salarysob.SalarySobItemMapper; import com.google.common.collect.Lists; @@ -73,19 +72,7 @@ public class SalarySobItemBiz { } } - public void InsertItemShow(SalarySobItemHidePO salarySobItemHidePO) { - if (salarySobItemHidePO == null) { - return; - } - SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); - try { - SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class); - mapper.insertItemShow(salarySobItemHidePO); - sqlSession.commit(); - } finally { - sqlSession.close(); - } - } + public List listBySalarySobIdAndGroupId(Long salarySobId, Collection salarySobItemGroupIds) { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); @@ -131,21 +118,6 @@ public class SalarySobItemBiz { } - public void batchInsertItemShow(List list) { - if (CollectionUtils.isEmpty(list)) { - return; - } - SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); - try { - SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class); - List> partition = Lists.partition( list, 100); - partition.forEach(mapper::batchInsertItemShow); - sqlSession.commit(); - } finally { - sqlSession.close(); - } - } - public void update(SalarySobItemPO salarySobItemPO) { if (Objects.isNull(salarySobItemPO)) { return; diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemBO.java index 049d06c5c..bc8aa4ecb 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemBO.java @@ -67,8 +67,6 @@ public class SalarySobItemBO { List defaultSalaryItemPOS, Long employeeId, String tenantKey) { Date now = new Date(); - // 需要保存的隐藏项目 - List needInsertItemHides = new ArrayList<>(); // 处理薪资账套默认的薪资项目分类 Map salarySobItemGroupIdMap = Maps.newHashMapWithExpectedSize(salarySobDefaultItemGroupPOS.size()); List salarySobItemGroups = Lists.newArrayListWithExpectedSize(salarySobDefaultItemGroupPOS.size()); @@ -87,20 +85,6 @@ public class SalarySobItemBO { .deleteType(NumberUtils.INTEGER_ZERO) .build()); salarySobItemGroupIdMap.put(salarySobDefaultItemGroupPO.getId(), salarySobItemGroupId); - - // 保存薪资项目分类隐藏信息 - needInsertItemHides.add(SalarySobItemHidePO.builder() - .id(IdGenerator.generate()) - .salarySobId(salarySobId) - .salaryItemId(salarySobItemGroupId) - .isGroup(1) - .itemHide(0L) - .creator(employeeId) - .createTime(now) - .updateTime(now) - .deleteType(NumberUtils.INTEGER_ZERO) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build()); } @@ -128,20 +112,6 @@ public class SalarySobItemBO { .tenantKey(tenantKey) .deleteType(NumberUtils.INTEGER_ZERO) .build()); - - // 保存薪资项目隐藏信息 - needInsertItemHides.add(SalarySobItemHidePO.builder() - .id(IdGenerator.generate()) - .salarySobId(salarySobId) - .salaryItemId(salaryItemPO.getId()) - .isGroup(0) - .itemHide(Long.valueOf(salaryItemPO.getHideDefault()== null ? 0 : salaryItemPO.getHideDefault())) - .creator(employeeId) - .createTime(now) - .updateTime(now) - .deleteType(NumberUtils.INTEGER_ZERO) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build()); } // 处理薪资账套默认的自定义薪资项目(开启了"默认使用") for (int i = 0; i < defaultSalaryItemPOS.size(); i++) { @@ -169,19 +139,6 @@ public class SalarySobItemBO { .tenantKey(tenantKey) .deleteType(NumberUtils.INTEGER_ZERO) .build()); - // 保存薪资项目隐藏信息 - needInsertItemHides.add(SalarySobItemHidePO.builder() - .id(IdGenerator.generate()) - .salarySobId(salarySobId) - .salaryItemId(salaryItemPO.getId()) - .isGroup(0) - .itemHide(Long.valueOf(salaryItemPO.getHideDefault() == null ? 0 : salaryItemPO.getHideDefault())) - .creator(employeeId) - .createTime(now) - .updateTime(now) - .deleteType(NumberUtils.INTEGER_ZERO) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build()); } // 薪资账套默认的回算薪资项目 @@ -209,7 +166,7 @@ public class SalarySobItemBO { } return new Result().setNeedInsertSalarySobItems(salarySobItems).setNeedInsertSalarySobItemGroups(salarySobItemGroups) - .setNeedInsertSalarySobBackItems(salarySobBackItems).setNeedInsertItemHides(needInsertItemHides); + .setNeedInsertSalarySobBackItems(salarySobBackItems); } @Data @@ -230,10 +187,5 @@ public class SalarySobItemBO { * 需要保存的回算薪资项目 */ List needInsertSalarySobBackItems; - - /** - * 需要保存的薪资项目隐藏信息 - */ - List needInsertItemHides; } } diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java index 3827ce3f0..dd2e00621 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java +++ b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java @@ -1,6 +1,5 @@ package com.engine.salary.mapper.salarysob; -import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import org.apache.ibatis.annotations.Param; @@ -89,12 +88,6 @@ public interface SalarySobItemMapper { */ void deleteItemShowBySalarySobId(@Param("salarySobIds")Collection salarySobIds); - /** - * 插入薪资项目分组是否显示 - * @param salarySobItemHidePO - */ - void insertItemShow(SalarySobItemHidePO salarySobItemHidePO); - /** * 根据账套id以及薪资项目分组获取 * @param @@ -104,9 +97,4 @@ public interface SalarySobItemMapper { void deleteByGroupIds(@Param("groupIds") List needDeleteGroupIds); - /** - * 批量插入薪资项目分组是否显示 - * @param list - */ - void batchInsertItemShow(@Param("collection")List list); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml index 7bf054ad4..e71a593c6 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml @@ -353,72 +353,6 @@ - - insert into hrsa_salary_item_hide (id,salary_sob_id,salary_item_id,is_group,item_hide, - creator,tenant_key,create_time,update_time,delete_type) - VALUES (#{id},#{salarySobId},#{salaryItemId}, - #{isGroup},#{itemHide},#{creator}, - #{tenantKey},#{createTime},#{updateTime},0) - - - - insert into hrsa_salary_item_hide (id,salary_sob_id,salary_item_id,is_group,item_hide, - creator,tenant_key,create_time,update_time,delete_type) - VALUES - - ( - #{item.id}, - #{item.salarySobId}, - #{item.salaryItemId}, - #{item.isGroup}, - #{item.itemHide}, - #{item.creator}, - #{item.tenantKey}, - #{item.createTime}, - #{item.updateTime}, - 0 - ) - - - - insert into hrsa_salary_item_hide (id,salary_sob_id,salary_item_id,is_group,item_hide, - creator,tenant_key,create_time,update_time,delete_type) - - select - #{item.id,jdbcType=DOUBLE}, - #{item.salarySobId,jdbcType=DOUBLE}, - #{item.salaryItemId,jdbcType=DOUBLE}, - #{item.isGroup,jdbcType=INTEGER}, - #{item.itemHide,jdbcType=INTEGER}, - #{item.creator,jdbcType=DOUBLE}, - #{item.tenantKey,jdbcType=VARCHAR}, - #{item.createTime,jdbcType=DATE}, - #{item.updateTime,jdbcType=DATE}, - 0 - from dual - - - - - insert into hrsa_salary_item_hide (id,salary_sob_id,salary_item_id,is_group,item_hide, - creator,tenant_key,create_time,update_time,delete_type) - VALUES - ( - #{item.id}, - #{item.salarySobId}, - #{item.salaryItemId}, - #{item.isGroup}, - #{item.itemHide}, - #{item.creator}, - #{item.tenantKey}, - #{item.createTime}, - #{item.updateTime}, - 0 - ) - - - - UPDATE hrsa_salary_sob_item SET delete_type = 1 diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 9d91167ad..9467158e2 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -2,10 +2,10 @@ package com.engine.salary.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.biz.*; import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO; @@ -36,7 +36,6 @@ 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; @@ -45,7 +44,6 @@ import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; @@ -405,13 +403,6 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobBackItems())) { getSalarySobBackItemService(user).batchInsert(result.getNeedInsertSalarySobBackItems()); } - if (CollectionUtils.isNotEmpty(result.getNeedInsertItemHides())) { - //去重 - List list = new ArrayList<>(result.getNeedInsertItemHides().stream() - .collect(Collectors.toMap(SalarySobItemHidePO::getSalaryItemId, Function.identity(), (oldValue, newValue) -> oldValue)) - .values()); - salarySobItemService.batchInsertItemShow(list); - } } /** @@ -739,60 +730,12 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { getSalarySobBackItemService(user).batchInsert(result.getSalarySobBackItems()); } - // 复制薪资账套的薪资项目隐藏副本 - if (CollectionUtils.isNotEmpty(result.getSalarySobItems())) { - List salarySobItems = result.getSalarySobItems(); - Date now = new Date(); - salarySobItems.stream().forEach(k -> { - Long salarySobItemShowId = IdGenerator.generate(); - SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder() - .id(salarySobItemShowId) - .salarySobId(k.getSalarySobId()) - .salaryItemId(k.getSalaryItemId()) - .isGroup(0) - .itemHide(k.getItemHide()) - .creator((long) user.getUID()) - .deleteType(NumberUtils.INTEGER_ZERO) - .createTime(now) - .updateTime(now) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build(); - if (k.getItemHide() == null) { - salarySobItemHidePO.setItemHide(Long.valueOf(0)); - } - salarySobItemService.InsertItemShow(salarySobItemHidePO); - }); - } // 复制薪资账套的薪资项目分类 if (CollectionUtils.isNotEmpty(result.getSalarySobItemGroups())) { salarySobItemGroupService.batchInsert(result.getSalarySobItemGroups()); } - // 复制薪资账套的薪资项目分类隐藏信息 - if (CollectionUtils.isNotEmpty(result.getSalarySobItemGroups())) { - List salarySobItemGroups = result.getSalarySobItemGroups(); - Date now = new Date(); - salarySobItemGroups.stream().forEach(k -> { - Long salarySobItemShowId = IdGenerator.generate(); - SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder() - .id(salarySobItemShowId) - .salarySobId(k.getSalarySobId()) - .salaryItemId(k.getId()) - .isGroup(1) - .itemHide(k.getItemHide()) - .creator((long) user.getUID()) - .deleteType(NumberUtils.INTEGER_ZERO) - .createTime(now) - .updateTime(now) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build(); - if (k.getItemHide() == null) { - salarySobItemHidePO.setItemHide(Long.valueOf(0)); - } - salarySobItemService.InsertItemShow(salarySobItemHidePO); - }); - } // 复制薪资账套的调薪计薪规则 if (CollectionUtils.isNotEmpty(result.getSalaryAdjustmentRules())) {