|
@@ -991,7 +991,7 @@ public class ApiController {
|
|
|
@ApiOperation(value = "任务-新增任务内容表", notes = "新增任务内容表")
|
|
|
@SysLog("新增任务内容表")
|
|
|
@PostMapping("/saveTaskContent")
|
|
|
- public R saveTaskContent(@RequestBody WmTaskContent wmTaskContent) {
|
|
|
+ public R<?> saveTaskContent(@RequestBody WmTaskContent wmTaskContent) {
|
|
|
Set<String> errorHash = new HashSet<>();
|
|
|
List<String> ducImgUrl = new ArrayList<>();
|
|
|
List<String> all = new ArrayList<>();
|
|
@@ -1027,24 +1027,36 @@ public class ApiController {
|
|
|
return R.failed(ducImgUrl, "提交重复的图片");
|
|
|
}
|
|
|
|
|
|
+ if (org.apache.commons.lang.StringUtils.isEmpty(wmTaskContent.getTemp30())) {
|
|
|
+ return R.failed("任务类型不能为空");
|
|
|
+ }
|
|
|
|
|
|
- R r = wmTaskContentService.saveTaskContent(wmTaskContent);
|
|
|
-
|
|
|
- log.info("结果:{}, 草稿key:{}", r, draftKey);
|
|
|
- if (r.getCode() == CommonConstants.SUCCESS && StrUtil.isNotEmpty(draftKey)) {
|
|
|
- String key = String.format(CacheConstants.TASK_CONTENT_DRAFT, taskTypeId, id);
|
|
|
- log.info("删除草稿:{}", key);
|
|
|
- redisTemplate.delete(key);
|
|
|
+ if (org.apache.commons.lang.StringUtils.isEmpty(wmTaskContent.getTemp32())) {
|
|
|
+ return R.failed("关联积分包不能为空");
|
|
|
}
|
|
|
|
|
|
- if (r.getCode() == CommonConstants.FAIL && CollUtil.isNotEmpty(all)) {
|
|
|
- // 保存图片
|
|
|
- log.info("all size:{}", all.size());
|
|
|
- all.forEach(hash -> {
|
|
|
- String key = String.format("%s:%s", id, hash);
|
|
|
- log.info("key: {}", key);
|
|
|
+ R<?> r = null;
|
|
|
+ try {
|
|
|
+ r = wmTaskContentService.saveTaskContent(wmTaskContent);
|
|
|
+ } catch (Exception e){
|
|
|
+ return R.failed(e.getMessage());
|
|
|
+ } finally {
|
|
|
+ log.info("结果:{}, 草稿key:{}", r, draftKey);
|
|
|
+ if (r != null && r.getCode() == CommonConstants.SUCCESS && StrUtil.isNotEmpty(draftKey)) {
|
|
|
+ String key = String.format(CacheConstants.TASK_CONTENT_DRAFT, taskTypeId, id);
|
|
|
+ log.info("删除草稿:{}", key);
|
|
|
redisTemplate.delete(key);
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (r == null || (r.getCode() == CommonConstants.FAIL && CollUtil.isNotEmpty(all))) {
|
|
|
+ // 保存图片
|
|
|
+ log.info("all size:{}", all.size());
|
|
|
+ all.forEach(hash -> {
|
|
|
+ String key = String.format("%s:%s", id, hash);
|
|
|
+ log.info("key: {}", key);
|
|
|
+ redisTemplate.delete(key);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return r;
|