Commit 5159ed88 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 0cf3d9e2
......@@ -133,7 +133,7 @@ public class TEmployeeProjectController {
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_del')" )
public R removeById(@PathVariable String id) {
return R.ok(tEmployeeProjectService.removeById(id));
return R.ok(tEmployeeProjectService.removeProjectInfo(id));
}
/**
......
......@@ -50,6 +50,8 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R updateProject(TEmployeeProject tEmployeeProject);
R removeProjectInfo(String id);
/**
* @param tEmployeeProject
* @Description: 减项
......
......@@ -190,6 +190,35 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return R.ok(flag);
}
@Override
public R removeProjectInfo(String id) {
TEmployeeProject tEmployeeProject = this.getById(id);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//删除项目档案
this.removeById(id);
//从剩下的项目档案中查找员工类型
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(list)) {
for (TEmployeeProject t :list) {
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break;
}
if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
return R.ok();
}
@Override
public R reEmpInfo(JSONObject jsonObject) {
if (Common.isNotNull(jsonObject)) {
......@@ -236,17 +265,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (count == CommonConstants.ONE_INT) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
String code = "";
if (Common.isNotNull(tEmployeeProject)) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (tEmployeeProject.getIsLeaveEmployee() == CommonConstants.dingleDigitIntArray[1]) {
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
code = CommonConstants.ONE_STRING;
}
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject);
return R.ok();
if (CommonConstants.ONE_STRING.equals(code)) {
return R.ok(null,"减项减档成功");
} else {
return R.ok(null,"减项成功,项目状态已更新为“已减项”");
}
}
}
return R.failed("人员在该项目下存在进行中/未完结的服务");
......
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