Browse Source

//tt product

release_toaliyun_real
xhxu 4 years ago
parent
commit
e83b532833
3 changed files with 52 additions and 52 deletions
  1. +50
    -50
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java

+ 50
- 50
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java View File

@@ -160,6 +160,7 @@ public class WxOrderController extends BaseController {
@ApiOperation(value = "抖音支付2.0与下单回调推送订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}")
@PostMapping("douyinPushOrder")
public Map<String,Object> douyinPushOrder(HttpServletRequest request) {

Map<String, Object> map = new HashMap();

SignatureHeader header = new SignatureHeader();
@@ -171,60 +172,60 @@ public class WxOrderController extends BaseController {

String body = ((BodyReaderHttpServletRequestWrapper) request).getBody();
logger.info("支付2.0预下单回调---body{}"+body);

JSONObject jsonObject = JSONObject.parseObject(body);
String msg = jsonObject.getString("msg");

JSONObject msgObject = JSONObject.parseObject(msg);
String app_id = msgObject.getString("app_id");
String open_id = msgObject.getString("open_id");
//透传字段
Map<String,String> couponMap = new HashMap<>();
try{
String cp_extra = msgObject.getString("cp_extra");
if(StringUtils.isBlank(cp_extra)){
try {
JSONObject jsonObject = JSONObject.parseObject(body);
String msg = jsonObject.getString("msg");

JSONObject msgObject = JSONObject.parseObject(msg);
String app_id = msgObject.getString("app_id");
String open_id = msgObject.getString("open_id");
//透传字段
Map<String,String> couponMap = new HashMap<>();
try{
String cp_extra = msgObject.getString("cp_extra");
if(StringUtils.isBlank(cp_extra)){
map.put("err_no",ErrorCode.SYS_PARAMETER_NOT_NULL.getCode());
map.put("err_tips","缺少透传字段");
return map;
}
couponMap = JSONObject.parseObject(cp_extra, Map.class);
}catch(Exception e){
}
if(couponMap.isEmpty()){
map.put("err_no",ErrorCode.SYS_PARAMETER_NOT_NULL.getCode());
map.put("err_tips","缺少透传字段");
map.put("err_tips","透传字段格式不正确");
return map;
}

//验证app
WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id);
if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat())
|| !EnumAppType.C.getCode().equals(appinfo.getType())){
map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode());
map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage());
return map;
}
WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId());
if(payAccount == null){
map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode());
map.put("err_tips","未找到支付配置");
return map;
}
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.updateTenantInfo(appinfo);
//验证用户
Long memberId = null;
TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, tenantEntity.getTenantId());
if(cuser != null && cuser.getUserId() != null){
memberId = cuser.getUserId();
}
if(memberId == null){
map.put("err_no",ErrorCode.USER_NOT_MEMBER.getCode());
map.put("err_tips",ErrorCode.USER_NOT_MEMBER.getMessage());
return map;
}
couponMap = JSONObject.parseObject(cp_extra, Map.class);
}catch(Exception e){
}
if(couponMap.isEmpty()){
map.put("err_no",ErrorCode.SYS_PARAMETER_NOT_NULL.getCode());
map.put("err_tips","透传字段格式不正确");
return map;
}

//验证app
WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id);
if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat())
|| !EnumAppType.C.getCode().equals(appinfo.getType())){
map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode());
map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage());
return map;
}
WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId());
if(payAccount == null){
map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode());
map.put("err_tips","未找到支付配置");
return map;
}
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.updateTenantInfo(appinfo);
//验证用户
Long memberId = null;
TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, tenantEntity.getTenantId());
if(cuser != null && cuser.getUserId() != null){
memberId = cuser.getUserId();
}
if(memberId == null){
map.put("err_no",ErrorCode.USER_NOT_MEMBER.getCode());
map.put("err_tips",ErrorCode.USER_NOT_MEMBER.getMessage());
return map;
}

try {
TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount);
CreateOrderCallback createOrderCallback = ttPayService.parseOrderNotifyV2Result(body, header);
JSONObject allExtParam = new JSONObject();
@@ -383,7 +384,6 @@ public class WxOrderController extends BaseController {
if (null != payOrder) {
WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(payOrder.getComposeOrder()).getComposeOrder(payOrder.getOrderId(), payOrder.getTenantId());
//查询微信订单状态并更新

boolean hasCompleted = wxPayOrderService.hasCompleted(composeOrder,payOrder);
if (!hasCompleted) {
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(payOrder, EnumPayWay.getEnum(payOrder.getPayVendor()).getPlat());


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java View File

@@ -1463,7 +1463,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
}else if(list != null && list.size() > 1){
throw new MallinkException(ErrorCode.PAY_ORDER_ERROR);
}
throw new MallinkException(ErrorCode.PAY_ORDER_NOT_FOUND);
return null;
}

@Override


+ 1
- 1
mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java View File

@@ -317,7 +317,7 @@ public class AliyunSMS implements SMSExcutor {
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
}
QuerySmsTemplateRequest request = new QuerySmsTemplateRequest();
request.setTemplateCode("SMS_239312983");
request.setTemplateCode("SMS_243451989");

DefaultAcsClient acsClient = new DefaultAcsClient(profile);
QuerySmsTemplateResponse response = null;


Loading…
Cancel
Save