|
@@ -2,6 +2,10 @@ package org.jeecg.ctop.finance.settlement.service.serviceImpl;
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
+import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
|
|
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.google.gson.JsonObject;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
@@ -24,9 +28,12 @@ import javax.servlet.http.HttpServletResponse;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
|
+import java.text.MessageFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Calendar;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -36,6 +43,12 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
@Resource
|
|
@Resource
|
|
private ReportSettlementMapper reportSettlementMapper;
|
|
private ReportSettlementMapper reportSettlementMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private CorpWexinUtils corpWexinUtils;
|
|
|
|
+ @Resource
|
|
|
|
+ private MailLogMapper mailLogMapper;
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
|
|
public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
|
|
return reportSettlementMapper.getAccountTransactionDayBytedance(null);
|
|
return reportSettlementMapper.getAccountTransactionDayBytedance(null);
|
|
@@ -550,8 +563,51 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @description: 给运营发送消息
|
|
|
|
+ *
|
|
|
|
+ * @param userId
|
|
|
|
+ * @return: org.jeecg.common.api.vo.Result
|
|
|
|
+ * @author: zianY
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Result sendMessageToOperate(String userId) {
|
|
|
|
+ int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
|
|
|
+ int productNum = 0;
|
|
|
|
+ int accountNum = 0;
|
|
|
|
+ String productInfo = null;
|
|
|
|
+ String message = "运营人{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
|
|
|
|
+
|
|
|
|
+ //查询所有 运营绑定的账户
|
|
|
|
+ List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
|
|
|
|
+ for (Map<String, Object> userMap : userList) {
|
|
|
|
+ userId = userMap.get("userId").toString();
|
|
|
|
+ //查询运营下的 账户 和 产品信息
|
|
|
|
+ List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
|
|
|
|
+ if (Check.isNull(productList)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //产品名称
|
|
|
|
+ List product = productList.stream().map(map -> map.get("productName")).distinct().collect(Collectors.toList());
|
|
|
|
+ productNum = product.size();
|
|
|
|
+ accountNum = productList.size();
|
|
|
|
+ productInfo = StringUtils.join(product.toArray(),"、");
|
|
|
|
+
|
|
|
|
+ //发送微信通知
|
|
|
|
+ JSONObject jsonObject = mailLogMapper.getWChatIdByUserId("f990f815ecef43fab9cbe1bb22bb6d63");
|
|
|
|
+ String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
|
|
|
|
+ corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
|
|
|
|
+ }
|
|
|
|
+ return Result.successMsg("成功。",null);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ String a = "woshiwoshi{1}woshi{2}111{3}===";
|
|
|
|
+ String b = MessageFormat.format(a,"测试","我","你","结束");
|
|
|
|
+ System.out.println(a);
|
|
|
|
+ System.out.println(b);
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|