提交修改

This commit is contained in:
quyixiao 2020-09-21 18:51:14 +08:00
parent 8f32cab62e
commit ca746a8804
10 changed files with 82 additions and 31 deletions

View File

@ -317,9 +317,11 @@ public class ResultRecordController extends AbstractController {
@RequestMapping("/getResultComment/{recordId}")
public R getResultComment(@PathVariable("recordId") Long recordId) {
ResultComment resultComment = resultCommentService.selectLastComment(recordId);
if (resultComment == null || !getUserId().equals(resultComment.getStaffId())) {
FlowRecord flowRecordLast = flowRecordService.selectLastFlowRecordByRecordId(recordId);
if (resultComment ==null || !resultComment.getFlowRecordId().equals(flowRecordLast.getId())) {
resultComment = new ResultComment();
}
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(recordId);
if (flowRecords != null && flowRecords.size() > 0) {
FlowRecord flowRecord = flowRecords.get(flowRecords.size()-1);

View File

@ -60,6 +60,5 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<ChartDto> departmentDistribution(@Param("monthTime") String monthTime);
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
}

View File

@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表
* </p>*业绩评论表
* @author quyixiao
* @since 2020-08-21
* @since 2020-09-21
*/
@Data
@ -34,15 +34,17 @@ public class ResultComment implements java.io.Serializable {
private String staffName;
//状态
private Integer status;
//流程id
private Long flowRecordId;
/**
*
*
* @return
*/
public Long getId() {
return id;
}
/**
*
*
* @param id
*/
public void setId(Long id) {
@ -50,14 +52,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) {
@ -65,14 +67,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 创建时间
* 创建时间
* @return
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 创建时间
* 创建时间
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
@ -80,14 +82,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 最后修改时间
* 最后修改时间
* @return
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 最后修改时间
* 最后修改时间
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
@ -95,14 +97,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) {
@ -110,14 +112,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) {
@ -125,14 +127,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 评论内容
* 评论内容
* @return
*/
public String getComment() {
return comment;
}
/**
* 评论内容
* 评论内容
* @param comment
*/
public void setComment(String comment) {
@ -140,14 +142,14 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 评论用户名称
* 评论用户名称
* @return
*/
public String getStaffName() {
return staffName;
}
/**
* 评论用户名称
* 评论用户名称
* @param staffName
*/
public void setStaffName(String staffName) {
@ -155,20 +157,35 @@ public class ResultComment implements java.io.Serializable {
}
/**
* 状态
* 状态
* @return
*/
public Integer getStatus() {
return status;
}
/**
* 状态
* 状态
* @param status
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 流程id
* @return
*/
public Long getFlowRecordId() {
return flowRecordId;
}
/**
* 流程id
* @param flowRecordId
*/
public void setFlowRecordId(Long flowRecordId) {
this.flowRecordId = flowRecordId;
}
@Override
public String toString() {
return "ResultComment{" +
@ -181,6 +198,7 @@ public class ResultComment implements java.io.Serializable {
",comment=" + comment +
",staffName=" + staffName +
",status=" + status +
",flowRecordId=" + flowRecordId +
"}";
}
}

View File

@ -90,4 +90,5 @@ public interface ResultRecordService extends IService<ResultRecord> {
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);
ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status);
}

View File

@ -5,6 +5,8 @@ import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.sys.dao.app.ResultCommentMapper;
import com.lz.modules.sys.entity.app.ResultComment;
import com.lz.modules.sys.service.app.ResultCommentService;
@ -34,6 +36,8 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
@Autowired
private StaffService staffService;
@Autowired
private FlowRecordService flowRecordService;
@Override
@ -88,11 +92,13 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
if (StringUtil.isNotBlank(content)) { //如果不为空,
if (comment == null) {
StaffEntity mySelf = staffService.selectStaffById(staffId);
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
comment = new ResultComment();
comment.setStaffId(staffId);
comment.setRecordId(req.getRecordResultId());
comment.setComment(resultComment);
comment.setStaffName(mySelf.getName());
comment.setFlowRecordId(lastUsedFlowRecord.getId());
comment.setStatus(status);
resultCommentService.insertResultComment(comment);
} else {

View File

@ -257,7 +257,7 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
}
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) + " roleNameMap : " + JSON.toJSONString(roleNameMap));
List<Flow> flows = flowService.selectByFlowId(flowId);
List<FlowRecord> flowRecordList = flowRecordService.selectFlowRecordByFlowId(resultRecord.getId());
List<FlowRecord> flowRecordList = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId());
SimpleDateFormat myFmt2 = new SimpleDateFormat("MM-dd HH:mm");
FlowRecord lastFlowRecord = null;
if (CollectionUtils.isNotEmpty(flowRecordList)) {
@ -267,7 +267,7 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
if (flowRecord.getStatus().equals(0)) {
lastFlowRecord = flowRecord;
}
stepList.add(new Step(name, time, 1, flowRecord.getStatusName()));
stepList.add(new Step(name, time, 1, ""));
}
}
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;

View File

@ -1,5 +1,6 @@
package com.lz.modules.sys.service.app.impl;
import cn.hutool.db.StatementUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -242,6 +243,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
return departmentMap;
}
@Override
public ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status) {
return resultRecordMapper.selectResultRecordByStaffIdStatus(staffId, status);
}
public void getChildIds(List<String> childDepartIds ,String parentId,Map<String,List<DepartmentsEntity>> departmentMap ){
childDepartIds.add(parentId);
List<DepartmentsEntity > tDepartments = departmentMap.get(parentId);
@ -324,15 +330,25 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Override
public ResultRecord initResult(Long staffId, Integer recordType, Long roleId) {
ResultRecord resultRecordOld = resultRecordService.selectResultRecordByStaffId(staffId);
ResultRecord resultRecordOld = resultRecordService.selectResultRecordByStaffIdStatus(staffId,4);
ResultRecord resultRecordNew = null;
if (resultRecordOld != null) {
Long oldResultRecordId = resultRecordOld.getId();
Long recordId = resultRecordOld.getId();
resultRecordOld.setId(null);
resultRecordOld.setType(Constant.TWO); // 1 表示是目标2 表示是业绩
resultRecordOld.setStatus(0);
resultRecordOld.setFlowStaffIdRole(resultDetailService.initRole(resultRecordOld.getStaffId(), roleId));
resultRecordService.insertResultRecord(resultRecordOld);
//删除月初目标
resultRecordService.deleteResultRecordById(oldResultRecordId);
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(oldResultRecordId);
for(FlowRecord flowRecord : flowRecords){
flowRecord.setRecordId(resultRecordOld.getId());
flowRecord.setId(null);
//新增record
flowRecordService.insertFlowRecord(flowRecord);
}
flowRecordService.initFlowRecord(resultRecordOld, roleId, recordType, "月未总结");
resultRecordNew = resultRecordOld;
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
@ -566,7 +582,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
resultRecord.setCurrentApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null);
resultRecord.setCurrentApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
}
resultRecordService.updateResultRecordById(resultRecord);
FlowRecord lastFlowRecord = flowRecords.get(flowRecords.size() - 1);
lastFlowRecord.setStatus(1);
@ -589,7 +604,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
if(mySelf.getId().longValue() == approvalStaff.getId().longValue()){//同一个人
mySelf.setName("");//用于替换消息中的@符号无其他任何作用不保存
}
r = R.ok("成功")
.put("from", mySelf)
.put("to", approvalStaff)

View File

@ -13,12 +13,13 @@
<result column="comment" property="comment"/>
<result column="staff_name" property="staffName"/>
<result column="status" property="status"/>
<result column="flow_record_id" property="flowRecordId"/>
</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, status AS status
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, flow_record_id AS flowRecordId
</sql>
@ -36,6 +37,7 @@
<if test="comment != null">comment, </if>
<if test="staffName != null">staff_name, </if>
<if test="status != null">status, </if>
<if test="flowRecordId != null">flow_record_id, </if>
is_delete,
gmt_create,
gmt_modified
@ -45,6 +47,7 @@
<if test="comment != null">#{ comment}, </if>
<if test="staffName != null">#{ staffName}, </if>
<if test="status != null">#{ status}, </if>
<if test="flowRecordId != null">#{ flowRecordId}, </if>
0,
now(),
now()
@ -62,7 +65,8 @@
<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="status != null">status = #{status}</if>
<if test="status != null">status = #{status},</if>
<if test="flowRecordId != null">flow_record_id = #{flowRecordId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -79,7 +83,8 @@
staff_id = #{staffId},
comment = #{comment},
staff_name = #{staffName},
status = #{status}
status = #{status},
flow_record_id = #{flowRecordId}
,gmt_modified = now()
where id = #{id}
</update>

View File

@ -267,5 +267,11 @@
SELECT count(score_level) value,score_level name from lz_result_record where is_delete = 0 and status =4 and type =2 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime} GROUP BY score_level
</select>
<select id="selectResultRecordByStaffIdStatus" resultType="com.lz.modules.sys.entity.app.ResultRecord">
select * from lz_result_record where is_delete = 0 and staff_id = #{staffId} and type = 1 and status = #{status} order by id desc limit 1
</select>
</mapper>

View File

@ -63,7 +63,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();