Commit 4ccd3a09 by HlQ

[chg] 代码优化

1 parent fea1033a
...@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; ...@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.fasterxml.jackson.databind.JsonNode;
import com.github.liaochong.myexcel.core.DefaultExcelBuilder; import com.github.liaochong.myexcel.core.DefaultExcelBuilder;
import com.github.liaochong.myexcel.core.watermark.Watermark; import com.github.liaochong.myexcel.core.watermark.Watermark;
import com.github.liaochong.myexcel.utils.WatermarkUtil; import com.github.liaochong.myexcel.utils.WatermarkUtil;
...@@ -463,13 +462,12 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -463,13 +462,12 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.put("title", "项目日志提醒") .put("title", "项目日志提醒")
.put("text", text); .put("text", text);
JsonNode atObj = null; var atObj = JsonUtil.createObj();
if (ArrayUtil.isNotEmpty(userIdStr)) { if (ArrayUtil.isNotEmpty(userIdStr)) {
var arr = JsonUtil.createArr(); var arr = JsonUtil.createArr();
Arrays.stream(userIdStr).forEach(arr::add); Arrays.stream(userIdStr).forEach(arr::add);
var atUser = Arrays.stream(userIdStr).collect(Collectors.joining("@", "@", "")); var atUser = Arrays.stream(userIdStr).collect(Collectors.joining("@", "@", ""));
System.out.println(atUser); atObj.set("atUserIds", arr);
atObj = JsonUtil.createObj().set("atUserIds", arr);
text = StrUtil.format(""" text = StrUtil.format("""
### 项目日志 ### 项目日志
### 查收人:{} ### 查收人:{}
...@@ -485,8 +483,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -485,8 +483,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
var body = JsonUtil.createObj() var body = JsonUtil.createObj()
.put("msgtype", "markdown") .put("msgtype", "markdown")
.putPOJO("markdown", markdown) .putPOJO("markdown", markdown)
// fixme atObj is null, dont add it .putPOJO("at", atObj.isEmpty() ? null : atObj);
.putPOJO("at", atObj);
var pushRes = dingMod.robotPush(storeVO.getBotToken(), body.toString()); var pushRes = dingMod.robotPush(storeVO.getBotToken(), body.toString());
return StrUtil.containsIgnoreCase(pushRes, "ok"); return StrUtil.containsIgnoreCase(pushRes, "ok");
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!