This commit is contained in:
钱涛 2022-06-17 17:22:48 +08:00
parent c701314f15
commit 5cea57d477
10 changed files with 52 additions and 25 deletions

View File

@ -42,7 +42,7 @@ public class SICategoryListCmd extends AbstractCommonCommand<Map<String, Object>
}
private String buildSqlWhere(Map<String, Object> params) {
String sqlWhere = "where delete_Type = 0";
String sqlWhere = "where delete_Type = 0 and data_type != 1";
Integer welfareType = (Integer)params.get("welfareType");
if (Objects.nonNull(welfareType)){

View File

@ -178,6 +178,11 @@ public class SalarySobItemAggregateBO {
if (CollectionUtils.isEmpty(itemGroups)) {
return Collections.emptyList();
}
return itemGroups.stream().sorted(Comparator.comparingInt(SalarySobItemGroupDTO::getSortedIndex)).collect(Collectors.toList());
return itemGroups.stream().map(group -> {
if (group != null && CollectionUtils.isEmpty(group.getItems())) {
group.setItems(new ArrayList<>());
}
return group;
}).sorted(Comparator.comparingInt(SalarySobItemGroupDTO::getSortedIndex)).collect(Collectors.toList());
}
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.Data;
/**
@ -16,11 +17,19 @@ public class SalarySobDuplicateParam {
/**
* 薪资账套的ID不允许为空
*/
@DataCheck(require = true, message = "薪资账套的ID不允许为空")
private Long id;
/**
* 名称不允许为空
* 名称不能超过40个字符长度
*/
@DataCheck(require = true, max = 40, message = "名称不允许为空且名称不能超过40个字符长度")
private String name;
/**
* 个税扣缴义务人id
*/
@DataCheck(require = true, message = "个税扣缴义务人不允许为空")
private Long taxAgentId;
}

View File

@ -83,18 +83,16 @@ public class SalarySobItemSaveParam {
//"薪资账套薪资项目保存参数-薪资项目分类")
public static class SalarySobItemGroupParam {
//主键id")
//主键id
private Long id;
//@Max(value = 40, message = "LABEL:98177")
//@NotEmpty(message = "LABEL:86266")
//分类名称")
//分类名称"
private String name;
//显示顺序")
//显示顺序
private Integer sortedIndex;
//分类下的薪资项目")
//分类下的薪资项目
private List<SalarySobItemParam> items;
}
}

View File

@ -166,6 +166,13 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
// todo 2分类名称唯一
List<SalarySobItemSaveParam.SalarySobItemGroupParam> itemGroups = saveParam.getItemGroups();
if(CollectionUtils.isNotEmpty(itemGroups)){
int count = (int)SalaryEntityUtil.properties(itemGroups, SalarySobItemSaveParam.SalarySobItemGroupParam::getName).stream().distinct().count();
if(count < itemGroups.size()){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "分类名称重复!"));
}
}
}
/**

View File

@ -336,6 +336,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
BeanUtils.copyProperties(salarySobPO, newSalarySobPO);
newSalarySobPO.setId(saveParam.getId())
.setName(saveParam.getName())
.setTaxAgentId(saveParam.getTaxAgentId())
.setIncomeCategory(saveParam.getTaxableItems())
.setSalaryCycleType(saveParam.getSalaryCycleType())
.setSalaryCycleFromDay(saveParam.getSalaryCycleFromDay())
@ -439,6 +440,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
@Override
@Transactional(rollbackFor = Exception.class)
public void duplicate(SalarySobDuplicateParam duplicateParam) {
ValidUtil.doValidator(duplicateParam);
// 查询薪资账套
SalarySobPO salarySobPO = getById(duplicateParam.getId());
if (Objects.isNull(salarySobPO)) {
@ -449,6 +452,16 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "薪资账套名称已存在"));
}
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
if (openDevolution) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
if (!taxAgentIds.contains(duplicateParam.getTaxAgentId())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "该扣缴义务人不在权限范围内!"));
}
}
// 查询薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listSome(SalarySobEmpFieldPO.builder().salarySobId(duplicateParam.getId()).build());
// 查询薪资账套的薪资项目副本
@ -464,6 +477,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
// 复制薪资账套的基础设置
SalarySobPO newSalarySob = SalarySobPO.builder()
.name(duplicateParam.getName())
.taxAgentId(duplicateParam.getTaxAgentId())
.incomeCategory(salarySobPO.getIncomeCategory())
.salaryCycleType(salarySobPO.getSalaryCycleType())
.salaryCycleFromDay(salarySobPO.getSalaryCycleFromDay())

View File

@ -345,10 +345,10 @@ public class SalaryArchiveController {
/**
* 删除薪资项目调整
*/
@POST
@GET
@Path("/deleteSalaryItem")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Long salaryArchiveItemId) {
public String deleteSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryArchiveItemId") Long salaryArchiveItemId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, String>(user).run(getSalaryArchiveItemWrapper(user)::deleteSalaryItem, salaryArchiveItemId);
}
@ -407,10 +407,10 @@ public class SalaryArchiveController {
* @param salaryArchiveTaxAgentId
* @return
*/
@POST
@GET
@Path("/deleteTaxAgent")
@Produces(MediaType.APPLICATION_JSON)
public String deleteTaxAgent(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Long salaryArchiveTaxAgentId) {
public String deleteTaxAgent(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryArchiveTaxAgentId") Long salaryArchiveTaxAgentId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, String>(user).run(getSalaryArchiveTaxAgentWrapper(user)::deleteTaxAgent, salaryArchiveTaxAgentId);
}

View File

@ -20,10 +20,7 @@ import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
@ -104,10 +101,10 @@ public class SalaryItemController {
/**
* 薪资项目的详情
*/
@POST
@GET
@Path("/getSalaryForm")
@Produces(MediaType.APPLICATION_JSON)
public String getSalaryItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Long id) {
public String getSalaryItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, SalaryItemFormDTO>(user).run(getSalaryItemWrapper(user)::getForm, id);
}

View File

@ -19,10 +19,7 @@ import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
@ -76,10 +73,10 @@ public class SalarySobController {
/**
* 薪资账套基本信息表单
*/
@POST
@GET
@Path("/basic/getForm")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobBasicForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Long id) {
public String getSalarySobBasicForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Map<String, Object>>(user).run(getSalarySobWrapper(user)::getForm, id);
}

View File

@ -169,7 +169,7 @@ public class SalarySobWrapper extends Service {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
return taxAgentIds.contains(salarySobPO.getTaxAgentId());
return taxAgentIds.contains(salarySobPO.getTaxAgentId())||Objects.isNull(salarySobPO.getTaxAgentId());
}
}