diff --git a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java index f0c82d48..0ae139aa 100644 --- a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java +++ b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java @@ -15,6 +15,7 @@ public enum WorkMsgTypeEnum { //绩效通过人事,老板审核的最终审核通知 PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"), URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"), + END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"), ; int type; String title; diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index bbc7ccfb..5058cc95 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -40,7 +40,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.io.PrintWriter; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; @@ -133,7 +132,6 @@ public class ResultRecordController extends AbstractController { } } } - R r = lzResultRecordService.queryPage(req, user); r .put("departmentList1", departmentList1) .put("departmentList2", departmentList2) @@ -359,7 +357,7 @@ public class ResultRecordController extends AbstractController { @RequestMapping("/recordIdsSubmit") public R recordIdsSubmit(String recordIds,Integer batchOpt) { if (StringUtil.isBlank(recordIds)) { - return R.error("请选择提交"); + return R.error("请勾选需要批量操作业绩!"); } List records = new ArrayList<>(); String ids[] = recordIds.split(","); @@ -370,29 +368,69 @@ public class ResultRecordController extends AbstractController { } } } - if (records == null) { - return R.error("请选择状态为待提交的记录"); - } R r = null; - if(batchOpt == 1){ - List resultRecords = resultRecordService.selectResultRecordByIds(records); + List resultRecords = resultRecordService.selectResultRecordByIds(records); + if(batchOpt == 1){ //提交审批 for (ResultRecord resultRecord : resultRecords) { - if (!resultRecord.getStatus().equals(3)) { - return R.error("您的提交记录中有状态不为侍提交的,请重新选择。"); + if (!StringUtil.in(resultRecord.getStatus(),1,2,3,5)) { + return R.error("您的提交记录中有状态不正确,请重新选择"); } } for (ResultRecord resultRecord : resultRecords) { - r = resultRecordService.approval(resultRecord.getId(), getUserId(),null); + r = resultRecordService.approval(resultRecord.getId(), resultRecord.getCurrentApprovalStaffId(),null,false); if (!r.isSuccess()) { return r; } } - }else if(batchOpt ==2 ){ - - }else if (batchOpt == 3 ){ - - }else if (batchOpt == 4 ){ - + } else if (batchOpt == 2) { //终止流程 + for (ResultRecord resultRecord : resultRecords) { + if (!StringUtil.in(resultRecord.getStatus(),1,2,3,5,6)) { + return R.error("您的提交记录中有状态不正确,请重新选择"); + } + } + for (ResultRecord resultRecord : resultRecords) { + r = resultRecordService.approval(resultRecord.getId(), resultRecord.getCurrentApprovalStaffId(), 7, true); + if (!r.isSuccess()) { + return r; + } + } + } else if (batchOpt == 3 || batchOpt == 4 ) { // 3 申述无效,直接驳回 ,4 领导重新打分 + for (ResultRecord resultRecord : resultRecords) { + if (!StringUtil.in(resultRecord.getStatus(),6)) { + return R.error("您的提交记录中有状态不正确,请重新选择"); + } + resultRecordService.reject(resultRecord); + } + if(batchOpt == 3 ){ + for (ResultRecord resultRecord : resultRecords) { + r = resultRecordService.reject(resultRecord); + if (!r.isSuccess()) { + return r; + } + } + } else { + for (ResultRecord resultRecord : resultRecords) { + List list = flowRecordService.selectFlowRecordByResultRecordIdType(resultRecord.getId(), 2); + for (int i = list.size() - 1; i >= 0; i--) { + FlowRecord flowRecord = list.get(i); + Long roleId = recordAuthService.getRoleIdByStaffRoleInfo(flowRecord.getFlowStaffIdRole(), flowRecord.getApprovalStaffId()); + List listAuth = recordAuthService.selectAuthInfo(roleId); + Auth auth = recordAuthService.getAuth(listAuth); + if (auth.getEditScore() > 0) {//表示是评分 + resultRecord.setFlowStaffIdRole(flowRecord.getFlowStaffIdRole()); + resultRecord.setCurrentApprovalStaffId(flowRecord.getApprovalStaffId()); + resultRecord.setCurrentApprovalStaffName(flowRecord.getApprovalStaffName()); + resultRecord.setStatus(1); + // 直接还原权限 + resultRecordService.updateResultRecordById(resultRecord); + break; + } else { + flowRecord.setStatus(1);//如果不是领导打分的话,直接删除掉 + flowRecordService.updateFlowRecordById(flowRecord); + } + } + } + } } if (r != null && r.isSuccess()) {//批量提交 StaffEntity mySelf = (StaffEntity) r.get("from"); diff --git a/src/main/java/com/lz/modules/flow/service/RecordAuthService.java b/src/main/java/com/lz/modules/flow/service/RecordAuthService.java index d25b64f4..7898bced 100644 --- a/src/main/java/com/lz/modules/flow/service/RecordAuthService.java +++ b/src/main/java/com/lz/modules/flow/service/RecordAuthService.java @@ -43,4 +43,6 @@ public interface RecordAuthService extends IService { String selectByStaffId(Long staffId); List selectAll(); + + Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java index e9c6b390..6e9e7d11 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java @@ -103,6 +103,21 @@ public class RecordAuthServiceImpl extends ServiceImpl list = JSONObject.parseArray(flowStaffIdRole, StaffRoleDto.class); + if (CollectionUtils.isNotEmpty(list)) { + for(StaffRoleDto staffRoleDto:list){ + if(staffRoleDto.getStaffId().equals(approvalStaffId)){ + return staffRoleDto.getRoleId(); + } + } + } + } + return 0l; + } + public Auth getAuth(List auths) { Map map = new HashMap<>(); diff --git a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java index 9d949b52..f623fd50 100644 --- a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java +++ b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java @@ -49,7 +49,7 @@ public interface ResultRecordMapper extends BaseMapper { List selectByConditionByLeader(@Param("page") IPage page, @Param("req") ResultRecordReq params); - void updateFlowStaffIdRoleToNull(@Param("id") Long id); + void updateFlowStaffIdRoleToNull(@Param("id") Long id, @Param("status") Integer status); List selectResultRecordByIds(@Param("recordIds") List recordIds); diff --git a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java index acc4c94c..d1e966dd 100644 --- a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java +++ b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java @@ -28,7 +28,7 @@ public class ResultRecord implements java.io.Serializable { private Date gmtModified; //月份 private Date monthTime; - //0.新建,1 提交审批中,2 拒绝, 3 侍提交 ,4 审批通过,5 驳回 + //0.新建,1 提交审批中,2 拒绝, 3 侍提交 ,4 审批通过,5 驳回,6申述,7 流程终止 private Integer status; //最后得分 private BigDecimal lastScore; diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java index c48a39b5..d9d41e0f 100644 --- a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java +++ b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java @@ -51,9 +51,9 @@ public interface ResultRecordService extends IService { ResultRecord selectResultRecordByStaffId(Long userId); - void updateFlowStaffIdRoleToNull(Long id); + void updateFlowStaffIdRoleToNull(Long id,Integer status); - R approval(Long resultRecordId, Long userId,Integer status); + R approval(Long resultRecordId, Long userId,Integer status,boolean flagEnd); List selectResultRecordByIds(List recordIds); @@ -92,5 +92,5 @@ public interface ResultRecordService extends IService { ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status); - R reject( ResultRecord resultRecord,ResultRecordReq req, Long userId); + R reject( ResultRecord resultRecord); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index d9c6f442..078545ca 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -187,9 +187,6 @@ public class ResultRecordServiceImpl extends ServiceImpl resultRecordMapper.selectByConditionByLeader(page, params) ); @@ -272,8 +276,8 @@ public class ResultRecordServiceImpl extends ServiceImpl staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole()); List listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(userId)); Auth auth = recordAuthService.getAuth(listAuth); @@ -398,13 +403,12 @@ public class ResultRecordServiceImpl extends ServiceImpl> flowInfo = getFlowInfo(resultRecord.getStaffId(), resultRecord.getType()); Long flowId = flowInfo.getFirst(); @@ -429,17 +433,23 @@ public class ResultRecordServiceImpl extends ServiceImpl= approvalList.size()) { //表示流程己经结束 + if (index < 0 || index >= approvalList.size() || flagEnd) { //表示流程己经结束 lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过"); lastFlowRecord.setStatusName(FlowRecordEnum.END.getName()); flowRecordService.updateCoverFlowRecordById(lastFlowRecord); - resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限 - return R.ok("流程审批结束") - .put("from", staff) - .put("to", staff) - .put("type", WorkMsgTypeEnum.PASS); + resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId(), status != null ? status : 4);// 更新状态 + if (flagEnd) { + return R.ok("流程终止") + .put("from", staff) + .put("to", staff) + .put("type", WorkMsgTypeEnum.END); + } else { + return R.ok("流程审批结束") + .put("from", staff) + .put("to", staff) + .put("type", WorkMsgTypeEnum.PASS); + } } - FlowRecord flowRecord = new FlowRecord(); flowRecord.setRecordId(resultRecordId); flowRecord.setRecordStaffId(resultRecord.getStaffId()); @@ -569,17 +579,17 @@ public class ResultRecordServiceImpl extends ServiceImpl flowRecords = flowRecordService.selectFlowRecordByResultRecordIdType(req.getRecordResultId(),resultRecord.getType()); - if(flowRecords!=null && flowRecords.size() == 2){ // 表示可以撤回 - r = reject(resultRecord, req, userId); + r = reject(resultRecord); + } else if (req.getStatus() == 7) { + List flowRecords = flowRecordService.selectFlowRecordByResultRecordIdType(req.getRecordResultId(), resultRecord.getType()); + if (flowRecords != null && flowRecords.size() == 2) { // 表示可以撤回 + r = reject(resultRecord); } else if (flowRecords != null && flowRecords.size() > 2) { return R.error("你的领导己经审批,不能撤回了"); } @@ -594,7 +604,7 @@ public class ResultRecordServiceImpl extends ServiceImpl flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(req.getRecordResultId()); + public R reject( ResultRecord resultRecord){ + List flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId()); StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId()); StaffEntity approvalStaff = mySelf; if (flowRecords.size() >= 2) { FlowRecord secondFlowRecord = flowRecords.get(flowRecords.size() - 2); resultRecord.setFlowStaffIdRole(secondFlowRecord.getFlowStaffIdRole()); - resultRecord.setStatus(req.getStatus()); + resultRecord.setStatus(5); //更新驳回状态为5 List list = JSONObject.parseArray(resultRecord.getFlowStaffIdRole(), StaffRoleDto.class); if (CollectionUtils.isNotEmpty(list)) { StaffRoleDto staffRoleDto = list.get(0); @@ -627,17 +637,18 @@ public class ResultRecordServiceImpl extends ServiceImpl + and department_level = #{req.departmentLevel} + + AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') = ]]> DATE_FORMAT(#{req.monthBeginDate}, '%Y-%m-%d %H:%i:%S') @@ -199,9 +203,11 @@ AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') DATE_FORMAT(#{req.monthEndDate}, '%Y-%m-%d %H:%i:%S') + and rd.status = #{req.status} + AND rd.remark LIKE CONCAT('%',#{req.remark},'%') @@ -225,7 +231,7 @@ and rd.staff_id = #{req.staffId} - + and rd.current_approval_staff_id = #{req.approvalStaffId} order by fr.id desc ) @@ -243,7 +249,7 @@ - update lz_result_record set flow_staff_id_role = '[]',status = 4,current_approval_staff_id = null ,current_approval_staff_name = null where id = #{id} + update lz_result_record set flow_staff_id_role = '[]',status = #{status},current_approval_staff_id = null ,current_approval_staff_name = null where id = #{id}