提交修改
This commit is contained in:
parent
436b1446e8
commit
eb3ada58d3
@ -1152,7 +1152,6 @@ public class ResultRecordController extends AbstractController {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除
|
||||
*/
|
||||
// http://localhost:8080/lz_management/user/lzresultrecord/new/resultRecordDetail?resultRecordId=593&loginUserId=322
|
||||
@ -1166,4 +1165,16 @@ public class ResultRecordController extends AbstractController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// http://localhost:8080/lz_management/user/lzresultrecord/get/reset/data?resultRecordId=593&loginUserId=322
|
||||
@RequestMapping("/get/reset/data")
|
||||
public R getResetData(RecordDetailDto recordDetailDto) {
|
||||
if(recordDetailDto.getLoginUserId() ==null && getUser() !=null ){
|
||||
recordDetailDto.setLoginUserId(getUserId());
|
||||
}
|
||||
return resultRecordService.getResetData(recordDetailDto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dto.ApprovalDto;
|
||||
import com.lz.modules.app.dto.RecordDetailDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
@ -298,4 +299,10 @@ public class TestController {
|
||||
System.out.println(roleIds);
|
||||
}
|
||||
|
||||
//http://localhost:8080/lz_management/test/reset/data?resultRecordId=3714
|
||||
@RequestMapping("/test/reset/data")
|
||||
public R getResetData(RecordDetailDto recordDetailDto) {
|
||||
return resultRecordService.getResetData(recordDetailDto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
13
src/main/java/com/lz/modules/app/resp/ResetDataResp.java
Normal file
13
src/main/java/com/lz/modules/app/resp/ResetDataResp.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.lz.modules.app.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ResetDataResp {
|
||||
private String flowName;
|
||||
private List<String> staffNames;
|
||||
private Long id ;
|
||||
|
||||
}
|
||||
@ -125,4 +125,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectResultRecordsByStartId(Long startId);
|
||||
List<Long> selectResultRecordIdsByStartId(Long startId);
|
||||
|
||||
R getResetData(RecordDetailDto recordDetailDto);
|
||||
}
|
||||
@ -20,10 +20,7 @@ import com.lz.modules.app.enums.FlowApprovalRoleTypeEnums;
|
||||
import com.lz.modules.app.enums.FlowRecordStatusEnums;
|
||||
import com.lz.modules.app.enums.RoleEnums;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.FlowDetailResp;
|
||||
import com.lz.modules.app.resp.FlowRecordResp;
|
||||
import com.lz.modules.app.resp.OwnResultResp;
|
||||
import com.lz.modules.app.resp.ResultRecordResp;
|
||||
import com.lz.modules.app.resp.*;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
@ -74,8 +71,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
private ResultRecordMapper resultRecordMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
private static EmployeesDto employeesDto;
|
||||
|
||||
@Autowired
|
||||
@ -184,14 +179,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll();
|
||||
if (StringUtil.isNotBlank(params.getDepartment1()) || StringUtil.isNotBlank(params.getDepartment2())
|
||||
|| StringUtil.isNotBlank(params.getDepartment3())) {
|
||||
Map<String,List<DepartmentsEntity>> departmentMap = null;
|
||||
if(employeesDto == null || employeesDto.getExpire() < new Date().getTime()){
|
||||
Map<String, List<DepartmentsEntity>> departmentMap = null;
|
||||
if (employeesDto == null || employeesDto.getExpire() < new Date().getTime()) {
|
||||
departmentMap = getStringListMap(tDepartments);
|
||||
Date expire = DateUtils.addMinute(new Date(),30);
|
||||
EmployeesDto newDto = new EmployeesDto(expire.getTime(),departmentMap);
|
||||
Date expire = DateUtils.addMinute(new Date(), 30);
|
||||
EmployeesDto newDto = new EmployeesDto(expire.getTime(), departmentMap);
|
||||
employeesDto = newDto;
|
||||
log.info("使用新数据");
|
||||
}else{
|
||||
} else {
|
||||
log.info("使用缓存");
|
||||
departmentMap = employeesDto.getCacheMap();
|
||||
}
|
||||
@ -204,12 +199,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isNotBlank(params.getStatusStr())){
|
||||
String status [] = params.getStatusStr().split(",");
|
||||
if (StringUtil.isNotBlank(params.getStatusStr())) {
|
||||
String status[] = params.getStatusStr().split(",");
|
||||
List<Long> listx = new ArrayList<>();
|
||||
if(status !=null){
|
||||
for(String l : status){
|
||||
listx.add(NumberUtil.objToLongDefault(l,-1));
|
||||
if (status != null) {
|
||||
for (String l : status) {
|
||||
listx.add(NumberUtil.objToLongDefault(l, -1));
|
||||
}
|
||||
params.setStatusList(listx);
|
||||
}
|
||||
@ -257,16 +252,16 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
pageUtils.setList(list);
|
||||
}
|
||||
return R.ok().put("page", pageUtils)
|
||||
.put("departmentLevel",departmentLevel);
|
||||
.put("departmentLevel", departmentLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments) {
|
||||
Map<String, List<DepartmentsEntity>> departmentMap = new HashMap<>();
|
||||
for(DepartmentsEntity department : tDepartments) {
|
||||
for (DepartmentsEntity department : tDepartments) {
|
||||
List<DepartmentsEntity> list = new ArrayList<>();
|
||||
for(DepartmentsEntity child : tDepartments) {
|
||||
if(child.getDepartmentParentId().equals(department.getDepartmentId())){
|
||||
for (DepartmentsEntity child : tDepartments) {
|
||||
if (child.getDepartmentParentId().equals(department.getDepartmentId())) {
|
||||
list.add(child);
|
||||
}
|
||||
}
|
||||
@ -280,12 +275,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return resultRecordMapper.selectResultRecordByStaffIdStatus(staffId, status);
|
||||
}
|
||||
|
||||
public void getChildIds(List<String> childDepartIds ,String parentId,Map<String,List<DepartmentsEntity>> departmentMap ){
|
||||
public void getChildIds(List<String> childDepartIds, String parentId, Map<String, List<DepartmentsEntity>> departmentMap) {
|
||||
childDepartIds.add(parentId);
|
||||
List<DepartmentsEntity > tDepartments = departmentMap.get(parentId);
|
||||
if(CollectionUtils.isNotEmpty(tDepartments)){
|
||||
for(DepartmentsEntity tDepartment:tDepartments){
|
||||
getChildIds(childDepartIds,tDepartment.getDepartmentId(),departmentMap);
|
||||
List<DepartmentsEntity> tDepartments = departmentMap.get(parentId);
|
||||
if (CollectionUtils.isNotEmpty(tDepartments)) {
|
||||
for (DepartmentsEntity tDepartment : tDepartments) {
|
||||
getChildIds(childDepartIds, tDepartment.getDepartmentId(), departmentMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,8 +298,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFlowStaffIdRoleToNull(Long id,Integer status) {
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id,status);
|
||||
public void updateFlowStaffIdRoleToNull(Long id, Integer status) {
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -330,14 +325,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartmentsStaffRelateEntity getLeaderDepartmentsStaffRelateEntity(Long staffId){
|
||||
public DepartmentsStaffRelateEntity getLeaderDepartmentsStaffRelateEntity(Long staffId) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
|
||||
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
if(leader == null){
|
||||
if (leader == null) {
|
||||
Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(departmentsStaffRelateEntity.getDepartmentId());
|
||||
if (StringUtil.isNotBlank(map.get("dd2"))) {
|
||||
leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd2"));
|
||||
if(leader ==null && StringUtil.isNotBlank(map.get("dd3"))){
|
||||
if (leader == null && StringUtil.isNotBlank(map.get("dd3"))) {
|
||||
leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd3"));
|
||||
return leader;
|
||||
|
||||
@ -349,12 +344,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
@Override
|
||||
public ResultRecord selectLastResultRecordByStaffIdType(Long staffId, int type) {
|
||||
return resultRecordMapper.selectLastResultRecordByStaffIdType(staffId,type);
|
||||
return resultRecordMapper.selectLastResultRecordByStaffIdType(staffId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultRecord selectCurrentMonthResultRecordByStaffIdType(Long staffId, int type) {
|
||||
return resultRecordMapper.selectCurrentMonthResultRecordByStaffIdType(staffId,type);
|
||||
return resultRecordMapper.selectCurrentMonthResultRecordByStaffIdType(staffId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -386,7 +381,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
@Override
|
||||
public ResultRecord initResult(Long staffId, Integer recordType, Long roleId) {
|
||||
ResultRecord resultRecordOld = resultRecordService.selectLastResultRecordByStaffIdType(staffId,1);
|
||||
ResultRecord resultRecordOld = resultRecordService.selectLastResultRecordByStaffIdType(staffId, 1);
|
||||
ResultRecord resultRecordNew = null;
|
||||
if (resultRecordOld != null) {
|
||||
Long oldResultRecordId = resultRecordOld.getId();
|
||||
@ -404,7 +399,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resultRecordService.deleteResultRecordById2(oldResultRecordId);
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(oldResultRecordId);
|
||||
|
||||
for(FlowRecord flowRecord : flowRecords){
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
flowRecord.setRecordId(resultRecordOld.getId());
|
||||
flowRecord.setId(null);
|
||||
flowRecord.setType(Constant.ONE);
|
||||
@ -428,12 +423,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resultRecordNew = resultRecordService.createResultRecord(staffId, recordType, roleId);
|
||||
}
|
||||
//保存文件价值观
|
||||
resultDetailService.insertWenHuaJiaZhiGua(Constant.WENHUAJIAZHIGUAN, resultRecordNew.getId(), staffId,new BigDecimal(0.3));
|
||||
resultDetailService.insertWenHuaJiaZhiGua(Constant.WENHUAJIAZHIGUAN, resultRecordNew.getId(), staffId, new BigDecimal(0.3));
|
||||
return resultRecordNew;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R checkApproval(ResultRecord resultRecord,Long userId){
|
||||
public R checkApproval(ResultRecord resultRecord, Long userId) {
|
||||
Long recordId = resultRecord.getId();
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
|
||||
if (CollectionUtils.isEmpty(resultDetails)) {
|
||||
@ -448,9 +443,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
List<RecordAuth> listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(userId));
|
||||
Auth auth = recordAuthService.getAuth(listAuth);
|
||||
// 如果是评分,查看是不是所有内容都己经评分
|
||||
if(auth.getEditScore() == 1 ){
|
||||
for(ResultDetail resultDetail : resultDetails ){
|
||||
if(resultDetail.getAcquireScore().compareTo(BigDecimal.ZERO) <= 0 ){
|
||||
if (auth.getEditScore() == 1) {
|
||||
for (ResultDetail resultDetail : resultDetails) {
|
||||
if (resultDetail.getAcquireScore().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return R.error("resultDetail[" + resultDetail.getId() + "] 评分必需 > 0 ");
|
||||
}
|
||||
}
|
||||
@ -459,9 +454,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public R approval(Long resultRecordId, Long userId,Integer status,boolean flagEnd) {
|
||||
public R approval(Long resultRecordId, Long userId, Integer status, boolean flagEnd) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
R r = resultRecordService.checkApproval(resultRecord,userId);
|
||||
R r = resultRecordService.checkApproval(resultRecord, userId);
|
||||
if (!r.isSuccess()) {
|
||||
return r;
|
||||
}
|
||||
@ -479,8 +474,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
approvalList.add(flowRelation.getChild());
|
||||
}
|
||||
}
|
||||
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) );
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId,0l);
|
||||
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()));
|
||||
List<Flow> flows = flowService.selectByFlowId(flowId, 0l);
|
||||
FlowRecord lastFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(resultRecordId);
|
||||
FlowRecord notFlowRecord = flowRecordService.selectNotApprovalStaffIdFlowRecords(resultRecord.getId());
|
||||
if (notFlowRecord != null) {
|
||||
@ -572,7 +567,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel,List<StaffRoleDto> staffRoleDtos, Long roleId) {
|
||||
public StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, List<StaffRoleDto> staffRoleDtos, Long roleId) {
|
||||
StaffEntity approvalStaff = null;
|
||||
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
|
||||
for (StaffRole staffRole : staffRoles) {
|
||||
@ -602,10 +597,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
@Override
|
||||
public int getDepartmentLevelIndex(List<Flow> list, int flowIndex) {
|
||||
if (flowIndex > list.size()) {
|
||||
return -1 ;
|
||||
return -1;
|
||||
}
|
||||
List<Flow> flows = new ArrayList<>();
|
||||
for(int i = 0 ;i < flowIndex ;i ++){
|
||||
for (int i = 0; i < flowIndex; i++) {
|
||||
flows.add(list.get(i));
|
||||
}
|
||||
int index = 0;
|
||||
@ -626,8 +621,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
@Override
|
||||
public R commitApproval(ResultRecordReq req, Long userId) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
|
||||
if(req.getStatus() == 2 || req.getStatus() == 3 || req.getStatus() == 5 ){
|
||||
if (resultRecord.getCurrentApprovalStaffId() !=null && !userId.equals(resultRecord.getCurrentApprovalStaffId())) {
|
||||
if (req.getStatus() == 2 || req.getStatus() == 3 || req.getStatus() == 5) {
|
||||
if (resultRecord.getCurrentApprovalStaffId() != null && !userId.equals(resultRecord.getCurrentApprovalStaffId())) {
|
||||
return R.error("请勿重复提交");
|
||||
}
|
||||
}
|
||||
@ -636,17 +631,17 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
int status = 1;
|
||||
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
|
||||
if (req.getStatus() == 2) {
|
||||
r = resultRecordService.approval(req.getRecordResultId(), userId,null,false);
|
||||
r = resultRecordService.approval(req.getRecordResultId(), userId, null, false);
|
||||
} else if (req.getStatus() == 3) { //侍提交
|
||||
resultRecord.setStatus(Constant.STATUS_3);
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
} else if (req.getStatus() == 5) { // 驳回
|
||||
status = 5;
|
||||
r = reject(resultRecord,status);
|
||||
r = reject(resultRecord, status);
|
||||
} else if (req.getStatus() == 7) {
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdType(req.getRecordResultId(), resultRecord.getType());
|
||||
if (flowRecords != null && flowRecords.size() == 2) { // 表示可以撤回
|
||||
r = reject(resultRecord,5);
|
||||
r = reject(resultRecord, 5);
|
||||
} else if (flowRecords != null && flowRecords.size() > 2) {
|
||||
return R.error("你的领导己经审批,不能撤回了");
|
||||
}
|
||||
@ -659,17 +654,17 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
.put("from", mySelf)
|
||||
.put("to", approvalStaff)
|
||||
.put("type", WorkMsgTypeEnum.URGING);
|
||||
}else if (req.getStatus() == 6){
|
||||
} else if (req.getStatus() == 6) {
|
||||
status = 6;
|
||||
// 回滚代码
|
||||
resultRecordService.reject(resultRecord,req.getStatus());
|
||||
resultRecordService.reject(resultRecord, req.getStatus());
|
||||
}
|
||||
resultCommentService.addOrUpdateComment(req, userId, status,lastUsedFlowRecord);
|
||||
if(r != null){//下面推送消息
|
||||
if(r.isSuccess()){
|
||||
StaffEntity mySelf = (StaffEntity)r.get("from");
|
||||
StaffEntity toSelf = (StaffEntity)r.get("to");
|
||||
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
|
||||
resultCommentService.addOrUpdateComment(req, userId, status, lastUsedFlowRecord);
|
||||
if (r != null) {//下面推送消息
|
||||
if (r.isSuccess()) {
|
||||
StaffEntity mySelf = (StaffEntity) r.get("from");
|
||||
StaffEntity toSelf = (StaffEntity) r.get("to");
|
||||
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum) r.get("type");
|
||||
sendWorkMSG(mySelf, toSelf, workMsgTypeEnum, req.getRecordResultId(), 1);
|
||||
return R.ok("成功");
|
||||
}
|
||||
@ -679,7 +674,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public R reject( ResultRecord resultRecord,Integer status){
|
||||
public R reject(ResultRecord resultRecord, Integer status) {
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId());
|
||||
StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
StaffEntity approvalStaff = mySelf;
|
||||
@ -713,7 +708,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
lastUsedFlowRecord.setStatusName(FlowRecordEnum.CONFIRM.getName());
|
||||
flowRecordService.insertFlowRecord(lastUsedFlowRecord);// 新插入一条提交记录
|
||||
|
||||
if(mySelf.getId().longValue() == approvalStaff.getId().longValue()){//同一个人
|
||||
if (mySelf.getId().longValue() == approvalStaff.getId().longValue()) {//同一个人
|
||||
mySelf.setName("你");//用于替换消息中的@符号。无其他任何作用,不保存
|
||||
}
|
||||
return R.ok("成功")
|
||||
@ -725,14 +720,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
public void sendWorkMSG(StaffEntity mySelf, StaffEntity toSelf, WorkMsgTypeEnum workMsgTypeEnum
|
||||
, Long recordResultId, int count){
|
||||
, Long recordResultId, int count) {
|
||||
String url = domain + "/management/dingtalklogin?url=";//免登接口
|
||||
String jump;
|
||||
if(count == 1){//一个提交
|
||||
if (count == 1) {//一个提交
|
||||
log.info("单个提交推送消息");
|
||||
jump = domain + "/management/recorddetail?id=" + recordResultId
|
||||
+ "&recordType=3" ;//跳转接口
|
||||
}else{//批量提交
|
||||
+ "&recordType=3";//跳转接口
|
||||
} else {//批量提交
|
||||
log.info("批量提交推送消息");
|
||||
jump = domain + "/management/result-record-lzresultrecordapp";//跳转接口
|
||||
}
|
||||
@ -749,19 +744,19 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds) {
|
||||
public List<GraphicsStatisticalDto> staffDistribution(String monthTime, List<String> staffIds) {
|
||||
|
||||
return resultRecordMapper.staffDistribution(monthTime,staffIds);
|
||||
return resultRecordMapper.staffDistribution(monthTime, staffIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatistical> countNumByFlowProcess(Long startId,List<Long> evaluationIds,List<String> departmentIds) {
|
||||
return resultRecordMapper.countNumByFlowProcess(startId,evaluationIds,departmentIds);
|
||||
public List<ChartStatistical> countNumByFlowProcess(Long startId, List<Long> evaluationIds, List<String> departmentIds) {
|
||||
return resultRecordMapper.countNumByFlowProcess(startId, evaluationIds, departmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChartStatistical> countNumByScoreLevel(Long startId,List<Long> evaluationIds,List<String> departmentIds) {
|
||||
return resultRecordMapper.countNumByScoreLevel(startId,evaluationIds,departmentIds);
|
||||
public List<ChartStatistical> countNumByScoreLevel(Long startId, List<Long> evaluationIds, List<String> departmentIds) {
|
||||
return resultRecordMapper.countNumByScoreLevel(startId, evaluationIds, departmentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -772,12 +767,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
@Override
|
||||
public R initFlowRecord(Long resultRecordId) {
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(resultRecordId);
|
||||
List<Flow> flows = flowService.selectByFlowId(resultRecord.getEvaluationId(),resultRecord.getStartId());
|
||||
List<Flow> flows = flowService.selectByFlowId(resultRecord.getEvaluationId(), resultRecord.getStartId());
|
||||
List<Long> flowIds = new ArrayList<>();
|
||||
for(Flow flow:flows){
|
||||
for (Flow flow : flows) {
|
||||
flowIds.add(flow.getId());
|
||||
}
|
||||
List<FlowApprovalRole> flowApprovalRoles =flowApprovalRoleService.selectFlowApprovalRoleList(flowIds);
|
||||
List<FlowApprovalRole> flowApprovalRoles = flowApprovalRoleService.selectFlowApprovalRoleList(flowIds);
|
||||
|
||||
return initFlowRecord(resultRecord, flows, flowApprovalRoles);
|
||||
}
|
||||
@ -805,28 +800,28 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
} else if (FlowApprovalRoleTypeEnums.FOUR_SUPPER.getType().equals(flowApprovalRole.getType())) {
|
||||
approvalStaff = getDepartmentStaff(resultRecord.getStaffId(), 5);
|
||||
}
|
||||
if(approvalStaff !=null && StringUtil.isNotBlank(approvalStaff.getName())){
|
||||
insertFlowRecord(flowRecord,approvalStaff,flows,flowApprovalRole,resultRecord,i,null);
|
||||
}else{
|
||||
List<StaffRole> staffRoles= staffRoleService.selectAllStaffRoleByDepartmentLevel(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName(),RoleEnums.CHILD_PM.getName()}));
|
||||
for(StaffRole staffRole:staffRoles){
|
||||
if (approvalStaff != null && StringUtil.isNotBlank(approvalStaff.getName())) {
|
||||
insertFlowRecord(flowRecord, approvalStaff, flows, flowApprovalRole, resultRecord, i, null);
|
||||
} else {
|
||||
List<StaffRole> staffRoles = staffRoleService.selectAllStaffRoleByDepartmentLevel(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName(), RoleEnums.CHILD_PM.getName()}));
|
||||
for (StaffRole staffRole : staffRoles) {
|
||||
approvalStaff = staffService.selectStaffById(staffRole.getStaffId());
|
||||
if(staffRole.getDepartmentId() ==0){ //如果是管理所有部门
|
||||
insertFlowRecord(flowRecord,approvalStaff,flows,flowApprovalRole,resultRecord,i,1);
|
||||
}else{
|
||||
if (staffRole.getDepartmentId() == 0) { //如果是管理所有部门
|
||||
insertFlowRecord(flowRecord, approvalStaff, flows, flowApprovalRole, resultRecord, i, 1);
|
||||
} else {
|
||||
DepartmentsStaffRelateEntity relateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(resultRecord.getStaffId());
|
||||
Map<String, String> map = departmentsService.selectUserAllDepartmentIds(relateEntity.getDepartmentId());
|
||||
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
|
||||
boolean flag = false;
|
||||
for(StaffRoleDepartment staffRoleDepartment: staffRoleDepartments){
|
||||
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
|
||||
String departmentName = map.get(staffRoleDepartment.getDepartmentId());
|
||||
if(StringUtil.isNotBlank(departmentName)){
|
||||
if (StringUtil.isNotBlank(departmentName)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag){ //如果管理员是管理特定部门
|
||||
insertFlowRecord(flowRecord,approvalStaff,flows,flowApprovalRole,resultRecord,i,1);
|
||||
if (flag) { //如果管理员是管理特定部门
|
||||
insertFlowRecord(flowRecord, approvalStaff, flows, flowApprovalRole, resultRecord, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -838,7 +833,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
|
||||
public void insertFlowRecord(FlowRecord flowRecord,StaffEntity approvalStaff,List<Flow> flows,FlowApprovalRole flowApprovalRole ,ResultRecord resultRecord,int i,Integer stepType ){
|
||||
public void insertFlowRecord(FlowRecord flowRecord, StaffEntity approvalStaff, List<Flow> flows, FlowApprovalRole flowApprovalRole, ResultRecord resultRecord, int i, Integer stepType) {
|
||||
flowRecord.setApprovalStaffName(approvalStaff.getName());
|
||||
flowRecord.setApprovalStaffId(approvalStaff.getId());
|
||||
Flow flow = getFlow(flows, flowApprovalRole.getFlowId());
|
||||
@ -855,38 +850,38 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resultRecord.setFlowProcess(flowChart.getFlowProcess());
|
||||
} else {
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.UN_TO_STATUS.getStatus());
|
||||
if(new Integer(4).equals(flowChart.getFlowProcess())){
|
||||
EvaluationStartStaff evaluationStartStaff = evaluationStartStaffService.selectEvaluationStartById(resultRecord.getEvaluationId(),resultRecord.getStartId());
|
||||
if(evaluationStartStaff !=null && new Integer(1).equals(evaluationStartStaff.getScore())){
|
||||
if (new Integer(4).equals(flowChart.getFlowProcess())) {
|
||||
EvaluationStartStaff evaluationStartStaff = evaluationStartStaffService.selectEvaluationStartById(resultRecord.getEvaluationId(), resultRecord.getStartId());
|
||||
if (evaluationStartStaff != null && new Integer(1).equals(evaluationStartStaff.getScore())) {
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.SKIP_STATUS.getStatus());
|
||||
}else{
|
||||
} else {
|
||||
log.info("evaluationStartStaff is null evaluationId :" + resultRecord.getEvaluationId() + ", startId : " + resultRecord.getStartId());
|
||||
}
|
||||
}
|
||||
}
|
||||
flowRecord.setFlowStaffIdRole(staffRole);
|
||||
flowRecord.setFlowIndex(flowApprovalRole.getStepIndex());
|
||||
flowRecord.setType(stepType !=null ? stepType :flowApprovalRole.getStepType()); //步骤类型0:依次,1:或签(同时通知,一人通过或拒绝即可),2会签(同时通知,所有人同意才可)
|
||||
flowRecord.setType(stepType != null ? stepType : flowApprovalRole.getStepType()); //步骤类型0:依次,1:或签(同时通知,一人通过或拒绝即可),2会签(同时通知,所有人同意才可)
|
||||
flowRecordService.insertFlowRecord(flowRecord);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
////1 提交审批,审批通过,2 撤回,3 催办,4 跳过,5 驳回,6 申述,7 流程终止,8 转交
|
||||
public R newApproval(ApprovalDto approvalDto) throws Exception{
|
||||
public R newApproval(ApprovalDto approvalDto) throws Exception {
|
||||
log.info("newApproval args :" + JSON.toJSONString(approvalDto));
|
||||
if(approvalDto.getResultRecordId() == null){
|
||||
if (approvalDto.getResultRecordId() == null) {
|
||||
throw new RRException("resultRecordId 不能为空");
|
||||
}
|
||||
if(approvalDto.getStatus() == null ){
|
||||
if (approvalDto.getStatus() == null) {
|
||||
throw new RRException("status 不能为空");
|
||||
}
|
||||
if(StringUtil.isBlank(approvalDto.getMenuName())){
|
||||
if (StringUtil.isBlank(approvalDto.getMenuName())) {
|
||||
throw new RRException("menuName 不能为空");
|
||||
}
|
||||
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(),2);
|
||||
if(CollectionUtils.isNotEmpty(flowRecords)){
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(), 2);
|
||||
if (CollectionUtils.isNotEmpty(flowRecords)) {
|
||||
FlowRecord preFlowRecord = flowRecords.get(0);
|
||||
// 评论内容
|
||||
FlowChart flowChart = flowService.selectFlowChartByChartId(preFlowRecord.getFlowId());
|
||||
@ -895,13 +890,13 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
switch (approvalDto.getStatus()) {
|
||||
case 1: //1 提交审批,审批通过
|
||||
return newSubmit(approvalDto,null);
|
||||
return newSubmit(approvalDto, null);
|
||||
case 2: //2 撤回
|
||||
return reSubmit(approvalDto);
|
||||
case 3: //3 催办
|
||||
return urge(approvalDto);
|
||||
case 4: //4 跳过
|
||||
if(approvalDto.getFlowRecordId() == null){
|
||||
if (approvalDto.getFlowRecordId() == null) {
|
||||
throw new RRException("currentStaffId 不能为空");
|
||||
}
|
||||
return skip(approvalDto);
|
||||
@ -913,7 +908,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
if (approvalDto.getTransferStaffId() == null) {
|
||||
throw new RRException("transferStaffId 不能为空");
|
||||
}
|
||||
if(approvalDto.getFlowRecordId() == null){
|
||||
if (approvalDto.getFlowRecordId() == null) {
|
||||
throw new RRException("flowRecordId 不能为空");
|
||||
}
|
||||
return transfer(approvalDto);
|
||||
@ -925,20 +920,20 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
private R skip(ApprovalDto approvalDto) {
|
||||
FlowRecord flowRecord = flowRecordService.selectFlowRecordById(approvalDto.getFlowRecordId());
|
||||
if(flowRecord.getStatus().equals(FlowRecordStatusEnums.FINISHED_STATUS.getStatus())
|
||||
|| flowRecord.getStatus().equals(FlowRecordStatusEnums.OTHER_APPROVAL.getStatus())){
|
||||
return R.ok("流程己经走了,无法跳过 " );
|
||||
if (flowRecord.getStatus().equals(FlowRecordStatusEnums.FINISHED_STATUS.getStatus())
|
||||
|| flowRecord.getStatus().equals(FlowRecordStatusEnums.OTHER_APPROVAL.getStatus())) {
|
||||
return R.ok("流程己经走了,无法跳过 ");
|
||||
}
|
||||
|
||||
if(flowRecord.getStatus().equals(FlowRecordStatusEnums.UN_TO_STATUS.getStatus())){ // 如果当前没有审批
|
||||
if (flowRecord.getStatus().equals(FlowRecordStatusEnums.UN_TO_STATUS.getStatus())) { // 如果当前没有审批
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.SKIP_STATUS.getStatus());
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
}else if (flowRecord.getStatus().equals(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus())){ //如果当前正在审批中
|
||||
} else if (flowRecord.getStatus().equals(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus())) { //如果当前正在审批中
|
||||
approvalDto.setLoginUserId(flowRecord.getApprovalStaffId());
|
||||
newSubmit(approvalDto,FlowRecordStatusEnums.SKIP_STATUS.getStatus());
|
||||
newSubmit(approvalDto, FlowRecordStatusEnums.SKIP_STATUS.getStatus());
|
||||
}
|
||||
flowChangeService.saveChange(approvalDto, flowRecord, 0);
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(flowRecord.getRecordId(),flowRecord.getId(), WorkMsgTypeEnum. SKIP.getType());
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(flowRecord.getRecordId(), flowRecord.getId(), WorkMsgTypeEnum.SKIP.getType());
|
||||
return R.ok("恭喜您,跳过成功。");
|
||||
}
|
||||
|
||||
@ -949,14 +944,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
flowRecord.setApprovalStaffId(staffEntity.getId());
|
||||
flowRecord.setApprovalStaffName(staffEntity.getName());
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(flowRecord.getRecordId(),flowRecord.getId(), WorkMsgTypeEnum.TRANSFER.getType());
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(flowRecord.getRecordId(), flowRecord.getId(), WorkMsgTypeEnum.TRANSFER.getType());
|
||||
return R.ok("转交成功");
|
||||
}
|
||||
|
||||
|
||||
private R reSubmit(ApprovalDto approvalDto) {
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(), 1);
|
||||
if(flowRecords!=null && flowRecords.size()>0){
|
||||
if (flowRecords != null && flowRecords.size() > 0) {
|
||||
return R.error("领导己经审批,不能撤回");
|
||||
}
|
||||
return newReject(approvalDto);
|
||||
@ -975,17 +970,17 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
}
|
||||
|
||||
private R newSubmit(ApprovalDto approvalDto,Integer finishedStatus) {
|
||||
private R newSubmit(ApprovalDto approvalDto, Integer finishedStatus) {
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(approvalDto.getResultRecordId());
|
||||
if(approvalDto.getLoginUserId() == null){
|
||||
if (approvalDto.getLoginUserId() == null) {
|
||||
approvalDto.setLoginUserId(resultRecord.getCurrentApprovalStaffId());
|
||||
}
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(),2);
|
||||
if(CollectionUtils.isEmpty(flowRecords)){
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(), 2);
|
||||
if (CollectionUtils.isEmpty(flowRecords)) {
|
||||
log.info("流程己经结束");
|
||||
return R.ok("流程己经结束");
|
||||
}
|
||||
if(finishedStatus == null){
|
||||
if (finishedStatus == null) {
|
||||
finishedStatus = FlowRecordStatusEnums.FINISHED_STATUS.getStatus();
|
||||
}
|
||||
FlowRecord preFlowRecord = flowRecords.get(0);
|
||||
@ -1022,8 +1017,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
flowRecordService.updateFlowRecordById(preFlowRecord);
|
||||
}
|
||||
// 找到当前下一个节点为0的 flowIndex
|
||||
FlowRecord nextFlowRecord = flowRecordService.selectFlowRecordByRecordIdMinIdStatus(approvalDto.getResultRecordId(),preFlowRecord.getId(), 0);
|
||||
if(nextFlowRecord == null){
|
||||
FlowRecord nextFlowRecord = flowRecordService.selectFlowRecordByRecordIdMinIdStatus(approvalDto.getResultRecordId(), preFlowRecord.getId(), 0);
|
||||
if (nextFlowRecord == null) {
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(resultRecord.getId(), WorkMsgTypeEnum.PROCESS.getType()); //流程己经结束调用
|
||||
log.info("流程己经结束2");
|
||||
return R.ok("流程己经结束");
|
||||
@ -1040,7 +1035,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
}
|
||||
resultRecord.setFlowProcess(currentFlowRecord.getFlowProcess());
|
||||
log.info("resultRecordId = "+resultRecord.getId() + ",currentFlowRecordId" + currentFlowRecord.getId() + " , 当前 flowProcess : " + resultRecord.getFlowProcess());
|
||||
log.info("resultRecordId = " + resultRecord.getId() + ",currentFlowRecordId" + currentFlowRecord.getId() + " , 当前 flowProcess : " + resultRecord.getFlowProcess());
|
||||
resultRecord.setFlowStaffIdRole(nextFlowRecords.size() == 1 ? currentFlowRecord.getFlowStaffIdRole() : null);
|
||||
resultRecord.setCurrentApprovalStaffId(nextFlowRecords.size() == 1 ? currentFlowRecord.getApprovalStaffId() : null);
|
||||
resultRecord.setCurrentApprovalStaffName(nextFlowRecords.size() == 1 ? currentFlowRecord.getApprovalStaffName() : null);
|
||||
@ -1050,21 +1045,21 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
private R newReject(ApprovalDto approvalDto) {
|
||||
List<FlowRecord> currentflowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(),FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus());
|
||||
if(currentflowRecords !=null && currentflowRecords.size() > 0 ){
|
||||
List<FlowRecord> currentflowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(approvalDto.getResultRecordId(), FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus());
|
||||
if (currentflowRecords != null && currentflowRecords.size() > 0) {
|
||||
FlowRecord currentFlowRecord = currentflowRecords.get(0);
|
||||
// 更新当前数据
|
||||
// 获取当前审批结点组
|
||||
List<FlowRecord> currentFlowRecords = flowRecordService.selectFlowRecordByRecordIdFlowIndex(approvalDto.getResultRecordId(), currentFlowRecord.getFlowIndex());
|
||||
for(FlowRecord flowRecord : currentFlowRecords){
|
||||
for (FlowRecord flowRecord : currentFlowRecords) {
|
||||
flowRecord.setStatus(FlowRecordStatusEnums.UN_TO_STATUS.getStatus());
|
||||
flowRecordService.updateFlowRecordById(flowRecord);
|
||||
}
|
||||
// 恢复之前数据
|
||||
// 获取之前审批过的结点
|
||||
FlowRecord preFlowRecord = flowRecordService.selectPreFlowRecordByRecordIdMaxIdStatus(approvalDto.getResultRecordId(),
|
||||
currentFlowRecord.getId(),FlowRecordStatusEnums.FINISHED_STATUS.getStatus());
|
||||
if(preFlowRecord != null) {
|
||||
currentFlowRecord.getId(), FlowRecordStatusEnums.FINISHED_STATUS.getStatus());
|
||||
if (preFlowRecord != null) {
|
||||
// 获取之前审批结点组
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdFlowIndex(approvalDto.getResultRecordId(), preFlowRecord.getFlowIndex());
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
@ -1073,9 +1068,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
FlowRecord lastFlowRecord = flowRecords.get(0);
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(approvalDto.getResultRecordId());
|
||||
resultRecord.setCurrentApprovalStaffId(flowRecords.size() == 1 ? lastFlowRecord.getApprovalStaffId():null);
|
||||
resultRecord.setCurrentApprovalStaffName(flowRecords.size() == 1 ?lastFlowRecord.getApprovalStaffName():null);
|
||||
resultRecord.setFlowStaffIdRole(flowRecords.size() == 1 ?lastFlowRecord.getFlowStaffIdRole():null);
|
||||
resultRecord.setCurrentApprovalStaffId(flowRecords.size() == 1 ? lastFlowRecord.getApprovalStaffId() : null);
|
||||
resultRecord.setCurrentApprovalStaffName(flowRecords.size() == 1 ? lastFlowRecord.getApprovalStaffName() : null);
|
||||
resultRecord.setFlowStaffIdRole(flowRecords.size() == 1 ? lastFlowRecord.getFlowStaffIdRole() : null);
|
||||
|
||||
FlowChart flowChart = flowService.selectFlowChartByChartId(lastFlowRecord.getFlowId());
|
||||
resultRecord.setFlowProcess(flowChart.getFlowProcess());
|
||||
@ -1089,7 +1084,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
private R urge(ApprovalDto approvalDto) {
|
||||
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(approvalDto.getResultRecordId());
|
||||
if(!resultRecord.getCurrentApprovalStaffId().equals(approvalDto.getLoginUserId())){
|
||||
if (!resultRecord.getCurrentApprovalStaffId().equals(approvalDto.getLoginUserId())) {
|
||||
log.info("催办" + resultRecord.getCurrentApprovalStaffId());
|
||||
dingtalkBusiness.sendWorkMSGWithAsyn(resultRecord.getId(), WorkMsgTypeEnum.URGING.getType());
|
||||
}
|
||||
@ -1106,7 +1101,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordId(recordDetailDto.getResultRecordId());
|
||||
List<FlowRecordResp> flowRecordList = new ArrayList<>();
|
||||
int flowIndex = -1;
|
||||
Long flowRecordId= 0l;
|
||||
Long flowRecordId = 0l;
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(recordDetailDto.getResultRecordId());
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
if (flowRecord.getFlowIndex().equals(flowIndex)) { //表示有重复数据
|
||||
@ -1119,7 +1114,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
boolean flag2 = false;
|
||||
boolean flag4 = false;
|
||||
List<FlowDetailResp> flowDetailRespList = lastResp.getFlowDetailRespList();
|
||||
mySetFlowDetailRespList(flowDetailRespList, flowRecord,recordDetailDto.getLoginUserId(),resultRecord.getStaffId());
|
||||
mySetFlowDetailRespList(flowDetailRespList, flowRecord, recordDetailDto.getLoginUserId(), resultRecord.getStaffId());
|
||||
for (FlowRecord mul : mulFlowRecord) {
|
||||
if (mul.getStatus().equals(FlowRecordStatusEnums.UN_TO_STATUS.getStatus())) {
|
||||
flag0 = true;
|
||||
@ -1130,28 +1125,28 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
} else if (mul.getStatus().equals(FlowRecordStatusEnums.SKIP_STATUS.getStatus())) {
|
||||
flag4 = true;
|
||||
}
|
||||
if(mul.getApprovalStaffId().equals(recordDetailDto.getLoginUserId())){
|
||||
if (mul.getApprovalStaffId().equals(recordDetailDto.getLoginUserId())) {
|
||||
lastResp.setStaffName(mul.getApprovalStaffName());
|
||||
}
|
||||
}
|
||||
if (stepIndex == 0 || stepIndex == 1) { // 依次
|
||||
if(flag0){
|
||||
if (flag0) {
|
||||
lastResp.setStatus(0);
|
||||
}else if(flag1){
|
||||
} else if (flag1) {
|
||||
lastResp.setStatus(1);
|
||||
}else if(flag2){
|
||||
} else if (flag2) {
|
||||
lastResp.setStatus(1);
|
||||
}else if (flag4){
|
||||
} else if (flag4) {
|
||||
lastResp.setStatus(4);
|
||||
}
|
||||
} else { //所有
|
||||
if(flag0){ //只要有 0 表示当前节点所有的为0
|
||||
if (flag0) { //只要有 0 表示当前节点所有的为0
|
||||
lastResp.setStatus(0);
|
||||
}else if(flag2){ // 只要有 2 表示所有的结点停留在当前
|
||||
} else if (flag2) { // 只要有 2 表示所有的结点停留在当前
|
||||
lastResp.setStatus(1);
|
||||
}else if(flag1){
|
||||
} else if (flag1) {
|
||||
lastResp.setStatus(1); // 当前步骤中只存在1和4 ,那么当前结点肯定通过了
|
||||
}else if (flag4){
|
||||
} else if (flag4) {
|
||||
lastResp.setStatus(4); // 当前步骤中所有的结点都跳过了
|
||||
}
|
||||
}
|
||||
@ -1164,11 +1159,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
resp.setStatus(flowRecord.getStatus() == 2 ? 1 : flowRecord.getStatus());
|
||||
|
||||
List<FlowDetailResp> flowDetailRespList = new ArrayList<>();
|
||||
mySetFlowDetailRespList(flowDetailRespList,flowRecord,recordDetailDto.getLoginUserId(),resultRecord.getStaffId());
|
||||
mySetFlowDetailRespList(flowDetailRespList, flowRecord, recordDetailDto.getLoginUserId(), resultRecord.getStaffId());
|
||||
resp.setFlowDetailRespList(flowDetailRespList);
|
||||
flowRecordList.add(resp);
|
||||
flowIndex = flowRecord.getFlowIndex();
|
||||
}
|
||||
|
||||
boolean flag = true;
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
if (flowRecord.getStatus() == 2) {
|
||||
@ -1176,39 +1172,40 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FlowRecordResp end = new FlowRecordResp();
|
||||
end.setFlowName("结束");
|
||||
end.setStatus(flag ? 1 : 0);
|
||||
flowRecordList.add(end);
|
||||
List<ResultComment> resultCommentList = resultCommentService.selectByRecordId(recordDetailDto.getResultRecordId());
|
||||
for(ResultComment resultComment:resultCommentList){
|
||||
for (ResultComment resultComment : resultCommentList) {
|
||||
StaffEntity staffEntity = staffService.selectStaffById(resultComment.getStaffId());
|
||||
resultComment.setAvatar(staffEntity.getAvatar());
|
||||
}
|
||||
Map<String,Integer> auth = new HashMap<>();
|
||||
auth.put("showResult",1);
|
||||
auth.put("showScore",1);
|
||||
List<FlowRecord> currentResultRecords = flowRecordService.selectFlowRecordByRecordIdStatus(recordDetailDto.getResultRecordId(),2);
|
||||
Map<String, Integer> auth = new HashMap<>();
|
||||
auth.put("showResult", 1);
|
||||
auth.put("showScore", 1);
|
||||
List<FlowRecord> currentResultRecords = flowRecordService.selectFlowRecordByRecordIdStatus(recordDetailDto.getResultRecordId(), 2);
|
||||
log.info("当前用户登陆用户 id :" + recordDetailDto.getLoginUserId());
|
||||
if(currentResultRecords !=null && currentResultRecords.size() > 0 ){
|
||||
if (currentResultRecords != null && currentResultRecords.size() > 0) {
|
||||
FlowRecord currentFlowRecord = currentResultRecords.get(0);
|
||||
int flowProcess = currentFlowRecord.getFlowProcess();
|
||||
if(flowProcess <= 3 ){
|
||||
auth.put("showResult",0);
|
||||
if (flowProcess <= 3) {
|
||||
auth.put("showResult", 0);
|
||||
}
|
||||
if( flowProcess <= 4 ){
|
||||
auth.put("showScore",0);
|
||||
if (flowProcess <= 4) {
|
||||
auth.put("showScore", 0);
|
||||
}
|
||||
FlowRecord currentResultRecord = null;
|
||||
for(FlowRecord flowRecord:currentResultRecords){
|
||||
if(flowRecord.getApprovalStaffId().equals(recordDetailDto.getLoginUserId())){
|
||||
for (FlowRecord flowRecord : currentResultRecords) {
|
||||
if (flowRecord.getApprovalStaffId().equals(recordDetailDto.getLoginUserId())) {
|
||||
currentResultRecord = flowRecord;
|
||||
log.info("当前审批用户 id id :" + currentResultRecord.getApprovalStaffId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(currentResultRecord !=null){
|
||||
if(StringUtil.isNotBlank(currentResultRecord.getFlowStaffIdRole())){
|
||||
if (currentResultRecord != null) {
|
||||
if (StringUtil.isNotBlank(currentResultRecord.getFlowStaffIdRole())) {
|
||||
auth = getAuth(currentResultRecord.getFlowStaffIdRole());
|
||||
flowRecordId = currentResultRecord.getId();
|
||||
}
|
||||
@ -1216,35 +1213,35 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
//如果是绩效管理员有一键催办功能
|
||||
StaffRole staffRole = staffRoleService.selectStaffRolesByStaffIdDepartmentLevelList(recordDetailDto.getLoginUserId(),
|
||||
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(),RoleEnums.MASTER_PM.getName()}));
|
||||
if(staffRole !=null){
|
||||
auth.put("toFast",1);
|
||||
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(), RoleEnums.MASTER_PM.getName()}));
|
||||
if (staffRole != null) {
|
||||
auth.put("toFast", 1);
|
||||
}
|
||||
auth.put("tiaozhuang",0);
|
||||
auth.put("tiaozhuang", 0);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("flowRecordList", flowRecordList);
|
||||
map.put("resultCommentList", resultCommentList);
|
||||
map.put("auth",auth);
|
||||
map.put("flowRecordId",flowRecordId);
|
||||
map.put("auth", auth);
|
||||
map.put("flowRecordId", flowRecordId);
|
||||
return R.ok().put("data", map);
|
||||
}
|
||||
|
||||
public Map<String,Integer> getAuth(String flowStaffIdRole){
|
||||
Map<String,Integer> auth = Maps.newHashMap();
|
||||
Map<String,Object> map = JSONObject.parseObject(flowStaffIdRole,Map.class);
|
||||
public Map<String, Integer> getAuth(String flowStaffIdRole) {
|
||||
Map<String, Integer> auth = Maps.newHashMap();
|
||||
Map<String, Object> map = JSONObject.parseObject(flowStaffIdRole, Map.class);
|
||||
List<Long> roleIds = null;
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
if(entry.getValue() !=null ){
|
||||
roleIds = JSON.parseArray(entry.getValue().toString(),Long.class);
|
||||
if (entry.getValue() != null) {
|
||||
roleIds = JSON.parseArray(entry.getValue().toString(), Long.class);
|
||||
}
|
||||
}
|
||||
if(roleIds !=null && roleIds.size() > 0){
|
||||
if (roleIds != null && roleIds.size() > 0) {
|
||||
auth = recordAuthService.selectAuthByRoleIds(roleIds);
|
||||
}
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void mySetFlowDetailRespList(List<FlowDetailResp> flowDetailRespList ,FlowRecord flowRecord,Long loginUserId,Long recordStaffId){
|
||||
public void mySetFlowDetailRespList(List<FlowDetailResp> flowDetailRespList, FlowRecord flowRecord, Long loginUserId, Long recordStaffId) {
|
||||
FlowDetailResp flowDetailResp = new FlowDetailResp();
|
||||
flowDetailResp.setCurrentStaffId(flowRecord.getApprovalStaffId());
|
||||
flowDetailResp.setStaffName(flowRecord.getApprovalStaffName());
|
||||
@ -1262,17 +1259,17 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
flowDetailResp.setAvatar(staffEntity.getAvatar());
|
||||
DepartmentsEntity departmentsEntity = departmentsDao.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
flowDetailResp.setDepartName(departmentsEntity.getDepartmentName());
|
||||
if(new Integer(0).equals(flowRecord.getStatus()) || new Integer(2).equals(flowRecord.getStatus())){
|
||||
int position = getRole(loginUserId,departmentsStaffRelateEntity) ;
|
||||
if (new Integer(0).equals(flowRecord.getStatus()) || new Integer(2).equals(flowRecord.getStatus())) {
|
||||
int position = getRole(loginUserId, departmentsStaffRelateEntity);
|
||||
/**
|
||||
1:绩效管理员的权限只在里面
|
||||
2:流程节点的授权只展示在外面(里面不展示)
|
||||
3:既是绩效管理员和审批节点人员,里面展示,外面根据节点授权情况来确定是否展示
|
||||
*/
|
||||
if(position == 1){ //如果是绩效管理员
|
||||
initTiaoZhuangZhuangJiao(flowDetailResp,1,1);
|
||||
if(flowRecord.getFlowProcess() == 0 ){//目标制定有转交,但是没有跳过
|
||||
initTiaoZhuangZhuangJiao(flowDetailResp,0,1);
|
||||
if (position == 1) { //如果是绩效管理员
|
||||
initTiaoZhuangZhuangJiao(flowDetailResp, 1, 1);
|
||||
if (flowRecord.getFlowProcess() == 0) {//目标制定有转交,但是没有跳过
|
||||
initTiaoZhuangZhuangJiao(flowDetailResp, 0, 1);
|
||||
}
|
||||
}
|
||||
}//如果流程节点己经走了,直接返回不可跳转,不可转交
|
||||
@ -1280,15 +1277,15 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
|
||||
public int getRole(Long loginUserId ,DepartmentsStaffRelateEntity departmentsStaffRelateEntity){
|
||||
int position = 0 ;
|
||||
public int getRole(Long loginUserId, DepartmentsStaffRelateEntity departmentsStaffRelateEntity) {
|
||||
int position = 0;
|
||||
StaffRole staffRole = staffRoleService.selectStaffRolesByStaffIdDepartmentLevelList(loginUserId,
|
||||
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(),RoleEnums.MASTER_PM.getName()}));
|
||||
if(staffRole !=null ){
|
||||
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(), RoleEnums.MASTER_PM.getName()}));
|
||||
if (staffRole != null) {
|
||||
boolean flag = false;
|
||||
if(staffRole.getDepartmentId() == 0 ){
|
||||
flag = true ;
|
||||
}else {
|
||||
if (staffRole.getDepartmentId() == 0) {
|
||||
flag = true;
|
||||
} else {
|
||||
Map<String, String> map = departmentsService.selectUserAllDepartmentIds(departmentsStaffRelateEntity.getDepartmentId());
|
||||
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
|
||||
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
|
||||
@ -1299,7 +1296,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
if (flag) {
|
||||
log.info("当前 loginUserId : " + loginUserId + ",是管理员");
|
||||
position = 1;//表示当前是绩效管理员
|
||||
}
|
||||
@ -1307,24 +1304,24 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return position;
|
||||
}
|
||||
|
||||
public void initTiaoZhuangZhuangJiao(FlowDetailResp flowDetailResp,int tiaoZhuang,int transfer){
|
||||
public void initTiaoZhuangZhuangJiao(FlowDetailResp flowDetailResp, int tiaoZhuang, int transfer) {
|
||||
flowDetailResp.setTiaozhuang(tiaoZhuang);
|
||||
flowDetailResp.setTransfer(transfer);
|
||||
}
|
||||
|
||||
public StaffEntity getDepartmentStaff(Long staffId, int level) {
|
||||
DepartManagers departManagers = staffService.findLeader( staffId, level);
|
||||
DepartManagers departManagers = staffService.findLeader(staffId, level);
|
||||
List<StaffEntity> staffEntities = departManagers.getManagers();
|
||||
if(CollectionUtils.isNotEmpty(staffEntities)){
|
||||
if (CollectionUtils.isNotEmpty(staffEntities)) {
|
||||
return staffEntities.get(0);
|
||||
}
|
||||
return new StaffEntity();
|
||||
|
||||
}
|
||||
|
||||
public Flow getFlow(List<Flow> flows,Long flowId){
|
||||
for(Flow flow : flows){
|
||||
if(flow.getId().equals(flowId)){
|
||||
public Flow getFlow(List<Flow> flows, Long flowId) {
|
||||
for (Flow flow : flows) {
|
||||
if (flow.getId().equals(flowId)) {
|
||||
return flow;
|
||||
}
|
||||
}
|
||||
@ -1332,22 +1329,45 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultRecord selectLastResultRecordByUserId(Long userId){
|
||||
public ResultRecord selectLastResultRecordByUserId(Long userId) {
|
||||
return resultRecordMapper.selectLastResultRecordByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultRecord selectResultRecordByStaffIdAndStartId(Long userId, Long startId){
|
||||
public ResultRecord selectResultRecordByStaffIdAndStartId(Long userId, Long startId) {
|
||||
return resultRecordMapper.selectResultRecordByStaffIdAndStartId(userId, startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultRecord> selectResultRecordsByStartId(Long startId){
|
||||
public List<ResultRecord> selectResultRecordsByStartId(Long startId) {
|
||||
return resultRecordMapper.selectResultRecordsByStartId(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectResultRecordIdsByStartId(Long startId){
|
||||
public List<Long> selectResultRecordIdsByStartId(Long startId) {
|
||||
return resultRecordMapper.selectIdsByStartId(startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getResetData(RecordDetailDto recordDetailDto) {
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordId(recordDetailDto.getResultRecordId());
|
||||
int flowIndex = 0;
|
||||
List<ResetDataResp> resetDataResps = new ArrayList<>();
|
||||
for (FlowRecord flowRecord : flowRecords) {
|
||||
if (flowRecord.getFlowIndex().equals(flowIndex - 1)) { //表示有重复数据
|
||||
ResetDataResp resetDataResp = resetDataResps.get(flowIndex - 1);
|
||||
resetDataResp.getStaffNames().add(flowRecord.getApprovalStaffName());
|
||||
continue;
|
||||
}
|
||||
ResetDataResp resetDataResp = new ResetDataResp();
|
||||
resetDataResp.setFlowName(flowRecord.getFlowName());
|
||||
resetDataResp.setId(flowRecord.getId());
|
||||
List<String> staffNames = new ArrayList<>();
|
||||
staffNames.add(flowRecord.getApprovalStaffName());
|
||||
resetDataResp.setStaffNames(staffNames);
|
||||
resetDataResps.add(resetDataResp);
|
||||
flowIndex ++ ;
|
||||
}
|
||||
return R.ok().put("data",resetDataResps);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user