提交修改

This commit is contained in:
quyixiao 2020-08-24 12:27:29 +08:00
parent c31d19f269
commit f30364d5e7
10 changed files with 94 additions and 54 deletions

View File

@ -77,6 +77,11 @@ public class ResultRecordController extends AbstractController {
@RequiresPermissions("user:lzresultrecord:list") @RequiresPermissions("user:lzresultrecord:list")
public R list(ResultRecordReq req) { public R list(ResultRecordReq req) {
SysUserEntity user = getUser(); SysUserEntity user = getUser();
if(req.getIsSelf() == 1){
req.setStaffId(user.getUserId());
}
PageUtils page = lzResultRecordService.queryPage(req, user); PageUtils page = lzResultRecordService.queryPage(req, user);
List<DepartmentsDto> departmentList1 = departmentsService.selectByParentDepartmentId("0"); List<DepartmentsDto> departmentList1 = departmentsService.selectByParentDepartmentId("0");
return R.ok().put("page", page) return R.ok().put("page", page)
@ -181,13 +186,19 @@ public class ResultRecordController extends AbstractController {
if (CollectionUtils.isNotEmpty(comments)) { if (CollectionUtils.isNotEmpty(comments)) {
ResultDetailResp header = new ResultDetailResp(); ResultDetailResp header = new ResultDetailResp();
header.setCheckRange("领导"); header.setCheckRange("领导");
header.setTarget("意见"); header.setTarget("状态");
header.setKeyResult("意见");
list.add(header); list.add(header);
commentNum = comments.size(); commentNum = comments.size();
for (ResultComment resultComment : comments) { for (ResultComment resultComment : comments) {
ResultDetailResp comment = new ResultDetailResp(); ResultDetailResp comment = new ResultDetailResp();
comment.setCheckRange(resultComment.getStaffName()); comment.setCheckRange(resultComment.getStaffName());
comment.setTarget(resultComment.getComment()); String target = "审批通过";
if (resultComment.getStatus() == 5) {
target = "驳回";
}
comment.setTarget(target);
comment.setKeyResult(resultComment.getComment());
list.add(comment); list.add(comment);
} }
} }
@ -211,28 +222,34 @@ public class ResultRecordController extends AbstractController {
@RequestMapping("/commitApproval") @RequestMapping("/commitApproval")
public R commitApproval(ResultRecordReq req) { public R commitApproval(ResultRecordReq req) {
resultCommentService.addOrUpdateComment(req, getUserId()); R r = null;
int status = 1;
if (req.getStatus() == 2) { if (req.getStatus() == 2) {
return resultRecordService.approval(req.getRecordResultId(), getUserId()); r = resultRecordService.approval(req.getRecordResultId(), getUserId());
} else if (req.getStatus() == 3) { //侍提交 } else if (req.getStatus() == 3) { //侍提交
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId()); ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
resultRecord.setStatus(Constant.STATUS_3); resultRecord.setStatus(Constant.STATUS_3);
resultRecordService.updateResultRecordById(resultRecord); resultRecordService.updateResultRecordById(resultRecord);
} else if (req.getStatus() == 4) { // 驳回 } else if (req.getStatus() == 5) { // 驳回
status = 5;
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(req.getRecordResultId()); List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(req.getRecordResultId());
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId()); ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
if (flowRecords.size() > 0 && req.getRollbackFlowId() > 0) { if (flowRecords.size() > 0 && req.getRollbackFlowId() > 0) {
for (FlowRecord flowRecord : flowRecords) { for (FlowRecord flowRecord : flowRecords) {
if (flowRecord.getId().equals(req.getRollbackFlowId())) { if (flowRecord.getId().equals(req.getRollbackFlowId())) {
resultRecord.setFlowStaffIdRole(flowRecord.getFlowStaffIdRole()); resultRecord.setFlowStaffIdRole(flowRecord.getFlowStaffIdRole());
} else { resultRecord.setStatus(req.getStatus());
resultRecord.setStatus(1);
}
resultRecordService.updateResultRecordById(resultRecord); resultRecordService.updateResultRecordById(resultRecord);
} }
if (flowRecord.getId() > req.getRollbackFlowId()) {
flowRecord.setStatus(1);
flowRecordService.updateFlowRecordById(flowRecord);
} }
} }
return R.ok("成功"); }
}
resultCommentService.addOrUpdateComment(req, getUserId(), status);
return r != null ? r : R.ok("成功");
} }
/** /**
@ -263,9 +280,15 @@ public class ResultRecordController extends AbstractController {
if (resultComment == null || !getUserId().equals(resultComment.getStaffId())) { if (resultComment == null || !getUserId().equals(resultComment.getStaffId())) {
resultComment = new ResultComment(); resultComment = new ResultComment();
} }
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(recordId); List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(recordId, 0l);
if (flowRecords != null && flowRecords.size() > 0) {
FlowRecord flowRecord = flowRecords.get(flowRecords.size()-1);
if(flowRecord.getApprovalStaffId().equals(getUserId())){
flowRecords.remove(flowRecord);
}
}
return R.ok().put("resultComment", resultComment) return R.ok().put("resultComment", resultComment)
.put("list",flowRecords); .put("list", flowRecords);
} }
/** /**

View File

@ -3,6 +3,7 @@ package com.lz.modules.flow.model;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.lz.common.utils.Constant; import com.lz.common.utils.Constant;
import com.lz.common.utils.NumberUtil;
import lombok.Data; import lombok.Data;
import java.util.HashMap; import java.util.HashMap;
@ -22,26 +23,15 @@ public class TypeRoleDto {
} }
public static Long getRoleId(String flowInfo, Integer type) { public static Long getRoleId(String flowInfo, Integer type) {
Map<String, Long> a = JSONObject.parseObject(JSON.toJSONBytes(flowInfo), Map.class); Map<String, Long> a = JSONObject.parseObject(flowInfo, Map.class);
return a.get(Constant.TYPE + type); return NumberUtil.objToLongDefault(a.get(Constant.TYPE + type),0l);
} }
public static void main(String[] args) { public static void main(String[] args) {
Map<String,Long> map = new HashMap(); Map<String,Long > a = JSONObject.parseObject("{\"type2\":3,\"type1\":3}",Map.class);
map.put("type1",3l);
map.put("type2",3l);
System.out.println(JSON.toJSONString(map));
Map<String,Long > a = JSONObject.parseObject(JSON.toJSONBytes(map),Map.class);
System.out.println(a.get("type1")); System.out.println(a.get("type1"));
} }
} }

View File

@ -32,6 +32,8 @@ public class ResultComment implements java.io.Serializable {
private String comment; private String comment;
//评论用户名称 //评论用户名称
private String staffName; private String staffName;
//状态
private Integer status;
/** /**
* *
* @return * @return
@ -152,6 +154,21 @@ public class ResultComment implements java.io.Serializable {
this.staffName = staffName; this.staffName = staffName;
} }
/**
* 状态
* @return
*/
public Integer getStatus() {
return status;
}
/**
* 状态
* @param status
*/
public void setStatus(Integer status) {
this.status = status;
}
@Override @Override
public String toString() { public String toString() {
return "ResultComment{" + return "ResultComment{" +
@ -163,6 +180,7 @@ public class ResultComment implements java.io.Serializable {
",staffId=" + staffId + ",staffId=" + staffId +
",comment=" + comment + ",comment=" + comment +
",staffName=" + staffName + ",staffName=" + staffName +
",status=" + status +
"}"; "}";
} }
} }

View File

@ -38,5 +38,5 @@ public interface ResultCommentService extends IService<ResultComment> {
ResultComment selectLastComment(Long recordId); ResultComment selectLastComment(Long recordId);
void addOrUpdateComment(ResultRecordReq req,Long userId); void addOrUpdateComment(ResultRecordReq req,Long userId,int status );
} }

View File

@ -80,7 +80,7 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
} }
@Override @Override
public void addOrUpdateComment(ResultRecordReq req, Long staffId) { public void addOrUpdateComment(ResultRecordReq req, Long staffId, int status) {
ResultComment comment = resultCommentService.selectResultCommentById(req.getResultCommitId()); ResultComment comment = resultCommentService.selectResultCommentById(req.getResultCommitId());
//如果评论不为空 //如果评论不为空
String resultComment = StringUtil.decodeBase64(req.getResultComment()); String resultComment = StringUtil.decodeBase64(req.getResultComment());
@ -93,9 +93,11 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
comment.setRecordId(req.getRecordResultId()); comment.setRecordId(req.getRecordResultId());
comment.setComment(resultComment); comment.setComment(resultComment);
comment.setStaffName(mySelf.getName()); comment.setStaffName(mySelf.getName());
comment.setStatus(status);
resultCommentService.insertResultComment(comment); resultCommentService.insertResultComment(comment);
} else { } else {
comment.setComment(resultComment); comment.setComment(resultComment);
comment.setStatus(status);
resultCommentService.updateResultCommentById(comment); resultCommentService.updateResultCommentById(comment);
} }
} else { } else {

View File

@ -154,6 +154,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
} }
} }
params.setDepartmentIds(departmentIds); params.setDepartmentIds(departmentIds);
String departmentLevel = Constant.ME; String departmentLevel = Constant.ME;
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId()); FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId());
if (flowDepartment != null) { if (flowDepartment != null) {
@ -168,6 +169,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit()).doSelect( PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit()).doSelect(
page -> resultRecordMapper.selectByConditionByLeader(page, params) page -> resultRecordMapper.selectByConditionByLeader(page, params)
); );
List<ResultRecord> resultRecords = pageUtils.getList(); List<ResultRecord> resultRecords = pageUtils.getList();
if(CollectionUtils.isNotEmpty(resultRecords)){ if(CollectionUtils.isNotEmpty(resultRecords)){
List<ResultRecordResp> list = new ArrayList<>(); List<ResultRecordResp> list = new ArrayList<>();
@ -360,7 +362,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
staffRoleDtos.add(staffRoleDto); staffRoleDtos.add(staffRoleDto);
} }
} }
flowRecord.setFlowName(mySelf.getName() + "-" + flows.get(flowIndex - 1).getOptDesc()); flowRecord.setFlowName((approvalStaff != null ? approvalStaff.getName() + "-" : "") + flows.get(flowIndex - 1).getOptDesc());
flowRecord.setApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null); flowRecord.setApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null);
flowRecord.setApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null); flowRecord.setApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
String staffRoles = JSON.toJSONString(staffRoleDtos); String staffRoles = JSON.toJSONString(staffRoleDtos);

View File

@ -12,12 +12,13 @@
<result column="staff_id" property="staffId"/> <result column="staff_id" property="staffId"/>
<result column="comment" property="comment"/> <result column="comment" property="comment"/>
<result column="staff_name" property="staffName"/> <result column="staff_name" property="staffName"/>
<result column="status" property="status"/>
</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, record_id AS recordId, staff_id AS staffId, comment AS comment, staff_name AS staffName id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, record_id AS recordId, staff_id AS staffId, comment AS comment, staff_name AS staffName, status AS status
</sql> </sql>
@ -34,6 +35,7 @@
<if test="staffId != null">staff_id, </if> <if test="staffId != null">staff_id, </if>
<if test="comment != null">comment, </if> <if test="comment != null">comment, </if>
<if test="staffName != null">staff_name, </if> <if test="staffName != null">staff_name, </if>
<if test="status != null">status, </if>
is_delete, is_delete,
gmt_create, gmt_create,
gmt_modified gmt_modified
@ -42,6 +44,7 @@
<if test="staffId != null">#{ staffId}, </if> <if test="staffId != null">#{ staffId}, </if>
<if test="comment != null">#{ comment}, </if> <if test="comment != null">#{ comment}, </if>
<if test="staffName != null">#{ staffName}, </if> <if test="staffName != null">#{ staffName}, </if>
<if test="status != null">#{ status}, </if>
0, 0,
now(), now(),
now() now()
@ -58,7 +61,8 @@
<if test="recordId != null">record_id = #{recordId},</if> <if test="recordId != null">record_id = #{recordId},</if>
<if test="staffId != null">staff_id = #{staffId},</if> <if test="staffId != null">staff_id = #{staffId},</if>
<if test="comment != null">comment = #{comment},</if> <if test="comment != null">comment = #{comment},</if>
<if test="staffName != null">staff_name = #{staffName}</if> <if test="staffName != null">staff_name = #{staffName},</if>
<if test="status != null">status = #{status}</if>
</trim> </trim>
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
@ -74,7 +78,8 @@
record_id = #{recordId}, record_id = #{recordId},
staff_id = #{staffId}, staff_id = #{staffId},
comment = #{comment}, comment = #{comment},
staff_name = #{staffName} staff_name = #{staffName},
status = #{status}
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
</update> </update>
@ -85,6 +90,7 @@
</update> </update>
<select id="selectByRecordId" resultType="com.lz.modules.sys.entity.app.ResultComment"> <select id="selectByRecordId" resultType="com.lz.modules.sys.entity.app.ResultComment">
select * from lz_result_comment where record_id=#{recordId} and is_delete = 0 select * from lz_result_comment where record_id=#{recordId} and is_delete = 0
</select> </select>

View File

@ -173,7 +173,7 @@
select * from ( select * from (
select rd.*,department_level,approval_staff_id,approval_staff_name,flow_name,flow_id,flow_index 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 from lz_flow_record fr left join lz_result_record rd on fr.record_id= rd.id
where department_level = #{req.departmentLevel} where department_level = #{req.departmentLevel} and fr.status = 0
<if test="req.monthBeginDate != null and req.monthBeginDate != '' "> <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') AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.monthBeginDate}, '%Y-%m-%d %H:%i:%S')
</if> </if>

View File

@ -127,8 +127,10 @@
<select id="selectFlowRecordByRecordId" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectFlowRecordByRecordId" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} select * from lz_flow_record where is_delete = 0 and record_id = #{recordId}
</select> </select>
<select id="selectFlowRecordByResultRecordIdFlowId" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectFlowRecordByResultRecordIdFlowId" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and id > #{rollbackFlowId} select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status = 0
</select> </select>

View File

@ -61,10 +61,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_staff_role"));
List<TablesBean> list2 = new ArrayList<TablesBean>(); List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments(); Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();