提交修改

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")
public R list(ResultRecordReq req) {
SysUserEntity user = getUser();
if(req.getIsSelf() == 1){
req.setStaffId(user.getUserId());
}
PageUtils page = lzResultRecordService.queryPage(req, user);
List<DepartmentsDto> departmentList1 = departmentsService.selectByParentDepartmentId("0");
return R.ok().put("page", page)
@ -181,13 +186,19 @@ public class ResultRecordController extends AbstractController {
if (CollectionUtils.isNotEmpty(comments)) {
ResultDetailResp header = new ResultDetailResp();
header.setCheckRange("领导");
header.setTarget("意见");
header.setTarget("状态");
header.setKeyResult("意见");
list.add(header);
commentNum = comments.size();
for (ResultComment resultComment : comments) {
ResultDetailResp comment = new ResultDetailResp();
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);
}
}
@ -211,28 +222,34 @@ public class ResultRecordController extends AbstractController {
@RequestMapping("/commitApproval")
public R commitApproval(ResultRecordReq req) {
resultCommentService.addOrUpdateComment(req, getUserId());
R r = null;
int status = 1;
if (req.getStatus() == 2) {
return resultRecordService.approval(req.getRecordResultId(), getUserId());
r = resultRecordService.approval(req.getRecordResultId(), getUserId());
} else if (req.getStatus() == 3) { //侍提交
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
resultRecord.setStatus(Constant.STATUS_3);
resultRecordService.updateResultRecordById(resultRecord);
} else if (req.getStatus() == 4) { // 驳回
} else if (req.getStatus() == 5) { // 驳回
status = 5;
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(req.getRecordResultId());
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
if (flowRecords.size() > 0 && req.getRollbackFlowId() > 0) {
for (FlowRecord flowRecord : flowRecords) {
if (flowRecord.getId().equals(req.getRollbackFlowId())) {
resultRecord.setFlowStaffIdRole(flowRecord.getFlowStaffIdRole());
} else {
resultRecord.setStatus(1);
resultRecord.setStatus(req.getStatus());
resultRecordService.updateResultRecordById(resultRecord);
}
if (flowRecord.getId() > req.getRollbackFlowId()) {
flowRecord.setStatus(1);
flowRecordService.updateFlowRecordById(flowRecord);
}
resultRecordService.updateResultRecordById(resultRecord);
}
}
}
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())) {
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)
.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.JSONObject;
import com.lz.common.utils.Constant;
import com.lz.common.utils.NumberUtil;
import lombok.Data;
import java.util.HashMap;
@ -22,26 +23,15 @@ public class TypeRoleDto {
}
public static Long getRoleId(String flowInfo, Integer type) {
Map<String, Long> a = JSONObject.parseObject(JSON.toJSONBytes(flowInfo), Map.class);
return a.get(Constant.TYPE + type);
Map<String, Long> a = JSONObject.parseObject(flowInfo, Map.class);
return NumberUtil.objToLongDefault(a.get(Constant.TYPE + type),0l);
}
public static void main(String[] args) {
Map<String,Long> map = new HashMap();
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);
Map<String,Long > a = JSONObject.parseObject("{\"type2\":3,\"type1\":3}",Map.class);
System.out.println(a.get("type1"));
}
}

View File

@ -32,15 +32,17 @@ public class ResultComment implements java.io.Serializable {
private String comment;
//评论用户名称
private String staffName;
//状态
private Integer status;
/**
*
*
* @return
*/
public Long getId() {
return id;
}
/**
*
*
* @param id
*/
public void setId(Long id) {
@ -48,14 +50,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 是否删除状态1删除0有效
* 是否删除状态1删除0有效
* @return
*/
public Integer getIsDelete() {
return isDelete;
}
/**
* 是否删除状态1删除0有效
* 是否删除状态1删除0有效
* @param isDelete
*/
public void setIsDelete(Integer isDelete) {
@ -63,14 +65,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 创建时间
* 创建时间
* @return
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 创建时间
* 创建时间
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
@ -78,14 +80,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 最后修改时间
* 最后修改时间
* @return
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 最后修改时间
* 最后修改时间
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
@ -93,14 +95,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 记录id
* 记录id
* @return
*/
public Long getRecordId() {
return recordId;
}
/**
* 记录id
* 记录id
* @param recordId
*/
public void setRecordId(Long recordId) {
@ -108,14 +110,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 评论用户id
* 评论用户id
* @return
*/
public Long getStaffId() {
return staffId;
}
/**
* 评论用户id
* 评论用户id
* @param staffId
*/
public void setStaffId(Long staffId) {
@ -123,14 +125,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 评论内容
* 评论内容
* @return
*/
public String getComment() {
return comment;
}
/**
* 评论内容
* 评论内容
* @param comment
*/
public void setComment(String comment) {
@ -138,20 +140,35 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 评论用户名称
* 评论用户名称
* @return
*/
public String getStaffName() {
return staffName;
}
/**
* 评论用户名称
* 评论用户名称
* @param staffName
*/
public void setStaffName(String staffName) {
this.staffName = staffName;
}
/**
* 状态
* @return
*/
public Integer getStatus() {
return status;
}
/**
* 状态
* @param status
*/
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "ResultComment{" +
@ -163,6 +180,7 @@ public class ResultComment implements java.io.Serializable {
",staffId=" + staffId +
",comment=" + comment +
",staffName=" + staffName +
",status=" + status +
"}";
}
}

View File

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

View File

@ -154,6 +154,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
}
params.setDepartmentIds(departmentIds);
String departmentLevel = Constant.ME;
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId());
if (flowDepartment != null) {
@ -165,9 +166,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
}
params.setDepartmentLevel(departmentLevel);
PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit()).doSelect(
PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit()).doSelect(
page -> resultRecordMapper.selectByConditionByLeader(page, params)
);
List<ResultRecord> resultRecords = pageUtils.getList();
if(CollectionUtils.isNotEmpty(resultRecords)){
List<ResultRecordResp> list = new ArrayList<>();
@ -360,7 +362,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
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.setApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
String staffRoles = JSON.toJSONString(staffRoleDtos);

View File

@ -12,12 +12,13 @@
<result column="staff_id" property="staffId"/>
<result column="comment" property="comment"/>
<result column="staff_name" property="staffName"/>
<result column="status" property="status"/>
</resultMap>
<!-- 通用查询结果列 -->
<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>
@ -34,6 +35,7 @@
<if test="staffId != null">staff_id, </if>
<if test="comment != null">comment, </if>
<if test="staffName != null">staff_name, </if>
<if test="status != null">status, </if>
is_delete,
gmt_create,
gmt_modified
@ -42,6 +44,7 @@
<if test="staffId != null">#{ staffId}, </if>
<if test="comment != null">#{ comment}, </if>
<if test="staffName != null">#{ staffName}, </if>
<if test="status != null">#{ status}, </if>
0,
now(),
now()
@ -58,7 +61,8 @@
<if test="recordId != null">record_id = #{recordId},</if>
<if test="staffId != null">staff_id = #{staffId},</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>
,gmt_modified = now()
where id = #{id}
@ -74,7 +78,8 @@
record_id = #{recordId},
staff_id = #{staffId},
comment = #{comment},
staff_name = #{staffName}
staff_name = #{staffName},
status = #{status}
,gmt_modified = now()
where id = #{id}
</update>
@ -85,6 +90,7 @@
</update>
<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>

View File

@ -173,7 +173,7 @@
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}
where department_level = #{req.departmentLevel} and fr.status = 0
<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')
</if>

View File

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

View File

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