Commit 6965cfaa authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents e71b5dd4 30157b35
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller; package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
...@@ -121,4 +122,30 @@ public class TEmployeeProjectController { ...@@ -121,4 +122,30 @@ public class TEmployeeProjectController {
public R addCheck(@RequestBody TEmployeeProject tEmployeeProject) { public R addCheck(@RequestBody TEmployeeProject tEmployeeProject) {
return R.ok(tEmployeeProjectService.addCheck(tEmployeeProject)); return R.ok(tEmployeeProjectService.addCheck(tEmployeeProject));
} }
/**
* 复档复项相关操作
* @param jsonObject
* @return R
*/
@Operation(summary = "复档复项相关操作", description = "复档复项相关操作")
@SysLog("复档复项相关操作" )
@PostMapping("/reEmpInfo")
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_reempinfo')" )
public R reEmpInfo(@RequestBody JSONObject jsonObject) {
return R.ok(tEmployeeProjectService.reEmpInfo(jsonObject));
}
/**
* 减项
* @param tEmployeeProject
* @return R
*/
@Operation(summary = "减项", description = "减项")
@SysLog("减项" )
@PostMapping("/deleteEmpPro")
@PreAuthorize("@pms.hasPermission('archives_temployeeproject_delempproinfo')" )
public R deleteEmpPro(@RequestBody TEmployeeProject tEmployeeProject) {
return R.ok(tEmployeeProjectService.deleteEmpPro(tEmployeeProject));
}
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.service; package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -31,4 +32,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> { ...@@ -31,4 +32,7 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R addCheck(TEmployeeProject tEmployeeProject); R addCheck(TEmployeeProject tEmployeeProject);
R reEmpInfo(JSONObject jsonObject);
R deleteEmpPro(TEmployeeProject tEmployeeProject);
} }
...@@ -16,13 +16,25 @@ ...@@ -16,13 +16,25 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/** /**
* 项目档案表 * 项目档案表
* *
...@@ -32,8 +44,136 @@ import org.springframework.stereotype.Service; ...@@ -32,8 +44,136 @@ import org.springframework.stereotype.Service;
@Service @Service
public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService { public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService {
private TEmployeeInfoService tEmployeeInfoService;
private TEmployeeLogService tEmployeeLogService;
private final String content1 = "减档";
private final String content2 = "减项";
private final String content3 = "减档减项";
@Override @Override
public R addCheck(TEmployeeProject tEmployeeProject) { public R addCheck(TEmployeeProject tEmployeeProject) {
return null;
Map<String,Object> map = new HashMap<>();
//身份证系统中是否已有
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//项目下已有身份证信息
TEmployeeProject employeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard,tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo,tEmployeeProject.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (!Common.isEmpty(employeeProject)) {
//身份证实名认证
if (!tEmployeeProject.getEmpName().equals(tEmployeeInfo.getEmpName())) {
return R.failed("姓名和身份证不一致,请确认后再次新增");
}
//项目状态为已减项
if (CommonConstants.dingleDigitIntArray[1] == employeeProject.getProjectStatus()) {
if (!Common.isEmpty(tEmployeeInfo)) {
map.put("empProId",tEmployeeProject.getId());
if (CommonConstants.STATUS_NORMAL.equals(tEmployeeInfo.getFileStatus())) {
return R.ok(map, "该人员已减项,是否“复项”");
} else {
map.put("employeeId", tEmployeeInfo.getId());
return R.ok(map, "该人员已减档减项,是否“复档复项”");
}
}
}
//状态为草稿、已审核
if (CommonConstants.dingleDigitIntArray[0] == employeeProject.getStatus() ||
CommonConstants.dingleDigitIntArray[1] == employeeProject.getStatus()) {
return R.failed("人员已有该项目信息,禁止重复添加!");
}
} else {
if (Common.isEmpty(tEmployeeInfo)) {
return R.failed("该人员暂无档案信息,禁止关联项目,如要添加,请先至“在档人员”处建档");
}
//判断是否已经减档
if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getFileStatus())) {
map.put("employeeId", tEmployeeInfo.getId());
return R.ok(null,"该人员在离职库已存在,是否“恢复档案”");
}
}
return R.ok();
}
@Override
public R reEmpInfo(JSONObject jsonObject) {
if (Common.isNotNull(jsonObject)) {
String empId = jsonObject.getString("empId");
String empProId = jsonObject.getString("empProId");
if (!Common.isEmpty(empId) && Common.isEmpty(empProId)) {
//复档
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(empId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoService.updateById(tEmployeeInfo);
addEmpLog(CommonConstants.dingleDigitIntArray[0],empId,"",content1);
} else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) {
//复项
TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject);
addEmpLog(CommonConstants.dingleDigitIntArray[1],"",empProId,content2);
} else {
//复档复项
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(empId);
TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoService.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject);
addEmpLog(CommonConstants.dingleDigitIntArray[2],empId,empProId,content3);
}
} else {
return R.failed("传参为空!");
}
return R.ok();
}
@Override
public R deleteEmpPro(TEmployeeProject tEmployeeProject) {
if (Common.isNotNull(tEmployeeProject)) {
if (tEmployeeProject.getIsLeaveEmployee()== CommonConstants.dingleDigitIntArray[1]) {
Long count = this.count(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpId,tEmployeeProject.getEmpId())
.eq(TEmployeeProject::getProjectStatus,CommonConstants.dingleDigitIntArray[0]));
if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) >0) {
return R.failed("该人员存在其他进行中的项目,禁止同步减档!");
}
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeProject.getEmpId());
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoService.updateById(tEmployeeInfo);
}
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject);
return R.ok();
}
return R.failed("传参为空!");
}
/**
* 新增档案操作记录
* @param type
* @param empId
* @param empProId
* @param content
* @author huyc
* @date 2022-06-20 17:19:40
*/
public void addEmpLog(int type, String empId, String empProId, String content) {
TEmployeeLog tEmployeeLog = new TEmployeeLog();
tEmployeeLog.setEmpId(empId);
tEmployeeLog.setType(type);
tEmployeeLog.setProjectId(empProId);
tEmployeeLog.setContent(content);
tEmployeeLogService.save(tEmployeeLog);
} }
} }
...@@ -58,8 +58,14 @@ public class YifuUser extends User { ...@@ -58,8 +58,14 @@ public class YifuUser extends User {
@Getter @Getter
private String systemFlag; private String systemFlag;
/**
* 用户组
*/
@Getter
private final String userGroup;
public YifuUser(String id, Long deptId, String username, String nickname,String systemFlag, String password, String phone, boolean enabled, public YifuUser(String id, Long deptId, String username, String nickname,String systemFlag, String password, String phone, boolean enabled,
boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,String userGroup,
Collection<? extends GrantedAuthority> authorities) { Collection<? extends GrantedAuthority> authorities) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
this.id = id; this.id = id;
...@@ -67,6 +73,7 @@ public class YifuUser extends User { ...@@ -67,6 +73,7 @@ public class YifuUser extends User {
this.phone = phone; this.phone = phone;
this.nickname = nickname; this.nickname = nickname;
this.systemFlag = systemFlag; this.systemFlag = systemFlag;
this.userGroup = userGroup;
} }
} }
...@@ -70,8 +70,8 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered { ...@@ -70,8 +70,8 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered {
// 构造security用户 // 构造security用户
return new YifuUser(user.getUserId(), user.getDeptId(), user.getUsername(),user.getNickname(),user.getSystemFlag(), return new YifuUser(user.getUserId(), user.getDeptId(), user.getUsername(),user.getNickname(),user.getSystemFlag(),
SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true, true, SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true,
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), authorities); true, StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), user.getUserGroup(),authorities);
} }
/** /**
......
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