提交修改
This commit is contained in:
parent
c4ca52bcf3
commit
b031dba1ee
@ -15,6 +15,7 @@ public enum WorkMsgTypeEnum {
|
||||
//绩效通过人事,老板审核的最终审核通知
|
||||
PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),
|
||||
URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"),
|
||||
END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"),
|
||||
;
|
||||
int type;
|
||||
String title;
|
||||
|
||||
@ -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<Long> 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<ResultRecord> resultRecords = resultRecordService.selectResultRecordByIds(records);
|
||||
List<ResultRecord> 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<FlowRecord> 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<RecordAuth> 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");
|
||||
|
||||
@ -43,4 +43,6 @@ public interface RecordAuthService extends IService<RecordAuth> {
|
||||
String selectByStaffId(Long staffId);
|
||||
|
||||
List<RecordAuth> selectAll();
|
||||
|
||||
Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId);
|
||||
}
|
||||
@ -103,6 +103,21 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
|
||||
return staffEntityMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId) {
|
||||
if (StringUtil.isNotBlank(flowStaffIdRole)) {
|
||||
List<StaffRoleDto> 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<RecordAuth> auths) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
|
||||
@ -49,7 +49,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecordDto> 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<ResultRecord> selectResultRecordByIds(@Param("recordIds") List<Long> recordIds);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -51,9 +51,9 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
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<ResultRecord> selectResultRecordByIds(List<Long> recordIds);
|
||||
|
||||
@ -92,5 +92,5 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status);
|
||||
|
||||
R reject( ResultRecord resultRecord,ResultRecordReq req, Long userId);
|
||||
R reject( ResultRecord resultRecord);
|
||||
}
|
||||
@ -187,9 +187,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
params.setStatusList(listx);
|
||||
}
|
||||
}
|
||||
if("1,2,5".equals(params.getStatusStr()) || "3".equals(params.getStatusStr())){
|
||||
params.setApprovalStaffId(user.getUserId());
|
||||
}
|
||||
|
||||
params.setDepartmentIds(departmentIds);
|
||||
String departmentLevel = Constant.ME;
|
||||
@ -205,6 +202,13 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
}
|
||||
params.setDepartmentLevel(departmentLevel);
|
||||
|
||||
if ("1,2,3,4,5,6,7".equals(params.getStatusStr()) && "HR".equals(departmentLevel)) { //如果是查看全部,并且用户角色是HR 的话,可以推动一切
|
||||
params.setDepartmentLevel(null);
|
||||
}
|
||||
if ("1,2,5".equals(params.getStatusStr()) || "3".equals(params.getStatusStr())) {
|
||||
params.setApprovalStaffId(user.getUserId());
|
||||
}
|
||||
PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit()).doSelect(
|
||||
page -> resultRecordMapper.selectByConditionByLeader(page, params)
|
||||
);
|
||||
@ -272,8 +276,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFlowStaffIdRoleToNull(Long id) {
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id);
|
||||
public void updateFlowStaffIdRoleToNull(Long id,Integer status) {
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id,status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -383,6 +387,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
if (sum < 0.7) {
|
||||
return R.error("recordId为[" + recordId + "]绩效权重之和必需等于0.7。");
|
||||
}
|
||||
|
||||
Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
|
||||
List<RecordAuth> listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(userId));
|
||||
Auth auth = recordAuthService.getAuth(listAuth);
|
||||
@ -398,13 +403,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public R approval(Long resultRecordId, Long userId,Integer status) {
|
||||
public R approval(Long resultRecordId, Long userId,Integer status,boolean flagEnd) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
R r = resultRecordService.checkApproval(resultRecord,userId);
|
||||
if (!r.isSuccess()) {
|
||||
return r;
|
||||
}
|
||||
|
||||
StaffEntity mySelf = staffService.selectStaffById(userId);
|
||||
TwoTuple<Long, List<FlowDepartment>> flowInfo = getFlowInfo(resultRecord.getStaffId(), resultRecord.getType());
|
||||
Long flowId = flowInfo.getFirst();
|
||||
@ -429,17 +433,23 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
StaffEntity staff = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
|
||||
int index = getDepartmentLevelIndex(flows, flowIndex);
|
||||
if (index < 0 || index >= 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<ResultRecordMapper, Res
|
||||
int status = 1;
|
||||
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
|
||||
if (req.getStatus() == 2) {
|
||||
r = resultRecordService.approval(req.getRecordResultId(), userId,null);
|
||||
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,req,userId);
|
||||
}else if (req.getStatus() == 7){
|
||||
List<FlowRecord> 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<FlowRecord> 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<ResultRecordMapper, Res
|
||||
.put("type", WorkMsgTypeEnum.URGING);
|
||||
}else if (req.getStatus() == 6){
|
||||
// 向上级申述
|
||||
resultRecordService.approval(req.getRecordResultId(), userId,req.getStatus());
|
||||
resultRecordService.approval(req.getRecordResultId(), userId,req.getStatus(),false);
|
||||
}
|
||||
resultCommentService.addOrUpdateComment(req, userId, status,lastUsedFlowRecord);
|
||||
if(r != null){//下面推送消息
|
||||
@ -611,14 +621,14 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
}
|
||||
|
||||
@Override
|
||||
public R reject( ResultRecord resultRecord,ResultRecordReq req, Long userId){
|
||||
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(req.getRecordResultId());
|
||||
public R reject( ResultRecord resultRecord){
|
||||
List<FlowRecord> 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<StaffRoleDto> 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<ResultRecordMapper, Res
|
||||
resultRecord.setCurrentApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
|
||||
}
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
|
||||
FlowRecord lastFlowRecord = flowRecords.get(flowRecords.size() - 1);
|
||||
lastFlowRecord.setStatus(1);
|
||||
flowRecordService.updateFlowRecordById(lastFlowRecord);
|
||||
|
||||
FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(req.getRecordResultId());
|
||||
FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(resultRecord.getId());
|
||||
lastFlowRecordNoStatus.setStatusName(FlowRecordEnum.REJECT.getName());
|
||||
lastFlowRecordNoStatus.setGmtCreate(new Date()); //更新驳回时间
|
||||
flowRecordService.updateFlowRecordById(lastFlowRecordNoStatus);
|
||||
|
||||
// 可能会被删除
|
||||
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
|
||||
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(resultRecord.getId());
|
||||
lastUsedFlowRecord.setId(null);
|
||||
lastUsedFlowRecord.setStatus(1);
|
||||
lastUsedFlowRecord.setStatusName(FlowRecordEnum.CONFIRM.getName());
|
||||
|
||||
@ -190,7 +190,11 @@
|
||||
select * from (
|
||||
select rd.*,department_level,approval_staff_id,approval_staff_name,flow_name,flow_id,flow_index
|
||||
from lz_flow_record fr left join lz_result_record rd on fr.record_id= rd.id
|
||||
where department_level = #{req.departmentLevel} and fr.status = 0 and rd.is_delete = 0 and fr.is_delete = 0
|
||||
where fr.status = 0 and rd.is_delete = 0 and fr.is_delete = 0
|
||||
<if test="req.departmentLevel != null and req.departmentLevel != '' ">
|
||||
and department_level = #{req.departmentLevel}
|
||||
</if>
|
||||
|
||||
<if test="req.monthBeginDate != null and req.monthBeginDate != '' ">
|
||||
AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> 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') <![CDATA[ <= ]]> DATE_FORMAT(#{req.monthEndDate},
|
||||
'%Y-%m-%d %H:%i:%S')
|
||||
</if>
|
||||
|
||||
<if test="req.status != null">
|
||||
and rd.status = #{req.status}
|
||||
</if>
|
||||
|
||||
<if test="req.remark != null and req.remark !='' ">
|
||||
AND rd.remark LIKE CONCAT('%',#{req.remark},'%')
|
||||
</if>
|
||||
@ -225,7 +231,7 @@
|
||||
and rd.staff_id = #{req.staffId}
|
||||
</if>
|
||||
|
||||
<if test="req.approvalStaffId !=null and req.approvalStaffId !=''" >
|
||||
<if test="req.approvalStaffId !=null and req.approvalStaffId !='' " >
|
||||
and rd.current_approval_staff_id = #{req.approvalStaffId}
|
||||
</if>
|
||||
order by fr.id desc )
|
||||
@ -243,7 +249,7 @@
|
||||
</select>
|
||||
|
||||
<update id="updateFlowStaffIdRoleToNull">
|
||||
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}
|
||||
</update>
|
||||
|
||||
<select id="selectResultRecordByIds" resultType="com.lz.modules.sys.entity.app.ResultRecord">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user