Commit b61480b05d0d248a9686e07fdb60eb52962cf1dd

Authored by 王言钊
1 parent a2b43c86

修改邮件发送定时任务时间

src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
... ... @@ -83,7 +83,7 @@ public class LiveApplyJob {
83 83 /**
84 84 * 直播申请邮件通知
85 85 */
86   - @Scheduled(fixedRate = 60 * 1000)
  86 + @Scheduled(fixedRate = 60 * 60 * 1000)
87 87 public void liveApplyNotice() {
88 88 Example example = new Example(ShyLiveapply.class);
89 89 Criteria criteria = example.createCriteria();
... ... @@ -113,11 +113,12 @@ public class LiveApplyJob {
113 113 if (CommonUtils.isNotNull(shySites)) {
114 114 liveApply.setSpid_desc(shySites.getName());
115 115 }
  116 + StringBuilder content = new StringBuilder();
116 117 //循环需要发送邮件的邮箱
117 118 for (ShyEmail shyEmail : shyEmailList) {
118 119 String startTime = CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss");
119 120 String endTime = CommonUtils.isNotNull(liveApply.getPre_end_time()) ? CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss") : "待定";
120   - String content = liveApply.getSender() + "__" + liveApply.getMobile() + "__" + liveApply.getOrganization() + "__" + liveApply.getTheme() + "__" + startTime + "__" + endTime + "__" + liveApply.getLive_place() + "__" + liveApply.getPush_url() + "__" + liveApply.getPull_source() + "," + liveApply.getPull_url();
  121 + content.append(liveApply.getSender()).append("__").append(liveApply.getMobile()).append("__").append(liveApply.getOrganization()).append("__").append(liveApply.getTheme()).append("__").append(startTime).append("__").append(endTime).append("__").append(liveApply.getLive_place()).append("__").append(liveApply.getPush_url()).append("__").append(liveApply.getPull_source()).append(",").append(liveApply.getPull_url());
121 122 //获取一个格式化后的当前时间
122 123 String dateTime = CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
123 124 String emailAddr = shyEmail.getEmail();
... ... @@ -127,7 +128,7 @@ public class LiveApplyJob {
127 128 emailparams.put("appId", appId);
128 129 emailparams.put("emailAddr", emailAddr);
129 130 emailparams.put("title", title);
130   - emailparams.put("content", content);
  131 + emailparams.put("content", content.toString());
131 132 emailparams.put("templateId", templateId);
132 133 emailparams.put("sign", OpenUtil.sign(emailparams, appKey));
133 134 HttpUtil httpUtil = HttpUtil.init();
... ... @@ -159,21 +160,25 @@ public class LiveApplyJob {
159 160 i += 1;
160 161 break;
161 162 }
162   - //String taskId = "003_01";
  163 + //String taskId = "003_09";
163 164 //String signatureId = "0";
164 165 //Map<String, String> mobileparams = new HashMap<>(16);
165 166 //mobileparams.put("appId", appId);
166 167 //mobileparams.put("mobile", liveApply.getMobile());
167   - //mobileparams.put("content", content);
  168 + //mobileparams.put("content", content.toString());
168 169 //mobileparams.put("taskId", taskId);
169 170 //mobileparams.put("signatureId", signatureId);
170 171 //httpUtil.setParamMap(mobileparams);
171   - //if (i > 4) {
  172 + //if (i > shyEmailList.size() * 2) {
172 173 // Map<String, String> post = httpUtil.post(mobile_send_URL);
173 174 // logger.info("当前发送短信用户为:" + liveApply.getMobile() + ",发送短信的直播申请审核云id为:" + liveApply.getId() + "结果为:" + post.get("result"));
174   - // noticeState = CommonConst.NOTICE_SUCCESS;
175   - // noticeMsg = noticeMsg + "\n" + dateTime + "短信手机号" + liveApply.getMobile() + "(" + liveApply.getSender() + ")发送成功";
176   - // i = 0;
  175 + // JSONObject result = JSONObject.parseObject(post.get("result"));
  176 + // Integer code = result.getInteger("errorCode");
  177 + // if (code == 0) {
  178 + // noticeState = CommonConst.NOTICE_SUCCESS;
  179 + // noticeMsg.append(noticeMsg).append("\n").append(dateTime).append("短信手机号").append(liveApply.getMobile()).append("(").append(liveApply.getSender()).append(")发送成功").toString();
  180 + // i = 0;
  181 + // }
177 182 // break;
178 183 //}
179 184 }
... ...