微信消息通知更新。
This commit is contained in:
parent
5e0d35a989
commit
b5a09dfd71
|
|
@ -4,6 +4,7 @@ import com.ghy.common.core.controller.BaseController;
|
|||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.domain.entity.SysUser;
|
||||
import com.ghy.common.enums.*;
|
||||
import com.ghy.common.utils.WechatMsgUtils;
|
||||
import com.ghy.customer.domain.Customer;
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
import com.ghy.customer.service.CustomerAddressService;
|
||||
|
|
@ -257,6 +258,19 @@ public class OrderController extends BaseController {
|
|||
orderGoodsService.insertOrderGoods(orderGoods);
|
||||
});
|
||||
|
||||
// 推送公众号通知数据。
|
||||
try{
|
||||
Worker assignWorker = workerService.selectById(orderMaster.getWorkerId());
|
||||
// 消息组装。
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("character string1", orderMaster.getCode());
|
||||
params.put("thing2", customer.getName());
|
||||
params.put("data8", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", new Date()));
|
||||
params.put("thing4", "有新订单,请及时处理!");
|
||||
WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), assignWorker.getOpenId(), WxMsgEnum.TEXT, params);
|
||||
}catch (Exception e){
|
||||
// 暂时不做任何操作。
|
||||
}
|
||||
return AjaxResult.success("下单成功");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,16 @@
|
|||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 微信所需jar -->
|
||||
<dependency>
|
||||
<groupId>org.wso2.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ghy.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -7,27 +8,42 @@ import org.springframework.stereotype.Component;
|
|||
* 七牛云配置
|
||||
* @author clunt
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "wx")
|
||||
public class WxConfig {
|
||||
|
||||
/**
|
||||
* appId
|
||||
*/
|
||||
public String appId;
|
||||
|
||||
/**
|
||||
* secret
|
||||
*/
|
||||
public String secret;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
/**
|
||||
* 授权形式
|
||||
* get Token grant_type
|
||||
*/
|
||||
private String grantTypeInToken = "client_credential";
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
/**
|
||||
* 获取用户Token url
|
||||
* get Token url
|
||||
*/
|
||||
private String gerTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=";
|
||||
|
||||
public String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
/**
|
||||
* 发送消息api
|
||||
*/
|
||||
private String sendMsgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
||||
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模版相关
|
||||
* 测试模版
|
||||
*/
|
||||
private String textTemplateId = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ public enum WxMsgEnum {
|
|||
/** 新订单通知 */
|
||||
NEW_ORDER("","gFoPAYF4J6Y_O5OzzNUbvMxTrsAS7aUWffdNH42xhzM"),
|
||||
/** 商城端消息通知 */
|
||||
CUSTOMER_ORDER("", "JtsGFPDjYhL2GbHfKxvTJaR_lLp8xLyw8VeR01Y0JHM")
|
||||
CUSTOMER_ORDER("", "JtsGFPDjYhL2GbHfKxvTJaR_lLp8xLyw8VeR01Y0JHM"),
|
||||
/** 测试 **/
|
||||
TEXT("", "JtsGFPDjYhL2GbHfKxvTJaR_lLp8xLyw8VeR01Y0JHM"),
|
||||
;
|
||||
/** 超时消息通知 */
|
||||
// OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"),
|
||||
|
|
|
|||
12
pom.xml
12
pom.xml
|
|
@ -332,6 +332,18 @@
|
|||
<version>${wxpay.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 微信所需jar -->
|
||||
<dependency>
|
||||
<groupId>org.wso2.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.3.1.wso2v1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.3.1.wso2v1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue