提交修改

This commit is contained in:
quyixiao 2020-09-21 20:59:39 +08:00
parent ca746a8804
commit 546b964a1e
15 changed files with 140 additions and 54 deletions

View File

@ -1,6 +1,6 @@
package com.lz.common.emun; package com.lz.common.emun;
import javax.security.auth.message.AuthStatus;
/** /**
* 绩效通知相关type * 绩效通知相关type
@ -13,11 +13,17 @@ public enum WorkMsgTypeEnum {
//绩效通过领导审核的通知这一步提交到HR提交的type //绩效通过领导审核的通知这一步提交到HR提交的type
LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"), LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"),
//绩效通过人事老板审核的最终审核通知 //绩效通过人事老板审核的最终审核通知
PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),; PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),
URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"),
;
int type; int type;
String title; String title;
String btnText; String btnText;
String content; String content;
WorkMsgTypeEnum(int type, String title, String btnText, String content){ WorkMsgTypeEnum(int type, String title, String btnText, String content){
this.type = type; this.type = type;
this.title = title; this.title = title;
@ -25,6 +31,8 @@ public enum WorkMsgTypeEnum {
this.content = content; this.content = content;
} }
public static WorkMsgTypeEnum findRoleTypeByCode(int code) { public static WorkMsgTypeEnum findRoleTypeByCode(int code) {
for (WorkMsgTypeEnum workMsgTypeEnum : WorkMsgTypeEnum.values()) { for (WorkMsgTypeEnum workMsgTypeEnum : WorkMsgTypeEnum.values()) {
if (workMsgTypeEnum.getType() == code) { if (workMsgTypeEnum.getType() == code) {

View File

@ -169,4 +169,5 @@ public class Constant {
public static final String OSS_BUCCKET = "my-wallet"; public static final String OSS_BUCCKET = "my-wallet";
public static final Integer TWO = 2; public static final Integer TWO = 2;
public static final Integer ONE = 1;
} }

View File

@ -662,4 +662,16 @@ public class StringUtil extends StringUtils {
} }
return randomNum.toString(); return randomNum.toString();
} }
public static boolean in(Integer status, Integer ... is) {
if(is == null || is.length <= 0){
return false;
}
for(Integer i:is){
if(i.equals(status)){
return true;
}
}
return false;
}
} }

View File

@ -40,6 +40,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.io.PrintWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -266,6 +267,10 @@ public class ResultRecordController extends AbstractController {
} }
String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId()); String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId());
int fileCount = recordFileService.selectRecordFileCountByRecordId(resultRecord.getId()); int fileCount = recordFileService.selectRecordFileCountByRecordId(resultRecord.getId());
if(resultRecord.getStaffId().equals(getUserId()) && StringUtil.in(resultRecord.getStatus() ,1,2,3,5)){
auth.setSubmited(1);
}
return R.ok() return R.ok()
.put("staffName", staffEntity.getName()) .put("staffName", staffEntity.getName())
.put("department1", departmentDto.getDepartment1()) .put("department1", departmentDto.getDepartment1())

View File

@ -44,4 +44,6 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectFlowRecordByFlowId(@Param("recordId") Long recordId); List<FlowRecord> selectFlowRecordByFlowId(@Param("recordId") Long recordId);
FlowRecord selectLastFlowNoStatusRecordByRecordId(@Param("recordId") Long recordId); FlowRecord selectLastFlowNoStatusRecordByRecordId(@Param("recordId") Long recordId);
List<FlowRecord> selectFlowRecordByResultRecordIdType(@Param("resultRecordId") Long resultRecordId, @Param("type") Integer type);
} }

View File

@ -46,6 +46,8 @@ public class FlowRecord implements java.io.Serializable {
private String flowStaffIdRole; private String flowStaffIdRole;
//状态名称 //状态名称
private String statusName; private String statusName;
//类型 ,1 表示提交目标2 表示提交结果
private Integer type;
/** /**
* *
* @return * @return
@ -271,6 +273,14 @@ public class FlowRecord implements java.io.Serializable {
this.statusName = statusName; this.statusName = statusName;
} }
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
@Override @Override
public String toString() { public String toString() {
return "FlowRecord{" + return "FlowRecord{" +

View File

@ -28,4 +28,7 @@ public class Auth {
private int keyResult37; private int keyResult37;
private int editScore; private int editScore;
private int deleteDetail; private int deleteDetail;
private int dissatisfied;
private int submited;//是否己经提交
} }

View File

@ -46,4 +46,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
List<FlowRecord> selectFlowRecordByFlowId(Long recordId); List<FlowRecord> selectFlowRecordByFlowId(Long recordId);
FlowRecord selectLastFlowNoStatusRecordByRecordId(Long resultRecordId); FlowRecord selectLastFlowNoStatusRecordByRecordId(Long resultRecordId);
List<FlowRecord> selectFlowRecordByResultRecordIdType(Long recordResultId, Integer type);
} }

View File

@ -102,6 +102,7 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
flowRecord.setRecordStaffId(resultRecord.getStaffId()); flowRecord.setRecordStaffId(resultRecord.getStaffId());
flowRecord.setRecordId(resultRecord.getId()); flowRecord.setRecordId(resultRecord.getId());
flowRecord.setStatus(0); flowRecord.setStatus(0);
flowRecord.setType(resultRecord.getType());
flowRecord.setDepartmentLevel(Constant.ME); flowRecord.setDepartmentLevel(Constant.ME);
flowRecord.setStatusName(FlowRecordEnum.START.getName()); flowRecord.setStatusName(FlowRecordEnum.START.getName());
flowRecordMapper.insertFlowRecord(flowRecord); flowRecordMapper.insertFlowRecord(flowRecord);
@ -122,5 +123,10 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectLastFlowNoStatusRecordByRecordId(resultRecordId); return flowRecordMapper.selectLastFlowNoStatusRecordByRecordId(resultRecordId);
} }
@Override
public List<FlowRecord> selectFlowRecordByResultRecordIdType(Long resultRecordId, Integer type) {
return flowRecordMapper.selectFlowRecordByResultRecordIdType(resultRecordId,type);
}
} }

View File

@ -2,6 +2,7 @@ package com.lz.modules.sys.service.app;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.app.req.ResultRecordReq; import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.sys.entity.app.ResultComment; import com.lz.modules.sys.entity.app.ResultComment;
import java.util.List; import java.util.List;
@ -38,5 +39,5 @@ public interface ResultCommentService extends IService<ResultComment> {
ResultComment selectLastComment(Long recordId); ResultComment selectLastComment(Long recordId);
void addOrUpdateComment(ResultRecordReq req,Long userId,int status ); void addOrUpdateComment(ResultRecordReq req, Long userId, int status , FlowRecord lastUsedFlowRecord);
} }

View File

@ -91,4 +91,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments); Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);
ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status); ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status);
R reject( ResultRecord resultRecord,ResultRecordReq req, Long userId);
} }

View File

@ -84,7 +84,7 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
} }
@Override @Override
public void addOrUpdateComment(ResultRecordReq req, Long staffId, int status) { public void addOrUpdateComment(ResultRecordReq req, Long staffId, int status,FlowRecord lastUsedFlowRecord) {
ResultComment comment = resultCommentService.selectResultCommentById(req.getResultCommitId()); ResultComment comment = resultCommentService.selectResultCommentById(req.getResultCommitId());
//如果评论不为空 //如果评论不为空
String resultComment = StringUtil.decodeBase64(req.getResultComment()); String resultComment = StringUtil.decodeBase64(req.getResultComment());
@ -92,7 +92,7 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
if (StringUtil.isNotBlank(content)) { //如果不为空, if (StringUtil.isNotBlank(content)) { //如果不为空,
if (comment == null) { if (comment == null) {
StaffEntity mySelf = staffService.selectStaffById(staffId); StaffEntity mySelf = staffService.selectStaffById(staffId);
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
comment = new ResultComment(); comment = new ResultComment();
comment.setStaffId(staffId); comment.setStaffId(staffId);
comment.setRecordId(req.getRecordResultId()); comment.setRecordId(req.getRecordResultId());

View File

@ -346,6 +346,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
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);
//新增record //新增record
flowRecordService.insertFlowRecord(flowRecord); flowRecordService.insertFlowRecord(flowRecord);
} }
@ -475,6 +476,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
flowRecord.setFlowStaffIdRole(staffRoles); flowRecord.setFlowStaffIdRole(staffRoles);
flowRecord.setStatusName(FlowRecordEnum.APPROVALING.getName()); flowRecord.setStatusName(FlowRecordEnum.APPROVALING.getName());
flowRecord.setType(resultRecord.getType());
FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(resultRecordId); FlowRecord lastFlowRecordNoStatus = flowRecordService.selectLastFlowNoStatusRecordByRecordId(resultRecordId);
// 如果上一步是开始则不进行修改如果上一步是确认中改成提交如果上一点是审批中将上一步改成通过 // 如果上一步是开始则不进行修改如果上一步是确认中改成提交如果上一点是审批中将上一步改成通过
@ -556,11 +558,14 @@ 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 (resultRecord.getCurrentApprovalStaffId() !=null && !userId.equals(resultRecord.getCurrentApprovalStaffId())) { if (resultRecord.getCurrentApprovalStaffId() !=null && !userId.equals(resultRecord.getCurrentApprovalStaffId())) {
return R.error("请勿重复提交"); return R.error("请勿重复提交");
} }
}
R r = null; R r = null;
int status = 1; int status = 1;
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
if (req.getStatus() == 2) { if (req.getStatus() == 2) {
r = resultRecordService.approval(req.getRecordResultId(), userId); r = resultRecordService.approval(req.getRecordResultId(), userId);
} else if (req.getStatus() == 3) { //侍提交 } else if (req.getStatus() == 3) { //侍提交
@ -568,6 +573,40 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
resultRecordService.updateResultRecordById(resultRecord); resultRecordService.updateResultRecordById(resultRecord);
} else if (req.getStatus() == 5) { // 驳回 } else if (req.getStatus() == 5) { // 驳回
status = 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);
}else if(flowRecords!=null && flowRecords.size() > 2){
return R.error("你的领导己经审批,不能撤回了");
}
}else if(req.getStatus() == 8 ){
Long staffId = resultRecord.getStaffId();
Long approvalStaffId = resultRecord.getCurrentApprovalStaffId();
StaffEntity mySelf = staffService.selectStaffById(staffId);
StaffEntity approvalStaff = staffService.selectStaffById(approvalStaffId);
r = R.ok("成功")
.put("from", mySelf)
.put("to", approvalStaff)
.put("type", WorkMsgTypeEnum.URGING);
}
resultCommentService.addOrUpdateComment(req, userId, status,lastUsedFlowRecord);
if(r != null){//下面推送消息
if(r.isSuccess()){
StaffEntity mySelf = (StaffEntity)r.get("from");
StaffEntity toSelf = (StaffEntity)r.get("to");
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
sendWorkMSG(mySelf, toSelf, workMsgTypeEnum, req.getRecordResultId(), 1);
return R.ok("成功");
}
return r;
}
return R.ok("成功");
}
@Override
public R reject( ResultRecord resultRecord,ResultRecordReq req, Long userId){
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(req.getRecordResultId()); List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(req.getRecordResultId());
StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId()); StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId());
StaffEntity approvalStaff = mySelf; StaffEntity approvalStaff = mySelf;
@ -595,8 +634,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
// 可能会被删除 // 可能会被删除
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId()); FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
lastUsedFlowRecord.setId(null); lastUsedFlowRecord.setId(null);
lastUsedFlowRecord.setGmtCreate(new Date());
lastUsedFlowRecord.setGmtModified(new Date());
lastUsedFlowRecord.setStatus(1); lastUsedFlowRecord.setStatus(1);
lastUsedFlowRecord.setStatusName(FlowRecordEnum.CONFIRM.getName()); lastUsedFlowRecord.setStatusName(FlowRecordEnum.CONFIRM.getName());
flowRecordService.insertFlowRecord(lastUsedFlowRecord);// 新插入一条提交记录 flowRecordService.insertFlowRecord(lastUsedFlowRecord);// 新插入一条提交记录
@ -604,24 +641,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
if(mySelf.getId().longValue() == approvalStaff.getId().longValue()){//同一个人 if(mySelf.getId().longValue() == approvalStaff.getId().longValue()){//同一个人
mySelf.setName("");//用于替换消息中的@符号无其他任何作用不保存 mySelf.setName("");//用于替换消息中的@符号无其他任何作用不保存
} }
r = 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);
} }
} return R.error("驳回失败");
resultCommentService.addOrUpdateComment(req, userId, status);
if(r != null){//下面推送消息
if(r.isSuccess()){
StaffEntity mySelf = (StaffEntity)r.get("from");
StaffEntity toSelf = (StaffEntity)r.get("to");
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
sendWorkMSG(mySelf, toSelf, workMsgTypeEnum, req.getRecordResultId(), 1);
return R.ok("成功");
}
return r;
}
return R.ok("成功");
} }
public void sendWorkMSG(StaffEntity mySelf, StaffEntity toSelf, WorkMsgTypeEnum workMsgTypeEnum public void sendWorkMSG(StaffEntity mySelf, StaffEntity toSelf, WorkMsgTypeEnum workMsgTypeEnum

View File

@ -19,12 +19,13 @@
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="flow_staff_id_role" property="flowStaffIdRole"/> <result column="flow_staff_id_role" property="flowStaffIdRole"/>
<result column="status_name" property="statusName"/> <result column="status_name" property="statusName"/>
<result column="type" property="type"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_level AS departmentLevel, record_id AS recordId, approval_staff_id AS approvalStaffId, approval_staff_name AS approvalStaffName, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, status AS status, flow_staff_id_role AS flowStaffIdRole, status_name AS statusName id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_level AS departmentLevel, record_id AS recordId, approval_staff_id AS approvalStaffId, approval_staff_name AS approvalStaffName, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, status AS status, flow_staff_id_role AS flowStaffIdRole, status_name AS statusName, type AS type
</sql> </sql>
@ -48,6 +49,7 @@
<if test="status != null">status, </if> <if test="status != null">status, </if>
<if test="flowStaffIdRole != null">flow_staff_id_role, </if> <if test="flowStaffIdRole != null">flow_staff_id_role, </if>
<if test="statusName != null">status_name, </if> <if test="statusName != null">status_name, </if>
<if test="type != null">type, </if>
is_delete, is_delete,
gmt_create, gmt_create,
gmt_modified gmt_modified
@ -63,6 +65,7 @@
<if test="status != null">#{ status}, </if> <if test="status != null">#{ status}, </if>
<if test="flowStaffIdRole != null">#{ flowStaffIdRole}, </if> <if test="flowStaffIdRole != null">#{ flowStaffIdRole}, </if>
<if test="statusName != null">#{ statusName}, </if> <if test="statusName != null">#{ statusName}, </if>
<if test="type != null">#{ type}, </if>
0, 0,
now(), now(),
now() now()
@ -86,7 +89,8 @@
<if test="flowIndex != null">flow_index = #{flowIndex},</if> <if test="flowIndex != null">flow_index = #{flowIndex},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="flowStaffIdRole != null">flow_staff_id_role = #{flowStaffIdRole},</if> <if test="flowStaffIdRole != null">flow_staff_id_role = #{flowStaffIdRole},</if>
<if test="statusName != null">status_name = #{statusName}</if> <if test="statusName != null">status_name = #{statusName},</if>
<if test="type != null">type = #{type}</if>
</trim> </trim>
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
@ -109,7 +113,8 @@
flow_index = #{flowIndex}, flow_index = #{flowIndex},
status = #{status}, status = #{status},
flow_staff_id_role = #{flowStaffIdRole}, flow_staff_id_role = #{flowStaffIdRole},
status_name = #{statusName} status_name = #{statusName},
type = #{type}
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
</update> </update>
@ -122,8 +127,6 @@
<select id="selectLastFlowRecordByRecordId" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectLastFlowRecordByRecordId" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status = 0 order by id desc limit 1 select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status = 0 order by id desc limit 1
</select> </select>
@ -151,5 +154,11 @@
</select> </select>
<select id="selectFlowRecordByResultRecordIdType" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{resultRecordId} and type = #{type} and status = 0
</select>
</mapper> </mapper>

View File

@ -63,7 +63,7 @@ public class MysqlMain {
} }
List<TablesBean> list = new ArrayList<TablesBean>(); List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_result_comment")); list.add(new TablesBean("lz_flow_record"));
List<TablesBean> list2 = new ArrayList<TablesBean>(); List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments(); Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();