Commit 877f22a087a1750c441339cd33f8fefe14a6b763
1 parent
1dc9937f
新增邮件消息管理功能,邮件发送人员的动态实现
Showing
13 changed files
with
1072 additions
and
69 deletions
src/main/java/com/cnlive/shenhe/api/LiveApplyControllerApi.java
| @@ -108,7 +108,7 @@ public class LiveApplyControllerApi { | @@ -108,7 +108,7 @@ public class LiveApplyControllerApi { | ||
| 108 | shyliveApply.setCallback(callback);//设置回调地址 | 108 | shyliveApply.setCallback(callback);//设置回调地址 |
| 109 | shyliveApply.setReceive(CommonConst.RECEIVE_BEFORE); | 109 | shyliveApply.setReceive(CommonConst.RECEIVE_BEFORE); |
| 110 | shyliveApply.setShenhe_state(CommonConst.AUDIT_INTT); | 110 | shyliveApply.setShenhe_state(CommonConst.AUDIT_INTT); |
| 111 | - shyliveApply.setNotice_jishu(CommonConst.NOTICE_INTT); | 111 | + shyliveApply.setEmail_notice_state(CommonConst.NOTICE_INTT); |
| 112 | shyliveApply.setUpdater(null); | 112 | shyliveApply.setUpdater(null); |
| 113 | shyliveApply.setAuditor(null); | 113 | shyliveApply.setAuditor(null); |
| 114 | shyliveApply.setUpdated_at(CommonUtils.getCurrentTime());//更新时间 | 114 | shyliveApply.setUpdated_at(CommonUtils.getCurrentTime());//更新时间 |
| @@ -138,11 +138,11 @@ public class LiveApplyControllerApi { | @@ -138,11 +138,11 @@ public class LiveApplyControllerApi { | ||
| 138 | liveApplyServiceImpl.getShenheType(shyliveApply1);//获取审核类型 | 138 | liveApplyServiceImpl.getShenheType(shyliveApply1);//获取审核类型 |
| 139 | shyliveApply1.setReceive(CommonConst.RECEIVE_BEFORE); | 139 | shyliveApply1.setReceive(CommonConst.RECEIVE_BEFORE); |
| 140 | shyliveApply1.setShenhe_state(CommonConst.AUDIT_INTT); | 140 | shyliveApply1.setShenhe_state(CommonConst.AUDIT_INTT); |
| 141 | - shyliveApply1.setNotice_jishu(CommonConst.NOTICE_INTT); | 141 | + shyliveApply1.setEmail_notice_state(CommonConst.NOTICE_INTT); |
| 142 | shyliveApply1.setUpdater(null); | 142 | shyliveApply1.setUpdater(null); |
| 143 | shyliveApply1.setAuditor(null); | 143 | shyliveApply1.setAuditor(null); |
| 144 | shyliveApply1.setShenhe_msg(null); | 144 | shyliveApply1.setShenhe_msg(null); |
| 145 | - shyliveApply1.setNotice_msg(null); | 145 | + shyliveApply1.setEmail_notice_msg(""); |
| 146 | shyliveApply1.setCreated_at(CommonUtils.getCurrentTime());//创建时间 | 146 | shyliveApply1.setCreated_at(CommonUtils.getCurrentTime());//创建时间 |
| 147 | shyliveApply1.setUpdated_at(CommonUtils.getCurrentTime());//更新时间 | 147 | shyliveApply1.setUpdated_at(CommonUtils.getCurrentTime());//更新时间 |
| 148 | 148 |
src/main/java/com/cnlive/shenhe/controller/EmailController.java
0 → 100644
| 1 | +package com.cnlive.shenhe.controller; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 5 | +import com.cnlive.shenhe.bean.ResponseBean; | ||
| 6 | +import com.cnlive.shenhe.bean.SessionUser; | ||
| 7 | +import com.cnlive.shenhe.entity.ShyEmail; | ||
| 8 | +import com.cnlive.shenhe.entity.ShySites; | ||
| 9 | +import com.cnlive.shenhe.entity.ShyUsers; | ||
| 10 | +import com.cnlive.shenhe.entity.ShyUsersfree; | ||
| 11 | +import com.cnlive.shenhe.serviceImpl.EmailServiceImpl; | ||
| 12 | +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | ||
| 13 | +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | ||
| 14 | +import com.cnlive.shenhe.utils.CommonConst; | ||
| 15 | +import com.cnlive.shenhe.utils.CommonUtils; | ||
| 16 | +import com.github.pagehelper.PageInfo; | ||
| 17 | + | ||
| 18 | +import org.jasig.cas.client.authentication.AttributePrincipal; | ||
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 20 | +import org.springframework.stereotype.Controller; | ||
| 21 | +import org.springframework.ui.Model; | ||
| 22 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 23 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 24 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 25 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 26 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 27 | + | ||
| 28 | +import java.util.HashMap; | ||
| 29 | +import java.util.List; | ||
| 30 | +import java.util.Map; | ||
| 31 | + | ||
| 32 | +import javax.print.attribute.HashAttributeSet; | ||
| 33 | +import javax.servlet.http.HttpServletRequest; | ||
| 34 | +import javax.servlet.http.HttpSession; | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * @Auther: liwei | ||
| 38 | + * @Date: 2019/08/20 14:22 | ||
| 39 | + * @Description: | ||
| 40 | + */ | ||
| 41 | +@Controller | ||
| 42 | +@RequestMapping("/email") | ||
| 43 | +public class EmailController { | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + EmailServiceImpl emailServiceImpl; | ||
| 47 | + @Autowired | ||
| 48 | + SitesServiceImpl sitesService; | ||
| 49 | + | ||
| 50 | + @Autowired | ||
| 51 | + UsersServiceImpl usersService; | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + @GetMapping(value = "/page") | ||
| 55 | + public String page(Model model, Integer page, Integer pageSize, String orderByClause, | ||
| 56 | + String remark,String email, HttpSession session) { | ||
| 57 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 58 | + if(CommonUtils.isNull(sessionUser)){ | ||
| 59 | + return "redirect:/users/login"; | ||
| 60 | + } | ||
| 61 | + if (CommonUtils.isNull(page)) page = 1; | ||
| 62 | + if (CommonUtils.isNull(pageSize)) pageSize = 10; | ||
| 63 | + PageInfo<ShyEmail> emailPage = emailServiceImpl.getPage(page, pageSize, orderByClause, remark,email); | ||
| 64 | + List<ShyEmail> list = emailPage.getList(); | ||
| 65 | + JSONObject email_message = CommonConst.EMAIL_MESSAGE; | ||
| 66 | + if (!list.isEmpty()) { | ||
| 67 | + for (ShyEmail shyEmail : list) { | ||
| 68 | + //获取更新人的名称 | ||
| 69 | + String updater=""; | ||
| 70 | + if (CommonUtils.isNotEmpty(shyEmail.getUpdater())) { | ||
| 71 | + ShyUsers user = new ShyUsers(); | ||
| 72 | + user.setUser_id(shyEmail.getUpdater()); | ||
| 73 | + user = usersService.select(user); | ||
| 74 | + if (CommonUtils.isNotNull(user)) { | ||
| 75 | + String email_add = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail(); | ||
| 76 | + String userName = CommonUtils.isEmpty(user.getUsername()) ? email_add : user.getUsername(); | ||
| 77 | + updater = userName; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + shyEmail.setUpdater(updater); | ||
| 81 | + | ||
| 82 | + //获取邮件消息类型名称 | ||
| 83 | + String email_type_name=shyEmail.getNotice_type(); | ||
| 84 | + if(CommonUtils.isNotEmpty(email_type_name)){ | ||
| 85 | + for (String bkey : email_message.keySet()) { | ||
| 86 | + email_type_name = email_type_name.replace(bkey, email_message.getString(bkey)); | ||
| 87 | + } | ||
| 88 | + }else{ | ||
| 89 | + email_type_name="无"; | ||
| 90 | + } | ||
| 91 | + shyEmail.setEmail_type_name(email_type_name); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + model.addAttribute("emailPage", emailPage); | ||
| 95 | + model.addAttribute("pageSize", pageSize); | ||
| 96 | + model.addAttribute("email_message", email_message); | ||
| 97 | + return "page/email.html"; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @PostMapping("/updateState") | ||
| 101 | + @ResponseBody | ||
| 102 | + public ResponseBean updateState(Integer id, Boolean isEnable, HttpSession session) { | ||
| 103 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 104 | + Integer n = emailServiceImpl.updateState(id, isEnable,sessionUser.getUserId()); | ||
| 105 | + if(n>0){ | ||
| 106 | + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "当前用户"+(isEnable==true?"启用":"禁用")+"成功"); | ||
| 107 | + } | ||
| 108 | + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试"); | ||
| 109 | + } | ||
| 110 | + @PostMapping("/deleted") | ||
| 111 | + @ResponseBody | ||
| 112 | + public ResponseBean deleted(Integer id,HttpSession session) { | ||
| 113 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 114 | + Integer n = emailServiceImpl.deleted(id, sessionUser.getUserId()); | ||
| 115 | + if(n>0){ | ||
| 116 | + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "数据删除成功"); | ||
| 117 | + } | ||
| 118 | + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试"); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + | ||
| 122 | + | ||
| 123 | + @PostMapping(value = "/write") | ||
| 124 | + public String write(Integer id,String email,String remark, String[] write_business, HttpSession session, String redirect_url) { | ||
| 125 | + if(CommonUtils.isEmpty(email)&&CommonUtils.isEmpty(remark)){ | ||
| 126 | + return "error.html"; | ||
| 127 | + } | ||
| 128 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 129 | + String write = ""; | ||
| 130 | + if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { | ||
| 131 | + for (String w : write_business) { | ||
| 132 | + write = write + "," + w; | ||
| 133 | + } | ||
| 134 | + write = write.substring(1); | ||
| 135 | + } | ||
| 136 | + boolean success = emailServiceImpl.update(id,email,remark,write,sessionUser.getUserId()); | ||
| 137 | + if (success) { | ||
| 138 | + return "redirect:" + redirect_url; | ||
| 139 | + } else { | ||
| 140 | + return "error.html"; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | +} |
src/main/java/com/cnlive/shenhe/controller/UsersFreeController.java
| @@ -104,9 +104,6 @@ public class UsersFreeController { | @@ -104,9 +104,6 @@ public class UsersFreeController { | ||
| 104 | if(CommonUtils.isEmpty(userId)&&CommonUtils.isEmpty(userMobile)){ | 104 | if(CommonUtils.isEmpty(userId)&&CommonUtils.isEmpty(userMobile)){ |
| 105 | return "error.html"; | 105 | return "error.html"; |
| 106 | } | 106 | } |
| 107 | - if(CommonUtils.isNull(write_business)){ | ||
| 108 | - return "error.html"; | ||
| 109 | - } | ||
| 110 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | 107 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 111 | String write = ""; | 108 | String write = ""; |
| 112 | if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { | 109 | if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { |
src/main/java/com/cnlive/shenhe/entity/ShyEmail.java
0 → 100644
| 1 | +package com.cnlive.shenhe.entity; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | +import javax.persistence.*; | ||
| 5 | + | ||
| 6 | +@Table(name = "shy_email") | ||
| 7 | +public class ShyEmail { | ||
| 8 | + /** | ||
| 9 | + * id | ||
| 10 | + */ | ||
| 11 | + @Id | ||
| 12 | + private Integer id; | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * email地址 | ||
| 16 | + */ | ||
| 17 | + private String email; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 备注 | ||
| 21 | + */ | ||
| 22 | + private String remark; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 通知类型,逗号分隔:1、直播申请通知 | ||
| 26 | + */ | ||
| 27 | + private String notice_type; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 是否启用,0:未启用,1:启用 | ||
| 31 | + */ | ||
| 32 | + private Boolean is_enable; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 是否删除,0:未删除,1:已删除 | ||
| 36 | + */ | ||
| 37 | + private Boolean is_delete; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 更新人 | ||
| 41 | + */ | ||
| 42 | + private String updater; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 创建时间 | ||
| 46 | + */ | ||
| 47 | + private Date created_at; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 更新时间 | ||
| 51 | + */ | ||
| 52 | + private Date updated_at; | ||
| 53 | + | ||
| 54 | + @Transient | ||
| 55 | + private String email_type_name; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 获取id | ||
| 59 | + * | ||
| 60 | + * @return id - id | ||
| 61 | + */ | ||
| 62 | + public Integer getId() { | ||
| 63 | + return id; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 设置id | ||
| 68 | + * | ||
| 69 | + * @param id id | ||
| 70 | + */ | ||
| 71 | + public void setId(Integer id) { | ||
| 72 | + this.id = id; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 获取email地址 | ||
| 77 | + * | ||
| 78 | + * @return email - email地址 | ||
| 79 | + */ | ||
| 80 | + public String getEmail() { | ||
| 81 | + return email; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 设置email地址 | ||
| 86 | + * | ||
| 87 | + * @param email email地址 | ||
| 88 | + */ | ||
| 89 | + public void setEmail(String email) { | ||
| 90 | + this.email = email; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 获取备注 | ||
| 95 | + * | ||
| 96 | + * @return remark - 备注 | ||
| 97 | + */ | ||
| 98 | + public String getRemark() { | ||
| 99 | + return remark; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * 设置备注 | ||
| 104 | + * | ||
| 105 | + * @param remark 备注 | ||
| 106 | + */ | ||
| 107 | + public void setRemark(String remark) { | ||
| 108 | + this.remark = remark; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 获取通知类型,逗号分隔:1、直播申请通知 | ||
| 113 | + * | ||
| 114 | + * @return notice_type - 通知类型,逗号分隔:1、直播申请通知 | ||
| 115 | + */ | ||
| 116 | + public String getNotice_type() { | ||
| 117 | + return notice_type; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * 设置通知类型,逗号分隔:1、直播申请通知 | ||
| 122 | + * | ||
| 123 | + * @param notice_type 通知类型,逗号分隔:1、直播申请通知 | ||
| 124 | + */ | ||
| 125 | + public void setNotice_type(String notice_type) { | ||
| 126 | + this.notice_type = notice_type; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 获取是否启用,0:未启用,1:启用 | ||
| 131 | + * | ||
| 132 | + * @return is_enable - 是否启用,0:未启用,1:启用 | ||
| 133 | + */ | ||
| 134 | + public Boolean getIs_enable() { | ||
| 135 | + return is_enable; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * 设置是否启用,0:未启用,1:启用 | ||
| 140 | + * | ||
| 141 | + * @param is_enable 是否启用,0:未启用,1:启用 | ||
| 142 | + */ | ||
| 143 | + public void setIs_enable(Boolean is_enable) { | ||
| 144 | + this.is_enable = is_enable; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * 获取是否删除,0:未删除,1:已删除 | ||
| 149 | + * | ||
| 150 | + * @return is_delete - 是否删除,0:未删除,1:已删除 | ||
| 151 | + */ | ||
| 152 | + public Boolean getIs_delete() { | ||
| 153 | + return is_delete; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * 设置是否删除,0:未删除,1:已删除 | ||
| 158 | + * | ||
| 159 | + * @param is_delete 是否删除,0:未删除,1:已删除 | ||
| 160 | + */ | ||
| 161 | + public void setIs_delete(Boolean is_delete) { | ||
| 162 | + this.is_delete = is_delete; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + /** | ||
| 166 | + * 获取更新人 | ||
| 167 | + * | ||
| 168 | + * @return updater - 更新人 | ||
| 169 | + */ | ||
| 170 | + public String getUpdater() { | ||
| 171 | + return updater; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * 设置更新人 | ||
| 176 | + * | ||
| 177 | + * @param updater 更新人 | ||
| 178 | + */ | ||
| 179 | + public void setUpdater(String updater) { | ||
| 180 | + this.updater = updater; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + /** | ||
| 184 | + * 获取创建时间 | ||
| 185 | + * | ||
| 186 | + * @return created_at - 创建时间 | ||
| 187 | + */ | ||
| 188 | + public Date getCreated_at() { | ||
| 189 | + return created_at; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + /** | ||
| 193 | + * 设置创建时间 | ||
| 194 | + * | ||
| 195 | + * @param created_at 创建时间 | ||
| 196 | + */ | ||
| 197 | + public void setCreated_at(Date created_at) { | ||
| 198 | + this.created_at = created_at; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + /** | ||
| 202 | + * 获取更新时间 | ||
| 203 | + * | ||
| 204 | + * @return updated_at - 更新时间 | ||
| 205 | + */ | ||
| 206 | + public Date getUpdated_at() { | ||
| 207 | + return updated_at; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + /** | ||
| 211 | + * 设置更新时间 | ||
| 212 | + * | ||
| 213 | + * @param updated_at 更新时间 | ||
| 214 | + */ | ||
| 215 | + public void setUpdated_at(Date updated_at) { | ||
| 216 | + this.updated_at = updated_at; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + public String getEmail_type_name() { | ||
| 220 | + return email_type_name; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public void setEmail_type_name(String email_type_name) { | ||
| 224 | + this.email_type_name = email_type_name; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + | ||
| 228 | +} | ||
| 0 | \ No newline at end of file | 229 | \ No newline at end of file |
src/main/java/com/cnlive/shenhe/entity/ShyLiveapply.java
| @@ -132,14 +132,14 @@ public class ShyLiveapply { | @@ -132,14 +132,14 @@ public class ShyLiveapply { | ||
| 132 | private String shenhe_msg; | 132 | private String shenhe_msg; |
| 133 | 133 | ||
| 134 | /** | 134 | /** |
| 135 | - * 技术通知 1未通知 2已通知 3通知失败 | 135 | + * 邮件通知状态 1未通知 2已通知 3通知失败 |
| 136 | */ | 136 | */ |
| 137 | - private Integer notice_jishu; | 137 | + private Integer email_notice_state; |
| 138 | 138 | ||
| 139 | /** | 139 | /** |
| 140 | - * 通知消息 | 140 | + * 邮件通知消息 |
| 141 | */ | 141 | */ |
| 142 | - private String notice_msg; | 142 | + private String email_notice_msg; |
| 143 | 143 | ||
| 144 | /** | 144 | /** |
| 145 | * 创建时间 | 145 | * 创建时间 |
| @@ -610,39 +610,39 @@ public class ShyLiveapply { | @@ -610,39 +610,39 @@ public class ShyLiveapply { | ||
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | /** | 612 | /** |
| 613 | - * 获取技术通知 1未通知 2已通知 3通知失败 | 613 | + * 获取邮件通知状态 1未通知 2已通知 3通知失败 |
| 614 | * | 614 | * |
| 615 | - * @return notice_jishu - 技术通知 1未通知 2已通知 3通知失败 | 615 | + * @return email_notice_state - 邮件通知状态 1未通知 2已通知 3通知失败 |
| 616 | */ | 616 | */ |
| 617 | - public Integer getNotice_jishu() { | ||
| 618 | - return notice_jishu; | 617 | + public Integer getEmail_notice_state() { |
| 618 | + return email_notice_state; | ||
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | /** | 621 | /** |
| 622 | - * 设置技术通知 1未通知 2已通知 3通知失败 | 622 | + * 设置邮件通知状态 1未通知 2已通知 3通知失败 |
| 623 | * | 623 | * |
| 624 | - * @param notice_jishu 技术通知 1未通知 2已通知 3通知失败 | 624 | + * @param email_notice_state 邮件通知状态 1未通知 2已通知 3通知失败 |
| 625 | */ | 625 | */ |
| 626 | - public void setNotice_jishu(Integer notice_jishu) { | ||
| 627 | - this.notice_jishu = notice_jishu; | 626 | + public void setEmail_notice_state(Integer email_notice_state) { |
| 627 | + this.email_notice_state = email_notice_state; | ||
| 628 | } | 628 | } |
| 629 | 629 | ||
| 630 | /** | 630 | /** |
| 631 | - * 获取通知消息 | 631 | + * 获取邮件通知消息 |
| 632 | * | 632 | * |
| 633 | - * @return notice_msg - 通知消息 | 633 | + * @return email_notice_msg - 邮件通知消息 |
| 634 | */ | 634 | */ |
| 635 | - public String getNotice_msg() { | ||
| 636 | - return notice_msg; | 635 | + public String getEmail_notice_msg() { |
| 636 | + return email_notice_msg; | ||
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | /** | 639 | /** |
| 640 | - * 设置通知消息 | 640 | + * 设置邮件通知消息 |
| 641 | * | 641 | * |
| 642 | - * @param notice_msg 通知消息 | 642 | + * @param email_notice_msg 邮件通知消息 |
| 643 | */ | 643 | */ |
| 644 | - public void setNotice_msg(String notice_msg) { | ||
| 645 | - this.notice_msg = notice_msg; | 644 | + public void setEmail_notice_msg(String email_notice_msg) { |
| 645 | + this.email_notice_msg = email_notice_msg; | ||
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | /** | 648 | /** |
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
| @@ -5,11 +5,13 @@ import com.cnlive.shenhe.bean.ErrorEnum; | @@ -5,11 +5,13 @@ import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 5 | import com.cnlive.shenhe.bean.ResponseBean; | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | import com.cnlive.shenhe.entity.ShyChannel; | 6 | import com.cnlive.shenhe.entity.ShyChannel; |
| 7 | import com.cnlive.shenhe.entity.ShyComments; | 7 | import com.cnlive.shenhe.entity.ShyComments; |
| 8 | +import com.cnlive.shenhe.entity.ShyEmail; | ||
| 8 | import com.cnlive.shenhe.entity.ShyLiveapply; | 9 | import com.cnlive.shenhe.entity.ShyLiveapply; |
| 9 | import com.cnlive.shenhe.entity.ShyVideos; | 10 | import com.cnlive.shenhe.entity.ShyVideos; |
| 10 | import com.cnlive.shenhe.mapper.ShyLiveapplyMapper; | 11 | import com.cnlive.shenhe.mapper.ShyLiveapplyMapper; |
| 11 | import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl; | 12 | import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl; |
| 12 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; | 13 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; |
| 14 | +import com.cnlive.shenhe.serviceImpl.EmailServiceImpl; | ||
| 13 | import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl; | 15 | import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl; |
| 14 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | 16 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; |
| 15 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | 17 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; |
| @@ -52,7 +54,8 @@ public class LiveApplyJob { | @@ -52,7 +54,8 @@ public class LiveApplyJob { | ||
| 52 | 54 | ||
| 53 | @Autowired | 55 | @Autowired |
| 54 | UsersServiceImpl usersService; | 56 | UsersServiceImpl usersService; |
| 55 | - | 57 | + @Autowired |
| 58 | + EmailServiceImpl emailServiceImpl; | ||
| 56 | 59 | ||
| 57 | @Scheduled(fixedRate = 60 * 1000) | 60 | @Scheduled(fixedRate = 60 * 1000) |
| 58 | public void updateLiveApply() { | 61 | public void updateLiveApply() { |
| @@ -77,54 +80,61 @@ public class LiveApplyJob { | @@ -77,54 +80,61 @@ public class LiveApplyJob { | ||
| 77 | Example example = new Example(ShyLiveapply.class); | 80 | Example example = new Example(ShyLiveapply.class); |
| 78 | Example.Criteria criteria = example.createCriteria(); | 81 | Example.Criteria criteria = example.createCriteria(); |
| 79 | criteria.andEqualTo("shenhe_state", CommonConst.AUDIT_SUCCESS); | 82 | criteria.andEqualTo("shenhe_state", CommonConst.AUDIT_SUCCESS); |
| 80 | - criteria.andNotEqualTo("notice_jishu", CommonConst.NOTICE_SUCCESS); | 83 | + criteria.andNotEqualTo("notice_jishu", CommonConst.NOTICE_SUCCESS);//状态不等于已通知 |
| 81 | List<ShyLiveapply> shyLiveApplyList = shyLiveApplyMapper.selectByExample(example); | 84 | List<ShyLiveapply> shyLiveApplyList = shyLiveApplyMapper.selectByExample(example); |
| 82 | if (shyLiveApplyList.size() > 0) { | 85 | if (shyLiveApplyList.size() > 0) { |
| 83 | logger.info("直播申请邮件通知开始,共"+shyLiveApplyList.size()+"个"); | 86 | logger.info("直播申请邮件通知开始,共"+shyLiveApplyList.size()+"个"); |
| 84 | String app_id = "769_jetja50p18"; //开发者对应的id,与app_key相对应 | 87 | String app_id = "769_jetja50p18"; //开发者对应的id,与app_key相对应 |
| 85 | String app_key = "ad101b9152817a79b5c33c3617b96ff91385096ff3b4ba"; //开发者帐号对应的key. 请开发者谨慎保管此值。 | 88 | String app_key = "ad101b9152817a79b5c33c3617b96ff91385096ff3b4ba"; //开发者帐号对应的key. 请开发者谨慎保管此值。 |
| 86 | String URL = "http://sms.cnlive.com/CnliveM3/email/sendMoreVarEmail.action";//调用邮件发送服务器的地址 | 89 | String URL = "http://sms.cnlive.com/CnliveM3/email/sendMoreVarEmail.action";//调用邮件发送服务器的地址 |
| 90 | + List<String> shyEmailList=emailServiceImpl.getEmailSendList(CommonConst.EMAIL_LIVEAPPLY); | ||
| 87 | for(ShyLiveapply liveApply : shyLiveApplyList){ | 91 | for(ShyLiveapply liveApply : shyLiveApplyList){ |
| 88 | - String startTime=CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss"); | ||
| 89 | - String endTime=CommonUtils.isNotNull(liveApply.getPre_end_time())?CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss"):"待定"; | ||
| 90 | - String content = liveApply.getSender()+"__"+liveApply.getMobile()+"__"+liveApply.getOrganization()+"__"+liveApply.getTheme()+"__"+startTime+"__"+endTime+"__"+liveApply.getLive_place()+"__"+liveApply.getPush_url()+"__"+liveApply.getPull_url(); | ||
| 91 | - String emailAddr = "642522156@qq.com"; | ||
| 92 | - String title = "新直播开播申请"; | ||
| 93 | - String templateId = "4017"; | ||
| 94 | - Integer notice_jishu = CommonConst.NOTICE_INTT;//初始化通知状态 | ||
| 95 | - String notice_msg = "";//初始化通知消息 | ||
| 96 | - Map<String, String> params = new HashMap<>(); | ||
| 97 | - params.put("appId", app_id); | ||
| 98 | - params.put("emailAddr", emailAddr); | ||
| 99 | - params.put("title",title ); | ||
| 100 | - params.put("content", content); | ||
| 101 | - params.put("templateId", templateId); | ||
| 102 | - params.put("sign", OpenUtil.sign(params,app_key)); | ||
| 103 | - HttpUtil httpUtil = HttpUtil.init(); | ||
| 104 | - httpUtil.setParamMap(params); | ||
| 105 | - try { | ||
| 106 | - Map<String, String> post = httpUtil.post(URL); | ||
| 107 | - logger.info(post.get("result")); | ||
| 108 | - JSONObject result=JSONObject.parseObject(post.get("result")); | ||
| 109 | - if (result == null) { | ||
| 110 | - notice_jishu=CommonConst.NOTICE_FAIL; | ||
| 111 | - notice_msg="邮件服务器调用失败,result为空"; | ||
| 112 | - } | ||
| 113 | - Integer code = result.getInteger("errorCode"); | ||
| 114 | - if (code != 0) { | ||
| 115 | - notice_jishu=CommonConst.NOTICE_FAIL; | ||
| 116 | - notice_msg="邮件服务器调用失败,result返回消息为:"+result.getString("errorMessage"); | ||
| 117 | - }else{ | ||
| 118 | - notice_jishu=CommonConst.NOTICE_SUCCESS; | ||
| 119 | - notice_msg="邮件发送成功"; | ||
| 120 | - } | ||
| 121 | - } catch (Exception e) { | ||
| 122 | - notice_jishu=CommonConst.NOTICE_FAIL; | ||
| 123 | - notice_msg="邮件服务器调用失败,服务器报错了"; | ||
| 124 | - } | 92 | + Integer notice_state = liveApply.getEmail_notice_state();//初始化通知状态 |
| 93 | + String notice_msg = liveApply.getEmail_notice_msg();//初始化通知消息 | ||
| 94 | + for(String emailAddr:shyEmailList){//循环需要发送邮件的邮箱 | ||
| 95 | + String startTime=CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss"); | ||
| 96 | + String endTime=CommonUtils.isNotNull(liveApply.getPre_end_time())?CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss"):"待定"; | ||
| 97 | + String content = liveApply.getSender()+"__"+liveApply.getMobile()+"__"+liveApply.getOrganization()+"__"+liveApply.getTheme()+"__"+startTime+"__"+endTime+"__"+liveApply.getLive_place()+"__"+liveApply.getPush_url()+"__"+liveApply.getPull_url(); | ||
| 98 | + String dateTime=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");//获取一个格式化后的当前时间 | ||
| 99 | +// String emailAddr = "642522156@qq.com"; | ||
| 100 | + String title = "新直播开播申请"; | ||
| 101 | + String templateId = "4017"; | ||
| 102 | + Map<String, String> params = new HashMap<>(); | ||
| 103 | + params.put("appId", app_id); | ||
| 104 | + params.put("emailAddr", emailAddr); | ||
| 105 | + params.put("title",title ); | ||
| 106 | + params.put("content", content); | ||
| 107 | + params.put("templateId", templateId); | ||
| 108 | + params.put("sign", OpenUtil.sign(params,app_key)); | ||
| 109 | + HttpUtil httpUtil = HttpUtil.init(); | ||
| 110 | + httpUtil.setParamMap(params); | ||
| 111 | + try { | ||
| 112 | + Map<String, String> post = httpUtil.post(URL); | ||
| 113 | + logger.info(post.get("result")); | ||
| 114 | + JSONObject result=JSONObject.parseObject(post.get("result")); | ||
| 115 | + if (result == null) { | ||
| 116 | + notice_state=CommonConst.NOTICE_FAIL; | ||
| 117 | + notice_msg=notice_msg+","+dateTime+" 邮件服务器调用失败,result为空"; | ||
| 118 | + break; | ||
| 119 | + } | ||
| 120 | + Integer code = result.getInteger("errorCode"); | ||
| 121 | + if (code != 0) { | ||
| 122 | + notice_state=CommonConst.NOTICE_FAIL; | ||
| 123 | + notice_msg=notice_msg+","+dateTime+" 邮件服务器调用失败,result返回消息为:"+result.getString("errorMessage"); | ||
| 124 | + break; | ||
| 125 | + }else{ | ||
| 126 | + notice_state=CommonConst.NOTICE_SUCCESS; | ||
| 127 | + notice_msg=notice_msg+","+dateTime+" 邮件"+emailAddr+"发送成功"; | ||
| 128 | + } | ||
| 129 | + } catch (Exception e) { | ||
| 130 | + notice_state=CommonConst.NOTICE_FAIL; | ||
| 131 | + notice_msg=notice_msg+","+dateTime+" 邮件服务器调用失败,服务器报错了"; | ||
| 132 | + break; | ||
| 133 | + } | ||
| 134 | + } | ||
| 125 | 135 | ||
| 126 | - liveApply.setNotice_jishu(notice_jishu); | ||
| 127 | - liveApply.setNotice_msg(notice_msg); | 136 | + liveApply.setEmail_notice_state(notice_state); |
| 137 | + liveApply.setEmail_notice_msg(notice_msg); | ||
| 128 | liveApplyServiceImpl.updateshyLiveApply(liveApply); | 138 | liveApplyServiceImpl.updateshyLiveApply(liveApply); |
| 129 | } | 139 | } |
| 130 | } | 140 | } |
src/main/java/com/cnlive/shenhe/mapper/ShyEmailMapper.java
0 → 100644
src/main/java/com/cnlive/shenhe/serviceImpl/EmailServiceImpl.java
0 → 100644
| 1 | +package com.cnlive.shenhe.serviceImpl; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.cnlive.shenhe.entity.ShyEmail; | ||
| 5 | +import com.cnlive.shenhe.entity.ShySites; | ||
| 6 | +import com.cnlive.shenhe.entity.ShyUsers; | ||
| 7 | +import com.cnlive.shenhe.entity.ShyUsersfree; | ||
| 8 | +import com.cnlive.shenhe.mapper.ShyEmailMapper; | ||
| 9 | +import com.cnlive.shenhe.mapper.ShyUsersMapper; | ||
| 10 | +import com.cnlive.shenhe.mapper.ShyUsersfreeMapper; | ||
| 11 | +import com.cnlive.shenhe.utils.AuditPass; | ||
| 12 | +import com.cnlive.shenhe.utils.CommonUtils; | ||
| 13 | +import com.github.pagehelper.PageHelper; | ||
| 14 | +import com.github.pagehelper.PageInfo; | ||
| 15 | + | ||
| 16 | +import java.util.ArrayList; | ||
| 17 | +import java.util.Arrays; | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import org.slf4j.Logger; | ||
| 21 | +import org.slf4j.LoggerFactory; | ||
| 22 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 23 | +import org.springframework.stereotype.Service; | ||
| 24 | +import tk.mybatis.mapper.entity.Example; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * @Auther: 周伟鹏 | ||
| 28 | + * @Date: 2018/11/29 14:23 | ||
| 29 | + * @Description: | ||
| 30 | + */ | ||
| 31 | +@Service | ||
| 32 | +public class EmailServiceImpl { | ||
| 33 | + private static Logger logger = LoggerFactory.getLogger(EmailServiceImpl.class); | ||
| 34 | + @Autowired | ||
| 35 | + ShyEmailMapper shyEmailMapper; | ||
| 36 | + | ||
| 37 | + public PageInfo<ShyEmail> getPage(Integer page, Integer pageSize, String orderByClause, | ||
| 38 | + String remark,String email) { | ||
| 39 | + Example example = new Example(ShyEmail.class); | ||
| 40 | + Example.Criteria criteria = example.createCriteria(); | ||
| 41 | + if (CommonUtils.isNotEmpty(orderByClause)) { | ||
| 42 | + example.setOrderByClause(orderByClause); | ||
| 43 | + }else{ | ||
| 44 | + example.setOrderByClause("created_at desc"); | ||
| 45 | + } | ||
| 46 | + if (CommonUtils.isNotEmpty(remark)) { | ||
| 47 | + criteria.andLike("remark", "%" + remark + "%"); | ||
| 48 | + } | ||
| 49 | + if (CommonUtils.isNotEmpty(email)) { | ||
| 50 | + criteria.andLike("email", "%" + email + "%"); | ||
| 51 | + } | ||
| 52 | + criteria.andEqualTo("is_delete",false); | ||
| 53 | + PageHelper.startPage(page, pageSize, true); | ||
| 54 | + List<ShyEmail> ShyEmailList = shyEmailMapper.selectByExample(example); | ||
| 55 | + PageInfo<ShyEmail> pageInfo = new PageInfo<ShyEmail>(ShyEmailList); | ||
| 56 | + return pageInfo; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public ShyEmail get(Integer id) { | ||
| 60 | + return shyEmailMapper.selectByPrimaryKey(id); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public ShyEmail select(ShyEmail shyEmail) { | ||
| 64 | + return shyEmailMapper.selectOne(shyEmail); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public Integer updateState(Integer id, Boolean isEnable,String userId) { | ||
| 68 | + ShyEmail shyEmail=get(id); | ||
| 69 | + shyEmail.setIs_enable(isEnable); | ||
| 70 | + shyEmail.setUpdater(userId); | ||
| 71 | + shyEmail.setUpdated_at(CommonUtils.getCurrentTime()); | ||
| 72 | + return shyEmailMapper.updateByPrimaryKeySelective(shyEmail); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public Integer deleted(Integer id, String userId) { | ||
| 76 | + ShyEmail shyEmail=get(id); | ||
| 77 | + shyEmail.setUpdater(userId); | ||
| 78 | + shyEmail.setIs_delete(true); | ||
| 79 | + shyEmail.setUpdated_at(CommonUtils.getCurrentTime()); | ||
| 80 | + return shyEmailMapper.updateByPrimaryKeySelective(shyEmail); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public boolean update(Integer id, String email, String remark, String write, String updater) { | ||
| 84 | + | ||
| 85 | + ShyEmail shyEmail = new ShyEmail(); | ||
| 86 | + if (CommonUtils.isNotNull(id)) { | ||
| 87 | + shyEmail.setId(id); | ||
| 88 | + shyEmail = shyEmailMapper.selectOne(shyEmail); | ||
| 89 | + if (shyEmail != null) { | ||
| 90 | + shyEmail.setEmail(email); | ||
| 91 | + shyEmail.setRemark(remark); | ||
| 92 | + shyEmail.setNotice_type(write); | ||
| 93 | + shyEmail.setUpdater(updater); | ||
| 94 | + shyEmail.setUpdated_at(CommonUtils.getCurrentTime()); | ||
| 95 | + int re = shyEmailMapper.updateByPrimaryKeySelective(shyEmail); | ||
| 96 | + if (re != 1) { | ||
| 97 | + return false; | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + } else { | ||
| 101 | + shyEmail.setEmail(email); | ||
| 102 | + shyEmail.setIs_delete(false); | ||
| 103 | + shyEmail.setIs_enable(true); | ||
| 104 | + shyEmail.setNotice_type(write); | ||
| 105 | + shyEmail.setRemark(remark); | ||
| 106 | + shyEmail.setUpdater(updater); | ||
| 107 | + shyEmail.setCreated_at(CommonUtils.getCurrentTime()); | ||
| 108 | + shyEmail.setUpdated_at(CommonUtils.getCurrentTime()); | ||
| 109 | + int re = shyEmailMapper.insertSelective(shyEmail); | ||
| 110 | + if (re != 1) { | ||
| 111 | + return false; | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + return true; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 通过邮件发送类型,获取需要发送邮件的list | ||
| 119 | + * @param emailSendType | ||
| 120 | + * @return | ||
| 121 | + */ | ||
| 122 | + public List<String> getEmailSendList(Integer emailSendType) { | ||
| 123 | + | ||
| 124 | + List<ShyEmail> shyEmailList = shyEmailMapper.selectAll(); | ||
| 125 | + List<String> emailList = new ArrayList<String>(); | ||
| 126 | + for (ShyEmail shyEmail : shyEmailList) { | ||
| 127 | + if (CommonUtils.isNotEmpty(shyEmail.getNotice_type())) { | ||
| 128 | + String[] business = shyEmail.getNotice_type().split(","); | ||
| 129 | + List<String> asList = Arrays.asList(business); | ||
| 130 | + if (asList.contains(emailSendType + "")) { | ||
| 131 | + emailList.add(shyEmail.getEmail()); | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + return emailList; | ||
| 136 | + | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | +} |
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
| @@ -105,6 +105,14 @@ public class CommonConst { | @@ -105,6 +105,14 @@ public class CommonConst { | ||
| 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 | //通知消息设置 | 106 | //通知消息设置 |
| 107 | public static JSONObject NOTICE = JSONObject.parseObject("{\"1\":\"频道通知\",\"2\":\"直播申请通知\"}"); | 107 | public static JSONObject NOTICE = JSONObject.parseObject("{\"1\":\"频道通知\",\"2\":\"直播申请通知\"}"); |
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * 邮件消息:直播申请 | ||
| 111 | + */ | ||
| 112 | + public static Integer EMAIL_LIVEAPPLY = 1; | ||
| 113 | + | ||
| 114 | + //邮件消息设置 | ||
| 115 | + public static JSONObject EMAIL_MESSAGE = JSONObject.parseObject("{\"1\":\"直播申请邮件通知\"}"); | ||
| 108 | 116 | ||
| 109 | /** | 117 | /** |
| 110 | * 抽帧状态:未抽帧 | 118 | * 抽帧状态:未抽帧 |
src/main/resources/mapper/ShyEmailMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="com.cnlive.shenhe.mapper.ShyEmailMapper"> | ||
| 4 | + <resultMap id="BaseResultMap" type="com.cnlive.shenhe.entity.ShyEmail"> | ||
| 5 | + <!-- | ||
| 6 | + WARNING - @mbg.generated | ||
| 7 | + --> | ||
| 8 | + <id column="id" jdbcType="INTEGER" property="id" /> | ||
| 9 | + <result column="email" jdbcType="VARCHAR" property="email" /> | ||
| 10 | + <result column="remark" jdbcType="VARCHAR" property="remark" /> | ||
| 11 | + <result column="notice_type" jdbcType="VARCHAR" property="notice_type" /> | ||
| 12 | + <result column="is_enable" jdbcType="BIT" property="is_enable" /> | ||
| 13 | + <result column="is_delete" jdbcType="BIT" property="is_delete" /> | ||
| 14 | + <result column="updater" jdbcType="VARCHAR" property="updater" /> | ||
| 15 | + <result column="created_at" jdbcType="TIMESTAMP" property="created_at" /> | ||
| 16 | + <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" /> | ||
| 17 | + </resultMap> | ||
| 18 | +</mapper> | ||
| 0 | \ No newline at end of file | 19 | \ No newline at end of file |
src/main/resources/mapper/ShyLiveapplyMapper.xml
| @@ -30,8 +30,8 @@ | @@ -30,8 +30,8 @@ | ||
| 30 | <result column="updater" jdbcType="VARCHAR" property="updater" /> | 30 | <result column="updater" jdbcType="VARCHAR" property="updater" /> |
| 31 | <result column="auditor" jdbcType="VARCHAR" property="auditor" /> | 31 | <result column="auditor" jdbcType="VARCHAR" property="auditor" /> |
| 32 | <result column="shenhe_msg" jdbcType="VARCHAR" property="shenhe_msg" /> | 32 | <result column="shenhe_msg" jdbcType="VARCHAR" property="shenhe_msg" /> |
| 33 | - <result column="notice_jishu" jdbcType="INTEGER" property="notice_jishu" /> | ||
| 34 | - <result column="notice_msg" jdbcType="VARCHAR" property="notice_msg" /> | 33 | + <result column="email_notice_state" jdbcType="INTEGER" property="email_notice_state" /> |
| 34 | + <result column="email_notice_msg" jdbcType="VARCHAR" property="email_notice_msg" /> | ||
| 35 | <result column="created_at" jdbcType="TIMESTAMP" property="created_at" /> | 35 | <result column="created_at" jdbcType="TIMESTAMP" property="created_at" /> |
| 36 | <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" /> | 36 | <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" /> |
| 37 | <result column="simple_content" jdbcType="LONGVARCHAR" property="simple_content" /> | 37 | <result column="simple_content" jdbcType="LONGVARCHAR" property="simple_content" /> |
src/main/resources/templates/common/frame.html
| @@ -91,6 +91,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em" th:text="${session.sessionUser. | @@ -91,6 +91,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em" th:text="${session.sessionUser. | ||
| 91 | <li><a href="/users/page" id="/users/page"> 审核云用户管理</a></li> | 91 | <li><a href="/users/page" id="/users/page"> 审核云用户管理</a></li> |
| 92 | <li><a href="/sites/page" id="/sites/page"> SP白名单管理</a></li> | 92 | <li><a href="/sites/page" id="/sites/page"> SP白名单管理</a></li> |
| 93 | <li><a href="/usersFree/page" id="/usersFree/page"> 用户白名单管理</a></li> | 93 | <li><a href="/usersFree/page" id="/usersFree/page"> 用户白名单管理</a></li> |
| 94 | + <li><a href="/email/page" id="/email/page"> 邮件消息管理</a></li> | ||
| 94 | </ul> | 95 | </ul> |
| 95 | </li> | 96 | </li> |
| 96 | </ul> | 97 | </ul> |
src/main/resources/templates/page/email.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> | ||
| 3 | + | ||
| 4 | +<head th:replace="../templates/common/head::head"></head> | ||
| 5 | +<style type="text/css"> | ||
| 6 | + .fixed-table-toolbar .bs-bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top: 0px;} | ||
| 7 | + .table{margin-bottom:0;} | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + .switch { | ||
| 11 | + position: relative; | ||
| 12 | + display: inline-block; | ||
| 13 | + width: 60px; | ||
| 14 | + height: 34px; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +.switch input {display:none;} | ||
| 18 | + | ||
| 19 | +.slider { | ||
| 20 | + position: absolute; | ||
| 21 | + cursor: pointer; | ||
| 22 | + top: 0; | ||
| 23 | + left: 0; | ||
| 24 | + right: 0; | ||
| 25 | + bottom: 0; | ||
| 26 | + background-color: red; | ||
| 27 | + -webkit-transition: .4s; | ||
| 28 | + transition: .4s; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +.slider:before { | ||
| 32 | + position: absolute; | ||
| 33 | + content: ""; | ||
| 34 | + height: 26px; | ||
| 35 | + width: 26px; | ||
| 36 | + left: 4px; | ||
| 37 | + bottom: 4px; | ||
| 38 | + background-color: white; | ||
| 39 | + -webkit-transition: .4s; | ||
| 40 | + transition: .4s; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +input:checked + .slider { | ||
| 44 | + background-color: #2196F3; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +input:focus + .slider { | ||
| 48 | + box-shadow: 0 0 1px #2196F3; | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +input:checked + .slider:before { | ||
| 52 | + -webkit-transform: translateX(26px); | ||
| 53 | + -ms-transform: translateX(26px); | ||
| 54 | + transform: translateX(26px); | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +/* Rounded sliders */ | ||
| 58 | +.slider.round { | ||
| 59 | + border-radius: 34px; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +.slider.round:before { | ||
| 63 | + border-radius: 50%; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +</style> | ||
| 67 | +<body class="skin-blue sidebar-mini"> | ||
| 68 | + | ||
| 69 | +<div class="wrapper"> | ||
| 70 | + | ||
| 71 | + <div th:replace="../templates/common/frame::frame"></div> | ||
| 72 | + | ||
| 73 | + <div class="content-wrapper" style="min-height: 788px;"> | ||
| 74 | + <section class="content-header"> | ||
| 75 | + <h1> | ||
| 76 | + 邮件消息管理 | ||
| 77 | + </h1> | ||
| 78 | + <ol class="breadcrumb"> | ||
| 79 | + <li>首页</li> | ||
| 80 | + <li>系统管理</li> | ||
| 81 | + <li class="active">邮件消息管理</li> | ||
| 82 | + </ol> | ||
| 83 | + </section> | ||
| 84 | + <section class="content"> | ||
| 85 | + <div class="row"> | ||
| 86 | + <div class="col-xs-12"> | ||
| 87 | + <div class="box box-info"> | ||
| 88 | + <div class="box-body"> | ||
| 89 | + <div class="btn-group margin-bottom " style="padding: 0; width: 98%; float: right;"> | ||
| 90 | + <div class="columns columns-right btn-group "> | ||
| 91 | + <button class="btn btn-success" onclick="javascript:add()" type="button" name="refresh" title="添加" id="email_addS">添加</button> | ||
| 92 | + </div> | ||
| 93 | + <div class="col-md-6 pull-right" style="padding: 0; width: 5%;"> | ||
| 94 | + <button class="btn btn-default" type="button" name="refresh" | ||
| 95 | + title="搜索" id="emailQuery">搜索</button> | ||
| 96 | + </div> | ||
| 97 | + <div class="col-md-6 pull-right" style="padding: 0; width: 20%;"> | ||
| 98 | + <label for="mobile" class="control-label cb-toolbar" | ||
| 99 | + style="font-size: 15px; top: 8px; font-weight: 100;">邮件地址:</label> | ||
| 100 | + <div class="col-sm-7" style="padding: 0;"> | ||
| 101 | + <input class="form-control" type="text" th:value="${param.email}" id="email_query"> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + <div class="col-md-5 pull-right" style="padding: 0; width: 15%;"> | ||
| 105 | + <label for="sp_id" class="control-label cb-toolbar" | ||
| 106 | + style="font-size: 15px; top: 8px; font-weight: 100;">邮件人:</label> | ||
| 107 | + <div class="col-sm-7" style="padding: 0;"> | ||
| 108 | + <input class="form-control" type="text" th:value="${param.remark}" id="remark_query"> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + | ||
| 115 | + <div class="fixed-table-container" style="padding-bottom: 0px;"> | ||
| 116 | + <div class="fixed-table-body"> | ||
| 117 | + <table data-toggle="table" data-pagination="true" data-search="false" data-show-refresh="true" | ||
| 118 | + data-show-toggle="true" data-show-columns="true" data-toolbar="#toolbar" class="table table-hover"> | ||
| 119 | + <thead> | ||
| 120 | + <tr> | ||
| 121 | + <th style="text-align: center; width: 5%;" data-field="sp_id" tabindex="0"> | ||
| 122 | + <div class="th-inner ">ID</div> | ||
| 123 | + <div class="fht-cell"></div> | ||
| 124 | + </th> | ||
| 125 | + <th style="text-align: center; width: 12%;" data-field="sp_id_brief" tabindex="0"> | ||
| 126 | + <div class="th-inner ">邮件地址</div> | ||
| 127 | + <div class="fht-cell"></div> | ||
| 128 | + </th> | ||
| 129 | + <th style="text-align: center; width: 8%;" data-field="type" tabindex="0"> | ||
| 130 | + <div class="th-inner ">邮件人</div> | ||
| 131 | + <div class="fht-cell"></div> | ||
| 132 | + </th> | ||
| 133 | + <th style="text-align: center; width: 12%;" data-field="type" tabindex="0"> | ||
| 134 | + <div class="th-inner ">通知类型</div> | ||
| 135 | + <div class="fht-cell"></div> | ||
| 136 | + </th> | ||
| 137 | + <th style="text-align: center; width: 6%;" data-field="type" tabindex="0"> | ||
| 138 | + <div class="th-inner ">使用状态</div> | ||
| 139 | + <div class="fht-cell"></div> | ||
| 140 | + </th> | ||
| 141 | + <th style="text-align: center; width: 8%;" data-field="type" tabindex="0"> | ||
| 142 | + <div class="th-inner ">修改人</div> | ||
| 143 | + <div class="fht-cell"></div> | ||
| 144 | + </th> | ||
| 145 | + <th style="text-align: center; width: 12%;" data-field="upload_time" tabindex="0"> | ||
| 146 | + <div class="th-inner ">创建时间</div> | ||
| 147 | + <div class="fht-cell"></div> | ||
| 148 | + </th> | ||
| 149 | + <th style="text-align: center; width: 12%;" data-field="updated_at" tabindex="0"> | ||
| 150 | + <div class="th-inner ">更新时间</div> | ||
| 151 | + <div class="fht-cell"></div> | ||
| 152 | + </th> | ||
| 153 | + <th style="text-align: center; width: 10%;" data-field="action" tabindex="0"> | ||
| 154 | + <div class="th-inner ">操作</div> | ||
| 155 | + <div class="fht-cell"></div> | ||
| 156 | + </th> | ||
| 157 | + </tr> | ||
| 158 | + </thead> | ||
| 159 | + <tbody> | ||
| 160 | + <tr th:data-index="${emailStat.index}" th:each="email : ${emailPage.list}"> | ||
| 161 | + <td style="text-align: center; width: 5%;" th:text="${email.id}">82</td> | ||
| 162 | + <td style="text-align: center; width: 12%;" th:text="${email.email}">视讯中国</td> | ||
| 163 | + <td style="text-align: center; width: 8%;" th:text="${email.remark}">用户名</td> | ||
| 164 | + <td style="text-align: center; width: 12%;" th:text="${email.email_type_name}"></td> | ||
| 165 | + <td style="text-align: center; width: 6%;" th:if="${email.is_enable==true}"> | ||
| 166 | + <label class="switch"><input type="checkbox" checked th:id="'id'+${email.id}"><span class="slider round" th:id="${email.id}"></span></label> | ||
| 167 | + </td> | ||
| 168 | + <td style="text-align: center; width: 6%;" th:if="${email.is_enable!=true}"> | ||
| 169 | + <label class="switch"><input type="checkbox" th:id="'id'+${email.id}"><span class="slider round" th:id="${email.id}"></span></label> | ||
| 170 | + </td> | ||
| 171 | + <td style="text-align: center; width: 8%;" th:text="${email.updater}"></td> | ||
| 172 | + <td style="text-align: center; width: 12%;" th:text="${#dates.format(email.created_at, 'yyyy-MM-dd HH:mm:ss')}">2018-11-22 | ||
| 173 | + 23:08:48</td> | ||
| 174 | + <td style="text-align: center; width: 12%;" th:text="${#dates.format(email.updated_at, 'yyyy-MM-dd HH:mm:ss')}">2016-08-03 | ||
| 175 | + 14:27:17</td> | ||
| 176 | + <td style="text-align: center; width: 10%;"> | ||
| 177 | + <span> </span> | ||
| 178 | + <a class="edit" th:href="'javascript:edit('+${email.id}+',\''+${email.email}+'\',\''+${email.remark}+'\',\''+${email.notice_type} +'\')'"> | ||
| 179 | + <button class="btn btn-primary btn-xs">修改</button> | ||
| 180 | + </a><span> </span><span> </span> | ||
| 181 | + <span> </span> | ||
| 182 | + <a class="delete" th:href="'javascript:deleted('+${email.id}+')'"> | ||
| 183 | + <button class="btn btn-danger btn-xs">删除</button> | ||
| 184 | + </a><span> </span><span> </span></td> | ||
| 185 | + </tr> | ||
| 186 | + | ||
| 187 | + </tbody> | ||
| 188 | + </table> | ||
| 189 | + </div> | ||
| 190 | + | ||
| 191 | + <div class="fixed-table-pagination" style="display: block;"> | ||
| 192 | + <div class="pull-left pagination-detail"> | ||
| 193 | + <span class="pagination-info" | ||
| 194 | + th:text="'共 '+${emailPage.total}+' 条记录,每页显示'">共 0 条记录</span> | ||
| 195 | + <select class="" id="pageSize" name="pageSize" | ||
| 196 | + onchange="selectPageSize()"> | ||
| 197 | + <option value="10" th:selected="${pageSize==10}">10</option> | ||
| 198 | + <option value="20" th:selected="${pageSize==20}">20</option> | ||
| 199 | + <option value="50" th:selected="${pageSize==50}">50</option> | ||
| 200 | + <option value="100" th:selected="${pageSize==100}">100</option> | ||
| 201 | + </select> <span class="pagination-info">条记录</span> | ||
| 202 | + </div> | ||
| 203 | + <div class="pull-right pagination"> | ||
| 204 | + <ul class="pagination" th:if="${emailPage.pages>1}"> | ||
| 205 | + <li class="page-pre"><a | ||
| 206 | + th:href="'javascript:fanye(1);'">‹‹</a></li> | ||
| 207 | + <li class="page-pre" th:if="${!emailPage.isFirstPage}"><a | ||
| 208 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum-1}+'\');'">‹</a> | ||
| 209 | + </li> | ||
| 210 | + | ||
| 211 | + <li class="page-number" th:if="${emailPage.pageNum-3>=1}"><a | ||
| 212 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum-3}+'\');'" | ||
| 213 | + th:text="${emailPage.pageNum-3}">2</a></li> | ||
| 214 | + <li class="page-number" th:if="${emailPage.pageNum-2>=1}"><a | ||
| 215 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum-2}+'\');'" | ||
| 216 | + th:text="${emailPage.pageNum-2}">2</a></li> | ||
| 217 | + <li class="page-number" th:if="${emailPage.pageNum-1>=1}"><a | ||
| 218 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum-1}+'\');'" | ||
| 219 | + th:text="${emailPage.pageNum-1}">2</a></li> | ||
| 220 | + <li class="page-number active"><a | ||
| 221 | + href="javaScript:void(0);" th:text="${emailPage.pageNum}">2</a></li> | ||
| 222 | + <li class="page-number" | ||
| 223 | + th:if="${emailPage.pageNum+1<=emailPage.pages}"><a | ||
| 224 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum+1}+'\');'" | ||
| 225 | + th:text="${emailPage.pageNum+1}">2</a></li> | ||
| 226 | + <li class="page-number" | ||
| 227 | + th:if="${emailPage.pageNum+2<=emailPage.pages}"><a | ||
| 228 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum+2}+'\');'" | ||
| 229 | + th:text="${emailPage.pageNum+2}">2</a></li> | ||
| 230 | + <li class="page-number" | ||
| 231 | + th:if="${emailPage.pageNum+3<=emailPage.pages}"><a | ||
| 232 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum+3}+'\');'" | ||
| 233 | + th:text="${emailPage.pageNum+3}">2</a></li> | ||
| 234 | + | ||
| 235 | + <li class="page-next" th:if="${!emailPage.isLastPage}"><a | ||
| 236 | + th:onclick="'javascript:fanye(\''+${emailPage.pageNum+1}+'\');'">›</a> | ||
| 237 | + </li> | ||
| 238 | + <li class="page-next"><a | ||
| 239 | + th:onclick="'javascript:fanye(\''+${emailPage.pages}+'\');'">››</a> | ||
| 240 | + </li> | ||
| 241 | + </ul> | ||
| 242 | + </div> | ||
| 243 | + </div> | ||
| 244 | + </div> | ||
| 245 | + </div> | ||
| 246 | + <div class="clearfix"></div> | ||
| 247 | + </div> | ||
| 248 | + </div> | ||
| 249 | + </div> | ||
| 250 | + </section> | ||
| 251 | + </div> | ||
| 252 | + | ||
| 253 | +<!-- 模态框(Modal) --> | ||
| 254 | +<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||
| 255 | + <div class="modal-dialog"> | ||
| 256 | + <div class="modal-content" style="margin-top: 30%;"> | ||
| 257 | + <div class="modal-header"> | ||
| 258 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
| 259 | + <h4 class="modal-title" id="myModalLabel">编辑邮件消息</h4> | ||
| 260 | + </div> | ||
| 261 | + <div class="modal-body"> | ||
| 262 | + <form action="/email/write" method="post" id="editWrite"> | ||
| 263 | + <input type="text" name="redirect_url" value="" class="hide" id="redirect_url"/> | ||
| 264 | + <div class="form-group hide"> | ||
| 265 | + <label class="control-label col-sm-3" style="font-size: 15px;" >Id:</label> | ||
| 266 | + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | ||
| 267 | + <input class="form-control" style="width:30%;" type="text" value="" id="id" name="id"> | ||
| 268 | + </div> | ||
| 269 | + </div> | ||
| 270 | + <div class="form-group"> | ||
| 271 | + <label class="control-label col-sm-3" style="font-size: 15px;">邮件地址:</label> | ||
| 272 | + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | ||
| 273 | + <input class="form-control" style="width:40%;" type="text" value="" id="email_edit" name="email"> | ||
| 274 | + </div> | ||
| 275 | + </div> | ||
| 276 | + <div class="form-group"> | ||
| 277 | + <label class="control-label col-sm-3" style="font-size: 15px;">邮件人:</label> | ||
| 278 | + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | ||
| 279 | + <input class="form-control" style="width:20%;" type="text" value="" id="remark_edit" name="remark"> | ||
| 280 | + </div> | ||
| 281 | + </div> | ||
| 282 | + | ||
| 283 | + <div class="form-group"> | ||
| 284 | + <label class="control-label col-sm-3" style="font-size: 15px;">邮件类型:</label> | ||
| 285 | + <div class="col-sm-9" style="float: left"> | ||
| 286 | + <div th:each="bu:${email_message}" style="padding-right: 30px;" class="write_check"> | ||
| 287 | + <span th:text="${bu.value}" style="font-size: 15px"></span> | ||
| 288 | + <input type="checkbox" name="write_business" th:value="${bu.key}" th:id="'write_check_'+${bu.key}"> | ||
| 289 | + </div> | ||
| 290 | + </div> | ||
| 291 | + </div> | ||
| 292 | + | ||
| 293 | + </form> | ||
| 294 | + </div> | ||
| 295 | + <div class="modal-footer"> | ||
| 296 | + <button type="button" class="btn btn-primary" onclick="javascript:$('#editWrite').submit();">提交</button> | ||
| 297 | + <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> | ||
| 298 | + </div> | ||
| 299 | + </div><!-- /.modal-content --> | ||
| 300 | + </div><!-- /.modal-dialog --> | ||
| 301 | +</div> | ||
| 302 | +<!-- /.modal --> | ||
| 303 | + <script> | ||
| 304 | + //打开编辑窗口 | ||
| 305 | + function edit(Id,email,remark,write_business){ | ||
| 306 | + $("#myModalLabel").text("编辑邮件消息"); | ||
| 307 | + $("#id").val(Id); | ||
| 308 | + $("#email_edit").val(email); | ||
| 309 | + $("#email_edit").attr("readonly","true"); | ||
| 310 | + $("#remark_edit").val(remark); | ||
| 311 | + $("#redirect_url").val(location.pathname+location.search); | ||
| 312 | + $(".write_check input").prop("checked",false); | ||
| 313 | + if($.trim(write_business)!=''){ | ||
| 314 | + var array = write_business.split(",") | ||
| 315 | + for (var i=0;i<array.length;i++){ | ||
| 316 | + $("#write_check_"+array[i]).prop("checked",true); | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + $('#editModal').modal('show'); | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + //打开添加窗口 | ||
| 323 | + function add(){ | ||
| 324 | + $("#id").val(""); | ||
| 325 | + $("#email_edit").val(""); | ||
| 326 | + $("#email_edit").removeAttr("readonly"); | ||
| 327 | + $("#remark_edit").val(""); | ||
| 328 | + $(".write_check input").prop("checked",false); | ||
| 329 | + | ||
| 330 | + $("#redirect_url").val(location.pathname+location.search); | ||
| 331 | + $("#myModalLabel").text("添加邮件消息"); | ||
| 332 | + $('#editModal').modal('show'); | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + //删除操作 | ||
| 336 | + function deleted(id){ | ||
| 337 | + var r = confirm("您确定删除本条内容吗?"); | ||
| 338 | + if (r == true) { | ||
| 339 | + $.post("/email/deleted?id=" + id, function (data) { | ||
| 340 | + if (data.errorCode == 0) { | ||
| 341 | + alert(data.errorMessage); | ||
| 342 | + location.href = location.href; | ||
| 343 | + } else { | ||
| 344 | + alert(data.errorMessage); | ||
| 345 | + } | ||
| 346 | + }) | ||
| 347 | + } | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + | ||
| 351 | + //开关的点击事件 | ||
| 352 | + $(".slider").on('click',function(e){ | ||
| 353 | + var myId=$(this).prop("id"); | ||
| 354 | + // var myIndex = $(".slider").index($(this)); | ||
| 355 | + var checked=$("#id"+myId).prop("checked");//获取当前状态,下一个状态用!checked表示 | ||
| 356 | + $.post("/email/updateState?id=" + myId+"&isEnable="+!checked, function (data) { | ||
| 357 | + if (data.errorCode == 0) { | ||
| 358 | + alert(data.errorMessage); | ||
| 359 | + location.href = location.href; | ||
| 360 | + } else { | ||
| 361 | + alert(data.errorMessage); | ||
| 362 | + location.href = location.href; | ||
| 363 | + } | ||
| 364 | + }) | ||
| 365 | + }) | ||
| 366 | + | ||
| 367 | + //翻页函数 | ||
| 368 | + function fanye(page) { | ||
| 369 | + var param = location.search; | ||
| 370 | + if (param.indexOf("page=") != -1) { | ||
| 371 | + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连 | ||
| 372 | + var split = se.split("&"); | ||
| 373 | + var h = ""; | ||
| 374 | + for (var i = 0; i < split.length; i++) { | ||
| 375 | + var s = split[i]; | ||
| 376 | + if (s.indexOf("page=") < 0) h = h + "&" + split[i]; | ||
| 377 | + } | ||
| 378 | + h = h.substring(1, h.length); | ||
| 379 | + window.location.href = "/email/page?" + h + "&page=" + page; | ||
| 380 | + } else { | ||
| 381 | + param = param.substring(1, param.length); | ||
| 382 | + window.location.href = "/email/page?" + param + "&page=" + page; | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + //选择每页数量触发函数 | ||
| 387 | + function selectPageSize(){ | ||
| 388 | + var pageSize=$("#pageSize").val(); | ||
| 389 | + var param = location.search; | ||
| 390 | + if (param.indexOf("pageSize=") != -1) { | ||
| 391 | + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连 | ||
| 392 | + var split = se.split("&"); | ||
| 393 | + var h = ""; | ||
| 394 | + for (var i = 0; i < split.length; i++) { | ||
| 395 | + var s = split[i]; | ||
| 396 | + if (s.indexOf("pageSize=") < 0 &&s.indexOf("page=") < 0) h = h + "&" + split[i]; | ||
| 397 | + } | ||
| 398 | + h = h.substring(1, h.length); | ||
| 399 | + window.location.href = "/email/page?" + h + "&pageSize=" + pageSize; | ||
| 400 | + } else { | ||
| 401 | + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连 | ||
| 402 | + var split = se.split("&"); | ||
| 403 | + var h = ""; | ||
| 404 | + for (var i = 0; i < split.length; i++) { | ||
| 405 | + var s = split[i]; | ||
| 406 | + if (s.indexOf("page=") < 0) h = h + "&" + split[i]; | ||
| 407 | + } | ||
| 408 | + h = h.substring(1, h.length); | ||
| 409 | + window.location.href = "/email/page?" + h + "&pageSize=" + pageSize; | ||
| 410 | + } | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + //搜索 | ||
| 414 | + $('#emailQuery').click(function () { | ||
| 415 | + var email = $("#email_query").val(); | ||
| 416 | + var remark = $("#remark_query").val(); | ||
| 417 | + var pageSize = $("#pageSize").val(); | ||
| 418 | + window.location.href = "/email/page?email=" + email + "&remark=" + remark+ "&pageSize=" + pageSize; | ||
| 419 | + }); | ||
| 420 | + | ||
| 421 | + //鼠标回车事件 | ||
| 422 | + $(document).keyup(function(event){ | ||
| 423 | + if(event.keyCode ==13){ | ||
| 424 | + $("#emailQuery").trigger("click"); | ||
| 425 | + } | ||
| 426 | + }); | ||
| 427 | + </script> | ||
| 428 | + | ||
| 429 | + <footer th:replace="../templates/common/foot::foot" ></footer> | ||
| 430 | + | ||
| 431 | + | ||
| 432 | + <!-- Add the sidebar's background. This div must be placed | ||
| 433 | + immediately after the control sidebar --> | ||
| 434 | + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div> | ||
| 435 | + | ||
| 436 | +</div><!-- ./wrapper --> | ||
| 437 | + | ||
| 438 | + | ||
| 439 | +<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip --> | ||
| 440 | +<script type="text/javascript"> | ||
| 441 | + $('div.alert').not('.alert-danger').delay(3000).slideUp(300); | ||
| 442 | +</script> | ||
| 443 | + | ||
| 444 | +<!-- AdminLTE App --> | ||
| 445 | +<script src="../../static/js/app.min.js"></script> | ||
| 446 | +<!-- AdminLTE for demo purposes --> | ||
| 447 | +<script src="../../static/js/sidebar.js"></script> | ||
| 448 | + | ||
| 449 | + | ||
| 450 | +</body> | ||
| 451 | +</html> | ||
| 0 | \ No newline at end of file | 452 | \ No newline at end of file |