diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java
index 602c1293..34db081a 100644
--- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java
+++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java
@@ -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 flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(recordId);
if (flowRecords != null && flowRecords.size() > 0) {
FlowRecord flowRecord = flowRecords.get(flowRecords.size()-1);
diff --git a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java
index e94a9c5a..9d949b52 100644
--- a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java
+++ b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java
@@ -60,6 +60,5 @@ public interface ResultRecordMapper extends BaseMapper {
List departmentDistribution(@Param("monthTime") String monthTime);
-
-
+ ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
}
\ No newline at end of file
diff --git a/src/main/java/com/lz/modules/sys/entity/app/ResultComment.java b/src/main/java/com/lz/modules/sys/entity/app/ResultComment.java
index eeac5bea..754160f5 100644
--- a/src/main/java/com/lz/modules/sys/entity/app/ResultComment.java
+++ b/src/main/java/com/lz/modules/sys/entity/app/ResultComment.java
@@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表
*
*业绩评论表
* @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 +
"}";
}
}
\ No newline at end of file
diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java
index 0e4c03d3..9d01a2ed 100644
--- a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java
+++ b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java
@@ -90,4 +90,5 @@ public interface ResultRecordService extends IService {
Map> getStringListMap(List tDepartments);
+ ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status);
}
\ No newline at end of file
diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultCommentServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultCommentServiceImpl.java
index 96f6a6e7..3a2ab434 100644
--- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultCommentServiceImpl.java
+++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultCommentServiceImpl.java
@@ -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 flows = flowService.selectByFlowId(flowId);
- List flowRecordList = flowRecordService.selectFlowRecordByFlowId(resultRecord.getId());
+ List 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 childDepartIds ,String parentId,Map> departmentMap ){
childDepartIds.add(parentId);
List tDepartments = departmentMap.get(parentId);
@@ -324,15 +330,25 @@ public class ResultRecordServiceImpl extends ServiceImpl 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 resultDetails = resultDetailService.selectByRecordId(recordId);
@@ -566,7 +582,6 @@ public class ResultRecordServiceImpl extends ServiceImpl
+
- 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
@@ -36,6 +37,7 @@
comment,
staff_name,
status,
+ flow_record_id,
is_delete,
gmt_create,
gmt_modified
@@ -45,6 +47,7 @@
#{ comment},
#{ staffName},
#{ status},
+ #{ flowRecordId},
0,
now(),
now()
@@ -62,7 +65,8 @@
staff_id = #{staffId},
comment = #{comment},
staff_name = #{staffName},
- status = #{status}
+ status = #{status},
+ flow_record_id = #{flowRecordId}
,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}
diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml
index 75c542fd..5931032a 100644
--- a/src/main/resources/mapper/app/ResultRecordMapper.xml
+++ b/src/main/resources/mapper/app/ResultRecordMapper.xml
@@ -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
+
+
+
+
diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java
index 8b0e88fd..4ab58ce2 100644
--- a/src/test/java/com/lz/mysql/MysqlMain.java
+++ b/src/test/java/com/lz/mysql/MysqlMain.java
@@ -63,7 +63,7 @@ public class MysqlMain {
}
List list = new ArrayList();
- list.add(new TablesBean("lz_staff_role"));
+ list.add(new TablesBean("lz_result_comment"));
List list2 = new ArrayList();
Map map = MysqlUtil2ShowCreateTable.getComments();