Commit 5c54c2d9 authored by hongguangwu's avatar hongguangwu

档案(增、删、改、减档)

parent d5472711
...@@ -198,24 +198,40 @@ public class TEmployeeInfoController { ...@@ -198,24 +198,40 @@ public class TEmployeeInfoController {
*/ */
@Operation(summary = "修改人员档案表", description = "修改人员档案表") @Operation(summary = "修改人员档案表", description = "修改人员档案表")
@SysLog("修改人员档案表") @SysLog("修改人员档案表")
@PutMapping @PostMapping("/updateEmployee")
@PreAuthorize("@pms.hasPermission('demo_temployeeinfo_edit')") @PreAuthorize("@pms.hasPermission('temployeeinfo_edit')")
public R<Boolean> updateById(@RequestBody TEmployeeInfo tEmployeeInfo) { public R<Boolean> updateEmployee(@RequestBody TEmployeeInfo tEmployeeInfo) {
return R.ok(tEmployeeInfoService.updateById(tEmployeeInfo)); return tEmployeeInfoService.updateEmployee(tEmployeeInfo);
} }
/** /**
* 通过id删除人员档案表 * @param id
* * @Description: 通过id删除人员档案表
* @param id id * @Author: hgw
* @return R * @Date: 2022/6/21 19:42
*/ * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过id删除人员档案表", description = "通过id删除人员档案表") @Operation(summary = "通过id删除人员档案表", description = "通过id删除人员档案表")
@SysLog("通过id删除人员档案表") @SysLog("通过id删除人员档案表")
@DeleteMapping("/{id}") @GetMapping("/deleteEmployee")
@PreAuthorize("@pms.hasPermission('demo_temployeeinfo_del')") @PreAuthorize("@pms.hasPermission('temployeeinfo_del')")
public R<Boolean> removeById(@PathVariable String id) { public R<String> deleteEmployee(@RequestParam String id) {
return R.ok(tEmployeeInfoService.removeById(id)); return tEmployeeInfoService.deleteEmployee(id);
}
/**
* @param id
* @Description: 通过id减档人员档案表
* @Author: hgw
* @Date: 2022/6/21 19:42
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过id减档人员档案表", description = "通过id减档人员档案表")
@SysLog("通过id减档人员档案表")
@GetMapping("/minusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_minus')")
public R<String> minusEmployee(@RequestParam String id) {
return tEmployeeInfoService.minusEmployee(id);
} }
} }
...@@ -62,11 +62,7 @@ public class TEmployeeProjectController { ...@@ -62,11 +62,7 @@ public class TEmployeeProjectController {
@Operation(summary = "根据人员档案id获取项目list", description = "根据人员档案id获取项目list") @Operation(summary = "根据人员档案id获取项目list", description = "根据人员档案id获取项目list")
@GetMapping("/getListByEmpId" ) @GetMapping("/getListByEmpId" )
public R<List<TEmployeeProject>> getListByEmpId(@RequestParam String empId) { public R<List<TEmployeeProject>> getListByEmpId(@RequestParam String empId) {
TEmployeeProject project = new TEmployeeProject(); return R.ok(tEmployeeProjectService.getListByEmpId(empId, CommonConstants.ZERO_INT));
project.setEmpId(empId);
project.setProjectStatus(CommonConstants.ZERO_INT);
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return R.ok(tEmployeeProjectService.list(Wrappers.query(project)));
} }
/** /**
......
...@@ -72,6 +72,33 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -72,6 +72,33 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
**/ **/
R<String> addNewEmployee(TEmployeeInfo employeeInfo); R<String> addNewEmployee(TEmployeeInfo employeeInfo);
/**
* @param employeeInfo
* @Description: 更新档案信息
* @Author: hgw
* @Date: 2022/6/21 19:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> updateEmployee(TEmployeeInfo employeeInfo);
/**
* @param id
* @Description: 删除
* @Author: hgw
* @Date: 2022/6/21 19:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> deleteEmployee(String id);
/**
* @param id
* @Description: 减项
* @Author: hgw
* @Date: 2022/6/21 19:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> minusEmployee(String id);
/** /**
* @param employeeInfo 档案信息 * @param employeeInfo 档案信息
* @param fileSource 人员档案来源(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬) * @param fileSource 人员档案来源(4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
......
...@@ -42,4 +42,14 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> { ...@@ -42,4 +42,14 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R deleteEmpPro(TEmployeeProject tEmployeeProject); R deleteEmpPro(TEmployeeProject tEmployeeProject);
R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd); R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd);
/**
* @param projectStatus 传0才过滤
* @param empId
* @Description: 根据员工id获取项目list
* @Author: hgw
* @Date: 2022/6/21 19:33
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject>>
**/
List<TEmployeeProject> getListByEmpId(String empId, int projectStatus);
} }
...@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...@@ -47,6 +49,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -47,6 +49,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 缓存信息 // 缓存信息
private final CacheManager cacheManager; private final CacheManager cacheManager;
private final TEmployeeProjectService tEmployeeProjectService;
@Override @Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) { public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
...@@ -91,6 +94,53 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -91,6 +94,53 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return zeroArr[num] + nowNums; return zeroArr[num] + nowNums;
} }
@Override
public R<Boolean> updateEmployee(TEmployeeInfo employeeInfo) {
// TODO-更新学历-房
return R.ok(this.updateById(employeeInfo));
}
@Override
public R<String> deleteEmployee(String id) {
TEmployeeInfo employee = this.getById(id);
if (employee != null) {
if (employee.getStatus() != CommonConstants.ZERO_INT) {
return R.failed("非草稿状态,无法删除!");
}
employee.setDeleteFlag(CommonConstants.STATUS_DEL);
// 获取项目档案,传参1,不过滤项目状态
List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ONE_INT);
if (projectList != null && !projectList.isEmpty()) {
for (TEmployeeProject project : projectList) {
project.setDeleteFlag(CommonConstants.STATUS_DEL);
}
tEmployeeProjectService.updateBatchById(projectList);
}
this.updateById(employee);
return R.ok("已删除");
} else {
return R.failed("未找到人员档案信息");
}
}
@Override
public R<String> minusEmployee(String id) {
TEmployeeInfo employee = this.getById(id);
if (employee != null) {
// 获取项目档案,传参0,过滤项目状态
List<TEmployeeProject> projectList = tEmployeeProjectService.getListByEmpId(id, CommonConstants.ZERO_INT);
if (projectList != null && !projectList.isEmpty()) {
return R.failed("还有["+projectList+"]条项目未减项,请先去减项!");
}
employee.setFileStatus(CommonConstants.ONE_INT);
this.updateById(employee);
return R.ok("已减档");
} else {
return R.failed("未找到人员档案信息");
}
}
@Override @Override
//@GlobalTransactional // 分布式事务注解 //@GlobalTransactional // 分布式事务注解
//@Transactional(rollbackFor = Exception) //@Transactional(rollbackFor = Exception)
......
...@@ -225,4 +225,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -225,4 +225,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
BeanUtil.copyProperties(excel, insert); BeanUtil.copyProperties(excel, insert);
this.save(insert); this.save(insert);
} }
@Override
public List<TEmployeeProject> getListByEmpId(String empId, int projectStatus) {
TEmployeeProject project = new TEmployeeProject();
project.setEmpId(empId);
if (projectStatus == 0) {
project.setProjectStatus(CommonConstants.ZERO_INT);
}
project.setDeleteFlag(CommonConstants.STATUS_NORMAL);
return this.list(Wrappers.query(project));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment