外部人员

This commit is contained in:
钱涛 2023-03-14 10:52:48 +08:00
parent 0c409c627c
commit 767fbe36f5
15 changed files with 633 additions and 22 deletions

View File

@ -0,0 +1,36 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.Data;
import java.util.List;
/**
* 外部人员管理范围保存参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class SalarySobRangeExtSaveParam {
//薪资账套的id
@DataCheck(require = true, message = "薪资账套的ID不允许为空")
private Long salarySobId;
/**
* 对象id
*/
private List<Long> targetIds;
/**
* 对象类型1外部人员
*/
private Long targetType;
}

View File

@ -0,0 +1,65 @@
package com.engine.salary.entity;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* 个税扣缴义务人的管理范围表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobExtRangePO {
/**
* 主键id
*/
private Long id;
/**
* 账套id
*/
private Long salarySobId;
/**
* 对象id
*/
private Long targetId;
/**
* 对象类型1外部人员
*/
private Integer targetType;
/**
* 租户ID
*/
private String tenantKey;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private Long creator;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
//主键id集合
private Collection<Long> ids;
@TableTitle(title = "名称", dataIndex = "targetName", key = "targetName")
private String targetName;
}

View File

@ -0,0 +1,69 @@
package com.engine.salary.mapper.salarysob;
import com.engine.salary.entity.SalarySobExtRangePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface SalarySobExtRangeMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalarySobExtRangePO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalarySobExtRangePO> listSome(SalarySobExtRangePO salarySobExtRange);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalarySobExtRangePO getById(Long id);
/**
* 新增忽略null字段
*
* @param salarySobExtRange 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalarySobExtRangePO salarySobExtRange);
/**
* 修改修改所有字段
*
* @param salarySobExtRange 修改的记录
* @return 返回影响行数
*/
int update(SalarySobExtRangePO salarySobExtRange);
/**
* 修改忽略null字段
*
* @param salarySobExtRange 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalarySobExtRangePO salarySobExtRange);
/**
* 删除记录
*
* @param salarySobExtRange 待删除的记录
* @return 返回影响行数
*/
int delete(SalarySobExtRangePO salarySobExtRange);
List<SalarySobExtRangePO> listPage4Ext(SalarySobExtRangePO build);
void deleteByIds(@Param("ids") Collection<Long> ids);
}

View File

@ -0,0 +1,249 @@
<?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.SalarySobExtRangeMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.SalarySobExtRangePO">
<result column="create_time" property="createTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="id" property="id" />
<result column="salary_sob_id" property="salarySobId" />
<result column="target_id" property="targetId" />
<result column="target_type" property="targetType" />
<result column="tenant_key" property="tenantKey" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.create_time
, t.creator
, t.delete_type
, t.id
, t.salary_sob_id
, t.target_id
, t.target_type
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_salary_sob_ext_range t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_salary_sob_ext_range t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.SalarySobExtRangePO">
SELECT
<include refid="baseColumns" />
FROM hrsa_salary_sob_ext_range t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="targetId != null">
AND target_id = #{targetId}
</if>
<if test="targetType != null">
AND target_type = #{targetType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.SalarySobExtRangePO">
INSERT INTO hrsa_salary_sob_ext_range
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="id != null">
id,
</if>
<if test="salarySobId != null">
salary_sob_id,
</if>
<if test="targetId != null">
target_id,
</if>
<if test="targetType != null">
target_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="id != null" >
#{id},
</if>
<if test="salarySobId != null" >
#{salarySobId},
</if>
<if test="targetId != null" >
#{targetId},
</if>
<if test="targetType != null" >
#{targetType},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.SalarySobExtRangePO">
UPDATE hrsa_salary_sob_ext_range
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
salary_sob_id=#{salarySobId},
target_id=#{targetId},
target_type=#{targetType},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.SalarySobExtRangePO">
UPDATE hrsa_salary_sob_ext_range
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="salarySobId != null" >
salary_sob_id=#{salarySobId},
</if>
<if test="targetId != null" >
target_id=#{targetId},
</if>
<if test="targetType != null" >
target_type=#{targetType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.SalarySobExtRangePO">
UPDATE hrsa_salary_sob_ext_range
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
<select id="listPage4Ext" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.SalarySobExtRangePO">
SELECT
<include refid="baseColumns" />
,e.username as targetName
FROM hrsa_salary_sob_ext_range t
left join hrsa_external_employee e
on t.target_id = e.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>
<if test="targetId != null">
AND t.target_id = #{targetId}
</if>
<if test="targetType != null">
AND t.target_type = #{targetType}
</if>
<if test="ids != null and ids.size()>0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY t.id DESC
</select>
<delete id="deleteByIds">
UPDATE hrsa_salary_sob_ext_range
SET delete_type=1
WHERE id IN and delete_type=0
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,7 +1,9 @@
package com.engine.salary.mapper.taxagent;
import com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface TaxAgentExtRangeMapper {
@ -60,5 +62,6 @@ public interface TaxAgentExtRangeMapper {
* @return 返回影响行数
*/
int delete(TaxAgentExtRangePO taxAgentExtRange);
void deleteByIds(@Param("ids")Collection<Long> ids);
}

View File

@ -210,5 +210,15 @@
AND delete_type = 0
</delete>
<delete id="deleteByIds" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO">
UPDATE hrsa_tax_agent_ext_range
SET delete_type=1
WHERE id in
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
AND delete_type = 0
</delete>
</mapper>

View File

@ -1,6 +1,8 @@
package com.engine.salary.service;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
@ -63,6 +65,19 @@ public interface SalarySobRangeService {
*/
void save(SalarySobRangeSaveParam saveParam);
/**
* 保存外部人员
* @param saveParam
*/
void saveExtRange(SalarySobRangeExtSaveParam saveParam);
/**
* 外部人员列表
* @param param
* @return
*/
PageInfo<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param);
/**
* 根据主键id删除薪资账套的人员范围
*
@ -70,6 +85,8 @@ public interface SalarySobRangeService {
*/
void deleteByIds(Collection<Long> ids);
void deleteSalarySobExtRange(Collection<Long> ids);
/**
* 根据薪资账套id删除薪资账套的人员范围
*

View File

@ -58,6 +58,7 @@ public interface TaxAgentManageRangeService {
*/
void saveExtRange(TaxAgentManageRangeExtSaveParam saveParam);
void deleteExtRange(Collection<Long> ids);
/**
* 根据主键id删除管理范围

View File

@ -190,6 +190,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
queryParam.setExtSalaryArchiveList(true);
List<SalaryArchiveListDTO> list = getSalaryArchiveList(queryParam);
list = list.stream()
//过滤档案状态

View File

@ -6,6 +6,8 @@ import com.engine.core.impl.Service;
import com.engine.hrm.biz.OrganizationShowSetBiz;
import com.engine.salary.biz.SalarySobRangeBiz;
import com.engine.salary.biz.SpecialAddDeductionBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.PositionInfo;
@ -14,6 +16,7 @@ import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO;
import com.engine.salary.entity.salarysob.bo.SalarySobRangeSaveBO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeImportListDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
@ -24,6 +27,7 @@ import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salarysob.SalarySobExtRangeMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.SalarySobRangeService;
@ -40,10 +44,10 @@ import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
@ -84,6 +88,10 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
}
private SalarySobExtRangeMapper getSalarySobExtRangeMapper() {
return SqlProxyHandle.getProxy(SalarySobExtRangeMapper.class);
}
// private ComInfoCache comInfoCache;
// private LoggerTemplate salarySobLoggerTemplate;
@ -144,7 +152,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
List<PositionInfo> positionInfos = getSalaryEmployeeService(user).listPositionInfo(positionIds);
// 薪资账套的人员范围po转换成列表dto
List<SalarySobRangeListDTO> salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos,subCompanyInfos, positionInfos);
List<SalarySobRangeListDTO> salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos, subCompanyInfos, positionInfos);
// 根据对象名称过滤
if (StringUtils.isNotEmpty(queryParam.getTargetName())) {
salarySobRangeListDTOS = salarySobRangeListDTOS.stream()
@ -152,7 +160,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
.collect(Collectors.toList());
}
// 填充总数和当页数据
PageInfo<SalarySobRangeListDTO> pageInfo = new PageInfo<SalarySobRangeListDTO>(salarySobRangeListDTOS,SalarySobRangeListDTO.class);
PageInfo<SalarySobRangeListDTO> pageInfo = new PageInfo<SalarySobRangeListDTO>(salarySobRangeListDTOS, SalarySobRangeListDTO.class);
pageInfo.setTotal(salarySobRangeListDTOS.size());
pageInfo.setList(SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), salarySobRangeListDTOS));
pageInfo.setPageNum(queryParam.getCurrent());
@ -194,6 +202,46 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public void saveExtRange(SalarySobRangeExtSaveParam saveParam) {
ValidUtil.doValidator(saveParam);
// 查询薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 查询已有的人员范围
List<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listSome(SalarySobExtRangePO.builder().salarySobId(saveParam.getSalarySobId()).build());
// 处理一下本次的保存参数如果原来添加过对应的人员/部门/岗位那么本次不需要新增只需要更新
List<Long> oldTargetIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobExtRangePO::getTargetId, Collectors.toList());
List<Long> targetIds = saveParam.getTargetIds();
Date date = new Date();
if (CollectionUtils.isNotEmpty(targetIds)) {
targetIds.stream().filter(targetId -> !oldTargetIds.contains(targetId)).forEach(targetId -> {
SalarySobExtRangePO po = SalarySobExtRangePO.builder()
.id(IdGenerator.generate())
.targetType(1)
.salarySobId(saveParam.getSalarySobId())
.targetId(targetId)
.createTime(date)
.updateTime(date)
.creator((long) user.getUID())
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
getSalarySobExtRangeMapper().insertIgnoreNull(po);
});
}
}
@Override
public PageInfo<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param) {
List<SalarySobExtRangePO> salarySobRangePOS = getSalarySobExtRangeMapper().listPage4Ext(SalarySobExtRangePO.builder().salarySobId(param.getSalarySobId()).build());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), salarySobRangePOS, SalarySobExtRangePO.class);
}
@Override
public void deleteByIds(Collection<Long> ids) {
// 查询薪资账套的人员范围
@ -205,13 +253,13 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
// 删除薪资账套的人员范围
salarySobRangeBiz.deleteByIds(ids);
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getSalarySobId);
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByIds(salarySobIds);
// "关联人员范围"还是"从范围中排除"
Integer includeType = salarySobRangePOS.get(0).getIncludeType();
// todo 记录日志
String operateTypeName = Objects.equals(includeType, NumberUtils.INTEGER_ONE) ?
SalaryI18nUtil.getI18nLabel(98605, "关联人员范围删除对象") : SalaryI18nUtil.getI18nLabel(98606, "从范围中排除删除对象");
// Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getSalarySobId);
// List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByIds(salarySobIds);
// // "关联人员范围"还是"从范围中排除"
// Integer includeType = salarySobRangePOS.get(0).getIncludeType();
// // todo 记录日志
// String operateTypeName = Objects.equals(includeType, NumberUtils.INTEGER_ONE) ?
// SalaryI18nUtil.getI18nLabel(98605, "关联人员范围删除对象") : SalaryI18nUtil.getI18nLabel(98606, "从范围中排除删除对象");
// salarySobPOS.forEach(salarySobPO -> {
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
@ -222,6 +270,14 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
// });
}
@Override
public void deleteSalarySobExtRange(Collection<Long> ids) {
if(CollectionUtils.isEmpty(ids)){
return;
}
getSalarySobExtRangeMapper().deleteByIds(ids);
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobRangeBiz.deleteBySalarySobIds(salarySobIds);
@ -241,10 +297,10 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
// 注释
List<ExcelComment> excelComments = Lists.newArrayList();
if(confValue.equals("1")){
if (confValue.equals("1")) {
// 人员校验规则为工号
excelComments.add(new ExcelComment(3, 0, 4, 2, SalaryI18nUtil.getI18nLabel(100344, "必填")));
}else {
} else {
excelComments.add(new ExcelComment(0, 0, 1, 2, SalaryI18nUtil.getI18nLabel(100344, "必填")));
}
excelComments.add(new ExcelComment(4, 0, 6, 3, SalaryI18nUtil.getI18nLabel(100344, "若不填,默认全部员工状态。指定员工状态格式:试用、正式、临时、试用延期")));
@ -363,19 +419,19 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
}
// 设置员工状态
if(StringUtils.isEmpty(employeeStatusStr)){
if (StringUtils.isEmpty(employeeStatusStr)) {
SalaryEmployeeStatusEnum[] values = SalaryEmployeeStatusEnum.values();
po.setEmployeeStatus(SalaryEmployeeStatusEnum.values());
}else{
} else {
Boolean[] haveError = {false};
// 人员状态字符串转换为对应的value
SalaryEmployeeStatusEnum[] status = SalaryEmployeeStatusEnum.getEnumsParseByFormatStr(employeeStatusStr, haveError);
if(haveError[0]){
if (haveError[0]) {
Map<String, String> errorMessageMap = new HashMap<>();
errorMessageMap.put("message", rowIndex + "员工状态不存在,或格式有误。格式为:试用、正式、临时、试用延期");
errorData.add(errorMessageMap);
errorSum += 1;
}else{
} else {
po.setEmployeeStatus(status);
}
}
@ -426,7 +482,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
}
// 多条相同人的则以第一条为准如果逆序排列用于重复的则以最后一条为准Collections.reverse(pos);
// 去重通过记录的唯一条件(人员id
List<SalarySobRangeSaveParam.SalarySobRangeTargetParam> finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getTargetId() ))), ArrayList::new));
List<SalarySobRangeSaveParam.SalarySobRangeTargetParam> finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getTargetId()))), ArrayList::new));
return finalPos;
}
@ -453,7 +509,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
List<SalarySobRangeImportListDTO> salarySobRangeImportList = ExcelParseHelper.parse2Map(fileInputStream, SalarySobRangeImportListDTO.class, 0, 1, 5, "TaxAgentEmployee.xlsx");
List<SalarySobRangeImportListDTO> salarySobRangeImportList = ExcelParseHelper.parse2Map(fileInputStream, SalarySobRangeImportListDTO.class, 0, 1, 5, "TaxAgentEmployee.xlsx");
apidatas.put("preview", salarySobRangeImportList);
} finally {
IOUtils.closeQuietly(fileInputStream);
@ -463,16 +519,16 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
/**
* @return List<List < String>>
* @description 获取excel数据行
* @return List<List<String>>
* @author Harryxzy
* @date 2023/1/9 11:37
*/
private List<List<Object>> getExcelRowList() {
// 表头
List<Object> headers = Lists.newArrayList();
headers.add(SalaryI18nUtil.getI18nLabel( 85429, "姓名"));
headers.add(SalaryI18nUtil.getI18nLabel( 86185, "部门"));
headers.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
headers.add(SalaryI18nUtil.getI18nLabel(86185, "部门"));
headers.add(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
headers.add(SalaryI18nUtil.getI18nLabel(86317, "工号"));
headers.add(SalaryI18nUtil.getI18nLabel(86318, "员工状态"));

View File

@ -4,6 +4,7 @@ import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.HrmStatus;
@ -13,6 +14,7 @@ import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeListDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO;
import com.engine.salary.entity.taxagent.param.*;
import com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
@ -35,6 +37,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.entity.LocalRunnable;
import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -388,6 +391,25 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(108605, "参数错误,无此外部人员"));
}
Date now = new Date();
List<TaxAgentExtRangePO> oldPO = listExtByIds(targetIds);
List<Long> oldIds = SalaryEntityUtil.properties(oldPO, TaxAgentExtRangePO::getTargetId, Collectors.toList());
targetIds.stream().filter(targetId -> !oldIds.contains(targetId)).forEach(targetId -> {
TaxAgentExtRangePO po = TaxAgentExtRangePO.builder()
.id(IdGenerator.generate())
.taxAgentId(taxAgentId)
.targetId(targetId)
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.deleteType(0)
.targetType(1)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
getTaxAgentExtRangeMapper().insertIgnoreNull(po);
});
/* 同步本地人员范围的关联人员=========================== */
if (saveParam.isSync()) {
@ -400,6 +422,26 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
}
}
private List<TaxAgentExtRangePO> listExtByIds(Collection<Long> targetIds) {
List<TaxAgentExtRangePO> oldPO = getTaxAgentExtRangeMapper().listSome(TaxAgentExtRangePO.builder().ids(targetIds).build());
return oldPO;
}
@Override
public void deleteExtRange(Collection<Long> ids) {
// 查询管理范围
List<TaxAgentExtRangePO> taxAgentManageRanges = listExtByIds(ids);
if (CollectionUtils.isEmpty(taxAgentManageRanges)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98604, "数据不存在或已被删除"));
}
List<Long> taxAgentIds = taxAgentManageRanges.stream().map(TaxAgentExtRangePO::getTaxAgentId).distinct().collect(Collectors.toList());
if (taxAgentIds.size() > 1) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110159, "一次只能删一个个税个税扣缴义务人的范围"));
}
// 删除管理范围
getTaxAgentExtRangeMapper().deleteByIds(ids);
}
private void syncLocalExtEmp(Long taxAgentId, List<DataCollectionEmployee> allSalaryEmployees) {
List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees));

View File

@ -1,6 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salarysob.dto.*;
@ -193,6 +194,22 @@ public class SalarySobController {
return new ResponseResult<SalarySobRangeSaveParam, String>(user).run(getSalarySobRangeWrapper(user)::save, saveParam);
}
@POST
@Path("/ext/save")
@Produces(MediaType.APPLICATION_JSON)
public String saveSalarySobExtRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobRangeExtSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobRangeExtSaveParam, String>(user).run(getSalarySobRangeWrapper(user)::saveExtRange, saveParam);
}
@POST
@Path("/range/ext/list")
@Produces(MediaType.APPLICATION_JSON)
public String listPage4Ext(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobRangeQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobRangeQueryParam, PageInfo<SalarySobExtRangePO>>(user).run(getSalarySobRangeWrapper(user)::listPage4Ext, queryParam);
}
/**
* 删除薪资账套人员范围
*/
@ -204,6 +221,17 @@ public class SalarySobController {
return new ResponseResult<Collection<Long>, String>(user).run(getSalarySobRangeWrapper(user)::delete, ids);
}
/**
* 删除薪资账套人员范围
*/
@POST
@Path("/range/ext/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalarySobExtRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getSalarySobRangeWrapper(user)::deleteSalarySobExtRange, ids);
}
/***
* @description 下载薪资账套人员范围导入模板
* @return Response

View File

@ -270,6 +270,15 @@ public class TaxAgentController {
return new ResponseResult<Collection<Long>, String>(user).run(getTaxAgentWrapper(user)::deleteRange, ids);
}
//删除外部人员范围
@POST
@Path("/range/ext/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteExtRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getTaxAgentWrapper(user)::deleteExtRange, ids);
}
/**
* 下载人员范围导入模板
*

View File

@ -2,7 +2,9 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
@ -68,6 +70,19 @@ public class SalarySobRangeWrapper extends Service {
getSalarySobRangeService(user).save(saveParam);
}
/**
* 保存
*
* @param saveParam 保存参数
*/
public void saveExtRange(SalarySobRangeExtSaveParam saveParam) {
getSalarySobRangeService(user).saveExtRange(saveParam);
}
public PageInfo<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param) {
return getSalarySobRangeService(user).listPage4Ext(param);
}
/**
* 删除
*
@ -77,6 +92,10 @@ public class SalarySobRangeWrapper extends Service {
getSalarySobRangeService(user).deleteByIds(ids);
}
public void deleteSalarySobExtRange(Collection<Long> ids) {
getSalarySobRangeService(user).deleteSalarySobExtRange(ids);
}
/***
* @description 下载薪资账套人员范围导入模板
* @return XSSFWorkbook

View File

@ -357,6 +357,11 @@ public class TaxAgentWrapper extends Service {
return StringUtils.EMPTY;
}
public void deleteExtRange(Collection<Long> ids) {
getTaxAgentManageRangeService(user).deleteExtRange(ids);
}
/**
* 删除管理范围
*
@ -450,4 +455,5 @@ public class TaxAgentWrapper extends Service {
}
}