This commit is contained in:
钱涛 2022-05-26 11:02:55 +08:00
parent 586fad5f2c
commit f6eb69e62a
15 changed files with 227 additions and 196 deletions

View File

@ -125,5 +125,10 @@ CREATE TABLE hrsa_tax_agent_sub_admin_emp
INDEX idx_tax_agent(tax_agent_id) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
ALTER TABLE hrsa_add_up_deduction ADD COLUMN payment_agency varchar(255) NULL COMMENT '代缴机构' AFTER tenant_key;
ALTER TABLE hrsa_tax_agent ADD COLUMN payment_agency varchar(255) NULL COMMENT '代缴机构' AFTER tenant_key;
ALTER TABLE hrsa_salary_sob ADD COLUMN tax_agent_id bigint(0) NULL COMMENT '个税扣缴义务人的主键id' AFTER tenant_key;

View File

@ -0,0 +1,32 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth;
/**
* 考勤引用是否可以操作参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuoteCheckOperationParam {
//薪资所属月
@DataCheck(require = true, message = "薪资所属月必传")
private YearMonth salaryYearMonth;
//关联账套id
@DataCheck(require = true, message = "关联账套id必传")
private Long salarySobId;
}

View File

@ -27,6 +27,12 @@ public class SalarySobPO {
* 名称
*/
private String name;
/**
* 个税扣缴义务人的主键id
*/
private Long taxAgentId;
/**
* 应税项目1:正常工资薪金所得
*/
@ -85,5 +91,6 @@ public class SalarySobPO {
private String tenantKey;
Collection<Long> ids;
Collection<Long> taxAgentIds;
}

View File

@ -7,6 +7,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 个税扣缴义务人保存参数
* <p>Copyright: Copyright (c) 2022</p>
@ -30,7 +32,7 @@ public class TaxAgentSaveParam {
private String name;
//管理员主键id
private Long adminUserId;
private List<Long> adminUserIds;
//代缴机构
private String paymentAgency;

View File

@ -34,7 +34,7 @@ public class TaxAgentEmployeePO {
private String status;
//人事状态")
private String personnelStatus;
// private String personnelStatus;
private Collection<Long> ids;
}

View File

@ -85,7 +85,6 @@ public interface SalaryAcctResultMapper {
* 根据薪资核算id删除薪资核算结果
*
* @param salaryAcctRecordIds
* @param tenantKey
*/
void deleteBySalaryAcctRecordIds(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctRecordIds);

View File

@ -39,13 +39,6 @@ public interface SalarySobMapper {
*/
int insertIgnoreNull(SalarySobPO SalarySobPO);
/**
* 修改修改所有字段
*
* @param SalarySobPO 修改的记录
* @return 返回影响行数
*/
int update(SalarySobPO SalarySobPO);
/**
* 修改忽略null字段
@ -55,14 +48,6 @@ public interface SalarySobMapper {
*/
int updateIgnoreNull(SalarySobPO SalarySobPO);
/**
* 删除记录
*
* @param SalarySobPO 待删除的记录
* @return 返回影响行数
*/
int delete(SalarySobPO SalarySobPO);
void deleteByIds(@Param("ids") Collection<Long> ids);
List<SalarySobPO> listByParam(@Param("param") SalarySobPO SalarySobPO);

View File

@ -18,6 +18,7 @@
<result column="update_time" property="updateTime"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="tax_agent_id" property="taxAgentId"/>
</resultMap>
<!-- 表字段 -->
@ -40,6 +41,7 @@
, t.update_time
, t.delete_type
, t.tenant_key
, t.tax_agent_id
</sql>
<!-- 查询全部 -->
@ -118,6 +120,12 @@
#{id}
</foreach>
</if>
<if test="taxAgentIds != null and taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
ORDER BY id DESC
</select>
@ -177,6 +185,9 @@
<if test="tenantKey != null">
tenant_key,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -227,32 +238,12 @@
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salarysob.po.SalarySobPO">
UPDATE hrsa_salary_sob
<set>
name=#{name},
income_category=#{incomeCategory},
salary_cycle_type=#{salaryCycleType},
salary_cycle_from_day=#{salaryCycleFromDay},
tax_cycle_type=#{taxCycleType},
attend_cycle_type=#{attendCycleType},
attend_cycle_from_day=#{attendCycleFromDay},
social_security_cycle_type=#{socialSecurityCycleType},
disable=#{disable},
description=#{description},
creator=#{creator},
create_time=#{createTime},
update_time=#{updateTime},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobPO">
@ -303,19 +294,14 @@
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.salarysob.po.SalarySobPO">
UPDATE hrsa_salary_sob
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<update id="deleteByIds">
UPDATE hrsa_salary_sob
SET delete_type = 1

View File

@ -219,7 +219,7 @@
<select id="listEmployee" resultType="com.engine.salary.entity.taxagent.po.TaxAgentEmployeePO">
select e.ID as employeeId,
e.LASTNAME as username,
d.DEPARTMENTNAME as departmentName
d.DEPARTMENTNAME as departmentName,
e.status
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id

View File

@ -12,12 +12,13 @@ import java.util.Collection;
import java.util.List;
/**
* @description: 薪资账套
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/9/21 4:06 PM
* @version:v1.0
*/
* 薪资账套
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobService {
/**

View File

@ -80,6 +80,91 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
@Override
public AddUpDeduction getById(Long id) {
return getAddUpDeductionMapper().getById(id);
}
// /**
// * 获取作为修改者的最新记录
// * 说明以人员id和个税口角义务人id去重
// *
// * @param currentEmployeeId
// * @return
// */
// private List<AddUpDeduction> getLastListByModifier(Long currentEmployeeId) {
// List<AddUpDeductionPO> list = new LambdaQueryChainWrapper<>(getAddUpDeductionMapper())
// .eq(AddUpDeductionPO::getDeleteType, 0)
// .eq(AddUpDeductionPO::getTenantKey)
// .eq(AddUpDeductionPO::getModifier, currentEmployeeId)
// .orderByDesc(AddUpDeductionPO::getDeclareMonth)
// .list();
// return list.stream()
// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
// }
@Override
public PageInfo<AddUpDeductionDTO> listPage(AddUpDeductionQueryParam queryParam) {
long employeeId = (long) user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
return new PageInfo<>(list, AddUpDeductionDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeductionPO> lastList = getLastListByModifier(employeeId);
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
// 自己最后修改过的则可以看到最新和其历史
// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth()))
).collect(Collectors.toList());
// 填充总数和当页数据
// 分页参数
PageInfo<AddUpDeductionDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionDTO.class);
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list));
return dtoPage;
}
}
@Override
public PageInfo<AddUpDeductionRecordDTO> recordListPage(AddUpDeductionQueryParam queryParam) {
long employeeId = (long) user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, AddUpDeductionRecordDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeductionPO> lastList = getLastListByModifier(employeeId, tenantKey);
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
// 自己最后修改过的则可以看到最新和其历史
// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth()))
).collect(Collectors.toList());
// 分页参数
// 填充总数和当页数据
PageInfo<AddUpDeductionRecordDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionRecordDTO.class);
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list));
return dtoPage;
}
}
/**
* 导出详情列表
*
@ -193,7 +278,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
@Override
public XSSFWorkbook downloadTemplate(boolean isChief,AddUpDeductionQueryParam queryParam) {
public XSSFWorkbook downloadTemplate(boolean isChief, AddUpDeductionQueryParam queryParam) {
String sheetName = SalaryI18nUtil.getI18nLabel(101603, "累计专项附加扣除导入模板");
String[] header = {
@ -213,38 +298,41 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
SalaryI18nUtil.getI18nLabel(105142, "累计婴幼儿照护")
};
List<Object> headerList = Arrays.asList(header);
// 2.表头
if (queryParam.getDeclareMonth() != null) {
queryParam.setDeclareMonth(queryParam.getDeclareMonth().stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
// 获取累计专项附加扣除
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
// 人员信息赋值
list.forEach(m -> {
// todo 身份证号
m.setIdNo("");
});
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
for (AddUpDeductionDTO dto : list) {
List<Object> row = new ArrayList<>();
row.add(Util.null2String(dto.getUsername()));
row.add(Util.null2String(dto.getTaxAgentName()));
row.add(Util.null2String(dto.getDepartmentName()));
row.add(Util.null2String(dto.getMobile()));
row.add(Util.null2String(dto.getJobNum()));
row.add(Util.null2String(dto.getIdNo()));
row.add(Util.null2String(dto.getHiredate()));
row.add(Util.null2String(dto.getAddUpChildEducation()));
row.add(Util.null2String(dto.getAddUpContinuingEducation()));
row.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
row.add(Util.null2String(dto.getAddUpHousingRent()));
row.add(Util.null2String(dto.getAddUpSupportElderly()));
row.add(Util.null2String(dto.getAddUpIllnessMedical()));
row.add(Util.null2String(dto.getAddUpInfantCare()));
rows.add(row);
}
// // 2.表头
// if (queryParam.getDeclareMonth() != null) {
// queryParam.setDeclareMonth(queryParam.getDeclareMonth().stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
// }
// // 获取累计专项附加扣除
// List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
// // 人员信息赋值
// list.forEach(m -> {
// // todo 身份证号
// m.setIdNo("");
// });
//
// for (AddUpDeductionDTO dto : list) {
// List<Object> row = new ArrayList<>();
// row.add(Util.null2String(dto.getUsername()));
// row.add(Util.null2String(dto.getTaxAgentName()));
// row.add(Util.null2String(dto.getDepartmentName()));
// row.add(Util.null2String(dto.getMobile()));
// row.add(Util.null2String(dto.getJobNum()));
// row.add(Util.null2String(dto.getIdNo()));
// row.add(Util.null2String(dto.getHiredate()));
// row.add(Util.null2String(dto.getAddUpChildEducation()));
// row.add(Util.null2String(dto.getAddUpContinuingEducation()));
// row.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
// row.add(Util.null2String(dto.getAddUpHousingRent()));
// row.add(Util.null2String(dto.getAddUpSupportElderly()));
// row.add(Util.null2String(dto.getAddUpIllnessMedical()));
// row.add(Util.null2String(dto.getAddUpInfantCare()));
// rows.add(row);
// }
// 4.注释
List<ExcelComment> excelComments = Lists.newArrayList();
@ -265,91 +353,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
@Override
public AddUpDeduction getById(Long id) {
return getAddUpDeductionMapper().getById(id);
}
// /**
// * 获取作为修改者的最新记录
// * 说明以人员id和个税口角义务人id去重
// *
// * @param currentEmployeeId
// * @return
// */
// private List<AddUpDeduction> getLastListByModifier(Long currentEmployeeId) {
// List<AddUpDeductionPO> list = new LambdaQueryChainWrapper<>(getAddUpDeductionMapper())
// .eq(AddUpDeductionPO::getDeleteType, 0)
// .eq(AddUpDeductionPO::getTenantKey)
// .eq(AddUpDeductionPO::getModifier, currentEmployeeId)
// .orderByDesc(AddUpDeductionPO::getDeclareMonth)
// .list();
// return list.stream()
// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
// }
@Override
public PageInfo<AddUpDeductionDTO> listPage(AddUpDeductionQueryParam queryParam) {
long employeeId = (long)user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
return new PageInfo<>(list, AddUpDeductionDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeductionPO> lastList = getLastListByModifier(employeeId);
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
// 自己最后修改过的则可以看到最新和其历史
// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth()))
).collect(Collectors.toList());
// 填充总数和当页数据
// 分页参数
PageInfo<AddUpDeductionDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionDTO.class);
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list));
return dtoPage;
}
}
@Override
public PageInfo<AddUpDeductionRecordDTO> recordListPage(AddUpDeductionQueryParam queryParam) {
long employeeId = (long)user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, AddUpDeductionRecordDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeductionPO> lastList = getLastListByModifier(employeeId, tenantKey);
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
// 作为分管理员
|| TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())
// 自己最后修改过的则可以看到最新和其历史
// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth()))
).collect(Collectors.toList());
// 分页参数
// 填充总数和当页数据
PageInfo<AddUpDeductionRecordDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionRecordDTO.class);
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list));
return dtoPage;
}
}
@Override
public XSSFWorkbook export(boolean isChief, AddUpDeductionQueryParam queryParam) {
@ -428,9 +431,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
@Override
public List<SalaryAcctEmployeePO> getAccountedEmployeeData(String yearMonth) {
List<SalaryAcctEmployeePO> list = Lists.newArrayList();
LocalDate salaryMonthDate = LocalDate.parse(yearMonth+"-01", SalaryDateUtil.DATE_FORMATTER);
LocalDate salaryMonthDate = LocalDate.parse(yearMonth + "-01", SalaryDateUtil.DATE_FORMATTER);
List<SalaryAcctRecordPO> salaryAcctRecords = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthDate)).endDate(SalaryDateUtil.localDateToDate(salaryMonthDate)).build());
salaryAcctRecords.forEach(e->{
salaryAcctRecords.forEach(e -> {
boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue();
if (isAccounted) {
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId())));

View File

@ -70,9 +70,6 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
private SalarySobCheckRuleService getSalarySobCheckRuleService(User user) {
return (SalarySobCheckRuleService) ServiceUtil.getService(SalarySobCheckRuleServiceImpl.class, user);
}
//
// private LoggerTemplate salarySobLoggerTemplate;
//
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
@ -161,7 +158,6 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
}
/**
* todo
* 新建薪资账套时保存默认的员工信息字段
*
* @param salarySobPO 薪资账套

View File

@ -127,7 +127,6 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
// private AuthorityService authorityService;
// private HrmCommonHrmStatusService hrmCommonHrmStatusService;
@Override
@ -273,7 +272,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
// 是否开启分权
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
if (isOpenDevolution && saveParam.getAdminUserId() == null) {
if (isOpenDevolution && CollectionUtils.isEmpty(saveParam.getAdminUserIds())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员"));
}
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listByName(saveParam.getName());
@ -293,7 +292,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, (long) user.getUID());
getTaxAgentMapper().insert(taxAgent);
if (isOpenDevolution) {
getTaxAgentAdminService(user).batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId()));
getTaxAgentAdminService(user).batchInsert(saveParam.getId(), saveParam.getAdminUserIds());
}
// 记录日志
// SalaryLoggerUtil.recordAddSingleLog(taxAgentLoggerTemplate,
@ -313,7 +312,6 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
}
@Override
@Transactional(rollbackFor = Exception.class)
public String update(TaxAgentSaveParam saveParam) {
ValidUtil.doValidator(saveParam, RuntimeTypeEnum.UPDATE);
@ -323,7 +321,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
}
// 是否开启分权
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
if (isOpenDevolution && saveParam.getAdminUserId() == null) {
if (isOpenDevolution && CollectionUtils.isEmpty(saveParam.getAdminUserIds())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员"));
}
@ -338,17 +336,17 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
taxAgentNew.setUpdateTime(new Date());
getTaxAgentMapper().update(taxAgentNew);
if (isOpenDevolution) {
Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder()
.taxAgentId(saveParam.getId())
.adminUserId(saveParam.getAdminUserId())
.build());
if (isUnEnableChange) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115937, "该管理员有未归档核算数据,不可更换管理员"));
}
// Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder()
// .taxAgentId(saveParam.getId())
// .adminUserId(saveParam.getAdminUserIds())
// .build());
// if (isUnEnableChange) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115937, "该管理员有未归档核算数据,不可更换管理员"));
// }
// 删除管理员
getTaxAgentAdminService(user).deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId()));
// 新增管理员
getTaxAgentAdminService(user).batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId()));
getTaxAgentAdminService(user).batchInsert(saveParam.getId(), saveParam.getAdminUserIds());
}
// 记录日志
// SalaryLoggerUtil.recordUpdateSingleLog(taxAgentLoggerTemplate,
@ -364,6 +362,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
@Override
public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam) {
ValidUtil.doValidator(checkParam);
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId()));
Long adminUserId = CollectionUtils.isNotEmpty(taxAgentAdminList) ? taxAgentAdminList.get(0).getEmployeeId() : 0L;
boolean isChanged = checkParam.getAdminUserId() != null && !adminUserId.equals(checkParam.getAdminUserId());
@ -586,7 +585,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service
.map(TaxAgentPO::getId)
.filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) {
taxAgentManageRangeEmployeeList.addAll(getTaxAgentSubAdminEmp(allTaxAgents, noAdminTaxAgentIds, allEmployees));
// taxAgentManageRangeEmployeeList.addAll(getTaxAgentSubAdminEmp(allTaxAgents, noAdminTaxAgentIds, allEmployees));
}
return taxAgentManageRangeEmployeeList;

View File

@ -77,6 +77,21 @@ public class AttendQuoteController {
// }
/**
* 检查是否可以操作
* 说明已经核算过的不能再操作
*
* @param checkOperationParam
* @return
*/
@POST
@Path("/checkOperation")
@Produces(MediaType.APPLICATION_JSON)
public String checkOperation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AttendQuoteCheckOperationParam checkOperationParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AttendQuoteCheckOperationParam, Boolean>(user).run(getAttendQuoteWrapper(user)::checkOperation, checkOperationParam);
}
/**
* 获取薪资周期和考勤周期
*

View File

@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteCheckOperationParam;
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
import com.engine.salary.entity.datacollection.param.QuerySalaryCycleAndAttendCycleParam;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
@ -15,6 +16,7 @@ import com.engine.salary.service.impl.AttendQuoteServiceImpl;
import com.engine.salary.service.impl.SalarySobServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
@ -101,12 +103,11 @@ public class AttendQuoteWrapper extends Service {
* 检查是否可以操作
*
*
* @param salaryYearMonth
* @param salarySobId
* @return
*/
public Boolean checkOperation(YearMonth salaryYearMonth, Long salarySobId) {
return getAttendQuoteService(user).checkOperation(salaryYearMonth, salarySobId);
public Boolean checkOperation(AttendQuoteCheckOperationParam checkOperationParam) {
ValidUtil.doValidator(checkOperationParam);
return getAttendQuoteService(user).checkOperation(checkOperationParam.getSalaryYearMonth(), checkOperationParam.getSalarySobId());
}
/**