|
@@ -7,14 +7,17 @@ import com.usky.dxtop.common.utils.Arith;
|
|
|
import com.usky.dxtop.common.utils.http.HttpUtils;
|
|
|
import com.usky.dxtop.model.Charge;
|
|
|
import com.usky.dxtop.model.Dish;
|
|
|
+import com.usky.dxtop.model.Order;
|
|
|
import com.usky.dxtop.service.ChargeService;
|
|
|
import com.usky.dxtop.service.DishService;
|
|
|
import com.usky.dxtop.service.MsgLogService;
|
|
|
import com.usky.dxtop.service.api.TopApiConfiger;
|
|
|
import com.usky.dxtop.service.api.WxApi;
|
|
|
+import com.usky.dxtop.service.job.CenterUserJob;
|
|
|
import com.usky.dxtop.service.job.SmJob;
|
|
|
import com.usky.dxtop.service.listener.ChargeTransMqListener;
|
|
|
import com.usky.dxtop.service.listener.DishTransMqListener;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -27,95 +30,20 @@ import java.util.TreeMap;
|
|
|
* @author yq
|
|
|
* @date 2021/9/28 15:11
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest
|
|
|
public class SmApiTest {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
- private MsgLogService msgLogService;
|
|
|
+ private CenterUserJob centerUserJob;
|
|
|
|
|
|
- @Autowired
|
|
|
- private WxApi wxApi;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ChargeTransMqListener chargeTransMqListener;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private DishTransMqListener dishTransMqListener;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private DishService dishService;
|
|
|
- @Autowired
|
|
|
- private ChargeService chargeService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SmJob smJob;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private TopApiConfiger topApiConfiger;
|
|
|
@Test
|
|
|
public void test1(){
|
|
|
- smJob.personApi(null);
|
|
|
- }
|
|
|
- @Test
|
|
|
- public void testSendMessage(){
|
|
|
- Dish dish = dishService.getById(637744684233638175L);
|
|
|
- wxApi.sendMessageApi("o5P6I5tLj-TjrK7leWUT8EFmTCa4",dishTransMqListener.getMessageData(dish),wxApi.getToken(WxApi.APP_ID,WxApi.SECRET), WxApi.DISH_TEMPLATE_ID,"https://smartpark.caih.com/vuepay/#/record?id=2");
|
|
|
-
|
|
|
-
|
|
|
- Charge charge = chargeService.getById(637744683598183711L);
|
|
|
- wxApi.sendMessageApi("o5P6I5tLj-TjrK7leWUT8EFmTCa4",chargeTransMqListener.getMessageData(charge),wxApi.getToken(WxApi.APP_ID,WxApi.SECRET), WxApi.CHARGE_TEMPLATE_ID,"https://smartpark.caih.com/vuepay/#/record?id=2");
|
|
|
+ centerUserJob.groupApi(null);
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- public void order(){
|
|
|
-
|
|
|
- TreeMap<String, String> stringStringTreeMap = topApiConfiger.generateUnifyParam("fsfsfsfjwo1214578", new Double(Arith.mul(0.01, 100)).intValue(),
|
|
|
- topApiConfiger.notifyUrl, null,
|
|
|
- null, null, "ojJtF5WLIcOsQVXcLu9n6JkvE0Zw", "W06", null, "wx40274c2aaec24330",
|
|
|
- null, null, null, null);
|
|
|
- String unify = topApiConfiger.generateParam(stringStringTreeMap);
|
|
|
- String result;
|
|
|
- try {
|
|
|
- result = HttpUtils.sendGet(topApiConfiger.unifyUrl, unify,null);
|
|
|
- }catch (Exception e){
|
|
|
- throw new CustomException("调用统一支付接口异常:"+e.getMessage());
|
|
|
- }
|
|
|
- JSONObject obj= JSON.parseObject(result);
|
|
|
- String payInfo;
|
|
|
- if ("0000".equals(obj.get("status"))){
|
|
|
- payInfo = obj.get("payinfo").toString();
|
|
|
- System.out.println(payInfo);
|
|
|
- }else {
|
|
|
- throw new CustomException(obj.get("errorMessage").toString());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public TreeMap<String, String> generateUnifyParam(String merchantOrderNo, Integer amount, String notifyUrl,
|
|
|
- String backUrl, String note, String orderName, String acct,
|
|
|
- String payType, String validTime, String subAppid,
|
|
|
- String remark, String asinfo, String groupNo,
|
|
|
- String consumerIp){
|
|
|
- TreeMap<String, String> tMap = new TreeMap<>();
|
|
|
- tMap.put("version","v1.0");
|
|
|
- tMap.put("merchantNo","228304018003");
|
|
|
- tMap.put("merchantOrderNo",merchantOrderNo);
|
|
|
- tMap.put("amount",amount.toString());
|
|
|
- tMap.put("notifyUrl",notifyUrl);
|
|
|
- tMap.put("backUrl",backUrl);
|
|
|
- tMap.put("note",note);
|
|
|
- tMap.put("orderName",orderName);
|
|
|
- tMap.put("acct",acct);
|
|
|
- tMap.put("payType",payType);
|
|
|
- tMap.put("validTime",validTime);
|
|
|
- tMap.put("subAppid",subAppid);
|
|
|
- tMap.put("remark",remark);
|
|
|
- tMap.put("asinfo",asinfo);
|
|
|
- tMap.put("groupNo",groupNo);
|
|
|
- tMap.put("consumerIp",consumerIp);
|
|
|
- return tMap;
|
|
|
- }
|
|
|
|
|
|
|
|
|
|