Commit 90f23d70c1b8ccf54d699edc9423fe6c695d0f20

Authored by liwei2917
1 parent 22c78bf4

修改消息弹窗出现的问题,修改邮件发送后的日志存储

src/main/java/com/cnlive/shenhe/controller/UsersController.java
@@ -131,10 +131,10 @@ public class UsersController { @@ -131,10 +131,10 @@ public class UsersController {
131 shyUser =usersService.select(shyUser); 131 shyUser =usersService.select(shyUser);
132 boolean isShow_chinnal=false;//是否显示频道消息框 132 boolean isShow_chinnal=false;//是否显示频道消息框
133 boolean isShow_liveApply=false;//是否显示直播申请消息框 133 boolean isShow_liveApply=false;//是否显示直播申请消息框
134 - if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains("1")){ 134 + if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains(CommonConst.NOTICE_CHANNAL.toString())){
135 isShow_chinnal=true; 135 isShow_chinnal=true;
136 } 136 }
137 - if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains("2")){ 137 + if(CommonUtils.isNotEmpty(shyUser.getNotice_show())&&shyUser.getNotice_show().contains(CommonConst.NOTICE_LIVEAPPLY.toString())){
138 isShow_liveApply=true; 138 isShow_liveApply=true;
139 } 139 }
140 Map<String,Object> map=new HashMap<>(); 140 Map<String,Object> map=new HashMap<>();
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
@@ -93,17 +93,17 @@ public class LiveApplyJob { @@ -93,17 +93,17 @@ public class LiveApplyJob {
93 String app_id = email_app_id; //开发者对应的id,与app_key相对应 93 String app_id = email_app_id; //开发者对应的id,与app_key相对应
94 String app_key = email_app_key; //开发者帐号对应的key. 请开发者谨慎保管此值。 94 String app_key = email_app_key; //开发者帐号对应的key. 请开发者谨慎保管此值。
95 String URL = email_send_URL;//调用邮件发送服务器的地址 95 String URL = email_send_URL;//调用邮件发送服务器的地址
96 - List<String> shyEmailList=emailServiceImpl.getEmailSendList(CommonConst.EMAIL_LIVEAPPLY); 96 + List<ShyEmail> shyEmailList=emailServiceImpl.getEmailSendList(CommonConst.EMAIL_LIVEAPPLY);
97 logger.info("直播申请邮件通知开始,共"+shyLiveApplyList.size()+"个申请,每个申请通知"+shyEmailList.size()+"个邮箱"); 97 logger.info("直播申请邮件通知开始,共"+shyLiveApplyList.size()+"个申请,每个申请通知"+shyEmailList.size()+"个邮箱");
98 for(ShyLiveapply liveApply : shyLiveApplyList){ 98 for(ShyLiveapply liveApply : shyLiveApplyList){
99 Integer notice_state = liveApply.getEmail_notice_state();//初始化通知状态 99 Integer notice_state = liveApply.getEmail_notice_state();//初始化通知状态
100 String notice_msg = liveApply.getEmail_notice_msg();//初始化通知消息 100 String notice_msg = liveApply.getEmail_notice_msg();//初始化通知消息
101 - for(String emailAddr:shyEmailList){//循环需要发送邮件的邮箱 101 + for(ShyEmail shyEmail:shyEmailList){//循环需要发送邮件的邮箱
102 String startTime=CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss"); 102 String startTime=CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss");
103 String endTime=CommonUtils.isNotNull(liveApply.getPre_end_time())?CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss"):"待定"; 103 String endTime=CommonUtils.isNotNull(liveApply.getPre_end_time())?CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss"):"待定";
104 String content = liveApply.getSender()+"__"+liveApply.getMobile()+"__"+liveApply.getOrganization()+"__"+liveApply.getTheme()+"__"+startTime+"__"+endTime+"__"+liveApply.getLive_place()+"__"+liveApply.getPush_url()+"__"+liveApply.getPull_url(); 104 String content = liveApply.getSender()+"__"+liveApply.getMobile()+"__"+liveApply.getOrganization()+"__"+liveApply.getTheme()+"__"+startTime+"__"+endTime+"__"+liveApply.getLive_place()+"__"+liveApply.getPush_url()+"__"+liveApply.getPull_url();
105 String dateTime=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");//获取一个格式化后的当前时间 105 String dateTime=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");//获取一个格式化后的当前时间
106 -// String emailAddr = "642522156@qq.com"; 106 + String emailAddr = shyEmail.getEmail();
107 String title = "新直播开播申请"; 107 String title = "新直播开播申请";
108 String templateId = "4017"; 108 String templateId = "4017";
109 Map<String, String> params = new HashMap<>(); 109 Map<String, String> params = new HashMap<>();
@@ -121,21 +121,21 @@ public class LiveApplyJob { @@ -121,21 +121,21 @@ public class LiveApplyJob {
121 JSONObject result=JSONObject.parseObject(post.get("result")); 121 JSONObject result=JSONObject.parseObject(post.get("result"));
122 if (result == null) { 122 if (result == null) {
123 notice_state=CommonConst.NOTICE_FAIL; 123 notice_state=CommonConst.NOTICE_FAIL;
124 - notice_msg=notice_msg+","+dateTime+" 邮件服务器调用失败,result为空"; 124 + notice_msg=notice_msg+"\n"+dateTime+" 邮件服务器调用失败,result为空";
125 break; 125 break;
126 } 126 }
127 Integer code = result.getInteger("errorCode"); 127 Integer code = result.getInteger("errorCode");
128 if (code != 0) { 128 if (code != 0) {
129 notice_state=CommonConst.NOTICE_FAIL; 129 notice_state=CommonConst.NOTICE_FAIL;
130 - notice_msg=notice_msg+","+dateTime+" 邮件服务器调用失败,result返回消息为:"+result.getString("errorMessage"); 130 + notice_msg=notice_msg+"\n"+dateTime+" 邮件服务器调用失败,result返回消息为:"+result.getString("errorMessage");
131 break; 131 break;
132 }else{ 132 }else{
133 notice_state=CommonConst.NOTICE_SUCCESS; 133 notice_state=CommonConst.NOTICE_SUCCESS;
134 - notice_msg=notice_msg+","+dateTime+" 邮件"+emailAddr+"发送成功"; 134 + notice_msg=notice_msg+"\n"+dateTime+" 邮件"+emailAddr+"("+shyEmail.getRemark()+")发送成功";
135 } 135 }
136 } catch (Exception e) { 136 } catch (Exception e) {
137 notice_state=CommonConst.NOTICE_FAIL; 137 notice_state=CommonConst.NOTICE_FAIL;
138 - notice_msg=notice_msg+","+dateTime+" 邮件服务器调用失败,服务器报错了"; 138 + notice_msg=notice_msg+"\n"+dateTime+" 邮件服务器调用失败,服务器报错了";
139 break; 139 break;
140 } 140 }
141 } 141 }
src/main/java/com/cnlive/shenhe/serviceImpl/EmailServiceImpl.java
@@ -119,18 +119,18 @@ public class EmailServiceImpl { @@ -119,18 +119,18 @@ public class EmailServiceImpl {
119 * @param emailSendType 119 * @param emailSendType
120 * @return 120 * @return
121 */ 121 */
122 - public List<String> getEmailSendList(Integer emailSendType) { 122 + public List<ShyEmail> getEmailSendList(Integer emailSendType) {
123 ShyEmail shyEmail= new ShyEmail(); 123 ShyEmail shyEmail= new ShyEmail();
124 shyEmail.setIs_delete(false); 124 shyEmail.setIs_delete(false);
125 shyEmail.setIs_enable(true); 125 shyEmail.setIs_enable(true);
126 List<ShyEmail> shyEmailList = shyEmailMapper.select(shyEmail); 126 List<ShyEmail> shyEmailList = shyEmailMapper.select(shyEmail);
127 - List<String> emailList = new ArrayList<String>(); 127 + List<ShyEmail> emailList = new ArrayList<ShyEmail>();
128 for (ShyEmail shyEmail2 : shyEmailList) { 128 for (ShyEmail shyEmail2 : shyEmailList) {
129 if (CommonUtils.isNotEmpty(shyEmail2.getNotice_type())) { 129 if (CommonUtils.isNotEmpty(shyEmail2.getNotice_type())) {
130 String[] business = shyEmail2.getNotice_type().split(","); 130 String[] business = shyEmail2.getNotice_type().split(",");
131 List<String> asList = Arrays.asList(business); 131 List<String> asList = Arrays.asList(business);
132 if (asList.contains(emailSendType + "")) { 132 if (asList.contains(emailSendType + "")) {
133 - emailList.add(shyEmail2.getEmail()); 133 + emailList.add(shyEmail2);
134 } 134 }
135 } 135 }
136 } 136 }
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
@@ -103,6 +103,17 @@ public class CommonConst { @@ -103,6 +103,17 @@ public class CommonConst {
103 103
104 //白名单设置 104 //白名单设置
105 public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\",\"4\":\"频道业务\",\"5\":\"直播申请业务\"}"); 105 public static JSONObject BUSINESS = JSONObject.parseObject("{\"1\":\"点播业务\",\"2\":\"评论业务\",\"3\":\"图文业务\",\"4\":\"频道业务\",\"5\":\"直播申请业务\"}");
  106 +
  107 + /**
  108 + * 弹窗消息:频道
  109 + */
  110 + public static Integer NOTICE_CHANNAL = 1;
  111 +
  112 + /**
  113 + * 弹窗消息:直播申请
  114 + */
  115 + public static Integer NOTICE_LIVEAPPLY = 2;
  116 +
106 //通知消息设置 117 //通知消息设置
107 public static JSONObject NOTICE = JSONObject.parseObject("{\"1\":\"频道通知\",\"2\":\"直播申请通知\"}"); 118 public static JSONObject NOTICE = JSONObject.parseObject("{\"1\":\"频道通知\",\"2\":\"直播申请通知\"}");
108 119
src/main/resources/templates/common/head.html
@@ -133,7 +133,7 @@ @@ -133,7 +133,7 @@
133 },1000); 133 },1000);
134 }); 134 });
135 135
136 - function notice_liveApply(){ 136 + function notice_channel(){
137 $.ajax({ 137 $.ajax({
138 type:'get', 138 type:'get',
139 dataType:'json', 139 dataType:'json',
@@ -146,7 +146,7 @@ @@ -146,7 +146,7 @@
146 } 146 }
147 }); 147 });
148 } 148 }
149 - function notice_channel(){ 149 + function notice_liveApply(){
150 $.ajax({ 150 $.ajax({
151 type:'get', 151 type:'get',
152 dataType:'json', 152 dataType:'json',