Merge branch 'version_1.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_1.0
This commit is contained in:
commit
685e21b4bb
@ -47,6 +47,7 @@ public class Constant {
|
||||
public static final String INVELOMENT_TYPE_TEST = "dev";
|
||||
|
||||
public static final String SING = "【霖梓控股】";
|
||||
public static final Integer STATUS_3 = 3;
|
||||
|
||||
/**
|
||||
* 菜单类型
|
||||
|
||||
@ -640,4 +640,8 @@ public class StringUtil extends StringUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String removeHtml(String html) {
|
||||
return html.replaceAll("\\<.*?>","");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.lz.modules.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lz.common.utils.*;
|
||||
import com.lz.modules.app.dto.DepartmentsDto;
|
||||
import com.lz.modules.app.dto.StaffDepartmentDto;
|
||||
@ -11,15 +10,16 @@ import com.lz.modules.app.resp.ResultDetailResp;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.flow.req.ResultDetailReq;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.flow.service.RecordAuthService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultComment;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultCommentService;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@ -51,38 +51,19 @@ public class ResultRecordController extends AbstractController {
|
||||
private ResultRecordService lzResultRecordService;
|
||||
@Autowired
|
||||
private DepartmentsService departmentsService;
|
||||
|
||||
@Autowired
|
||||
private ResultDetailService resultDetailService;
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||
|
||||
@Autowired
|
||||
private RecordAuthService recordAuthService;
|
||||
|
||||
@Autowired
|
||||
private FlowDepartmentService flowDepartmentService;
|
||||
private ResultCommentService resultCommentService;
|
||||
|
||||
@Autowired
|
||||
private FlowRelationService flowRelationService;
|
||||
|
||||
@Autowired
|
||||
private FlowService flowService;
|
||||
|
||||
@Autowired
|
||||
private FlowRecordService flowRecordService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@ -125,17 +106,17 @@ public class ResultRecordController extends AbstractController {
|
||||
List<RecordAuth> listAuth = new ArrayList<>();
|
||||
if (req.getRecordType() == 1) { //新增目标
|
||||
listAuth = recordAuthService.selectAuthInfo(7l);
|
||||
auth = getAuth(listAuth);
|
||||
auth = recordAuthService.getAuth(listAuth);
|
||||
} else if (req.getRecordType() == 2) { //新增业绩
|
||||
listAuth = recordAuthService.selectAuthInfo(8l);
|
||||
auth = getAuth(listAuth);
|
||||
auth = recordAuthService.getAuth(listAuth);
|
||||
auth.setWenHuaEdit(1);
|
||||
ResultRecord resultRecordOld = resultRecordService.selectResultRecordByStaffId(getUserId());
|
||||
ResultRecord resultRecordNew = null;
|
||||
if (resultRecordOld != null) {
|
||||
Long recordId = resultRecordOld.getId();
|
||||
resultRecordOld.setId(null);
|
||||
resultRecordOld.setFlowStaffIdRole(initRole(resultRecordOld.getStaffId(), 8l));
|
||||
resultRecordOld.setFlowStaffIdRole(resultDetailService.initRole(resultRecordOld.getStaffId(), 8l));
|
||||
resultRecordService.insertResultRecord(resultRecordOld);
|
||||
resultRecordNew = resultRecordOld;
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
|
||||
@ -148,17 +129,17 @@ public class ResultRecordController extends AbstractController {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resultRecordNew = createResultRecord(getUserId(),2);
|
||||
resultRecordNew = createResultRecord(getUserId(), 2);
|
||||
}
|
||||
//保存文件价值观
|
||||
recordType = 3;
|
||||
insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId());
|
||||
insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId());
|
||||
resultDetailService.insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId());
|
||||
resultDetailService.insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId());
|
||||
recordResultId = resultRecordNew.getId();
|
||||
} else if (resultRecord != null) {
|
||||
Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
|
||||
listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId()));
|
||||
auth = getAuth(listAuth);
|
||||
auth = recordAuthService.getAuth(listAuth);
|
||||
}
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordResultId);
|
||||
if (CollectionUtils.isNotEmpty(resultDetails)) {
|
||||
@ -169,8 +150,8 @@ public class ResultRecordController extends AbstractController {
|
||||
int type2 = tempType2;
|
||||
if (tempType1 == 0) {
|
||||
type1 = 1;
|
||||
list.add(getYeJi());
|
||||
list.add(getYeJiKaoHe());
|
||||
list.add(resultDetailService.getYeJi());
|
||||
list.add(resultDetailService.getYeJiKaoHe());
|
||||
}
|
||||
if (tempType2 == 0) {
|
||||
type2 = 2;
|
||||
@ -196,14 +177,14 @@ public class ResultRecordController extends AbstractController {
|
||||
}
|
||||
resp.setIsEdit(1);
|
||||
if (count == type1 + 1 && tempType1 != 0) {
|
||||
list.add(getYeJiKaoHe());
|
||||
list.add(resultDetailService.getYeJiKaoHe());
|
||||
}
|
||||
list.add(resp);
|
||||
}
|
||||
if (tempType2 == 0) {
|
||||
list.add(getYeJiKaoHe());
|
||||
list.add(getWenHuaJiaZhiGua1(auth));
|
||||
list.add(getWenHuaJiaZhiGua2(auth));
|
||||
list.add(resultDetailService.getYeJiKaoHe());
|
||||
list.add(resultDetailService.getWenHuaJiaZhiGua1(auth));
|
||||
list.add(resultDetailService.getWenHuaJiaZhiGua2(auth));
|
||||
}
|
||||
} else {
|
||||
int type1 = 1;
|
||||
@ -214,14 +195,14 @@ public class ResultRecordController extends AbstractController {
|
||||
fourRowspan = type1 + 1 + type2 + 1;
|
||||
fiveRowspan = type1 + 1 + type2 + 2;
|
||||
|
||||
list.add(getYeJi());
|
||||
list.add(getYeJiKaoHe());
|
||||
list.add(getWenHuaJiaZhiGua1(auth));
|
||||
list.add(getWenHuaJiaZhiGua2(auth));
|
||||
list.add(resultDetailService.getYeJi());
|
||||
list.add(resultDetailService.getYeJiKaoHe());
|
||||
list.add(resultDetailService.getWenHuaJiaZhiGua1(auth));
|
||||
list.add(resultDetailService.getWenHuaJiaZhiGua2(auth));
|
||||
}
|
||||
list.add(getWenHuaJiaZhiGuaResult1());
|
||||
list.add(getWenHuaJiaZhiGuaResult2());
|
||||
list.add(getLastResult());
|
||||
list.add(resultDetailService.getWenHuaJiaZhiGuaResult1());
|
||||
list.add(resultDetailService.getWenHuaJiaZhiGuaResult2());
|
||||
list.add(resultDetailService.getLastResult());
|
||||
return R.ok()
|
||||
.put("staffName", staffEntity.getName())
|
||||
.put("department1", departmentDto.getDepartment1())
|
||||
@ -239,238 +220,24 @@ public class ResultRecordController extends AbstractController {
|
||||
.put("recordResultId", recordResultId);
|
||||
}
|
||||
|
||||
|
||||
public String initRole(Long staffId,Long roleId){
|
||||
List<StaffRoleDto> staffRoles = new ArrayList<>();
|
||||
StaffRoleDto staffRole = new StaffRoleDto() ;
|
||||
staffRole.setStaffId(staffId);
|
||||
staffRole.setRoleId(roleId);
|
||||
staffRoles.add(staffRole);
|
||||
return JSON.toJSONString(staffRoles);
|
||||
}
|
||||
|
||||
@RequestMapping("/commitApproval")
|
||||
public R commitApproval(ResultRecordReq req) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
|
||||
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
StaffEntity mySelf = staffService.selectStaffById(getUserId());
|
||||
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffEntity.getId());
|
||||
Long flowId = flowDepartment != null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己
|
||||
if (flowDepartment == null) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
|
||||
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
|
||||
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工
|
||||
}
|
||||
List<FlowDepartment> list = new ArrayList<>();
|
||||
list.add(flowDepartment);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (flowDepartment.getParentId() != null && flowDepartment.getParentId() > 0) {
|
||||
flowDepartment = flowDepartmentService.selectFlowDepartmentById(flowDepartment.getParentId());
|
||||
list.add(flowDepartment);
|
||||
} else {
|
||||
break;
|
||||
if (req.getStatus() == 2) {
|
||||
String resultComment = StringUtil.decodeBase64(req.getResultComment());
|
||||
resultComment = StringUtil.removeHtml(resultComment);
|
||||
if (StringUtil.isNotBlank(resultComment)) {
|
||||
ResultComment comment = new ResultComment();
|
||||
comment.setCommentUserId(getUserId());
|
||||
comment.setRecordId(req.getRecordResultId());
|
||||
resultCommentService.insertResultComment(comment);
|
||||
}
|
||||
return resultRecordService.approval(req.getRecordResultId(), getUserId());
|
||||
} else if (req.getStatus() == 3) { //侍提交
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
|
||||
resultRecord.setStatus(Constant.STATUS_3);
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
}
|
||||
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
|
||||
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
|
||||
// approvalList = [ME,ONE_D,TWO_D,HR,BOSS]
|
||||
List<String> approvalList = new ArrayList<>();
|
||||
approvalList.add("ME");
|
||||
for (FlowRelation flowRelation : flowRelations) {
|
||||
if (staffEntityMap.get(flowRelation.getChild()) != null || flowRelation.getCanReplace() == 0) {
|
||||
approvalList.add(flowRelation.getChild());
|
||||
}
|
||||
}
|
||||
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId);
|
||||
FlowRecord lastFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
|
||||
FlowRecord notFlowRecord = flowRecordService.selectNotApprovalStaffIdFlowRecords(resultRecord.getId());
|
||||
if (notFlowRecord != null) {
|
||||
notFlowRecord.setApprovalStaffId(getUserId());
|
||||
}
|
||||
|
||||
StaffEntity staff = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
|
||||
int index = getDepartmentLevelIndex(flows, flowIndex);
|
||||
if (index < 0) { //表示流程己经结束
|
||||
lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过");
|
||||
flowRecordService.updateCoverFlowRecordById(lastFlowRecord);
|
||||
resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限
|
||||
return R.ok("流程审批结束");
|
||||
}
|
||||
|
||||
FlowRecord flowRecord = new FlowRecord();
|
||||
flowRecord.setRecordId(req.getRecordResultId());
|
||||
flowRecord.setRecordStaffId(resultRecord.getStaffId());
|
||||
flowRecord.setFlowIndex(flowIndex);
|
||||
flowRecord.setFlowId(flowId);
|
||||
String departmentLevel = approvalList.get(index);
|
||||
flowRecord.setDepartmentLevel(departmentLevel);
|
||||
StaffEntity approvalStaff = null;
|
||||
List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
|
||||
if (Constant.ME.equals(departmentLevel)) { //如果是自己
|
||||
approvalStaff = staff; // 是自己进行审批
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(),flows.get(flowIndex-1).getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
} else {
|
||||
FlowDepartment flowD = staffEntityMap.get(departmentLevel);
|
||||
if (flowD == null) {
|
||||
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
|
||||
for(StaffRole staffRole: staffRoles ){
|
||||
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
|
||||
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
|
||||
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
|
||||
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
|
||||
if(StringUtil.isNotBlank(value) ){
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(),staffRole.getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(staffRoleDtos.size() == 1 ){ //表示只有一个审批的用户
|
||||
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
|
||||
}
|
||||
} else {
|
||||
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(), flows.get(flowIndex - 1).getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
}
|
||||
}
|
||||
flowRecord.setFlowName(mySelf.getName() + "-" + flows.get(flowIndex - 1).getOptDesc());
|
||||
flowRecord.setApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null);
|
||||
flowRecord.setApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
|
||||
flowRecordService.insertFlowRecord(flowRecord);
|
||||
resultRecord.setFlowStaffIdRole(JSON.toJSONString(staffRoleDtos));
|
||||
resultRecordService.updateResultRecordById(resultRecord);// 更新用户权限
|
||||
return R.ok("提交审批成功");
|
||||
}
|
||||
|
||||
public int getDepartmentLevelIndex(List<Flow> list,int flowIndex) {
|
||||
if(flowIndex > list.size()){
|
||||
return -1 ;
|
||||
}
|
||||
List<Flow> flows = new ArrayList<>();
|
||||
for(int i = 0 ;i < flowIndex ;i ++){
|
||||
flows.add(list.get(i));
|
||||
}
|
||||
int index = 0;
|
||||
for (Flow flow : flows) {
|
||||
String opt = flow.getOpt();
|
||||
String opts[] = opt.split("");
|
||||
for (String p : opts) {
|
||||
if ("+".equals(p)) {
|
||||
index++;
|
||||
} else {
|
||||
index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public void insertWenHuaJiaZhiGua(String target, Long recordId, Long staffId) {
|
||||
ResultDetail wenhua1 = new ResultDetail();
|
||||
wenhua1.setTarget(target);
|
||||
wenhua1.setType(2);
|
||||
wenhua1.setCheckWeight(new BigDecimal(0.15));
|
||||
wenhua1.setStaffId(staffId);
|
||||
wenhua1.setRecordId(recordId);
|
||||
resultDetailService.insertResultDetail(wenhua1);
|
||||
}
|
||||
|
||||
public ResultDetailResp getYeJi() {
|
||||
ResultDetailResp result = new ResultDetailResp();
|
||||
result.setCheckRange("业绩");
|
||||
result.setCheckWeight(new BigDecimal(0.7));
|
||||
result.setIsAdd(1);
|
||||
result.setIsEdit(1);
|
||||
result.setType(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ResultDetailResp getYeJiKaoHe() {
|
||||
ResultDetailResp respHeader = new ResultDetailResp();
|
||||
respHeader.setKeyResult("业务考核结果");
|
||||
respHeader.setCheckWeight(new BigDecimal(0.7));
|
||||
respHeader.setSuperScore("/");
|
||||
respHeader.setAcquireScore(new BigDecimal(0));
|
||||
respHeader.setScoreComment("/");
|
||||
respHeader.setIsAdd(-1);
|
||||
return respHeader;
|
||||
}
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGua1(Auth auth) {
|
||||
ResultDetailResp wenhua1 = new ResultDetailResp();
|
||||
wenhua1.setCheckRange("文化价值观");
|
||||
wenhua1.setTarget("做人:相信、包容、担当");
|
||||
wenhua1.setType(2);
|
||||
wenhua1.setIsEdit(auth.getWenHuaEdit());
|
||||
wenhua1.setCheckWeight(new BigDecimal(0.15));
|
||||
return wenhua1;
|
||||
}
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGua2(Auth auth) {
|
||||
ResultDetailResp wenhua2 = new ResultDetailResp();
|
||||
wenhua2.setCheckRange("文化价值观");
|
||||
wenhua2.setTarget("做事:用户第一、求真、极致");
|
||||
wenhua2.setType(2);
|
||||
wenhua2.setIsEdit(auth.getWenHuaEdit());
|
||||
wenhua2.setCheckWeight(new BigDecimal(0.15));
|
||||
return wenhua2;
|
||||
}
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGuaResult1() {
|
||||
ResultDetailResp tail1 = new ResultDetailResp();
|
||||
tail1.setKeyResult("文化价值观考核结果");
|
||||
tail1.setCheckWeight(new BigDecimal(0.3));
|
||||
tail1.setSuperScore("/");
|
||||
tail1.setAcquireScore(new BigDecimal(0));
|
||||
tail1.setScoreComment("/");
|
||||
tail1.setIsAdd(-1);
|
||||
return tail1;
|
||||
}
|
||||
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGuaResult2() {
|
||||
ResultDetailResp tail2 = new ResultDetailResp();
|
||||
tail2.setCheckRange("文化价值观考核结果");
|
||||
tail2.setAcquireScore(new BigDecimal(0));
|
||||
tail2.setScoreComment("/");
|
||||
tail2.setIsAdd(-1);
|
||||
return tail2;
|
||||
}
|
||||
|
||||
public ResultDetailResp getLastResult() {
|
||||
ResultDetailResp tail3 = new ResultDetailResp();
|
||||
tail3.setCheckRange("最终绩效考核结果等级");
|
||||
tail3.setAcquireScore(new BigDecimal(3.25));
|
||||
tail3.setScoreComment("/");
|
||||
tail3.setIsAdd(-1);
|
||||
return tail3;
|
||||
}
|
||||
|
||||
public Auth getAuth(List<RecordAuth> auths) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(auths)) {
|
||||
map = auths.stream().collect(Collectors.toMap(RecordAuth::getIdentity, RecordAuth::getStatus));
|
||||
}
|
||||
Auth auth = new Auth();
|
||||
auth.setAdd(NumberUtil.objToIntDefault(map.get("add"), 0));
|
||||
auth.setApprovel(NumberUtil.objToIntDefault(map.get("approvel"), 0));
|
||||
auth.setCheckResult(NumberUtil.objToIntDefault(map.get("checkResult"), 0));
|
||||
auth.setCheckWeight(NumberUtil.objToIntDefault(map.get("checkWeight"), 0));
|
||||
auth.setCommit(NumberUtil.objToIntDefault(map.get("commit"), 0));
|
||||
auth.setConfirmCommit(NumberUtil.objToIntDefault(map.get("confirmCommit"), 0));
|
||||
auth.setKeyResult(NumberUtil.objToIntDefault(map.get("keyResult"), 0));
|
||||
auth.setPriority(NumberUtil.objToIntDefault(map.get("priority"), 0));
|
||||
auth.setReject(NumberUtil.objToIntDefault(map.get("reject"), 0));
|
||||
auth.setScoreComment(NumberUtil.objToIntDefault(map.get("scoreComment"), 0));
|
||||
auth.setSuperScore(NumberUtil.objToIntDefault(map.get("superScore"), 0));
|
||||
auth.setTarget(NumberUtil.objToIntDefault(map.get("target"), 0));
|
||||
auth.setEdit(NumberUtil.objToIntDefault(map.get("edit"), 0));
|
||||
auth.setAcquireScore(NumberUtil.objToIntDefault(map.get("acquireScore"), 0));
|
||||
return auth;
|
||||
return R.ok("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -480,7 +247,6 @@ public class ResultRecordController extends AbstractController {
|
||||
@RequiresPermissions("user:lzresultrecord:info")
|
||||
public R info(@PathVariable("id") Long id) {
|
||||
ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id);
|
||||
|
||||
return R.ok().put("lzResultRecord", lzResultRecord);
|
||||
}
|
||||
|
||||
@ -540,7 +306,6 @@ public class ResultRecordController extends AbstractController {
|
||||
return R.ok("验证成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@ -577,9 +342,9 @@ public class ResultRecordController extends AbstractController {
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
resultRecord.setMonthTime(new Date());
|
||||
if (type == 1) {
|
||||
resultRecord.setFlowStaffIdRole(initRole(staffId,7l));
|
||||
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,7l));
|
||||
} else {
|
||||
resultRecord.setFlowStaffIdRole(initRole(staffId,8l));
|
||||
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,8l));
|
||||
}
|
||||
resultRecord.setStaffId(getUserId());
|
||||
resultRecord.setStatus(0);
|
||||
@ -587,7 +352,6 @@ public class ResultRecordController extends AbstractController {
|
||||
resultRecordService.insertResultRecord(resultRecord);
|
||||
return resultRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
|
||||
@ -32,4 +32,5 @@ public class ResultRecordReq {
|
||||
private Long staffId;
|
||||
private Integer recordType;
|
||||
private String departmentLevel ;
|
||||
private String resultComment;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.Date;
|
||||
* 菜单权限表
|
||||
* </p>*流转记录表
|
||||
* @author quyixiao
|
||||
* @since 2020-08-20
|
||||
* @since 2020-08-21
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -42,6 +42,8 @@ public class FlowRecord implements java.io.Serializable {
|
||||
private Integer flowIndex;
|
||||
//0表示正常状态,1 表示被驳回无用的流程
|
||||
private Integer status;
|
||||
// 员工&权限id
|
||||
private String flowStaffIdRole;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -237,6 +239,21 @@ public class FlowRecord implements java.io.Serializable {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工&权限id
|
||||
* @return
|
||||
*/
|
||||
public String getFlowStaffIdRole() {
|
||||
return flowStaffIdRole;
|
||||
}
|
||||
/**
|
||||
* 员工&权限id
|
||||
* @param flowStaffIdRole
|
||||
*/
|
||||
public void setFlowStaffIdRole(String flowStaffIdRole) {
|
||||
this.flowStaffIdRole = flowStaffIdRole;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FlowRecord{" +
|
||||
@ -253,6 +270,7 @@ public class FlowRecord implements java.io.Serializable {
|
||||
",flowId=" + flowId +
|
||||
",flowIndex=" + flowIndex +
|
||||
",status=" + status +
|
||||
",flowStaffIdRole=" + flowStaffIdRole +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -22,8 +22,8 @@ public class StaffRoleDto {
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<StaffRoleDto> staffRoleDtoList = new ArrayList<>();
|
||||
//StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);
|
||||
//staffRoleDtoList.add(staffRoleDto);
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);
|
||||
staffRoleDtoList.add(staffRoleDto);
|
||||
System.out.println(JSON.toJSONString(staffRoleDtoList));
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.lz.modules.flow.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -36,4 +37,6 @@ public interface RecordAuthService extends IService<RecordAuth> {
|
||||
List<RecordAuth> selectAuthInfo(Long roldId);
|
||||
|
||||
Map<Long ,Long > selectRoleIdByStaffRoleInfo(String flowStaffIdRole);
|
||||
|
||||
Auth getAuth(List<RecordAuth> listAuth);
|
||||
}
|
||||
@ -2,9 +2,11 @@ package com.lz.modules.flow.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.NumberUtil;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.flow.dao.RecordAuthMapper;
|
||||
import com.lz.modules.flow.entity.RecordAuth;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.flow.service.RecordAuthService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@ -82,4 +84,28 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
|
||||
}
|
||||
|
||||
|
||||
public Auth getAuth(List<RecordAuth> auths) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(auths)) {
|
||||
map = auths.stream().collect(Collectors.toMap(RecordAuth::getIdentity, RecordAuth::getStatus));
|
||||
}
|
||||
Auth auth = new Auth();
|
||||
auth.setAdd(NumberUtil.objToIntDefault(map.get("add"), 0));
|
||||
auth.setApprovel(NumberUtil.objToIntDefault(map.get("approvel"), 0));
|
||||
auth.setCheckResult(NumberUtil.objToIntDefault(map.get("checkResult"), 0));
|
||||
auth.setCheckWeight(NumberUtil.objToIntDefault(map.get("checkWeight"), 0));
|
||||
auth.setCommit(NumberUtil.objToIntDefault(map.get("commit"), 0));
|
||||
auth.setConfirmCommit(NumberUtil.objToIntDefault(map.get("confirmCommit"), 0));
|
||||
auth.setKeyResult(NumberUtil.objToIntDefault(map.get("keyResult"), 0));
|
||||
auth.setPriority(NumberUtil.objToIntDefault(map.get("priority"), 0));
|
||||
auth.setReject(NumberUtil.objToIntDefault(map.get("reject"), 0));
|
||||
auth.setScoreComment(NumberUtil.objToIntDefault(map.get("scoreComment"), 0));
|
||||
auth.setSuperScore(NumberUtil.objToIntDefault(map.get("superScore"), 0));
|
||||
auth.setTarget(NumberUtil.objToIntDefault(map.get("target"), 0));
|
||||
auth.setEdit(NumberUtil.objToIntDefault(map.get("edit"), 0));
|
||||
auth.setAcquireScore(NumberUtil.objToIntDefault(map.get("acquireScore"), 0));
|
||||
return auth;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ public class ResultRecord implements java.io.Serializable {
|
||||
private Date gmtModified;
|
||||
//月份
|
||||
private Date monthTime;
|
||||
//0.新建,1 提交审批中,2 拒绝
|
||||
//0.新建,1 提交审批中,2 拒绝 , 3侍提交
|
||||
private Integer status;
|
||||
//最后得分
|
||||
private BigDecimal lastScore;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.lz.modules.sys.service.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.app.resp.ResultDetailResp;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
|
||||
import java.util.List;
|
||||
@ -35,4 +37,22 @@ public interface ResultDetailService extends IService<ResultDetail> {
|
||||
List<ResultDetail> selectByRecordId(Long recordResultId);
|
||||
|
||||
List<ResultDetail> selectByRecordIdType(Long recordResultId, Integer type);
|
||||
|
||||
ResultDetailResp getYeJi();
|
||||
|
||||
ResultDetailResp getYeJiKaoHe();
|
||||
|
||||
ResultDetailResp getWenHuaJiaZhiGua2(Auth auth);
|
||||
|
||||
ResultDetailResp getWenHuaJiaZhiGua1(Auth auth);
|
||||
|
||||
ResultDetailResp getWenHuaJiaZhiGuaResult1();
|
||||
|
||||
ResultDetailResp getWenHuaJiaZhiGuaResult2();
|
||||
|
||||
ResultDetailResp getLastResult();
|
||||
|
||||
void insertWenHuaJiaZhiGua(String s, Long id, Long userId);
|
||||
|
||||
String initRole(Long staffId, Long l);
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.lz.modules.sys.service.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
@ -43,4 +44,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
ResultRecord selectResultRecordByStaffId(Long userId);
|
||||
|
||||
void updateFlowStaffIdRoleToNull(Long id);
|
||||
|
||||
R approval(Long resultRecordId, Long userId);
|
||||
}
|
||||
@ -1,12 +1,18 @@
|
||||
package com.lz.modules.sys.service.app.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.modules.app.resp.ResultDetailResp;
|
||||
import com.lz.modules.flow.model.Auth;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.sys.dao.app.ResultDetailMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -71,5 +77,97 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
|
||||
return resultDetailMapper.selectByRecordIdType(recordResultId,type);
|
||||
}
|
||||
|
||||
public ResultDetailResp getYeJi() {
|
||||
ResultDetailResp result = new ResultDetailResp();
|
||||
result.setCheckRange("业绩");
|
||||
result.setCheckWeight(new BigDecimal(0.7));
|
||||
result.setIsAdd(1);
|
||||
result.setIsEdit(1);
|
||||
result.setType(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ResultDetailResp getYeJiKaoHe() {
|
||||
ResultDetailResp respHeader = new ResultDetailResp();
|
||||
respHeader.setKeyResult("业务考核结果");
|
||||
respHeader.setCheckWeight(new BigDecimal(0.7));
|
||||
respHeader.setSuperScore("/");
|
||||
respHeader.setAcquireScore(new BigDecimal(0));
|
||||
respHeader.setScoreComment("/");
|
||||
respHeader.setIsAdd(-1);
|
||||
return respHeader;
|
||||
}
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGua1(Auth auth) {
|
||||
ResultDetailResp wenhua1 = new ResultDetailResp();
|
||||
wenhua1.setCheckRange("文化价值观");
|
||||
wenhua1.setTarget("做人:相信、包容、担当");
|
||||
wenhua1.setType(2);
|
||||
wenhua1.setIsEdit(auth.getWenHuaEdit());
|
||||
wenhua1.setCheckWeight(new BigDecimal(0.15));
|
||||
return wenhua1;
|
||||
}
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGua2(Auth auth) {
|
||||
ResultDetailResp wenhua2 = new ResultDetailResp();
|
||||
wenhua2.setCheckRange("文化价值观");
|
||||
wenhua2.setTarget("做事:用户第一、求真、极致");
|
||||
wenhua2.setType(2);
|
||||
wenhua2.setIsEdit(auth.getWenHuaEdit());
|
||||
wenhua2.setCheckWeight(new BigDecimal(0.15));
|
||||
return wenhua2;
|
||||
}
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGuaResult1() {
|
||||
ResultDetailResp tail1 = new ResultDetailResp();
|
||||
tail1.setKeyResult("文化价值观考核结果");
|
||||
tail1.setCheckWeight(new BigDecimal(0.3));
|
||||
tail1.setSuperScore("/");
|
||||
tail1.setAcquireScore(new BigDecimal(0));
|
||||
tail1.setScoreComment("/");
|
||||
tail1.setIsAdd(-1);
|
||||
return tail1;
|
||||
}
|
||||
|
||||
|
||||
public ResultDetailResp getWenHuaJiaZhiGuaResult2() {
|
||||
ResultDetailResp tail2 = new ResultDetailResp();
|
||||
tail2.setCheckRange("文化价值观考核结果");
|
||||
tail2.setAcquireScore(new BigDecimal(0));
|
||||
tail2.setScoreComment("/");
|
||||
tail2.setIsAdd(-1);
|
||||
return tail2;
|
||||
}
|
||||
|
||||
public ResultDetailResp getLastResult() {
|
||||
ResultDetailResp tail3 = new ResultDetailResp();
|
||||
tail3.setCheckRange("最终绩效考核结果等级");
|
||||
tail3.setAcquireScore(new BigDecimal(3.25));
|
||||
tail3.setScoreComment("/");
|
||||
tail3.setIsAdd(-1);
|
||||
return tail3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void insertWenHuaJiaZhiGua(String target, Long recordId, Long staffId) {
|
||||
ResultDetail wenhua1 = new ResultDetail();
|
||||
wenhua1.setTarget(target);
|
||||
wenhua1.setType(2);
|
||||
wenhua1.setCheckWeight(new BigDecimal(0.15));
|
||||
wenhua1.setStaffId(staffId);
|
||||
wenhua1.setRecordId(recordId);
|
||||
insertResultDetail(wenhua1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String initRole(Long staffId,Long roleId){
|
||||
List<StaffRoleDto> staffRoles = new ArrayList<>();
|
||||
StaffRoleDto staffRole = new StaffRoleDto() ;
|
||||
staffRole.setStaffId(staffId);
|
||||
staffRole.setRoleId(roleId);
|
||||
staffRoles.add(staffRole);
|
||||
return JSON.toJSONString(staffRoles);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,20 +1,22 @@
|
||||
package com.lz.modules.sys.service.app.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.DateUtils;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.common.utils.*;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
||||
import com.lz.modules.app.dto.EmployeesDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.ResultRecordResp;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.FlowDepartment;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.service.FlowDepartmentService;
|
||||
import com.lz.modules.flow.service.StaffRoleService;
|
||||
import com.lz.modules.flow.entity.*;
|
||||
import com.lz.modules.flow.model.StaffRoleDto;
|
||||
import com.lz.modules.flow.service.*;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
@ -26,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -64,6 +67,29 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private FlowRelationService flowRelationService;
|
||||
|
||||
@Autowired
|
||||
private FlowService flowService;
|
||||
|
||||
@Autowired
|
||||
private FlowRecordService flowRecordService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentsService departmentsService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResultRecord selectResultRecordById(Long id) {
|
||||
@ -195,5 +221,127 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R approval(Long resultRecordId,Long userId) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
StaffEntity mySelf = staffService.selectStaffById(userId);
|
||||
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffEntity.getId());
|
||||
Long flowId = flowDepartment != null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己
|
||||
if (flowDepartment == null) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
|
||||
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
|
||||
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工
|
||||
}
|
||||
List<FlowDepartment> list = new ArrayList<>();
|
||||
list.add(flowDepartment);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (flowDepartment.getParentId() != null && flowDepartment.getParentId() > 0) {
|
||||
flowDepartment = flowDepartmentService.selectFlowDepartmentById(flowDepartment.getParentId());
|
||||
list.add(flowDepartment);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
|
||||
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
|
||||
// approvalList = [ME,ONE_D,TWO_D,HR,BOSS]
|
||||
List<String> approvalList = new ArrayList<>();
|
||||
approvalList.add("ME");
|
||||
for (FlowRelation flowRelation : flowRelations) {
|
||||
if (staffEntityMap.get(flowRelation.getChild()) != null || flowRelation.getCanReplace() == 0) {
|
||||
approvalList.add(flowRelation.getChild());
|
||||
}
|
||||
}
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId);
|
||||
FlowRecord lastFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(resultRecordId);
|
||||
FlowRecord notFlowRecord = flowRecordService.selectNotApprovalStaffIdFlowRecords(resultRecord.getId());
|
||||
if (notFlowRecord != null) {
|
||||
notFlowRecord.setApprovalStaffId(userId);
|
||||
}
|
||||
|
||||
StaffEntity staff = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
|
||||
int index = getDepartmentLevelIndex(flows, flowIndex);
|
||||
if (index < 0) { //表示流程己经结束
|
||||
lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过");
|
||||
flowRecordService.updateCoverFlowRecordById(lastFlowRecord);
|
||||
resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限
|
||||
return R.ok("流程审批结束");
|
||||
}
|
||||
|
||||
FlowRecord flowRecord = new FlowRecord();
|
||||
flowRecord.setRecordId(resultRecordId);
|
||||
flowRecord.setRecordStaffId(resultRecord.getStaffId());
|
||||
flowRecord.setFlowIndex(flowIndex);
|
||||
flowRecord.setFlowId(flowId);
|
||||
String departmentLevel = approvalList.get(index);
|
||||
flowRecord.setDepartmentLevel(departmentLevel);
|
||||
StaffEntity approvalStaff = null;
|
||||
List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
|
||||
if (Constant.ME.equals(departmentLevel)) { //如果是自己
|
||||
approvalStaff = staff; // 是自己进行审批
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(),flows.get(flowIndex-1).getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
} else {
|
||||
FlowDepartment flowD = staffEntityMap.get(departmentLevel);
|
||||
if (flowD == null) {
|
||||
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
|
||||
for(StaffRole staffRole: staffRoles ){
|
||||
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
|
||||
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
|
||||
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
|
||||
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
|
||||
if(StringUtil.isNotBlank(value) ){
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(),staffRole.getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(staffRoleDtos.size() == 1 ){ //表示只有一个审批的用户
|
||||
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
|
||||
}
|
||||
} else {
|
||||
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(), flows.get(flowIndex - 1).getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
}
|
||||
}
|
||||
flowRecord.setFlowName(mySelf.getName() + "-" + flows.get(flowIndex - 1).getOptDesc());
|
||||
flowRecord.setApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null);
|
||||
flowRecord.setApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
|
||||
String staffRoles = JSON.toJSONString(staffRoleDtos);
|
||||
flowRecord.setFlowStaffIdRole(staffRoles);
|
||||
flowRecordService.insertFlowRecord(flowRecord);
|
||||
resultRecord.setFlowStaffIdRole(staffRoles);
|
||||
resultRecordService.updateResultRecordById(resultRecord);// 更新用户权限
|
||||
return R.ok("提交审批成功");
|
||||
}
|
||||
|
||||
|
||||
public int getDepartmentLevelIndex(List<Flow> list, int flowIndex) {
|
||||
if (flowIndex > list.size()) {
|
||||
return -1 ;
|
||||
}
|
||||
List<Flow> flows = new ArrayList<>();
|
||||
for(int i = 0 ;i < flowIndex ;i ++){
|
||||
flows.add(list.get(i));
|
||||
}
|
||||
int index = 0;
|
||||
for (Flow flow : flows) {
|
||||
String opt = flow.getOpt();
|
||||
String opts[] = opt.split("");
|
||||
for (String p : opts) {
|
||||
if ("+".equals(p)) {
|
||||
index++;
|
||||
} else {
|
||||
index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -17,18 +17,23 @@
|
||||
<result column="flow_id" property="flowId"/>
|
||||
<result column="flow_index" property="flowIndex"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="flow_staff_id_role" property="flowStaffIdRole"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_level AS departmentLevel, record_id AS recordId, approval_staff_id AS approvalStaffId, approval_staff_name AS approvalStaffName, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, status AS status
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_level AS departmentLevel, record_id AS recordId, approval_staff_id AS approvalStaffId, approval_staff_name AS approvalStaffName, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, status AS status, flow_staff_id_role AS flowStaffIdRole
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectFlowRecordById" resultType="FlowRecord" >
|
||||
select * from lz_flow_record where id=#{id} and is_delete = 0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertFlowRecord" parameterType="FlowRecord" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_flow_record(
|
||||
<if test="departmentLevel != null">department_level, </if>
|
||||
@ -40,6 +45,7 @@
|
||||
<if test="flowId != null">flow_id, </if>
|
||||
<if test="flowIndex != null">flow_index, </if>
|
||||
<if test="status != null">status, </if>
|
||||
<if test="flowStaffIdRole != null">flow_staff_id_role, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
@ -53,6 +59,7 @@
|
||||
<if test="flowId != null">#{ flowId}, </if>
|
||||
<if test="flowIndex != null">#{ flowIndex}, </if>
|
||||
<if test="status != null">#{ status}, </if>
|
||||
<if test="flowStaffIdRole != null">#{ flowStaffIdRole}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
@ -74,7 +81,8 @@
|
||||
<if test="recordStaffId != null">record_staff_id = #{recordStaffId},</if>
|
||||
<if test="flowId != null">flow_id = #{flowId},</if>
|
||||
<if test="flowIndex != null">flow_index = #{flowIndex},</if>
|
||||
<if test="status != null">status = #{status}</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="flowStaffIdRole != null">flow_staff_id_role = #{flowStaffIdRole}</if>
|
||||
</trim>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -95,7 +103,8 @@
|
||||
record_staff_id = #{recordStaffId},
|
||||
flow_id = #{flowId},
|
||||
flow_index = #{flowIndex},
|
||||
status = #{status}
|
||||
status = #{status},
|
||||
flow_staff_id_role = #{flowStaffIdRole}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@ -62,7 +62,7 @@ public class MysqlMain {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
list.add(new TablesBean("third_app_config"));
|
||||
list.add(new TablesBean("lz_flow_record"));
|
||||
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user