| @@ -1,16 +1,10 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.domain.po.WxAuthorizerInfo; | |||
| import com.iformall.domain.po.WxComponentVerifyTicket; | |||
| import com.iformall.domain.po.WxWeappAuditStatus; | |||
| import com.iformall.domain.po.WxWeappCodeStatus; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumWeappAuditStatus; | |||
| import com.iformall.enums.EnumWxAuthorizationInfoType; | |||
| import com.iformall.enums.EnumWxAuthorizationStatus; | |||
| import com.iformall.service.WxAuthorizerInfoService; | |||
| import com.iformall.service.WxComponentVerifyTicketService; | |||
| import com.iformall.service.WxWeappAuditStatusService; | |||
| import com.iformall.service.WxWeappCodeStatusService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.wechat.WxOpenService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -33,6 +27,7 @@ import java.io.ByteArrayOutputStream; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.nio.charset.Charset; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| @Controller | |||
| @@ -53,6 +48,12 @@ public class WechatCalllbackController extends BaseController { | |||
| @Autowired | |||
| private WxWeappAuditStatusService weappAuditStatusService; | |||
| @Autowired | |||
| private WxAppinfoService appinfoService; | |||
| @Autowired | |||
| private MailService mailService; | |||
| @RequestMapping(value = "/notify", method = RequestMethod.POST) | |||
| @ApiOperation("接收ticket回调") | |||
| public Object receiveTicket(HttpServletRequest request) throws IOException { | |||
| @@ -267,6 +268,7 @@ public class WechatCalllbackController extends BaseController { | |||
| private void updateAuditStatus(String appId, boolean success, String reason) { | |||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||
| if(auditStatus != null) { | |||
| if(success) { | |||
| @@ -279,5 +281,32 @@ public class WechatCalllbackController extends BaseController { | |||
| auditStatus.setAuditTime(new Date()); | |||
| weappAuditStatusService.updateStatus(auditStatus); | |||
| } | |||
| // 发邮件 | |||
| WxAppinfo appinfo = appinfoService.getByAppId(appId); | |||
| if(appinfo != null) { | |||
| SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 | |||
| StringBuilder titleSB = new StringBuilder(); | |||
| titleSB.append(appinfo.getName()); | |||
| if(success) { | |||
| titleSB.append("审核通过"); | |||
| } else { | |||
| titleSB.append("审核未通过"); | |||
| } | |||
| StringBuilder sb = new StringBuilder(); | |||
| sb.append(df.format(new Date())).append("\n"); | |||
| if(success) { | |||
| sb.append("审核通过\n"); | |||
| } else { | |||
| sb.append("审核未通过\n").append("原因").append(reason); | |||
| } | |||
| String[] receivers = new String[] {"wangmei@iformall.com", "wuguoqiang@iformall.com", "huanghui@iformall.com", "sunmingming@iformall.com"}; | |||
| //发送邮件 | |||
| mailService.sendSimpleMail(receivers, titleSB.toString(), sb.toString()); | |||
| } | |||
| } | |||
| } | |||