Commit 4ccd3a09 by HlQ

[chg] 代码优化

1 parent fea1033a
......@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.watermark.Watermark;
import com.github.liaochong.myexcel.utils.WatermarkUtil;
......@@ -463,13 +462,12 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.put("title", "项目日志提醒")
.put("text", text);
JsonNode atObj = null;
var atObj = JsonUtil.createObj();
if (ArrayUtil.isNotEmpty(userIdStr)) {
var arr = JsonUtil.createArr();
Arrays.stream(userIdStr).forEach(arr::add);
var atUser = Arrays.stream(userIdStr).collect(Collectors.joining("@", "@", ""));
System.out.println(atUser);
atObj = JsonUtil.createObj().set("atUserIds", arr);
atObj.set("atUserIds", arr);
text = StrUtil.format("""
### 项目日志
### 查收人:{}
......@@ -485,8 +483,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
var body = JsonUtil.createObj()
.put("msgtype", "markdown")
.putPOJO("markdown", markdown)
// fixme atObj is null, dont add it
.putPOJO("at", atObj);
.putPOJO("at", atObj.isEmpty() ? null : atObj);
var pushRes = dingMod.robotPush(storeVO.getBotToken(), body.toString());
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!