首页>代码>Spring MVC、Vue、layui、layer等成熟技术开发个人博客网站>/ExcellentCodeProject/src/main/java/com/ecp/common/communal/controller/EmailController.java
package com.ecp.common.communal.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.alibaba.fastjson.JSONObject; import com.ecp.common.communal.entity.JsonResult; import com.ecp.common.communal.service.EmailService; import com.ecp.common.communal.service.RSAService; import com.ecp.common.communal.util.KeywordsUtils; import org.springframework.web.servlet.ModelAndView; /** * 发送信息到电子邮箱认证 */ @Controller @RequestMapping(path = {"/common/communal/email/"}) public class EmailController { private static final Logger logger = LoggerFactory.getLogger(EmailController.class); @Resource EmailService emailService; @Resource RSAService rsaService; /** * 发送电子邮箱验证码 * @param request * @param response * @param session * @param paramsJsonStr */ @RequestMapping(path = {"sendVerificationEmailCode"}, method={RequestMethod.GET, RequestMethod.POST}) @ResponseBody public void sendVerificationEmailCode (HttpServletRequest request, HttpSession session, HttpServletResponse response, ModelAndView modelAndView, String paramsJsonStr) { try { request.setCharacterEncoding(KeywordsUtils.UTF_8); response.setCharacterEncoding(KeywordsUtils.UTF_8); System.out.println("==========前端传过来的参数:" + paramsJsonStr); JSONObject paramsJO = new JSONObject(); if (StringUtils.isNotBlank(paramsJsonStr)) { paramsJO = JSONObject.parseObject(paramsJsonStr); JsonResult jsonResultTemp = rsaService.decryptContentByRSA(paramsJO, session); System.out.println(jsonResultTemp); logger.info("==========请求发送电子邮箱验证码信息:" + jsonResultTemp); if (jsonResultTemp.isSuccess()) { paramsJO = jsonResultTemp.getData(); } } System.out.println("==========前端传过来的参数转化成JSONObject:" + paramsJO); JsonResult jsonResult = emailService.sendVerificationEmailCode(paramsJO, session); System.out.println(jsonResult); response.getWriter().print(jsonResult); } catch (Exception e) { e.printStackTrace(); } } }
最近下载更多
1690356080 LV37
2023年11月12日
123456nty LV36
2022年4月8日
ljm2s LV3
2021年9月24日
seve980508 LV1
2020年5月26日
499755609 LV8
2020年4月7日
jiajia91323 LV23
2019年12月13日
powerful LV7
2019年12月4日
admin123456686 LV10
2019年11月1日
xiongtianming18 LV12
2019年9月26日
wzsq20 LV12
2019年9月22日
最近浏览更多
流水本无情 LV9
3月24日
lichengai LV7
2月26日
admin_z LV22
1月29日
1515465193 LV9
2023年11月30日
1690356080 LV37
2023年11月12日
heqian LV16
2023年10月23日
zhaobing_g LV3
2023年8月28日
hkxyyz LV6
2023年7月16日
1614076596 LV1
2023年6月29日
mengmeng12323423 LV3
2023年6月17日