Przeglądaj źródła

add shopcallback

release_toaliyun_real
xiaohanzi 4 lat temu
rodzic
commit
504ae65412
1 zmienionych plików z 77 dodań i 0 usunięć
  1. +77
    -0
      mallinkTTCApi/src/main/java/com/iformall/callback/TtShopCallbackController.java

+ 77
- 0
mallinkTTCApi/src/main/java/com/iformall/callback/TtShopCallbackController.java Wyświetl plik

@@ -0,0 +1,77 @@
package com.iformall.callback;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.iformall.controller.BaseController;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxPayAccount;
import com.iformall.douyin.pay.DouYinPayHelper;
import com.iformall.interceptor.BodyReaderHttpServletRequestWrapper;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxPayAccountService;
import com.iformall.service.tt.TtOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
* https://op.jinritemai.com/docs/guide-docs/10/99
* @author alascor
*/
@RestController
@RequestMapping("/shopcallback")
public class TtShopCallbackController extends BaseController {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private TtOrderService ttOrderService;

@Autowired
private WxAppinfoService appinfoService;

@Autowired
private WxPayAccountService payAccountService;

@PostMapping(value = "/notice")
@ResponseBody
public Map<String,Object> createOrder( HttpServletRequest request){
String body = ((BodyReaderHttpServletRequestWrapper) request).getBody();
Map retMap = new HashMap();
retMap.put("code", 0);
retMap.put("msg", "success");
try {
JSONArray bodyarrays = JSONArray.parseArray(body);
if (null != bodyarrays) {
for (int i = 0 ; i < bodyarrays.size(); i++) {
JSONObject object = bodyarrays.getJSONObject(i);
String tag = object.getString("tag");
String msgId = object.getString("msg_id");
String dataJson = object.getString("data");
if ("0".equals(tag) && "0".equals(msgId)) {
return retMap;
//doudian_trade_TradePaid https://op.jinritemai.com/docs/message-docs/30/110
}else if ("101".equals(tag)) {
//解析串
return retMap;
}
}
}
return retMap;
} catch (Exception e){
e.printStackTrace();
retMap.put("code","1");
retMap.put("msg", "failed");
return retMap;
}
}

}

Ładowanie…
Anuluj
Zapisz