删除待定薪代办

删除待停薪代办
This commit is contained in:
钱涛 2022-10-18 16:44:31 +08:00
parent a29670d752
commit 1f48539e1c
6 changed files with 136 additions and 89 deletions

View File

@ -118,4 +118,8 @@ public interface SalaryArchiveMapper {
void gotoPendingFromStop(@Param("ids") Collection<Long> ids);
void gotoFixedFromStop(@Param("ids") Collection<Long> ids);
void deletePendingTodo(@Param("ids") Collection<Long> ids);
void deleteSuspendTodo(@Param("ids") Collection<Long> ids);
}

View File

@ -586,4 +586,28 @@
</foreach>
</update>
<update id="deletePendingTodo" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
UPDATE hrsa_salary_archive
<set>
run_status='STOP_FROM_PENDING'
</set>
WHERE run_status = 'PENDING'
and id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteSuspendTodo" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
UPDATE hrsa_salary_archive
<set>
run_status='FIXED'
</set>
WHERE run_status = 'SUSPEND'
and id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -180,6 +180,15 @@ public interface SalaryArchiveService {
*/
Map<String, Long> queryTabTotal();
/**
* 删除待定薪待办
*
* @param ids
* @return
*/
String deletePendingTodo(Collection<Long> ids);
/**
* 设为定薪员工
*
@ -220,13 +229,13 @@ public interface SalaryArchiveService {
*/
Map<String, Object> allGotoStop(SalaryArchiveQueryParam queryParam);
// /**
// * 删除待停薪待办
// *
// * @param ids
// * @return
// */
// String deleteSuspendTodo(Collection<Long> ids);
/**
* 删除待停薪待办
*
* @param ids
* @return
*/
String deleteSuspendTodo(Collection<Long> ids);
/**
* 取消停薪
@ -236,4 +245,5 @@ public interface SalaryArchiveService {
*/
String cancelStop(Collection<Long> ids);
}

View File

@ -2012,6 +2012,29 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return result;
}
@Override
public String deletePendingTodo(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
List<SalaryArchivePO> oldList = getSalaryArchiveMapper()
.listSome(SalaryArchivePO.builder()
.ids(ids)
.runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
.build());
if (CollectionUtils.isEmpty(oldList)) {
return StringUtils.EMPTY;
}
// 从待定薪到停薪
getSalaryArchiveMapper().deletePendingTodo(ids);
return StringUtils.EMPTY;
}
@Override
public Map<String, Object> gotoFixed(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
@ -2155,38 +2178,26 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return this.gotoStop(salaryArchiveIds);
}
// @Override
// public String deleteSuspendTodo(Collection<Long> ids) {
// if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
// }
// List<SalaryArchivePO> oldList = new LambdaQueryChainWrapper<>(salaryArchiveMapper)
// .eq(SalaryArchivePO::getDeleteType, 0)
// .eq(SalaryArchivePO::getTenantKey, currentTenantKey)
// .in(SalaryArchivePO::getId, ids)
// .eq(SalaryArchivePO::getRunStatus, SalaryArchiveStatusEnum.SUSPEND.getValue())
// .list();
// List<SalaryArchivePO> unableList = oldList.stream().filter(f->Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().isAfter(LocalDate.now())).collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(unableList)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 115789, "最后发薪日必须晚于今天"));
// }
//
// // 从待停薪到定薪
// new LambdaUpdateChainWrapper<>(salaryArchiveMapper)
// .eq(SalaryArchivePO::getDeleteType, 0)
// .eq(SalaryArchivePO::getTenantKey, currentTenantKey)
// .in(SalaryArchivePO::getId, ids)
// .eq(SalaryArchivePO::getRunStatus, SalaryArchiveStatusEnum.SUSPEND.getValue())
// .set(SalaryArchivePO::getRunStatus, SalaryArchiveStatusEnum.FIXED.getValue())
// .set(SalaryArchivePO::getModifier, currentEmployeeId)
// .update();
// // 记录日志
// List<SalaryArchivePO> newList = this.listByIds(ids);
// String operatedesc = SalaryI18nUtil.getI18nLabel( 106839, "删除待办");
// recordLog(oldList, newList, operatedesc, currentTenantKey);
//
// return StringUtils.EMPTY;
// }
@Override
public String deleteSuspendTodo(Collection<Long> ids) {
if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误"));
}
List<SalaryArchivePO> oldList = getSalaryArchiveMapper()
.listSome(SalaryArchivePO.builder()
.ids(ids)
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
.build());
List<SalaryArchivePO> unableList = oldList.stream().filter(f->Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().after(new Date())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(unableList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 115789, "最后发薪日必须晚于今天"));
}
// 从待停薪到定薪
getSalaryArchiveMapper().deleteSuspendTodo(ids);
return StringUtils.EMPTY;
}
@Override
public String cancelStop(Collection<Long> ids) {

View File

@ -118,18 +118,20 @@ public class SalaryArchiveController {
}
// /**
// * 删除待定薪待办
// *
// * @param ids
// * @return
// */
// @PostMapping("/deletePendingTodo")
// @ApiOperation("删除待定薪待办")
// @WeaPermission
// public WeaResult<String> deletePendingTodo(@RequestBody Collection<Long> ids) {
// return WeaResult.success(salaryArchiveWrapper.deletePendingTodo(ids, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
// }
/**
* 删除待定薪待办
*
* @param ids
* @return
*/
@POST
@Path("/deletePendingTodo")
@Produces(MediaType.APPLICATION_JSON)
public String deletePendingTodo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getSalaryArchiveWrapper(user)::deletePendingTodo, ids);
}
/**
* 发薪列表
@ -190,18 +192,19 @@ public class SalaryArchiveController {
}
// /**
// * 删除待停薪待办
// *
// * @param ids
// * @return
// */
// @PostMapping("/deleteSuspendTodo")
// @ApiOperation("删除待停薪待办")
// @WeaPermission
// public WeaResult<String> deleteSuspendTodo(@RequestBody Collection<Long> ids) {
// return WeaResult.success(salaryArchiveWrapper.deleteSuspendTodo(ids, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
// }
/**
* 删除待停薪待办
*
* @param ids
* @return
*/
@POST
@Path("/deleteSuspendTodo")
@Produces(MediaType.APPLICATION_JSON)
public String stopList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getSalaryArchiveWrapper(user)::deleteSuspendTodo, ids);
}
/**
* 停薪列表
@ -233,7 +236,6 @@ public class SalaryArchiveController {
}
/**
* 薪资档案列表
*
@ -303,7 +305,6 @@ public class SalaryArchiveController {
}
/**
* 保存发薪设置
*

View File

@ -190,6 +190,16 @@ public class SalaryArchiveWrapper extends Service {
return list(queryParam, SalaryArchiveListTypeEnum.PENDING);
}
/**
* 删除待定薪待办
*
* @param ids
* @return
*/
public String deletePendingTodo(Collection<Long> ids) {
return getSalaryArchiveService(user).deletePendingTodo(ids);
}
/**
* 定薪列表
*
@ -243,17 +253,6 @@ public class SalaryArchiveWrapper extends Service {
return getSalaryArchiveService(user).allGotoFixed(queryParam);
}
// /**
// * 删除待定薪待办
// *
// * @param ids
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// public String deletePendingTodo(Collection<Long> ids) {
// return getSalaryArchiveService(user).deletePendingTodo(ids);
// }
/**
* 停薪
@ -275,17 +274,15 @@ public class SalaryArchiveWrapper extends Service {
return getSalaryArchiveService(user).allGotoStop(queryParam);
}
// /**
// * 删除待停薪待办
// *
// * @param ids
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// public String deleteSuspendTodo(Collection<Long> ids) {
// return getSalaryArchiveService(user).deleteSuspendTodo(ids);
// }
/**
* 删除待停薪待办
*
* @param ids
* @return
*/
public String deleteSuspendTodo(Collection<Long> ids) {
return getSalaryArchiveService(user).deleteSuspendTodo(ids);
}
/**
* 取消停薪
@ -345,8 +342,8 @@ public class SalaryArchiveWrapper extends Service {
List<Map<String, Object>> salaryItems = Lists.newArrayList();
// 2.发薪设置表单
Map<String,Object> paySetForm = new HashMap<>();
paySetForm.put("data",po);
Map<String, Object> paySetForm = new HashMap<>();
paySetForm.put("data", po);
// 获取所有可被引用的薪资项目