|
|
@@ -0,0 +1,57 @@
|
|
|
+package cn.com.ctop.job.adq.data.service.impl;
|
|
|
+
|
|
|
+import cn.com.ctop.job.adq.data.mapper.AppBanWarnMapper;
|
|
|
+import cn.com.ctop.job.adq.data.service.IAppBanWarnService;
|
|
|
+import cn.com.ctop.job.adq.data.utils.Check;
|
|
|
+import cn.com.ctop.job.adq.data.utils.HttpUtils;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class AppBanWarnServiceImpl implements IAppBanWarnService {
|
|
|
+ @Autowired
|
|
|
+ private AppBanWarnMapper appBanWarnMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void appBanWarnJob(long createAt) {
|
|
|
+ List<JSONObject> list = appBanWarnMapper.getAppBanList(createAt);
|
|
|
+ if (Check.isNull(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ JSONObject jsonObject = list.get(i);
|
|
|
+ String appId = jsonObject.getString("appId");
|
|
|
+ String appName = jsonObject.getString("appName");
|
|
|
+ String num = jsonObject.getString("num");
|
|
|
+ sendMessage(appId, appName, num);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void sendMessage(String appId, String appName, String num) {
|
|
|
+ String url = "https://open.feishu.cn/open-apis/bot/v2/hook/f7278c1e-0455-40d9-8893-d09d7936eca4";
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("msg_type", "interactive");
|
|
|
+ JSONObject card = new JSONObject();
|
|
|
+ card.put("type", "template");
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ data.put("template_id", "AAqdt9MmVURPx");
|
|
|
+ JSONObject template_variable = new JSONObject();
|
|
|
+ template_variable.put("appId", appId);
|
|
|
+ template_variable.put("appName", appName);
|
|
|
+ template_variable.put("num", num);
|
|
|
+
|
|
|
+
|
|
|
+ data.put("template_variable", template_variable);
|
|
|
+ card.put("data", data);
|
|
|
+ param.put("card", card);
|
|
|
+ String s = HttpUtils.httpPostRequest(url, param, null);
|
|
|
+
|
|
|
+ }
|
|
|
+}
|