银行卡绑定不上,消息统一通知
This commit is contained in:
parent
202eb5237a
commit
60cb94d9dc
|
|
@ -51,6 +51,9 @@ public class CustomerBankController {
|
|||
if(adapayService == null){
|
||||
adapayService = SpringUtils.getBean(AdapayService.class);
|
||||
}
|
||||
if(customerBankService == null){
|
||||
customerBankService = SpringUtils.getBean(CustomerBankService.class);
|
||||
}
|
||||
// 需要先检查一次memberId是否已存在,如果已存在则只需要绑卡即可
|
||||
Map<String, Object> member = adapayService.queryMember(merchant.getDeptId(), memberId);
|
||||
if (AdapayStatusEnum.succeeded.code.equals(member.get("status")) && memberId.equals(member.get("member_id"))) {
|
||||
|
|
@ -88,6 +91,7 @@ public class CustomerBankController {
|
|||
customerBank.setSettleAccount(1);
|
||||
customerBankService.insertCustomerBank(customerBank);
|
||||
|
||||
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ghy.common.enums;
|
||||
|
||||
/**
|
||||
* 微信消息通知枚举
|
||||
* @author clunt
|
||||
*/
|
||||
|
||||
public enum WxMsgEnum {
|
||||
|
||||
/** 任务大厅订单通知 */
|
||||
PUBLIC_ORDER("", ""),
|
||||
/** 新订单通知 */
|
||||
NEW_ORDER("",""),
|
||||
/** 超时消息通知 */
|
||||
OVER_TIME("","8I5BnJMfwj-Z7udhNm9Z-kdjdg4__MV5ug1x8KKsbc0"),
|
||||
/** 今日单消息通知 */
|
||||
TODAY_ORDER("", ""),
|
||||
/** 明日单通知 */
|
||||
TOMORROW_ORDER("", ""),
|
||||
/** 不同意排单通知 */
|
||||
NOT_AGREE_PLAIN("", ""),
|
||||
/** 不同意完单通知 */
|
||||
NOT_AGREE_FINISH("",""),
|
||||
/** 子师傅拒绝接单/退单通知 */
|
||||
DETAIL_REJECT("", "")
|
||||
;
|
||||
|
||||
private String type;
|
||||
private String tempCode;
|
||||
|
||||
WxMsgEnum(String type, String tempCode) {
|
||||
this.type = type;
|
||||
this.tempCode = tempCode;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTempCode() {
|
||||
return tempCode;
|
||||
}
|
||||
|
||||
public void setTempCode(String tempCode) {
|
||||
this.tempCode = tempCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.ghy.system.service;
|
||||
|
||||
/**
|
||||
* 消息通知
|
||||
* @author clunt
|
||||
*/
|
||||
public interface IMessageNoticeService {
|
||||
|
||||
/**
|
||||
* 今日单/明日单通知
|
||||
*/
|
||||
public void noticeTodayOrder();
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
package com.ghy.system.service;
|
||||
|
||||
import com.ghy.common.enums.OrderStatus;
|
||||
import com.ghy.common.enums.WxMsgEnum;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 但星霖
|
||||
|
|
@ -21,4 +24,13 @@ public interface IWxMsgService {
|
|||
* @return 是否推送成功
|
||||
*/
|
||||
Boolean sendMsg(String openId, String remind, String orderId, String name, OrderStatus orderStatus, Long time);
|
||||
|
||||
/**
|
||||
* 推送微信消息
|
||||
* @param openId 微信唯一识别
|
||||
* @param wxMsgEnum 消息类型 * 用户查找模版id
|
||||
* @param params 模版内容
|
||||
*/
|
||||
void sendWxMsg(String openId, WxMsgEnum wxMsgEnum, Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ghy.system.service.impl;
|
||||
|
||||
import com.ghy.system.service.IMessageNoticeService;
|
||||
import com.ghy.system.service.IWxMsgService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class IMessageNoticeServiceImpl implements IMessageNoticeService {
|
||||
|
||||
@Autowired
|
||||
private IWxMsgService wxMsgService;
|
||||
|
||||
@Override
|
||||
public void noticeTodayOrder() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.ghy.system.service.impl;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ghy.common.enums.OrderStatus;
|
||||
import com.ghy.common.enums.WxMsgEnum;
|
||||
import com.ghy.common.utils.DateUtils;
|
||||
import com.ghy.system.config.WxMsgConfig;
|
||||
import com.ghy.system.service.IWxMsgService;
|
||||
|
|
@ -57,6 +58,21 @@ public class WxMsgServiceImpl implements IWxMsgService {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendWxMsg(String openId, WxMsgEnum wxMsgEnum, Map<String, Object> params) {
|
||||
WxMsgConfig wxMsgConfig = buildMsgDto(openId, wxMsgEnum, params);
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + getAccessToken();
|
||||
log.info("微信消息通知请求 url: {} , 参数: {}",url, wxMsgConfig);
|
||||
JSONObject responseData = postData(url, wxMsgConfig);
|
||||
log.info("微信消息通知请求参数:{}", JSON.toJSONString(responseData));
|
||||
Integer errorCode = responseData.getInteger("errcode");
|
||||
String errorMessage = responseData.getString("errmsg");
|
||||
if (errorCode == 0) {
|
||||
log.info("用户:" + "openId" + "消息推送成功");
|
||||
} else {
|
||||
log.error("微信消息通知失败,errcode:{},errorMessage:{}", errorCode, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取acctoken
|
||||
|
|
@ -122,6 +138,29 @@ public class WxMsgServiceImpl implements IWxMsgService {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private WxMsgConfig buildMsgDto(String openId, WxMsgEnum wxMsgEnum, Map<String, Object> params) {
|
||||
// 基础数据添加。
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Map.Entry<String, Object> objectEntry : params.entrySet()) {
|
||||
JSONObject model = new JSONObject();
|
||||
model.put("value", objectEntry.getValue());
|
||||
jsonObject.put(objectEntry.getKey(), jsonObject);
|
||||
}
|
||||
/**
|
||||
* 消息推送配置参数拼接
|
||||
*/
|
||||
WxMsgConfig wxMsgConfig = new WxMsgConfig();
|
||||
// openId
|
||||
wxMsgConfig.setTouser(openId);
|
||||
// 模板id
|
||||
wxMsgConfig.setTemplate_id(wxMsgEnum.getTempCode());
|
||||
// 数据data
|
||||
wxMsgConfig.setData(jsonObject);
|
||||
return wxMsgConfig;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue