完善修改绩效详情接口

This commit is contained in:
wulin 2020-12-07 11:54:23 +08:00
parent d6492015c5
commit 9ad3d87eee
9 changed files with 99 additions and 20 deletions

View File

@ -123,6 +123,7 @@ public class ResultRecordController extends AbstractController {
@Autowired
private ResourceService resourceService;
/**
* 列表
*/
@ -755,6 +756,8 @@ public class ResultRecordController extends AbstractController {
}
}
String commandValue = "";
int commandIndex = 1;
for (ResultRecortModelDto model:dto.getRecortModelDtos()
) {
int index = 0;
@ -766,36 +769,77 @@ public class ResultRecordController extends AbstractController {
) {//排序
ResultDetail resultDetail = new ResultDetail();
BeanUtils.copyProperties(detailDto, resultDetail);
ResultDetail resultDetail1 = null;
if(!isSetKeyResult && resultDetail.getId() != null && mapDetails.containsKey(resultDetail.getId())){
//这里判断是否有更新或者删除
ResultDetail resultDetail1 = mapDetails.get(resultDetail.getId());
resultDetail1 = mapDetails.get(resultDetail.getId());
boolean isUp = false;
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
//打上标识
isUp = true;
}
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
//打上标识
isUp = true;
resultDetail1.setKeyResult("<s>" + resultDetail1.getKeyResult() + "</s>");
}
if(resultDetail.getIsDelete().intValue() == 1){//被删除了
resultDetail.setIsDelete(0);
isUp = true;
}
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
//打上标识
isUp = true;
}else{
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
//打上标识
isUp = true;
}
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
//打上标识
isUp = true;
}
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
//打上标识
isUp = true;
}
}
if(isUp){
resultDetail1.setId(null);
resultDetail1.setIsBack(1);
resultDetail1.setTarget("<s>" + resultDetail1.getTarget() + "</s>");
resultDetail1.setIsBack(2);
resultDetail1.setBackId(resultDetail.getId());
inserts.add(resultDetail1);
}
}else{
//查询本detail是否编辑过
resultDetail1 = resultDetailService.selectNotNoticeResultDetailByBackId(resultDetail.getId());
if(resultDetail1 != null){
updates.add(resultDetail1);
}
}
if(dto.getCommandId() != null && dto.getCommandId().intValue() > 0 && resultDetail1 != null){
//有评论id
if(resultDetail1.getIsDelete().intValue() == 1){
commandValue += (commandIndex + "(删除)" + resultDetail1.getTarget() + "\r\n");
commandIndex++;
resultDetail1.setIsBack(1);
}else{
boolean isUp = false;
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
//打上标识
commandValue += (commandIndex + "(修改) 名称:" +
resultDetail1.getTarget()+ " 为:" + resultDetail.getTarget() + "\r\n");
isUp = true;
}
if(!resultDetail.getKeyResult().equals(resultDetail1.getKeyResult())){
//打上标识
commandValue += (commandIndex + "(修改) 考核标准:" +
resultDetail1.getKeyResult() + " 为:" + resultDetail.getTarget() + "\r\n");
isUp = true;
}
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
//打上标识
commandValue += (commandIndex + "(修改) 权重:" +
resultDetail1.getCheckWeight().multiply(new BigDecimal(100)).intValue() + "% 为:"
+ resultDetail.getCheckWeight().multiply(new BigDecimal(100)).intValue() +
"%\r\n");
isUp = true;
}
if(isUp){
commandIndex++;
resultDetail1.setIsBack(1);
}
}
}
resultDetail.setPriority(index);
@ -857,6 +901,11 @@ public class ResultRecordController extends AbstractController {
resultRecordService.updateResultRecordById(resultRecord);
if(dto.getCommandId() != null && dto.getCommandId().intValue() > 0 && commandValue.length() > 0){
//修改评论信息
resultCommentService.updateResultCommentCommentById(dto.getCommandId(), commandValue);
}
return R.ok();

View File

@ -38,4 +38,5 @@ public interface ResultCommentMapper extends BaseMapper<ResultComment> {
ResultComment selectLastComment(@Param("recordId") Long recordId);
int updateResultCommentCommentById(@Param("commandId") Long commandId, @Param("commandValue") String commandValue);
}

View File

@ -48,4 +48,6 @@ public interface ResultDetailMapper extends BaseMapper<ResultDetail> {
List<ResultDetailDto> selectDtosByRecordId(@Param("recordResultId") Long id, @Param("modelId") Long modelId);
int deleteResultDetailByRecordId(@Param("recordId") Long recordId);
ResultDetail selectNotNoticeResultDetailByBackId(@Param("backId") Long backId);
}

View File

@ -40,4 +40,6 @@ public interface ResultCommentService extends IService<ResultComment> {
void addOrUpdateComment(ResultRecordReq req, Long userId, int status , FlowRecord lastUsedFlowRecord);
int updateResultCommentCommentById(Long commandId, String commandValue);
}

View File

@ -72,4 +72,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
List<ResultDetailDto> selectDtosByRecordId(Long id, Long modelId);
int deleteResultDetailByRecordId(Long recordId);
ResultDetail selectNotNoticeResultDetailByBackId(Long id);
}

View File

@ -113,4 +113,9 @@ public class ResultCommentServiceImpl extends ServiceImpl<ResultCommentMapper, R
}
}
@Override
public int updateResultCommentCommentById(Long commandId, String commandValue){
return resultCommentMapper.updateResultCommentCommentById(commandId, commandValue);
}
}

View File

@ -345,4 +345,9 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
return resultDetailMapper.deleteResultDetailByRecordId(recordId);
}
@Override
public ResultDetail selectNotNoticeResultDetailByBackId(Long backId){
return resultDetailMapper.selectNotNoticeResultDetailByBackId(backId);
}
}

View File

@ -109,6 +109,15 @@
select * from lz_result_comment where record_id=#{recordId} and is_delete = 0 order by id desc limit 1
</select>
<update id="updateResultCommentCommentById" parameterType="ResultComment" >
update
lz_result_comment
set
comment = #{commandValue}
,gmt_modified = now()
where id = #{commandId}
</update>

View File

@ -196,12 +196,16 @@
</insert>
<select id="selectDtosByRecordId" resultType="com.lz.modules.flow.model.ResultDetailDto">
select * from lz_result_detail where record_id=#{recordResultId} and model_id = #{modelId} and is_delete = 0 order by priority asc
select * from lz_result_detail where record_id=#{recordResultId} and model_id = #{modelId} and is_delete = 0 and is_back = 0 order by priority asc
</select>
<update id="deleteResultDetailByRecordId" parameterType="java.lang.Long">
update lz_result_detail set is_delete = 1, gmt_modified = now() where record_id=#{recordId} and is_delete = 0
</update>
<select id="selectNotNoticeResultDetailByBackId" resultType="com.lz.modules.flow.model.ResultDetailDto">
select * from lz_result_detail where back_id = #{backId} and is_back = 2 order by priority asc
</select>
</mapper>