فهرست منبع

调用消息中心接口时添加异常捕获

fuyuhchuan 9 ماه پیش
والد
کامیت
b0e399ab8e
1فایلهای تغییر یافته به همراه17 افزوده شده و 13 حذف شده
  1. 17 13
      service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

+ 17 - 13
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

@@ -262,19 +262,23 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                 newContent.setTenantId(SecurityUtils.getTenantId());
                 pmWorkContentMapper.insert(newContent);
                 //推送消息中心
-                String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
-                String infoContent = nickName + "的工作报告";
-//                List<Long> ids = Arrays.stream(newReport.getCcTo().split(","))
-//                        .map(Long::parseLong)
-//                        .collect(Collectors.toList());
-                JsonObject jsonObject = new JsonObject();
-                jsonObject.addProperty("infoTitle", "工作报告");
-                jsonObject.addProperty("infoContent", infoContent);
-                jsonObject.addProperty("infoType", 5);
-                jsonObject.addProperty("id", id);
-                jsonObject.addProperty("userIds", newReport.getCcTo());
-                remoteMceService.addMce(jsonObject.toString());
-                System.out.println(jsonObject);
+                try {
+                    String nickName = SecurityUtils.getLoginUser().getSysUser().getNickName();
+                    String infoContent = nickName + "的工作报告";
+                    List<Long> ids = Arrays.stream(newReport.getCcTo().split(","))
+                            .map(Long::parseLong)
+                            .collect(Collectors.toList());
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("infoTitle", "工作报告");
+                    jsonObject.put("infoContent", infoContent);
+                    jsonObject.put("infoType", 5);
+                    jsonObject.put("id", id);
+                    jsonObject.put("userIds", ids);
+                    remoteMceService.addMce(jsonObject.toString());
+                    System.out.println(jsonObject);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
             }
         } else {
             PmWorkReport rp = new PmWorkReport();