diff --git a/src/main/java/com/lz/modules/app/dto/ResultDto.java b/src/main/java/com/lz/modules/app/dto/ResultDto.java index d86a55be..f85f0c62 100644 --- a/src/main/java/com/lz/modules/app/dto/ResultDto.java +++ b/src/main/java/com/lz/modules/app/dto/ResultDto.java @@ -10,6 +10,7 @@ public class ResultDto { @TaskHeader(value = "进度", order = 1) //返回值如30%, 如果没有可以不填写 private String rate; + private Long detailId; private Long taskId; @@ -27,4 +28,7 @@ public class ResultDto { this.taskId = taskId; this.content = content; } + + + } diff --git a/src/main/java/com/lz/modules/command/BaseCommand.java b/src/main/java/com/lz/modules/command/BaseCommand.java index b72d2cab..20d5ff4e 100644 --- a/src/main/java/com/lz/modules/command/BaseCommand.java +++ b/src/main/java/com/lz/modules/command/BaseCommand.java @@ -14,7 +14,14 @@ public class BaseCommand { protected String[] tokens; - protected SysUserEntity user ; + protected SysUserEntity user; + + public void init(SysUserEntity user, String[] tokens) throws Exception { + this.user = user; + this.tokens = tokens; + } + + diff --git a/src/main/java/com/lz/modules/command/base1000/AddCommand.java b/src/main/java/com/lz/modules/command/base1000/AddCommand.java new file mode 100644 index 00000000..a7759889 --- /dev/null +++ b/src/main/java/com/lz/modules/command/base1000/AddCommand.java @@ -0,0 +1,47 @@ +package com.lz.modules.command.base1000; + +import com.lz.common.utils.Constant; +import com.lz.common.utils.R; +import com.lz.modules.app.utils.t.Tuple; +import com.lz.modules.command.BaseCommand; +import com.lz.modules.command.ICommand; +import com.lz.modules.command.annotation.Description; +import com.lz.modules.command.annotation.Name; +import com.lz.modules.command.annotation.Summary; +import com.lz.modules.sys.entity.SysUserEntity; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component("add") +@Name("add") +@Summary("绩效任务查看 添加 或 更新 ") +@Description(Constant.EXAMPLE + + " add 1 \"短信开发\"\n" + + " add 1 \"短信开发\" 30 \n" + + " add 1 \"短信开发\" 30 \"中途遇到问题,可能会慢一点\"\n" + + " add 1 -n \"短信开发\" -r 30 \n" + + " add 1 -n \"短信开发\" \n" + + " add 1 -nr \"短信开发\" 30 \n" + + " update 1 -r 30 -m \n" + + " add 1 -n \"短信开发\" -r 30 -m \"中途遇到问题,可能会慢一点\"\n" + + " add 1 -nrm \"短信开发\" 30 \"中途遇到问题,可能会慢一点\"\n" +) +@Slf4j +public class AddCommand extends BaseCommand implements ICommand { + + @Override + public Tuple check() throws Exception { + return null; + } + + @Override + public Tuple parse() throws Exception { + return null; + } + + @Override + public R process(Tuple tuple) throws Exception { + return null; + } + +} diff --git a/src/main/java/com/lz/modules/command/base1000/ListCommand.java b/src/main/java/com/lz/modules/command/base1000/ListCommand.java new file mode 100644 index 00000000..d050e4cd --- /dev/null +++ b/src/main/java/com/lz/modules/command/base1000/ListCommand.java @@ -0,0 +1,5 @@ +package com.lz.modules.command.base1000; + +public class ListCommand { + +} diff --git a/src/main/java/com/lz/modules/command/base1000/UpdateCommand.java b/src/main/java/com/lz/modules/command/base1000/UpdateCommand.java new file mode 100644 index 00000000..7fd46207 --- /dev/null +++ b/src/main/java/com/lz/modules/command/base1000/UpdateCommand.java @@ -0,0 +1,4 @@ +package com.lz.modules.command.base1000; + +public class UpdateCommand { +} diff --git a/src/main/java/com/lz/modules/performance/service/impl/ResultTaskServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/ResultTaskServiceImpl.java index af3c6af4..aaf12da4 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/ResultTaskServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/ResultTaskServiceImpl.java @@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -338,7 +339,7 @@ public class ResultTaskServiceImpl extends ServiceImpl detailIds = resultDtos.stream().map(resultDto -> resultDto.getId() + "").collect(Collectors.toList()); + List detailIds = new ArrayList<>();//resultDtos.stream().map(resultDto -> resultDto.getId() + "").collect(Collectors.toList()); List dtos = resultTaskMapper.listResultTask(detailIds); for(ResultDto resultDto:dtos){ diff --git a/src/main/java/com/lz/modules/third/entity/TaskResp.java b/src/main/java/com/lz/modules/third/entity/TaskResp.java index 0716ee2f..ef93ca4b 100644 --- a/src/main/java/com/lz/modules/third/entity/TaskResp.java +++ b/src/main/java/com/lz/modules/third/entity/TaskResp.java @@ -10,7 +10,7 @@ import java.util.Date; *

*

*用户执行命令的最后一个值表 * @author quyixiao -* @since 2021-01-26 +* @since 2021-01-27 */ @Data @@ -31,19 +31,22 @@ public class TaskResp implements java.io.Serializable { private Date gmtModified; //索引 @ApiModelProperty(value = "索引 ", name = "indexId") - private Integer indexId; + private Long indexId; //用户 id @ApiModelProperty(value = "用户 id", name = "userId") private Long userId; - //返回值内容 id - @ApiModelProperty(value = "返回值内容 id", name = "resultId") - private Long resultId; + //detailId id + @ApiModelProperty(value = "detailId id", name = "detailId") + private Long detailId; //返回值内容 @ApiModelProperty(value = "返回值内容", name = "content") private String content; // @ApiModelProperty(value = "", name = "command") private String command; + //任务 id + @ApiModelProperty(value = "任务 id", name = "taskId") + private Long taskId; /** * * @return @@ -108,14 +111,14 @@ public class TaskResp implements java.io.Serializable { * 索引 * @return */ - public Integer getIndexId() { + public Long getIndexId() { return indexId; } /** * 索引 * @param indexId */ - public void setIndexId(Integer indexId) { + public void setIndexId(Long indexId) { this.indexId = indexId; } @@ -135,18 +138,18 @@ public class TaskResp implements java.io.Serializable { } /** - * 返回值内容 id + * detailId id * @return */ - public Long getResultId() { - return resultId; + public Long getDetailId() { + return detailId; } /** - * 返回值内容 id - * @param resultId + * detailId id + * @param detailId */ - public void setResultId(Long resultId) { - this.resultId = resultId; + public void setDetailId(Long detailId) { + this.detailId = detailId; } /** @@ -179,6 +182,21 @@ public class TaskResp implements java.io.Serializable { this.command = command; } + /** + * 任务 id + * @return + */ + public Long getTaskId() { + return taskId; + } + /** + * 任务 id + * @param taskId + */ + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + @Override public String toString() { return "TaskResp{" + @@ -188,9 +206,10 @@ public class TaskResp implements java.io.Serializable { ",gmtModified=" + gmtModified + ",indexId=" + indexId + ",userId=" + userId + - ",resultId=" + resultId + + ",detailId=" + detailId + ",content=" + content + ",command=" + command + + ",taskId=" + taskId + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/third/service/impl/TaskRespServiceImpl.java b/src/main/java/com/lz/modules/third/service/impl/TaskRespServiceImpl.java index 16135455..2b54bd48 100644 --- a/src/main/java/com/lz/modules/third/service/impl/TaskRespServiceImpl.java +++ b/src/main/java/com/lz/modules/third/service/impl/TaskRespServiceImpl.java @@ -70,8 +70,8 @@ public class TaskRespServiceImpl extends ServiceImpl i List taskRespList =new ArrayList<>(); for(ResultDto resultDto : list){ TaskResp taskResp = new TaskResp(); - taskResp.setIndexId(resultDto.getIndex()); - taskResp.setResultId(resultDto.getId()); + /*taskResp.setIndexId(resultDto.getIndex()); + taskResp.setResultId(resultDto.getId());*/ taskResp.setUserId(user.getUserId()); taskResp.setContent(resultDto.getContent()); taskResp.setCommand(command); @@ -91,7 +91,7 @@ public class TaskRespServiceImpl extends ServiceImpl i public boolean updateIndex(SysUserEntity userEntity, TaskDto taskDto,String command) { TaskResp taskResp = taskRespService.selectTaskRespByUserIdIndex(userEntity.getUserId(), taskDto.getId(),command); if (taskResp != null) { - taskDto.setId(taskResp.getResultId()); + taskDto.setId(taskResp.getDetailId()); return true; } return false; diff --git a/src/main/java/com/lz/modules/third/utils/TaskConvertUtils.java b/src/main/java/com/lz/modules/third/utils/TaskConvertUtils.java index ff73071a..9d0f4117 100644 --- a/src/main/java/com/lz/modules/third/utils/TaskConvertUtils.java +++ b/src/main/java/com/lz/modules/third/utils/TaskConvertUtils.java @@ -118,7 +118,7 @@ public class TaskConvertUtils { } public static void main(String[] args) throws Exception { - /*ResultDto resultDto1 = new ResultDto(0, 10l, "哈哈0"); + /* ResultDto resultDto1 = new ResultDto(0, 10l, "哈哈0"); ResultDto resultDto2 = new ResultDto(1, 11l, "哈哈1"); ResultDto resultDto3 = new ResultDto(2, 12l, "哈哈2"); ResultDto resultDto4 = new ResultDto(3, 13l, "哈哈3", "30%"); diff --git a/src/main/resources/mapper/third/TaskRespMapper.xml b/src/main/resources/mapper/third/TaskRespMapper.xml index aa026924..5ae8fd1a 100644 --- a/src/main/resources/mapper/third/TaskRespMapper.xml +++ b/src/main/resources/mapper/third/TaskRespMapper.xml @@ -10,15 +10,16 @@ - + + - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, index_id AS indexId, user_id AS userId, result_id AS resultId, content AS content, command AS command + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, index_id AS indexId, user_id AS userId, detail_id AS detailId, content AS content, command AS command, task_id AS taskId @@ -33,18 +34,20 @@ insert into lz_task_resp( index_id, user_id, - result_id, + detail_id, content, command, + task_id, is_delete, gmt_create, gmt_modified )values( #{ indexId}, #{ userId}, - #{ resultId}, + #{ detailId}, #{ content}, #{ command}, + #{ taskId}, 0, now(), now() @@ -60,9 +63,10 @@ gmt_create = #{gmtCreate}, index_id = #{indexId}, user_id = #{userId}, - result_id = #{resultId}, + detail_id = #{detailId}, content = #{content}, - command = #{command} + command = #{command}, + task_id = #{taskId} ,gmt_modified = now() where id = #{id} @@ -77,9 +81,10 @@ gmt_create = #{gmtCreate}, index_id = #{indexId}, user_id = #{userId}, - result_id = #{resultId}, + detail_id = #{detailId}, content = #{content}, - command = #{command} + command = #{command}, + task_id = #{taskId} ,gmt_modified = now() where id = #{id} @@ -94,26 +99,27 @@ insert into lz_task_resp( index_id, user_id, - result_id, + detail_id, content, command, + task_id, is_delete, gmt_create, gmt_modified - ) values + )values ( #{ item.indexId}, #{ item.userId}, - #{ item.resultId}, + #{ item.detailId}, #{ item.content}, #{ item.command}, + #{ item.taskId}, 0, now(), now() ) -