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