Merge branch 'feature/addSalaryShowSwitch_xzy' into develop

This commit is contained in:
Harryxzy 2022-08-25 09:38:59 +08:00
commit 6809839a2c
25 changed files with 571 additions and 17 deletions

View File

@ -1,5 +1,6 @@
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;
@ -32,6 +33,17 @@ public class SalarySobItemBiz {
}
}
public List<SalarySobItemPO> listBySalarySobIdWithHideItem(SalarySobItemPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
return mapper.listBySalarySobIdWithHideItem(build);
} finally {
sqlSession.close();
}
}
public void batchInsert(Collection<SalarySobItemPO> salarySobItemPOS) {
if(CollectionUtils.isEmpty(salarySobItemPOS)){
return;
@ -58,4 +70,39 @@ public class SalarySobItemBiz {
sqlSession.close();
}
}
public void deleteItemShowBySalarySobId(Collection<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
mapper.deleteItemShowBySalarySobId(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
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<SalarySobItemPO> listBySalarySobIdAndGroupId(Long salarySobId, Collection<Long> salarySobItemGroupIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
return mapper.listBySalarySobIdAndGroupId(salarySobId,salarySobItemGroupIds);
} finally {
sqlSession.close();
}
}
}

View File

@ -62,4 +62,14 @@ public class SalarySobItemGroupBiz {
sqlSession.close();
}
}
public List<SalarySobItemGroupPO> listSomeWithItemHide(SalarySobItemGroupPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class);
return mapper.listSomeWithItemHide(build);
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,22 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import com.engine.salary.mapper.salarysob.SalarySobItemHideMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalarySobItemHideBiz {
public List<Long> listSome(SalarySobItemHidePO salarySobPO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemHideMapper mapper = sqlSession.getMapper(SalarySobItemHideMapper.class);
return mapper.getById(salarySobPO);
} finally {
sqlSession.close();
}
}
}

View File

@ -85,12 +85,14 @@ public class SalarySobItemAggregateBO {
.salarySobId(e.getSalarySobId())
.name(e.getName())
.sortedIndex(e.getSortedIndex())
.itemHide(e.getItemHide())
.build())
.collect(Collectors.toList());
Map<Long, SalarySobItemGroupDTO> salarySobItemGroupDTOMap = SalaryEntityUtil.convert2Map(salarySobItemGroupDTOS, SalarySobItemGroupDTO::getId);
Map<Long, SalaryItemPO> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
Map<Long, List<SalarySobItemPO>> salarySobItemMap = SalaryEntityUtil.group2Map(salarySobItems, SalarySobItemPO::getSalarySobItemGroupId);
Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
// 薪资账套的薪资项目副本po转换成dto
salarySobItemMap.forEach((k, v) -> {
List<SalarySobItemDTO> items = Lists.newArrayList();
@ -104,6 +106,7 @@ public class SalarySobItemAggregateBO {
.salaryItemId(salaryItemPO.getId())
.dateType(salaryItemPO.getDataType())
.name(salaryItemPO.getName())
.itemHide(salarySobItemPO.getItemHide())
.formulaId(salarySobItemPO.getFormulaId())
.formulaContent(formulaMap.getOrDefault(salarySobItemPO.getFormulaId(), ""))
.taxDeclarationColumn(SalaryItemBO.buildTaxDeclarationColumn(salaryItemPO.getCode()))

View File

@ -41,6 +41,7 @@ public class SalarySobItemDTO {
//名称
private String name;
//是否是薪资档案引用
private Integer useInEmployeeSalary;
@ -88,4 +89,8 @@ public class SalarySobItemDTO {
//是否可以删除
private boolean canDelete;
//该分类是否隐藏0不隐藏1隐藏
@JsonSerialize(using = ToStringSerializer.class)
private Long itemHide;
}

View File

@ -38,6 +38,10 @@ public class SalarySobItemGroupDTO {
//薪资项目分组排序字段")
private Integer sortedIndex;
//该分类是否隐藏0不隐藏1隐藏
@JsonSerialize(using = ToStringSerializer.class)
private Long itemHide;
//薪资项目分组下的薪资项目")
private List<SalarySobItemDTO> items;
}

View File

@ -73,6 +73,9 @@ public class SalarySobItemSaveParam {
//公式")
private Long formulaId;
//该分类是否隐藏0不隐藏1隐藏
private Long itemHide;
private Boolean canDelete;
}
@ -94,5 +97,8 @@ public class SalarySobItemSaveParam {
//分类下的薪资项目
private List<SalarySobItemParam> items;
//该分类是否隐藏0不隐藏1隐藏
private Long itemHide;
}
}

View File

@ -73,5 +73,8 @@ public class SalarySobItemGroupPO {
*/
private Date updateTime;
//该分类是否隐藏0不隐藏1隐藏
private Long itemHide;
Collection<Long> ids;
}

View File

@ -0,0 +1,71 @@
package com.engine.salary.entity.salarysob.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Description hrsa_salary_item_hide 薪资项目是否在薪资核算中展示
* @author Harryxzy
* @date 2022/8/22 18:00
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobItemHidePO {
/**
* ID
*/
private Long id;
/**
* 账套ID
*/
private Long salarySobId;
/**
* 薪资项目ID
*/
private Long salaryItemId;
/**
* 类型是否是项目组 0-不是 1-
*/
private Integer isGroup;
/**
* 是否隐藏0-不隐藏 1-隐藏
*/
private Long itemHide;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 租户
*/
private String tenantKey;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}

View File

@ -88,6 +88,9 @@ public class SalarySobItemPO {
*/
private Date updateTime;
//该分类是否隐藏0不隐藏1隐藏
private Long itemHide;
//in
Collection<Long> ids;
Collection<Long> salarySobIds;

View File

@ -21,7 +21,8 @@ public interface SalarySobItemGroupMapper {
* @return 返回集合没有返回空List
*/
List<SalarySobItemGroupPO> listSome(SalarySobItemGroupPO salarySobItemGroup);
List<SalarySobItemGroupPO> listSomeWithItemHide(SalarySobItemGroupPO build);
/**
* 根据主键查询
@ -85,5 +86,6 @@ public interface SalarySobItemGroupMapper {
* @param salarySobItemGroups
*/
void batchInsert(@Param("collection") Collection<SalarySobItemGroupPO> salarySobItemGroups);
}

View File

@ -12,6 +12,7 @@
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="item_hide" property="itemHide"/>
</resultMap>
<!-- 表字段 -->
@ -93,6 +94,35 @@
</select>
<select id="listSomeWithItemHide" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
SELECT
t
.
id
, t.salary_sob_id
, t.name
, t.sorted_index
, t.description
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, h.item_hide
from hrsa_salary_sob_item_group t LEFT JOIN hrsa_salary_item_hide h ON t.id=h.salary_item_id
where t.delete_type=0
<if test="id != null">
AND t.id = #{id}
</if>
<if test="salarySobId != null">
AND t.salary_sob_id = #{salarySobId}
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
INSERT INTO hrsa_salary_sob_item_group

View File

@ -0,0 +1,15 @@
package com.engine.salary.mapper.salarysob;
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import java.util.List;
public interface SalarySobItemHideMapper {
/**
* 根据账套id获取关闭显示开关的itemID
* @param salarySobPO
* @return
*/
List<Long> getById(SalarySobItemHidePO salarySobPO);
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.salarysob.SalarySobItemHideMapper">
<!-- 根据账套id获取关闭显示开关的itemID -->
<select id="getById" resultType="java.lang.Long">
SELECT salary_item_id FROM `hrsa_salary_item_hide`
where delete_type=0
and salary_sob_id=#{salarySobId}
and item_hide=1
<if test="isGroup!=null">
and is_group=#{isGroup}
</if>
</select>
</mapper>

View File

@ -1,7 +1,7 @@
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.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
@ -23,7 +23,9 @@ public interface SalarySobItemMapper {
* @return 返回集合没有返回空List
*/
List<SalarySobItemPO> listSome(SalarySobItemPO salarySobItemPO);
List<SalarySobItemPO> listBySalarySobIdWithHideItem(SalarySobItemPO salarySobItemPO);
/**
* 根据主键查询
@ -86,5 +88,24 @@ public interface SalarySobItemMapper {
* @param salarySobItems
*/
void batchInsert(@Param("collection") Collection<SalarySobItemPO> salarySobItems);
/**
* 删除工资项目是否显示
*
* @param salarySobIds
*/
void deleteItemShowBySalarySobId(@Param("salarySobIds")Collection<Long> salarySobIds);
/**
* 插入薪资项目分组是否显示
* @param salarySobItemHidePO
*/
void insertItemShow(SalarySobItemHidePO salarySobItemHidePO);
/**
* 根据账套id以及薪资项目分组获取
* @param
*/
List<SalarySobItemPO> listBySalarySobIdAndGroupId(@Param("salarySobId") Long salarySobId,@Param("salarySobItemGroupIds") Collection<Long> salarySobItemGroupIds);
}

View File

@ -121,6 +121,53 @@
ORDER BY id DESC
</select>
<select id="listBySalarySobIdAndGroupId"
resultType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_item t
WHERE delete_type = 0
<if test="salarySobId != null ">
AND salary_sob_id = #{salarySobId}
</if>
<if test="salarySobItemGroupIds != null and salarySobItemGroupIds.size()>0">
AND salary_sob_item_group_id IN
<foreach collection="salarySobItemGroupIds" open="(" item="id" separator="," close=",0)">
#{id}
</foreach>
</if>
<if test="salarySobItemGroupIds == null or salarySobItemGroupIds.size() == 0">
AND salary_sob_item_group_id IN (0)
</if>
</select>
<select id="listBySalarySobIdWithHideItem"
resultType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
SELECT
t.create_time
, t.creator
, t.delete_type
, t.description
, t.formula_id
, t.id
, t.salary_item_id
, t.salary_sob_id
, t.salary_sob_item_group_id
, t.sorted_index
, t.tenant_key
, t.update_time
,t.can_delete
,h.item_hide
FROM hrsa_salary_sob_item t
LEFT JOIN hrsa_salary_item_hide h ON t.salary_item_id=h.salary_item_id and t.salary_sob_id = h.salary_sob_id
WHERE t.delete_type = 0
and t.salary_sob_id=#{salarySobId}
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
@ -284,6 +331,16 @@
AND delete_type = 0
</delete>
<!-- 根据薪资账套ID删除记录 -->
<delete id="deleteItemShowBySalarySobId">
DELETE FROM hrsa_salary_item_hide
WHERE delete_type = 0
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</delete>
<update id="deleteBySalarySobIds">
UPDATE hrsa_salary_sob_item
@ -369,5 +426,13 @@
</foreach>
</insert>
<insert id="insertItemShow">
insert into hrsa_salary_item_hide(id,salary_sob_id,salary_item_id,is_group,item_hide,
creator,tenant_key,CREATE_TIME,update_time)
VALUES(#{id},#{salarySobId},#{salaryItemId},
#{isGroup},#{itemHide},#{creator},
#{tenantKey},#{createTime},#{updateTime});
</insert>
</mapper>

View File

@ -31,6 +31,14 @@ public interface SalarySobItemGroupService {
*/
List<SalarySobItemGroupPO> listBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id查询薪资账套的薪资项目分类带上隐藏信息
*
* @param salarySobId 薪资账套id
* @return
*/
List<SalarySobItemGroupPO> listBySalarySobIdWithItemHide(Long salarySobId);
/**
* 批量保存
*

View File

@ -0,0 +1,16 @@
package com.engine.salary.service;
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import java.util.List;
public interface SalarySobItemHideService {
/**
* 根据薪资账套id查询哪些字段关闭显示
*
* @param salarySobId
* @return
*/
List<Long> listHideGroupBysalarySobId(SalarySobItemHidePO salarySobId);
}

View File

@ -32,6 +32,20 @@ public interface SalarySobItemService {
*/
List<SalarySobItemPO> listBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id查询薪资账套的薪资项目副本(不包括已隐藏的薪资项目列)
*
* @param salarySobId 薪资账套的id
* @return
*/
List<SalarySobItemPO> listBySalarySobIdWithHideItem(Long salarySobId);
/**
* 根据薪资账套id和薪资项目分类查询薪资账套的薪资项目副本
*
*/
List<SalarySobItemPO> listBySalarySobIdAndGroupId(Long salarySobId,Collection<Long> salarySobItemGroupIds);
/**
* 根据薪资账套id查询薪资账套的薪资项目副本
*
@ -73,6 +87,13 @@ public interface SalarySobItemService {
*/
SalarySobItemAggregateDTO getAggregateBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id获取薪资账套的薪资项目聚合员工信息薪资项目副本薪资项目分类(不包含已设置为隐藏的)
* @param salarySobId
* @return
*/
SalarySobItemAggregateDTO getAggregateWithItemHideBySalarySobId(Long salarySobId);
/**
* 保存
*
@ -92,4 +113,10 @@ public interface SalarySobItemService {
*
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
/**
* 根据薪资账套id删除薪资项目是否显示
*
*/
void deleteItemShowBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -259,7 +259,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
*/
public List<WeaTableColumnGroup> listWeaTableColumn(SalaryAcctRecordPO salaryAcctRecordPO) {
// 查询薪资账套下的薪资项目+员工信息字段
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateBySalarySobId(salaryAcctRecordPO.getSalarySobId());
SalarySobItemAggregateDTO salarySobItemAggregateDTO = getSalarySobItemService(user).getAggregateWithItemHideBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 构建薪资核算结果列表表头
return SalaryAcctResultBO.buildTableColumns(salarySobItemAggregateDTO);
}

View File

@ -27,10 +27,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctResultTempPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.*;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
@ -117,6 +114,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
}
private SalarySobItemHideService getSalarySobItemHideService(User user) {
return (SalarySobItemHideService) ServiceUtil.getService(SalarySobItemHideServiceImpl.class, user);
}
private SalaryAcctCalculateService getSalaryAcctCalculateService(User user) {
return ServiceUtil.getService(SalaryAcctCalculateServiceImpl.class, user);
}
@ -144,6 +145,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
}
private SalarySobItemGroupService getSalarySobItemGroupService(User user) {
return (SalarySobItemGroupService) ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user);
}
private SalaryCheckResultService salaryCheckResultService;
@Override
@ -192,8 +198,29 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (Objects.isNull(salaryAcctEmployeePO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98831, "薪资核算人员不存在或已被删除"));
}
//----------------------------------------------
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobIdWithItemHide(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());
// 获取薪资项目分类ID
List<Long> salarySobItemGroupIds = salarySobItemGroupPOS.stream().map(SalarySobItemGroupPO::getId).collect(Collectors.toList());
// 查询薪资账套的薪资项目副本(已经过滤关闭分类显示按钮的薪资项目)
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobIdAndGroupId(salaryAcctEmployeePO.getSalarySobId(),salarySobItemGroupIds);
//----------------------------------------------
// 查询薪资核算所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctEmployeePO.getSalarySobId());
// 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());
// 查询薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
@ -205,6 +232,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeId(salaryAcctEmployeeId);
// 查询个税扣缴义务人
TaxAgentPO taxAgent = getTaxAgentService(user).getById(salaryAcctEmployeePO.getTaxAgentId());
// 转换成薪资核算结果详情dto
return SalaryAcctResultBO.convert2DetailDTO(simpleEmployee, taxAgent, salaryAcctEmployeePO, salarySobEmpFieldPOS, salarySobItemPOS, salaryItemPOS, salaryAcctResultPOS);
}

View File

@ -30,6 +30,11 @@ public class SalarySobItemGroupServiceImpl extends Service implements SalarySobI
return salarySobItemGroupMapper.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemGroupPO> listBySalarySobIdWithItemHide(Long salarySobId) {
return salarySobItemGroupMapper.listSomeWithItemHide(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build());
}
@Override
public void batchSave(Collection<SalarySobItemGroupPO> salarySobItemGroupPOS) {
salarySobItemGroupMapper.batchInsert(salarySobItemGroupPOS);

View File

@ -0,0 +1,18 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobItemHideBiz;
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import com.engine.salary.service.SalarySobItemHideService;
import java.util.List;
public class SalarySobItemHideServiceImpl extends Service implements SalarySobItemHideService {
private SalarySobItemHideBiz salarySobItemHideMapper = new SalarySobItemHideBiz();
@Override
public List<Long> listHideGroupBysalarySobId(SalarySobItemHidePO salarySobPO) {
return salarySobItemHideMapper.listSome(salarySobPO);
}
}

View File

@ -11,10 +11,7 @@ import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
@ -27,6 +24,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资账套的薪资项目副本
@ -51,6 +49,10 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
return (SalarySobItemGroupService) ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user);
}
private SalarySobItemHideService getSalarySobItemHideService(User user) {
return (SalarySobItemHideService) ServiceUtil.getService(SalarySobItemHideServiceImpl.class, user);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
@ -70,6 +72,16 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemPO> listBySalarySobIdWithHideItem(Long salarySobId) {
return salarySobItemMapper.listBySalarySobIdWithHideItem(SalarySobItemPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemPO> listBySalarySobIdAndGroupId(Long salarySobId,Collection<Long> salarySobItemGroupIds) {
return salarySobItemMapper.listBySalarySobIdAndGroupId(salarySobId,salarySobItemGroupIds);
}
@Override
public List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds) {
return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobIds(salarySobIds).build());
@ -110,9 +122,11 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 查询薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salarySobId);
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobIdWithItemHide(salarySobId);
// 查询薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId);
List<SalarySobItemPO> salarySobItemPOS =listBySalarySobIdWithHideItem (salarySobId);
// 薪资账套的薪资项目副本所用的公式id
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
// 查询公式详情
@ -120,6 +134,48 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 查询薪资账套的薪资项目副本所关联的薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 转换成聚合dto
SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
return salarySobItemAggregateBO.convert2AggregateDTO();
}
@Override
public SalarySobItemAggregateDTO getAggregateWithItemHideBySalarySobId(Long salarySobId) {
// 查询薪资账套
SalarySobPO salarySobPO = salarySobBiz.getById(salarySobId);
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 查询薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobIdWithItemHide(salarySobId);
// 获取关闭显示的分类
List<Long> hideGroupIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(1).build());
// 过滤关闭显示的薪资项目分类
salarySobItemGroupPOS = salarySobItemGroupPOS.stream().filter(group -> !(hideGroupIDs.contains(group.getId()))).collect(Collectors.toList());
// 获取薪资项目分类ID
List<Long> salarySobItemGroupIds = salarySobItemGroupPOS.stream().map(SalarySobItemGroupPO::getId).collect(Collectors.toList());
// 查询薪资账套的薪资项目副本(已经过滤关闭分类显示按钮的薪资项目)
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobIdAndGroupId(salarySobId,salarySobItemGroupIds);
// 获取关闭显示的薪资项目
List<Long> hideItemIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(0).build());
salarySobItemPOS = salarySobItemPOS.stream().filter(group -> !(hideItemIDs.contains(group.getSalaryItemId()))).collect(Collectors.toList());
// 薪资账套的薪资项目副本所用的公式id
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
// 查询公式详情
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 查询薪资账套的薪资项目副本所关联的薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 转换成聚合dto
SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
@ -186,6 +242,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
}
/**
* 清楚原相关数据
*
@ -198,6 +256,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
deleteBySalarySobIds(Collections.singleton(salarySobId));
// 删除薪资账套的薪资项目分类
getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
// 删除薪资项目是否显示
deleteItemShowBySalarySobIds(Collections.singleton(salarySobId));
}
/**
@ -248,6 +309,28 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.build();
//保存分类
salarySobItemGroupBiz.insert(salarySobItemGroupPO);
// 保存薪资项目分类 字段显隐
Long salarySobGroupItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobGroupItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobGroupItemShowId)
.salarySobId(salarySobId)
.salaryItemId(salarySobItemGroupId)
.isGroup(1)
.itemHide(itemGroupParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
if(itemGroupParam.getItemHide()==null){
salarySobGroupItemHidePO.setItemHide(Long.valueOf(0));
}
salarySobItemMapper.InsertItemShow(salarySobGroupItemHidePO);
// //获取分类id
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupBiz.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).name(itemGroupParam.getName()).build());
// Long salarySobItemGroupId = salarySobItemGroupPOS.get(0).getId();
@ -269,9 +352,27 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO))
.build();
salarySobItems.add(salarySobItemPO);
// 保存薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
salarySobItemMapper.InsertItemShow(salarySobItemHidePO);
}
}
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : saveParam.getItems()) {
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder()
.salarySobId(salarySobId)
@ -288,6 +389,22 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO))
.build();
salarySobItems.add(salarySobItemPO);
// 保存未分类薪资项目是否展示
Long salarySobItemShowId = IdGenerator.generate();
SalarySobItemHidePO salarySobItemHidePO = SalarySobItemHidePO.builder()
.id(salarySobItemShowId)
.salarySobId(salarySobId)
.salaryItemId(itemParam.getSalaryItemId())
.isGroup(0)
.itemHide(itemParam.getItemHide())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
salarySobItemMapper.InsertItemShow(salarySobItemHidePO);
}
// 保存薪资账套的薪资项目副本
@ -306,4 +423,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobItemMapper.deleteBySalarySobIds(salarySobIds);
}
@Override
public void deleteItemShowBySalarySobIds(Collection<Long> salarySobIds) {
salarySobItemMapper.deleteItemShowBySalarySobId(salarySobIds);
}
}

View File

@ -264,6 +264,8 @@ public class SalarySobController {
/**********************************薪资账套的薪资项目 end*********************************/
/**********************************调薪计薪规则 start*********************************/