test # Conflicts: # mlWechatOpen/src/main/java/com/iformall/schedule/UserUnionIdSchedule.javarelease
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.dto; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| @@ -10,6 +12,7 @@ import javax.persistence.Transient; | |||
| * @author jinguo | |||
| * | |||
| */ | |||
| @Data | |||
| public class WxCUserBasicInfoDto implements Serializable{ | |||
| /** | |||
| @@ -31,10 +34,9 @@ public class WxCUserBasicInfoDto implements Serializable{ | |||
| @io.swagger.annotations.ApiModelProperty(value="姓名",name="name") | |||
| private String name; | |||
| /*租户id**/ | |||
| // @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| private String tenantId; | |||
| @Transient | |||
| @@ -50,95 +52,5 @@ public class WxCUserBasicInfoDto implements Serializable{ | |||
| @Transient | |||
| private Integer sex; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public Date getBirthStartTime() { | |||
| return birthStartTime; | |||
| } | |||
| public void setBirthStartTime(Date birthStartTime) { | |||
| this.birthStartTime = birthStartTime; | |||
| } | |||
| public Date getBirthEndTime() { | |||
| return birthEndTime; | |||
| } | |||
| public void setBirthEndTime(Date birthEndTime) { | |||
| this.birthEndTime = birthEndTime; | |||
| } | |||
| public Integer getSex() { | |||
| return sex; | |||
| } | |||
| public void setSex(Integer sex) { | |||
| this.sex = sex; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Date getStartTime() { | |||
| return startTime; | |||
| } | |||
| public void setStartTime(Date startTime) { | |||
| this.startTime = startTime; | |||
| } | |||
| public Date getEndTime() { | |||
| return endTime; | |||
| } | |||
| public void setEndTime(Date endTime) { | |||
| this.endTime = endTime; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public Integer getLevelEndScore() { | |||
| return levelEndScore; | |||
| } | |||
| public void setLevelEndScore(Integer levelEndScore) { | |||
| this.levelEndScore = levelEndScore; | |||
| } | |||
| public Integer getLevelStartScore() { | |||
| return levelStartScore; | |||
| } | |||
| public void setLevelStartScore(Integer levelStartScore) { | |||
| this.levelStartScore = levelStartScore; | |||
| } | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.iformall.domain.dto; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| /** | |||
| * 审核提交 | |||
| * @author Stormeye | |||
| * | |||
| */ | |||
| @Data | |||
| public class WxWeappCodeAuditDto implements Serializable { | |||
| private static final long serialVersionUID = -1116465873573690766L; | |||
| @io.swagger.annotations.ApiModelProperty(value="appId",name="appId") | |||
| private String appId; | |||
| @io.swagger.annotations.ApiModelProperty(value="版本信息",name="version") | |||
| private String version; | |||
| @io.swagger.annotations.ApiModelProperty(value="反馈内容,不超过200字",name="feedbackInfo") | |||
| private String feedbackInfo; | |||
| @io.swagger.annotations.ApiModelProperty(value="图片media_id列表,中间用“丨”分割,xx丨yy丨zz,不超过5张图片, 其中 media_id 可以通过新增临时素材接口上传而得到",name="feedbackStuff") | |||
| private String feedbackStuff; | |||
| } | |||
| @@ -39,6 +39,8 @@ public class WxWeappAuditStatus implements Serializable { | |||
| private Integer auditStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核错误码",name="auditErrCode") | |||
| private String auditErrCode; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核失败的小程序截图示例",name="screenShot") | |||
| private String screenShot; | |||
| @io.swagger.annotations.ApiModelProperty(value="审核时间",name="auditTime") | |||
| private Date auditTime; | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumWxAuthotizationTemplateStatus { | |||
| SUCCESS(0, "模板已设置"), | |||
| Fail(1, "模板设置失败") | |||
| ; | |||
| public static EnumWxAuthotizationTemplateStatus getEnum(Integer code) { | |||
| for (EnumWxAuthotizationTemplateStatus value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumWxAuthotizationTemplateStatus(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -132,7 +132,7 @@ public class FmOpenInRedisDBConfigStorage extends WxOpenInMemoryConfigStorage { | |||
| } | |||
| @Override | |||
| public void updateComponentAccessTokent(String componentAccessToken, int expiresInSeconds) { | |||
| public void updateComponentAccessToken(String componentAccessToken, int expiresInSeconds) { | |||
| try (Jedis jedis = this.jedisPool.getResource()) { | |||
| jedis.setex(this.componentAccessTokenKey, expiresInSeconds - 200, componentAccessToken); | |||
| logger.info("updateComponentVerifyTicketAccessToken " + componentAccessToken); | |||
| @@ -58,6 +58,32 @@ public class FmOpenService extends WxOpenServiceImpl { | |||
| @Autowired | |||
| protected WeappAuditHandler weappAuditHandler; | |||
| @Autowired | |||
| protected CardCheckHandler cardCheckHandler; // 2.1 | |||
| @Autowired | |||
| protected CardUserGetCardHandler cardUserGetCardHandler; // 2.2 | |||
| @Autowired | |||
| protected CardUserGiftingCardHandler cardUserGiftingCardHandler; // 2.3 | |||
| @Autowired | |||
| protected CardUserDelCardHandler cardUserDelCardHandler; // 2.4 | |||
| @Autowired | |||
| protected CardUserConsumeCardHandler cardUserConsumeCardHandler; // 2.5 | |||
| @Autowired | |||
| protected CardUserPayHandler cardUserPayHandler; // 2.6 | |||
| @Autowired | |||
| protected CardUserViewCardHandler cardUserViewCardHandler; // 2.7 | |||
| @Autowired | |||
| protected CardUserEnterSessionHandler cardUserEnterSessionHandler; // 2.8 | |||
| @Autowired | |||
| protected CardUpdateMemberCardHandler cardUpdateMemberCardHandler; // 2.9 | |||
| @Autowired | |||
| protected CardSkuRemindHandler cardSkuRemindHandler; // 2.10 | |||
| @Autowired | |||
| protected CardPayOrderHandler cardPayOrderHandler; // 2.11 | |||
| @Autowired | |||
| protected CardSubmitMemCardHandler cardSubmitMemCardHandler; // 2.12 | |||
| private static JedisPool pool; | |||
| private WxOpenMessageRouter wxOpenMessageRouter; | |||
| @@ -148,6 +174,72 @@ public class FmOpenService extends WxOpenServiceImpl { | |||
| .event(WxConsts.EventType.WEAPP_AUDIT_FAIL) | |||
| .handler(this.weappAuditHandler).end(); | |||
| // 卡券事件推送 | |||
| // 审核事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_PASS_CHECK) | |||
| .handler(this.cardCheckHandler).end(); | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_NOT_PASS_CHECK) | |||
| .handler(this.cardCheckHandler).end(); | |||
| // 领取事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_GET_CARD) | |||
| .handler(this.cardUserGetCardHandler).end(); | |||
| // 转赠事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_GIFTING_CARD) | |||
| .handler(this.cardUserGiftingCardHandler).end(); | |||
| // 删除事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_DEL_CARD) | |||
| .handler(this.cardUserDelCardHandler).end(); | |||
| // 核销事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_CONSUME_CARD) | |||
| .handler(this.cardUserConsumeCardHandler).end(); | |||
| // 买单事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_PAY_FROM_PAY_CELL) | |||
| .handler(this.cardUserPayHandler).end(); | |||
| // 进入会员卡事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_VIEW_CARD) | |||
| .handler(this.cardUserViewCardHandler).end(); | |||
| // 从卡券进入公众号会话事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_USER_ENTER_SESSION_FROM_CARD) | |||
| .handler(this.cardUserEnterSessionHandler).end(); | |||
| // 会员卡内容更新事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_UPDATE_MEMBER_CARD) | |||
| .handler(this.cardUpdateMemberCardHandler).end(); | |||
| // 库存报警事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_SKU_REMIND) | |||
| .handler(this.cardSkuRemindHandler).end(); | |||
| // 券点流水详情事件 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_PAY_ORDER) | |||
| .handler(this.cardPayOrderHandler).end(); | |||
| // 会员卡激活事件推送 | |||
| wxOpenMessageRouter.rule().async(false) | |||
| .msgType(WxConsts.XmlMsgType.EVENT) | |||
| .event(WxConsts.EventType.CARD_PAY_ORDER) | |||
| .handler(this.cardSubmitMemCardHandler).end(); | |||
| // 默认 | |||
| wxOpenMessageRouter.rule().async(false).handler(this.msgHandler).end(); | |||
| } | |||
| @@ -5,7 +5,7 @@ import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| public abstract class AbstractHandler implements WxMpMessageHandler { | |||
| protected Logger logger = LoggerFactory.getLogger(getClass()); | |||
| @@ -0,0 +1,41 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.1 审核事件推送 | |||
| */ | |||
| @Component | |||
| public class CardCheckHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[toUser]]></ToUserName> | |||
| * <FromUserName><![CDATA[FromUser]]></FromUserName> | |||
| * <CreateTime>123456789</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[card_pass_check]]></Event> //不通过为card_not_pass_check | |||
| * <CardId><![CDATA[cardid]]></CardId> | |||
| * <RefuseReason><![CDATA[非法代制]]></RefuseReason> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_PASS_CHECK)) { | |||
| } else if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_NOT_PASS_CHECK)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,50 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.11 券点流水详情事件 | |||
| */ | |||
| @Component | |||
| public class CardPayOrderHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[gh_7223c83d4be5]]></ToUserName> | |||
| * <FromUserName><![CDATA[ob5E7s-HoN9tslQY3-0I4qmgluHk]]></FromUserName> | |||
| * <CreateTime>1453295737</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[card_pay_order]]></Event> | |||
| * <OrderId><![CDATA[404091456]]></OrderId> | |||
| * <Status><![CDATA[ORDER_STATUS_FINANCE_SUCC]]></Status> | |||
| * <CreateOrderTime>1453295737</CreateOrderTime> | |||
| * <PayFinishTime>0</PayFinishTime> | |||
| * <Desc><![CDATA[]]></Desc> | |||
| * <FreeCoinCount><![CDATA[200]]></FreeCoinCount> | |||
| * <PayCoinCount><![CDATA[0]]></PayCoinCount> | |||
| * <RefundFreeCoinCount><![CDATA[0]]></RefundFreeCoinCount> | |||
| * <RefundPayCoinCount><![CDATA[0]]></RefundPayCoinCount> | |||
| * <OrderType><![CDATA[ORDER_TYPE_SYS_ADD]]></OrderType> | |||
| * <Memo><![CDATA[开通账户奖励]]></Memo> | |||
| * <ReceiptInfo><![CDATA[]]></ReceiptInfo> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_PAY_ORDER)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.10 库存报警事件 | |||
| */ | |||
| @Component | |||
| public class CardSkuRemindHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[gh_2d62d*****0]]></ToUserName> | |||
| * <FromUserName><![CDATA[oa3LFuBvWb7*********]]></FromUserName> | |||
| * <CreateTime>1443838506</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[card_sku_remind]]></Event> | |||
| * <CardId><![CDATA[pa3LFuAh2P65**********]]></CardId> | |||
| * <Detail><![CDATA[the card's quantity is equal to 0]]></Detail> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_SKU_REMIND)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.12 会员卡激活事件推送 | |||
| */ | |||
| @Component | |||
| public class CardSubmitMemCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName> <![CDATA[gh_3fcea188bf78]]></ToUserName> | |||
| * <FromUserName><![CDATA[obLatjlaNQKb8FqOvt1M1x1lIBFE]]></FromUserName> | |||
| * <CreateTime>1432668700</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[submit_membercard_user_info]]></Event> | |||
| * <CardId><![CDATA[pbLatjtZ7v1BG_ZnTjbW85GYc_E8]]></CardId> | |||
| * <UserCardCode><![CDATA[018255396048]]></UserCardCode> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_SUBMIT_MEMBERCARD_USER_INFO)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.9 会员卡内容更新事件 | |||
| */ | |||
| @Component | |||
| public class CardUpdateMemberCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[gh_9e1765b5568e]]></ToUserName> | |||
| * <FromUserName><![CDATA[ojZ8YtyVyr30HheH3CM73y7h4jJE]]></FromUserName> | |||
| * <CreateTime>1445507140</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[update_member_card]]></Event> | |||
| * <CardId><![CDATA[pjZ8Ytx-nwvpCRyQneH3Ncmh6N94]]></CardId> | |||
| * <UserCardCode><![CDATA[485027611252]]></UserCardCode> | |||
| * <ModifyBonus>3</ModifyBonus> | |||
| * <ModifyBalance>0</ModifyBalance> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_UPDATE_MEMBER_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.5 核销事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserConsumeCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName> | |||
| * <FromUserName> <![CDATA[oZI8Fj040-be6rlDohc6gkoPOQTQ]]> </FromUserName> | |||
| * <CreateTime>1472549042</CreateTime> | |||
| * <MsgType> <![CDATA[event]]> </MsgType> | |||
| * <Event> <![CDATA[user_consume_card]]> </Event> | |||
| * <CardId> <![CDATA[pZI8Fj8y-E8hpvho2d1ZvpGwQBvA]]> </CardId> | |||
| * <UserCardCode> <![CDATA[452998530302]]> </UserCardCode> | |||
| * <ConsumeSource> <![CDATA[FROM_API]]> </ConsumeSource> | |||
| * <LocationName> <![CDATA[]]> </LocationName> | |||
| * <StaffOpenId> <![CDATA[oZ********nJ3bPJu_Rtjkw4c]]> </StaffOpenId> | |||
| * <VerifyCode> <![CDATA[]]> </VerifyCode> | |||
| * <RemarkAmount> <![CDATA[]]> </RemarkAmount> | |||
| * <OuterStr> <![CDATA[xxxxx]]> </OuterStr> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_CONSUME_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.4 删除事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserDelCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| *<xml> | |||
| * <ToUserName><![CDATA[toUser]]></ToUserName> | |||
| * <FromUserName><![CDATA[FromUser]]></FromUserName> | |||
| * <CreateTime>123456789</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[user_del_card]]></Event> | |||
| * <CardId><![CDATA[cardid]]></CardId> | |||
| * <UserCardCode><![CDATA[12312312]]></UserCardCode> | |||
| *</xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_DEL_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.8 从卡券进入公众号会话事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserEnterSessionHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[toUser]]></ToUserName> | |||
| * <FromUserName><![CDATA[FromUser]]></FromUserName> | |||
| * <CreateTime>123456789</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[user_enter_session_from_card]]></Event> | |||
| * <CardId><![CDATA[cardid]]></CardId> | |||
| * <UserCardCode><![CDATA[12312312]]></UserCardCode> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_ENTER_SESSION_FROM_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.2 领取事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserGetCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| *<xml> | |||
| * <ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName> | |||
| * <FromUserName> <![CDATA[oZI8Fj040-be6rlDohc6gkoPOQTQ]]> </FromUserName> | |||
| * <CreateTime>1472551036</CreateTime> | |||
| * <MsgType> <![CDATA[event]]> </MsgType> | |||
| * <Event> <![CDATA[user_get_card]]> </Event> | |||
| * <CardId> <![CDATA[pZI8Fjwsy5fVPRBeD78J4RmqVvBc]]> </CardId> | |||
| * <IsGiveByFriend>0</IsGiveByFriend> | |||
| * <UserCardCode> <![CDATA[226009850808]]> </UserCardCode> | |||
| * <FriendUserName> <![CDATA[]]> </FriendUserName> | |||
| * <OuterId>0</OuterId> | |||
| * <OldUserCardCode> <![CDATA[]]> </OldUserCardCode> | |||
| * <OuterStr> <![CDATA[12b]]> </OuterStr> | |||
| * <IsRestoreMemberCard>0</IsRestoreMemberCard> | |||
| * <IsRecommendByFriend>0</IsRecommendByFriend> | |||
| * <UnionId>o6_bmasdasdsad6_2sgVt7hMZOPfL</UnionId> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_GET_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,43 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.3 转赠事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserGiftingCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| *<xml> | |||
| * <ToUserName><![CDATA[gh_3fcea188bf78]]></ToUserName> | |||
| * <FromUserName><![CDATA[obLatjjwDolFjRRd3doGIdwNqRXw]]></FromUserName> | |||
| * <CreateTime>1474181868</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[user_gifting_card]]></Event> | |||
| * <CardId><![CDATA[pbLatjhU-3pik3d4PsbVzvBxZvJc]]></CardId> | |||
| * <UserCardCode><![CDATA[297466945104]]></UserCardCode> | |||
| * <IsReturnBack>0</IsReturnBack> | |||
| * <FriendUserName><![CDATA[obLatjlNerkb62HtSdQUx66C4NTU]]></FriendUserName> | |||
| * <IsChatRoom>0</IsChatRoom> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_GIFTING_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.6 买单事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserPayHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName><![CDATA[gh_e2243xxxxxxx]]></ToUserName> | |||
| * <FromUserName><![CDATA[oo2VNuOUuZGMxxxxxxxx]]></FromUserName> | |||
| * <CreateTime>1442390947</CreateTime> | |||
| * <MsgType><![CDATA[event]]></MsgType> | |||
| * <Event><![CDATA[user_pay_from_pay_cell]]></Event> | |||
| * <CardId><![CDATA[po2VNuCuRo-8sxxxxxxxxxxx]]></CardId> | |||
| * <UserCardCode><![CDATA[38050000000]]></UserCardCode> | |||
| * <TransId><![CDATA[10022403432015000000000]]></TransId> | |||
| * <LocationId>291710000</LocationId> | |||
| * <Fee><![CDATA[10000]]></Fee> | |||
| * <OriginalFee><![CDATA[10000]]> </OriginalFee> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_PAY_FROM_PAY_CELL)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -0,0 +1,41 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import me.chanjar.weixin.common.api.WxConsts; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Stormeye Wu | |||
| * 2.7 进入会员卡事件推送 | |||
| */ | |||
| @Component | |||
| public class CardUserViewCardHandler extends AbstractHandler { | |||
| @Override | |||
| public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, | |||
| Map<String, Object> context, WxMpService wxMpService, | |||
| WxSessionManager sessionManager) { | |||
| /** | |||
| * <xml> | |||
| * <ToUserName> <![CDATA[gh_fcxxxx6a20993]]> </ToUserName> | |||
| * <FromUserName> <![CDATA[oZI8Fj040-xxxxx6gkoPOQTQ]]> </FromUserName> | |||
| * <CreateTime>1467811138</CreateTime> | |||
| * <MsgType> <![CDATA[event]]> </MsgType> | |||
| * <Event> <![CDATA[user_view_card]]> </Event> | |||
| * <CardId> <![CDATA[pZI8Fj2ezBbxxxxxT2UbiiWLb7Bg]]> </CardId> | |||
| * <UserCardCode> <![CDATA[4xxxxxxxx8558]]> </UserCardCode> | |||
| * <OuterStr> <![CDATA[12b]]> </OuterStr> | |||
| * </xml> | |||
| */ | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.CARD_USER_VIEW_CARD)) { | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -1,6 +1,5 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import com.iformall.service.wechat.handler.AbstractHandler; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| @@ -10,7 +9,7 @@ import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class KfSessionHandler extends AbstractHandler { | |||
| @@ -12,7 +12,7 @@ import java.util.Map; | |||
| import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class LocationHandler extends AbstractHandler { | |||
| @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class LogHandler extends AbstractHandler { | |||
| @@ -1,6 +1,5 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import com.iformall.service.wechat.handler.AbstractHandler; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| @@ -12,7 +11,7 @@ import java.util.Map; | |||
| import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class MenuHandler extends AbstractHandler { | |||
| @@ -14,7 +14,7 @@ import java.util.Map; | |||
| import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class MsgHandler extends AbstractHandler { | |||
| @@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class NullHandler extends AbstractHandler { | |||
| @@ -1,9 +1,7 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import com.iformall.service.wechat.handler.AbstractHandler; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| public abstract class ScanHandler extends AbstractHandler { | |||
| @@ -1,6 +1,5 @@ | |||
| package com.iformall.service.wechat.handler; | |||
| import com.iformall.service.wechat.handler.AbstractHandler; | |||
| import me.chanjar.weixin.common.session.WxSessionManager; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | |||
| @@ -12,7 +11,7 @@ import java.util.Map; | |||
| /** | |||
| * 门店审核事件处理 | |||
| * | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class StoreCheckNotifyHandler extends AbstractHandler { | |||
| @@ -18,7 +18,7 @@ import java.util.Date; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class SubscribeHandler extends AbstractHandler { | |||
| @@ -16,7 +16,7 @@ import java.util.Date; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class UnsubscribeHandler extends AbstractHandler { | |||
| @@ -20,7 +20,7 @@ import java.util.Date; | |||
| import java.util.Map; | |||
| /** | |||
| * @author Binary Wang(https://github.com/binarywang) | |||
| * @author Stormeye Wu | |||
| */ | |||
| @Component | |||
| public class WeappAuditHandler extends AbstractHandler { | |||
| @@ -43,14 +43,14 @@ public class WeappAuditHandler extends AbstractHandler { | |||
| WxSessionManager sessionManager) { | |||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | |||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_SUCCESS)) { | |||
| updateAuditStatus(appId, true, null); | |||
| } else if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_SUCCESS)) { | |||
| updateAuditStatus(appId, false, wxMessage.getReason()); | |||
| updateAuditStatus(appId, true, new Date(wxMessage.getSuccTime()*1000), null, null); | |||
| } else if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_FAIL)) { | |||
| updateAuditStatus(appId, false, new Date(wxMessage.getFailTime()*1000), wxMessage.getReason(), wxMessage.getScreenShot()); | |||
| } | |||
| return null; | |||
| } | |||
| private void updateAuditStatus(String appId, boolean success, String reason) { | |||
| private void updateAuditStatus(String appId, boolean success, Date auditTime, String reason, String screenShot) { | |||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | |||
| if (auditStatus != null) { | |||
| if (success) { | |||
| @@ -59,8 +59,9 @@ public class WeappAuditHandler extends AbstractHandler { | |||
| } else { | |||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||
| auditStatus.setAuditErrCode(reason); | |||
| auditStatus.setScreenShot(screenShot); | |||
| } | |||
| auditStatus.setAuditTime(new Date()); | |||
| auditStatus.setAuditTime(auditTime); | |||
| weappAuditStatusService.updateStatus(auditStatus); | |||
| } | |||
| @@ -53,13 +53,17 @@ | |||
| com.fasterxml.jackson.dataformat, | |||
| com.fasterxml.jackson.datatype, | |||
| com.fasterxml.jackson.module, | |||
| com.fasterxml.uuid, | |||
| com.fasterxml, | |||
| com.github.axet, | |||
| com.github.binarywang, | |||
| com.github.jsqlparser, | |||
| com.github.pagehelper, | |||
| com.github.ulisesbocchio, | |||
| com.github.virtuald, | |||
| com.google.code.findbugs, | |||
| com.google.code.gson, | |||
| com.google.errorprone, | |||
| com.google.guava, | |||
| com.google.protobuf, | |||
| com.google.zxing, | |||
| @@ -78,6 +82,7 @@ | |||
| commons-cli, | |||
| commons-codec, | |||
| commons-collections, | |||
| commons-fileupload, | |||
| commons-io, | |||
| commons-logging, | |||
| io.lettuce, | |||
| @@ -87,14 +92,18 @@ | |||
| io.swagger, | |||
| io.undertow, | |||
| javax.activation, | |||
| javax.annotation, | |||
| javax.mail, | |||
| javax.persistence, | |||
| javax.servlet, | |||
| javax.validation, | |||
| javax.xml.bind, | |||
| joda-time, | |||
| junit, | |||
| mysql, | |||
| net.bytebuddy, | |||
| net.minidev, | |||
| net.sf.dozer, | |||
| net.sf.saxon, | |||
| ognl, | |||
| org.antlr, | |||
| @@ -111,16 +120,22 @@ | |||
| org.assertj, | |||
| org.bouncycastle, | |||
| org.checkerframework, | |||
| org.codehaus.mojo, | |||
| org.crazycake, | |||
| org.dom4j, | |||
| org.glassfish, | |||
| org.flowable, | |||
| org.flywaydb, | |||
| org.glassfish, | |||
| org.hibernate.validator, | |||
| org.jasypt, | |||
| org.javassist, | |||
| org.jboss.logging, | |||
| org.jboss.spec.javax.annotation, | |||
| org.jboss.spec.javax.websocket, | |||
| org.jboss.xnio, | |||
| org.jdom, | |||
| org.jodd, | |||
| org.mapstruct, | |||
| org.mockito, | |||
| org.mybatis, | |||
| org.mybatis.generator, | |||
| @@ -128,7 +143,9 @@ | |||
| org.ow2.asm, | |||
| org.projectlombok, | |||
| org.quartz-scheduler, | |||
| org.reflections, | |||
| org.rocketmq.spring.boot, | |||
| org.slf4j, | |||
| org.springframework, | |||
| org.springframework.amqp, | |||
| org.springframework.boot, | |||
| @@ -31,6 +31,9 @@ public class WechatOpenApplication { | |||
| @Value("${fm.deploy}") | |||
| private Integer fmDeploy; | |||
| @Value("${fm.upload_dir}") | |||
| private String uploadDir; | |||
| @Bean | |||
| public boolean isFmException() { | |||
| return fmException; | |||
| @@ -49,7 +52,10 @@ public class WechatOpenApplication { | |||
| @Bean | |||
| public Integer getFmDeploy() { return fmDeploy; } | |||
| @Bean | |||
| public String fmUploadDir() { | |||
| return uploadDir; | |||
| } | |||
| public static void main(String[] args) { | |||
| SpringApplication.run(WechatOpenApplication.class, args); | |||
| @@ -0,0 +1,133 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.service.WxAuthorizerInfoService; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import me.chanjar.weixin.mp.api.WxMpService; | |||
| import me.chanjar.weixin.mp.bean.material.WxMediaImgUploadResult; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.InputStream; | |||
| import java.util.UUID; | |||
| /** | |||
| * Stormeye Wu | |||
| */ | |||
| @Controller | |||
| @RequestMapping("/material") | |||
| @Api(description = "微信第三方开放平台素材文件") | |||
| public class WechatMediaController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(getClass()); | |||
| @Autowired | |||
| private String fmUploadDir; | |||
| @Autowired | |||
| private FmOpenService openService; | |||
| @Autowired | |||
| private WxAuthorizerInfoService authorizerInfoService; | |||
| @ApiOperation(value = "获取永久素材", notes = "") | |||
| @GetMapping("/getMedia") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "mediaId", value = "mediaId", dataType = "String", paramType = "query", required = true)}) | |||
| public void getMediaInfo(String appId, String mediaId, HttpServletRequest req, HttpServletResponse response) { | |||
| InputStream inputStream = null; | |||
| String filename = mediaId; | |||
| try { | |||
| WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId); | |||
| inputStream = mpService.getMaterialService().materialImageOrVoiceDownload(mediaId); | |||
| } catch (WxErrorException e) { | |||
| logger.error("获取永久素材失败", e); | |||
| throw new RuntimeException(e); | |||
| } | |||
| try { | |||
| response.reset(); | |||
| response.setContentType("application/octet-stream"); | |||
| String agent = req.getHeader("user-agent"); | |||
| if (agent.contains("Firefox")) { | |||
| response.setHeader("Content-disposition", | |||
| "attachment; filename=" | |||
| + new String(filename.getBytes("GB2312"), "ISO-8859-1")); | |||
| } else { | |||
| response.setHeader("Content-disposition", | |||
| "attachment; filename=" | |||
| + java.net.URLEncoder.encode(filename, "UTF-8")); | |||
| } | |||
| // 循环取出流中的数据 | |||
| byte[] b = new byte[1024]; | |||
| int len; | |||
| while ((len = inputStream.read(b)) > 0) | |||
| response.getOutputStream().write(b, 0, len); | |||
| inputStream.close(); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| /** | |||
| * 图片上传 | |||
| * | |||
| * @param multiReq | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/imgUpload/{appId}", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("上传图片") | |||
| public ResultData imgUpload( | |||
| @PathVariable("appId") String appId, | |||
| @RequestParam("file") MultipartFile multiReq) throws Exception { | |||
| logger.info("[" + getIpAddr() + "] WechatMediaController::imgUpload"); | |||
| String fileName = multiReq.getOriginalFilename(); | |||
| System.out.println(fileName); | |||
| // 本地保存 | |||
| FileOutputStream fos = null; | |||
| String localImgFileName = fmUploadDir + fileName; | |||
| BufferedInputStream fs = null; | |||
| File localFile = new File(localImgFileName); | |||
| fos = new FileOutputStream(localFile); | |||
| fs = (BufferedInputStream) multiReq.getInputStream(); | |||
| byte[] buffer = new byte[1024]; | |||
| int len = 0; | |||
| while ((len = fs.read(buffer)) != -1) { | |||
| fos.write(buffer, 0, len); | |||
| } | |||
| fos.close(); | |||
| fs.close(); | |||
| // 上传 微信 | |||
| try { | |||
| WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId); | |||
| WxMediaImgUploadResult openResult = mpService.getMaterialService().mediaImgUpload(localFile); | |||
| if(openResult != null) { | |||
| return new ResultData(openResult.getUrl()); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error("获取永久素材失败", e); | |||
| throw new RuntimeException(e); | |||
| } | |||
| // 删除本地缓存 | |||
| localFile.delete(); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -6,6 +6,7 @@ import com.google.gson.reflect.TypeToken; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxWeappCodeAuditDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | |||
| import com.iformall.enums.*; | |||
| @@ -225,7 +226,7 @@ public class WechatWeappCodeController { | |||
| } | |||
| } | |||
| @ApiOperation("将第三方提交的代码包提交审核") | |||
| @ApiOperation("将第三方提交的代码包提交审核 -- 即将废弃") | |||
| @GetMapping("/submitAudit") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true), | |||
| @@ -316,6 +317,100 @@ public class WechatWeappCodeController { | |||
| return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | |||
| } | |||
| @ApiOperation("将第三方提交的代码包提交审核") | |||
| @PostMapping("/submitAuditWithFeedBack") | |||
| public ResultData submitAudit(@RequestBody WxWeappCodeAuditDto codeAuditDto) { | |||
| Gson gson = new GsonBuilder().create(); | |||
| WxWeappExtSet extSetQ = new WxWeappExtSet(); | |||
| extSetQ.setAppId(codeAuditDto.getAppId()); | |||
| WxWeappExtSet extSet = weappExtSetService.getByObj(extSetQ); | |||
| if(StringUtils.isBlank(extSet.getReleaseJson())) { | |||
| logger.error("Release JSON is null"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| WxWeappCodeStatusVo codeQ = new WxWeappCodeStatusVo(); | |||
| codeQ.setAppId(codeAuditDto.getAppId()); | |||
| if(StringUtils.isNotBlank(codeAuditDto.getVersion())) { | |||
| codeQ.setUserVersion(codeAuditDto.getVersion()); | |||
| } | |||
| List<WxWeappCodeStatusVo> codeStatusList = weappCodeStatusService.getList(codeQ); | |||
| if(codeStatusList.size() == 1) { | |||
| WxWeappCodeStatusVo codeStatus = codeStatusList.get(0); | |||
| WxOpenMaSubmitAuditMessage subMessage = gson.fromJson(extSet.getReleaseJson(), new TypeToken<WxOpenMaSubmitAuditMessage>() {}.getType()); | |||
| if(StringUtils.isNotBlank(codeAuditDto.getFeedbackInfo())) { | |||
| subMessage.setFeedbackInfo(codeAuditDto.getFeedbackInfo()); | |||
| } | |||
| if(StringUtils.isNotBlank(codeAuditDto.getFeedbackStuff())) { | |||
| subMessage.setFeedbackStuff(codeAuditDto.getFeedbackStuff()); | |||
| } | |||
| if(codeStatus != null && codeStatus.getCodeStatus().equals(EnumWeappCodeCommitStatus.SUCCESS.getCode())) { | |||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(codeAuditDto.getAppId()); | |||
| boolean submitStatus = false; | |||
| String codeErrCode = ""; | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(codeAuditDto.getAppId()); | |||
| WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | |||
| logger.info(openRet.toString()); | |||
| if(openRet.isSuccess()) { | |||
| submitStatus = true; | |||
| codeErrCode = gson.toJson(openRet); | |||
| } else { | |||
| submitStatus = false; | |||
| codeErrCode = gson.toJson(openRet); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| submitStatus = false; | |||
| codeErrCode = e.getMessage(); | |||
| } | |||
| if (auditStatus == null) { | |||
| auditStatus = new WxWeappAuditStatus(); | |||
| auditStatus.setId(codeStatus.getId()); | |||
| auditStatus.setTenantId(codeStatus.getTenantId()); | |||
| auditStatus.setAppId(codeStatus.getAppId()); | |||
| auditStatus.setType(codeStatus.getType()); | |||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | |||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | |||
| if(submitStatus) { | |||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||
| } else { | |||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||
| } | |||
| auditStatus.setAuditErrCode(codeErrCode); | |||
| auditStatus.setAuditTime(new Date()); | |||
| weappAuditStatusService.saveStatus(auditStatus); | |||
| } else { | |||
| if(!submitStatus) { | |||
| if(!auditStatus.getUserVersion().equals(codeStatus.getUserVersion()) | |||
| && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||
| // 提交审核失败不替换当前审核中的数据 | |||
| return new ResultData(ErrorCode.WEAPP_HAD_AUDITING); | |||
| } | |||
| codeStatus.setCodeStatus(EnumWeappAuditStatus.FAIL.getCode()); | |||
| codeStatus.setCodeErrCode(codeErrCode); | |||
| } else { | |||
| codeStatus.setCodeStatus(EnumWeappAuditStatus.AUDITING.getCode()); | |||
| } | |||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | |||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | |||
| auditStatus.setAuditTime(new Date()); | |||
| weappAuditStatusService.updateStatus(auditStatus); | |||
| } | |||
| if(submitStatus) { | |||
| return new ResultData(codeErrCode); | |||
| } else { | |||
| return new ResultData(ErrorCode.WEAPP_AUDIT_ERR); | |||
| } | |||
| } else { | |||
| logger.error(ErrorCode.WEAPP_CODE_COMMIT_ERR.getMessage()); | |||
| return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | |||
| } | |||
| } | |||
| return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | |||
| } | |||
| @ApiOperation("查询某个指定版本的审核状态") | |||
| @PostMapping("/getAuditstatus") | |||
| public ResultData getAuditstatus(String appId, String auditidStr) { | |||
| @@ -66,9 +66,10 @@ public class WxWeappExtSetController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("扩展模板-批量模板更新") | |||
| @PostMapping("batchUpdate") | |||
| public ResultData batchAdd(@RequestBody WxWeappExtSet weappExtSet) { | |||
| logger.debug("[" + getIpAddr() + "] WxWeappExtSetController::batchAdd"); | |||
| logger.debug("[" + getIpAddr() + "] WxWeappExtSetController::batchUpdate"); | |||
| if (null == weappExtSet) return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| if(StringUtils.isBlank(weappExtSet.getExtJson())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| @@ -2,6 +2,7 @@ package com.iformall.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.template.WxMaTemplateAddResult; | |||
| import cn.binarywang.wx.miniapp.bean.template.WxMaTemplateListResult; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| @@ -202,8 +203,9 @@ public class WxWeappInfoController extends BaseController { | |||
| JSONObject urlObj = domainObj.getJSONObject("url"); | |||
| List<String> requestDomain = getUrlList(urlObj.getJSONArray("requestdomain")); | |||
| List<String> wsrequestDomain = getUrlList(urlObj.getJSONArray("wsrequestdomain")); | |||
| List<String> uploadDomain = getUrlList(urlObj.getJSONArray("requestdomain")); | |||
| List<String> downloadDomain = getUrlList(urlObj.getJSONArray("requestdomain")); | |||
| List<String> uploadDomain = getUrlList(urlObj.getJSONArray("uploaddomain")); | |||
| List<String> downloadDomain = getUrlList(urlObj.getJSONArray("downloaddomain")); | |||
| logger.info(downloadDomain.toString()); | |||
| WxOpenMaDomainResult openRet = openMaService.modifyDomain(action, | |||
| requestDomain, wsrequestDomain, | |||
| uploadDomain, downloadDomain); | |||
| @@ -246,63 +248,69 @@ public class WxWeappInfoController extends BaseController { | |||
| // 设置微信模板 | |||
| if(weappBasicSet.getType().equals(EnumAppType.C.getCode())) { | |||
| WxAppinfo appinfo = appinfoService.getByAppId(appId); | |||
| try { | |||
| if(authorizerInfo.getTemplateStatus() == null || | |||
| !authorizerInfo.getTemplateStatus().equals(EnumWxAuthotizationTemplateStatus.SUCCESS.getCode())) { | |||
| // 模板未设置或者设置失败 | |||
| // 获取模板 | |||
| WxAppinfo appinfo = appinfoService.getByAppId(appId); | |||
| WxMaService maService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||
| // 核销成功消息 | |||
| JSONObject verify_success = templeObj.getJSONObject("verify_success"); | |||
| JSONArray keyidlist = verify_success.getJSONArray("keyword_id_list"); | |||
| List<Integer> keyArr = getIdList(keyidlist); | |||
| WxMaTemplateAddResult ret = maService.getTemplateService().addTemplate(verify_success.getString("id"), keyArr); | |||
| logger.info(ret.toString()); | |||
| if(appinfo != null) { | |||
| // wx_template_msg | |||
| WxTemplateMsg templateMsgQ = new WxTemplateMsg(); | |||
| templateMsgQ.setTenantId(appinfo.getTenantId()); | |||
| templateMsgQ.setType(EnumTemplateType.VERIFY_SUCCESS.getCode()); | |||
| WxTemplateMsg templateMsg = templateMsgService.getByObj(templateMsgQ); | |||
| if(templateMsg != null) { | |||
| templateMsg.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsg); | |||
| } else { | |||
| templateMsgQ.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsgQ); | |||
| try { | |||
| // 核销成功消息 | |||
| JSONObject verify_success = templeObj.getJSONObject("verify_success"); | |||
| JSONArray keyidlist = verify_success.getJSONArray("keyword_id_list"); | |||
| List<Integer> keyArr = getIdList(keyidlist); | |||
| WxMaTemplateAddResult ret = maService.getTemplateService().addTemplate(verify_success.getString("id"), keyArr); | |||
| logger.info(ret.toString()); | |||
| if(appinfo != null) { | |||
| // wx_template_msg | |||
| WxTemplateMsg templateMsgQ = new WxTemplateMsg(); | |||
| templateMsgQ.setTenantId(appinfo.getTenantId()); | |||
| templateMsgQ.setType(EnumTemplateType.VERIFY_SUCCESS.getCode()); | |||
| WxTemplateMsg templateMsg = templateMsgService.getByObj(templateMsgQ); | |||
| if(templateMsg != null) { | |||
| templateMsg.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsg); | |||
| } else { | |||
| templateMsgQ.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsgQ); | |||
| } | |||
| } | |||
| } | |||
| // 核销失败消息 | |||
| JSONObject verify_fail = templeObj.getJSONObject("verify_fail"); | |||
| keyidlist = verify_fail.getJSONArray("keyword_id_list"); | |||
| List<Integer> keyArr1 = getIdList(keyidlist); | |||
| ret = maService.getTemplateService().addTemplate(verify_fail.getString("id"), keyArr1); | |||
| logger.info(ret.toString()); | |||
| if(appinfo != null) { | |||
| // wx_template_msg | |||
| WxTemplateMsg templateMsgQ = new WxTemplateMsg(); | |||
| templateMsgQ.setTenantId(appinfo.getTenantId()); | |||
| templateMsgQ.setType(EnumTemplateType.VERIFY_FAIL.getCode()); | |||
| WxTemplateMsg templateMsg = templateMsgService.getByObj(templateMsgQ); | |||
| if(templateMsg != null) { | |||
| templateMsg.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsg); | |||
| } else { | |||
| templateMsgQ.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsgQ); | |||
| // 核销失败消息 | |||
| JSONObject verify_fail = templeObj.getJSONObject("verify_fail"); | |||
| keyidlist = verify_fail.getJSONArray("keyword_id_list"); | |||
| List<Integer> keyArr1 = getIdList(keyidlist); | |||
| ret = maService.getTemplateService().addTemplate(verify_fail.getString("id"), keyArr1); | |||
| logger.info(ret.toString()); | |||
| if(appinfo != null) { | |||
| // wx_template_msg | |||
| WxTemplateMsg templateMsgQ = new WxTemplateMsg(); | |||
| templateMsgQ.setTenantId(appinfo.getTenantId()); | |||
| templateMsgQ.setType(EnumTemplateType.VERIFY_FAIL.getCode()); | |||
| WxTemplateMsg templateMsg = templateMsgService.getByObj(templateMsgQ); | |||
| if(templateMsg != null) { | |||
| templateMsg.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsg); | |||
| } else { | |||
| templateMsgQ.setTemplateId(ret.getTemplateId()); | |||
| templateMsgService.saveOrUpdate(templateMsgQ); | |||
| } | |||
| } | |||
| } | |||
| // 更新状态 | |||
| authorizerInfo.setTemplateStatus(0); | |||
| authorizerInfo.setTemplateTime(new Date()); | |||
| authorizerInfo.setUpdateTime(new Date()); | |||
| authorizerInfoService.updateTemplate(authorizerInfo); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| // 更新状态 | |||
| authorizerInfo.setTemplateStatus(1); | |||
| authorizerInfo.setTemplateTime(new Date()); | |||
| authorizerInfo.setUpdateTime(new Date()); | |||
| authorizerInfoService.updateTemplate(authorizerInfo); | |||
| return new ResultData(Result.ERROR, e.getMessage()); | |||
| // 更新状态 | |||
| authorizerInfo.setTemplateStatus(EnumWxAuthotizationTemplateStatus.SUCCESS.getCode()); | |||
| authorizerInfo.setTemplateTime(new Date()); | |||
| authorizerInfo.setUpdateTime(new Date()); | |||
| authorizerInfoService.updateTemplate(authorizerInfo); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| // 更新状态 | |||
| authorizerInfo.setTemplateStatus(EnumWxAuthotizationTemplateStatus.Fail.getCode()); | |||
| authorizerInfo.setTemplateTime(new Date()); | |||
| authorizerInfo.setUpdateTime(new Date()); | |||
| authorizerInfoService.updateTemplate(authorizerInfo); | |||
| return new ResultData(Result.ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| // 设置成功返回null | |||
| @@ -56,7 +56,6 @@ public class UserUnionIdSchedule { | |||
| List<WxPayOrderVo> paidList = payOrderMapper.findListOfPaidOrderByDate(dateMap); | |||
| paidList.parallelStream().forEach( payOrderVo -> { | |||
| getUnionId(payOrderVo); | |||
| //sendUniformMessage(payOrderVo); | |||
| }); | |||
| } | |||
| @@ -71,12 +70,12 @@ public class UserUnionIdSchedule { | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(payOrderVo.getAppId()); | |||
| if(StringUtils.isNotBlank(payOrderVo.getTransactionId())) { | |||
| String openRet = openMaService.getApiGetPaidUnionid(payOrderVo.getOpenId(), payOrderVo.getTransactionId()); | |||
| String openRet = openMaService.getPaidUnionId(payOrderVo.getOpenId(), payOrderVo.getTransactionId(), null, null); | |||
| logger.info(openRet); | |||
| } else { | |||
| WxPayAccount payAccount = payAccountMapper.selectByPrimaryKey(payOrderVo.getPayId()); | |||
| if(payAccount != null) { | |||
| String openRet = openMaService.getApiGetPaidUnionid(payOrderVo.getOpenId(), payAccount.getMchId(), payOrderVo.getPayOrderNo()); | |||
| String openRet = openMaService.getPaidUnionId(payOrderVo.getOpenId(), null, payAccount.getMchId(), payOrderVo.getPayOrderNo()); | |||
| logger.info(openRet); | |||
| } | |||
| } | |||
| @@ -85,67 +84,4 @@ public class UserUnionIdSchedule { | |||
| } | |||
| } | |||
| /** | |||
| * 根据payOrder发送模板消息 | |||
| * @param payOrderVo | |||
| */ | |||
| /* | |||
| public void sendUniformMessage(WxPayOrderVo payOrderVo) { | |||
| if(StringUtils.isBlank(payOrderVo.getOpenId())) { | |||
| return; | |||
| } | |||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); | |||
| // | |||
| // 卡券核销通知 p6pwzZN9GVJq11j2zh72EEhIn5fAIa6oQBBOjqVt8-U | |||
| // {{first.DATA}} | |||
| // 卡券类型:{{keyword1.DATA}} | |||
| // 卡券号码:{{keyword2.DATA}} | |||
| // 核销时间:{{keyword3.DATA}} | |||
| // {{remark.DATA}} | |||
| // 审核结果通知 SxhGTL6AlcYtbc4nEYxcS4zoGRzTiUr9KEscvpEItQw | |||
| // {{first.DATA}} | |||
| // 审核状态:{{keyword1.DATA}} | |||
| // 活动名称:{{keyword2.DATA}} | |||
| // 活动时间:{{keyword3.DATA}} | |||
| // 活动地点:{{keyword4.DATA}} | |||
| // {{remark.DATA}} | |||
| // | |||
| // | |||
| String template_id = "p6pwzZN9GVJq11j2zh72EEhIn5fAIa6oQBBOjqVt8-U"; | |||
| WxMaUniformMessage.MiniProgram miniprogram = new WxMaUniformMessage.MiniProgram(); | |||
| miniprogram.setAppid(payOrderVo.getAppId()); | |||
| miniprogram.setPagePath("pages/index/index"); | |||
| miniprogram.setUsePath(true); | |||
| WxMaUniformMessage templateMessage = WxMaUniformMessage.builder() | |||
| .isMpTemplateMsg(true) | |||
| .toUser(payOrderVo.getOpenId()) | |||
| .appid("wxed2f44705544b892") | |||
| .templateId(template_id) | |||
| .url("http://iformall.com") | |||
| .page("pages/index/index") | |||
| .formId(payOrderVo.getPrepayId()) // 微信支付的formId是prepayId | |||
| .miniProgram(miniprogram) | |||
| .data(Lists.newArrayList( | |||
| new WxMaTemplateData("first", payOrderVo.getAppId(), "#173177"), | |||
| new WxMaTemplateData("keyword1", payOrderVo.getOpenId(), "#173177"), | |||
| new WxMaTemplateData("keyword2", payOrderVo.getTransactionId(), "#173177"), | |||
| new WxMaTemplateData("keyword3", dateFormat.format(new Date()), "#173177") | |||
| )) | |||
| .emphasisKeyword("keyword1.DATA") | |||
| .build(); | |||
| WxMaService wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(payOrderVo.getAppId()); | |||
| try { | |||
| wxMaService.getMsgService().sendUniformMsg(templateMessage); | |||
| } catch (WxErrorException e) { | |||
| logger.error("支付通知测试: " + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.TEMPLATE_SEND_FAILED); | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| @@ -5,7 +5,7 @@ spring: | |||
| datasource: | |||
| url: jdbc:mysql://202.165.179.86:3306/mallinkDev?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) | |||
| password: ENC(WGu0+1DPIHrqorDhrbq1+7wr7xNG53mN) | |||
| password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||
| filters: stat | |||
| @@ -29,7 +29,7 @@ spring: | |||
| redis: | |||
| host: 202.165.179.86 | |||
| port: 6379 | |||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| @@ -69,7 +69,7 @@ wechat: | |||
| redis: | |||
| host: 202.165.179.86 | |||
| port: 6379 | |||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| @@ -87,12 +87,14 @@ jasypt: | |||
| fm: | |||
| exception: false | |||
| exception_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com,hanxueda@iformall.com | |||
| exception_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com | |||
| audit_emails: wangmei@iformall.com,wuguoqiang@iformall.com,huanghui@iformall.com,sunmingming@iformall.com | |||
| deploy: 1 | |||
| upload_dir: /home/test/server/uploads/ | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| me.chanjar.weixin: debug | |||
| path: ./logs/o | |||
| @@ -84,6 +84,7 @@ fm: | |||
| exception_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com,hanxueda@iformall.com | |||
| audit_emails: wangmei@iformall.com,wuguoqiang@iformall.com,huanghui@iformall.com,sunmingming@iformall.com | |||
| deploy: 3 | |||
| upload_dir: /home/ec2-user/server/uploads/ | |||
| logging: | |||
| level: | |||
| @@ -94,6 +94,7 @@ fm: | |||
| exception_emails: hupeng@iformall.com,wuguoqiang@iformall.com,gongbiao@iformall.com,luozukai@iformall.com,hanxueda@iformall.com | |||
| audit_emails: wangmei@iformall.com,wuguoqiang@iformall.com,huanghui@iformall.com,sunmingming@iformall.com | |||
| deploy: 2 | |||
| upload_dir: /home/ec2-user/server/uploads/ | |||
| ueditor: | |||
| config: config.json | |||
| @@ -18,16 +18,16 @@ | |||
| <parent> | |||
| <groupId>org.springframework.boot</groupId> | |||
| <artifactId>spring-boot-starter-parent</artifactId> | |||
| <version>2.1.4.RELEASE</version> | |||
| <version>2.1.5.RELEASE</version> | |||
| <relativePath/> | |||
| </parent> | |||
| <properties> | |||
| <weixin-java-common.version>3.3.0.A</weixin-java-common.version> | |||
| <weixin-java-mp.version>3.3.0.A</weixin-java-mp.version> | |||
| <weixin-java-miniapp.version>3.3.0.A</weixin-java-miniapp.version> | |||
| <weixin-java-pay.version>3.3.0.A</weixin-java-pay.version> | |||
| <weixin-java-open.version>3.3.0.A</weixin-java-open.version> | |||
| <weixin-java-common.version>3.4.0.A</weixin-java-common.version> | |||
| <weixin-java-mp.version>3.4.0.A</weixin-java-mp.version> | |||
| <weixin-java-miniapp.version>3.4.0.A</weixin-java-miniapp.version> | |||
| <weixin-java-pay.version>3.4.0.A</weixin-java-pay.version> | |||
| <weixin-java-open.version>3.4.0.A</weixin-java-open.version> | |||
| <quartz.version>2.3.0</quartz.version> | |||
| </properties> | |||