薪酬系统-福利档案结构改造,增员、减员接口返回结果格式调整

This commit is contained in:
sy 2022-10-17 10:13:38 +08:00
parent 8d9a00bfff
commit 8fa59c2cf9
3 changed files with 48 additions and 25 deletions

View File

@ -69,20 +69,20 @@ public interface SIArchivesService {
/**
* 批量减员
*/
String stayDelToStop(Collection<Long> ids);
Map<String, Object> stayDelToStop(Collection<Long> ids);
/**
* 全量减员
*/
String allStayDelToStop();
Map<String, Object> allStayDelToStop();
/**
* 全量增员
*/
String allStayAddToPay();
Map<String, Object> allStayAddToPay();
/**
* 批量增员
*/
String stayAddToPay(Collection<Long> ids);
Map<String, Object> stayAddToPay(Collection<Long> ids);
}

View File

@ -544,7 +544,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
* 批量减员
*/
@Override
public String stayDelToStop(Collection<Long> ids) {
public Map<String, Object> stayDelToStop(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
@ -621,34 +621,46 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
.employeeIds(toStopEmployeeIdList).runStatus(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()).build());
}
Map<String, Object> resultMap = new HashMap<>(2);
String resultMsg = "操作成功";
String resultType = "success";
// 批量设为定薪提示
//输出结果此处需区分单一减员和批量减员
if (baseInfoPOList.size() == toStopEmployeeIdList.size()) {
//减员成功
if (baseInfoPOList.size() == 1) {
return "减员成功";
resultMsg = "减员成功";
} else {
return "批量减员成功";
resultMsg = "批量减员成功";
}
} else {
//减员失败
resultType = "fail";
if (baseInfoPOList.size() == 1) {
return "减员失败,失败原因:数据未正常维护";
resultMsg = "减员失败,失败原因:数据未正常维护";
} else {
return "部分或全部失败:【共提交减员数据"
resultMsg = "部分或全部失败:【共提交减员数据"
+ employeeIds.size()
+"条,成功" + toStopEmployeeIdList.size()
+"条,失败" + noStopEmployeeIds.size()
+"条,失败原因:数据未正常维护】";
}
}
resultMap.put("type", resultType);
resultMap.put("msg", resultMsg);
return resultMap;
}
/**
* 全量减员
*/
@Override
public String allStayDelToStop() {
public Map<String, Object> allStayDelToStop() {
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
if (allBaseInfoList.size() > 0) {
Collection<Long> stayDelIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()))
@ -656,10 +668,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (stayDelIds.size() > 0) {
return stayDelToStop(stayDelIds);
} else {
return "当前无待减员数据";
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
} else {
return "当前无待减员数据";
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
}
@ -667,7 +679,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
* 批量增员
*/
@Override
public String stayAddToPay(Collection<Long> ids) {
public Map<String, Object> stayAddToPay(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
@ -775,33 +787,44 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
.employeeIds(toPayEmployeeIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
}
Map<String, Object> resultMap = new HashMap<>(2);
String resultMsg = "操作成功";
String resultType = "success";
// 批量设为定薪提示
//输出结果此处需区分单一增员和批量增员
if (baseInfoPOList.size() == toPayEmployeeIdList.size()) {
//增员成功
if (baseInfoPOList.size() == 1) {
return "增员成功";
resultMsg = "增员成功";
} else {
return "批量增员成功";
resultMsg = "批量增员成功";
}
} else {
//增员失败
resultType = "fail";
if (baseInfoPOList.size() == 1) {
return "增员失败,失败原因:数据未正常维护";
resultMsg = "增员失败,失败原因:数据未正常维护";
} else {
return "部分或全部失败:【共提交增员数据"
resultMsg = "部分或全部失败:【共提交增员数据"
+ employeeIds.size()
+"条,成功" + toPayEmployeeIdList.size()
+"条,失败" + noPayEmployeeIds.size()
+"条,失败原因:数据未正常维护】";
}
}
resultMap.put("type", resultType);
resultMap.put("msg", resultMsg);
return resultMap;
}
/**
* 全量增员
*/
@Override
public String allStayAddToPay() {
public Map<String, Object> allStayAddToPay() {
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
if (allBaseInfoList.size() > 0) {
Collection<Long> stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()))
@ -809,10 +832,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (stayAddIds.size() > 0) {
return stayAddToPay(stayAddIds);
} else {
return "当前无待增员数据";
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
} else {
return "当前无待增员数据";
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
}

View File

@ -178,7 +178,7 @@ public class SIArchivesController {
@Produces(MediaType.APPLICATION_JSON)
public String stayDelToStop(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getService(user)::stayDelToStop, ids);
return new ResponseResult<Collection<Long>, Map<String, Object>>(user).run(getService(user)::stayDelToStop, ids);
}
/**
@ -189,7 +189,7 @@ public class SIArchivesController {
@Produces(MediaType.APPLICATION_JSON)
public String allStayDelToStop(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, String>(user).run(getService(user)::allStayDelToStop);
return new ResponseResult<String, Map<String, Object>>(user).run(getService(user)::allStayDelToStop);
}
/**
@ -200,7 +200,7 @@ public class SIArchivesController {
@Produces(MediaType.APPLICATION_JSON)
public String stayAddToPay(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getService(user)::stayAddToPay, ids);
return new ResponseResult<Collection<Long>, Map<String, Object>>(user).run(getService(user)::stayAddToPay, ids);
}
/**
@ -211,6 +211,6 @@ public class SIArchivesController {
@Produces(MediaType.APPLICATION_JSON)
public String allStayAddToPay(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, String>(user).run(getService(user)::allStayAddToPay);
return new ResponseResult<String, Map<String, Object>>(user).run(getService(user)::allStayAddToPay);
}
}