feat:REQ-1419 代码逻辑优化
This commit is contained in:
parent
dc7beb1ece
commit
05f8801988
@ -39,7 +39,7 @@ public interface RobotMsgTemplateApi {
|
||||
* @return 返回新的机器人消息模板列表
|
||||
*/
|
||||
@PostMapping("api/im/robot/msgTemplate/update")
|
||||
ApiResult<RobotMsgTemplateResp> updateRobotMsgTemplateList(@RequestBody @Validated RobotMsgTemplateReq robotMsgTemplateReq);
|
||||
ApiResult<Void> updateRobotMsgTemplates(@RequestBody @Validated RobotMsgTemplateReq robotMsgTemplateReq);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ public class RobotInfoReq {
|
||||
|
||||
/**
|
||||
* 机器人状态
|
||||
*
|
||||
* @see RobotStatusEnum
|
||||
*/
|
||||
private String status = "creating";
|
||||
|
||||
@ -16,14 +16,10 @@ import java.util.List;
|
||||
public class RobotMsgTemplateReq {
|
||||
|
||||
|
||||
/**
|
||||
* 主键Id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 机器人Id
|
||||
*/
|
||||
@NotNull(message = "机器人ID不能为空")
|
||||
private String robotId;
|
||||
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ public class RobotMsgTemplateController implements RobotMsgTemplateApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<RobotMsgTemplateResp> updateRobotMsgTemplateList(RobotMsgTemplateReq robotMsgTemplateReq) {
|
||||
RobotMsgTemplateResp robotMsgTemplateResp = robotMsgTemplateService.updateRobotMsgTemplateList(robotMsgTemplateReq);
|
||||
return ApiResult.ok(robotMsgTemplateResp);
|
||||
public ApiResult<Void> updateRobotMsgTemplates(RobotMsgTemplateReq robotMsgTemplateReq) {
|
||||
robotMsgTemplateService.updateRobotMsgTemplateList(robotMsgTemplateReq);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,13 +68,10 @@ public class RobotMsgTemplateService {
|
||||
List<String> msgTemplates = partition.get(currentPage);
|
||||
robotMsgTemplate.setMsgTemplateList(msgTemplates);
|
||||
robotMsgTemplate.setRobotId(robotId);
|
||||
List<RobotMsgTemplateResp> templateRespList = msgTemplates.stream().map(new Function<String, RobotMsgTemplateResp>() {
|
||||
@Override
|
||||
public RobotMsgTemplateResp apply(String templateId) {
|
||||
List<RobotMsgTemplateResp> templateRespList = msgTemplates.stream().map(templateId -> {
|
||||
RobotMsgTemplateResp templateResp = new RobotMsgTemplateResp();
|
||||
templateResp.setMsgTemplateId(templateId);
|
||||
return templateResp;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
return PageResp.list((long) currentPage, (long) pageSize,
|
||||
(long) pageTotal, templateRespList);
|
||||
@ -96,7 +93,7 @@ public class RobotMsgTemplateService {
|
||||
}
|
||||
|
||||
|
||||
public RobotMsgTemplateResp updateRobotMsgTemplateList(RobotMsgTemplateReq robotMsgTemplateReq) {
|
||||
public void updateRobotMsgTemplateList(RobotMsgTemplateReq robotMsgTemplateReq) {
|
||||
String robotId = robotMsgTemplateReq.getRobotId();
|
||||
|
||||
RobotInfo robotInfo = robotInfoDao.lambdaQuery().eq(RobotInfo::getIsDelete, 0)
|
||||
@ -115,6 +112,5 @@ public class RobotMsgTemplateService {
|
||||
robotMsgTemplate.setUpdateAt(new Date());
|
||||
robotMsgTemplate.setMsgTemplateList(robotMsgTemplateReq.getMsgTemplateList());
|
||||
robotMsgTemplateDao.saveOrUpdate(robotMsgTemplate);
|
||||
return BeanMapper.map(robotMsgTemplate, RobotMsgTemplateResp.class);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user