Browse Source

Merge remote-tracking branch 'origin/test' into test

songyh 3 years ago
parent
commit
0db722a4f0

+ 8 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ExportReportController.java

@@ -65,8 +65,14 @@ public class ExportReportController {
 
     @ApiOperation(value = "财务结算-给运营发送消息", notes = "财务结算-给运营发送消息")
     @GetMapping(value = "/sendMessageToOperate")
-    public Result sendMessageToOperate(@RequestParam(value = "userId",required = false) String userId) {
-        return reportSettlementService.sendMessageToOperate(userId);
+    public Result sendMessageToOperate() {
+        return reportSettlementService.sendMessageToOperate();
+    }
+
+    @ApiOperation(value = "财务结算-给运营发送消息-demo", notes = "财务结算-给运营发送消息-demo")
+    @GetMapping(value = "/sendMessageToOperateDemo")
+    public Result sendMessageToOperateDemo(@RequestParam(value = "userId",required = false) String userId) {
+        return reportSettlementService.sendMessageToOperateDemo(userId);
 
     }
 

+ 2 - 1
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/IReportSettlementService.java

@@ -26,7 +26,8 @@ public interface IReportSettlementService {
 
 
 
-    Result sendMessageToOperate(String userId);
+    Result sendMessageToOperate();
+    Result sendMessageToOperateDemo(String userId);
 
 
 

+ 42 - 13
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java

@@ -204,14 +204,15 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     row.createCell(12).setCellValue(vo.getFrozen());
                 }
 
-                //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
-                ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+
 
                 //查询 图片 url
                 List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
 
                 if (!Check.isNull(imageUrlList)){
                     for (int j = 0; j < imageUrlList.size(); j++) {
+                        //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
+                        ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
                         String imagePath = imageUrlList.get(j);
                         //通过图片网络地址 获取输入流
                        /* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
@@ -220,8 +221,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         URL url = new URL(imagePath);
                         Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
                         BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
-
-
                         ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
                         int startIndex = settlementList.size() +6;
                         //anchor主要用于设置图片的属性
@@ -394,14 +393,15 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     row.createCell(12).setCellValue(vo.getBalance());
                 }
 
-                //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
-                ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
+
 
                 //查询 图片 url
                 List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
 
                 if (!Check.isNull(imageUrlList)){
                     for (int j = 0; j < imageUrlList.size(); j++) {
+                        //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
+                        ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
                         String imagePath = imageUrlList.get(j);
                         //通过图片网络地址 获取输入流
                        /* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
@@ -410,11 +410,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         URL url = new URL(imagePath);
                         Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
                         BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
-
                         ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
                         //anchor主要用于设置图片的属性
                         int startIndex = settlementList.size()+7;
-
                         HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, startIndex+(5*j)+50*j, (short) 10, startIndex+(5*j)+50*(j+1));
                         //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
                         anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
@@ -722,22 +720,22 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
      *
      * @description: 给运营发送消息
      *
-     * @param userId
+     * @param
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      */
     @Override
-    public Result sendMessageToOperate(String userId) {
+    public Result sendMessageToOperate() {
         int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
         int productNum = 0;
         int accountNum = 0;
         String productInfo = null;
-        String message =  "运营人{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
+        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();
+             String userId = userMap.get("userId").toString();
             //查询运营下的 账户 和 产品信息
             List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
             if (Check.isNull(productList)){
@@ -750,13 +748,44 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             productInfo = StringUtils.join(product.toArray(),"、");
 
             //发送微信通知
-            JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId("f990f815ecef43fab9cbe1bb22bb6d63");
+            JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(userId);
             String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
             corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
         }
         return Result.successMsg("成功",null);
     }
 
+    @Override
+    public Result sendMessageToOperateDemo(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) {
+             String realUserId = userMap.get("userId").toString();
+            //查询运营下的 账户 和 产品信息
+            List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(realUserId);
+            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(Check.isNull(userId) ? "f990f815ecef43fab9cbe1bb22bb6d63" : userId);
+            String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
+            corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
+        }
+        return Result.successMsg("发送微信通知成功-test",null);
+    }
+
 
 
     @Resource