|
@@ -1,13 +1,96 @@
|
|
package com.usky.dxtop;
|
|
package com.usky.dxtop;
|
|
|
|
|
|
|
|
+import com.usky.dxtop.service.config.rabbitmq.ChargeTransConfig;
|
|
|
|
+import com.usky.dxtop.service.config.rabbitmq.DishTransConfig;
|
|
|
|
+import com.usky.dxtop.service.config.rabbitmq.charge.ChargeProduceConfig;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+@RunWith(SpringRunner.class)
|
|
@SpringBootTest
|
|
@SpringBootTest
|
|
class DxtopApplicationTests {
|
|
class DxtopApplicationTests {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier(ChargeTransConfig.TEMPLATE)
|
|
|
|
+ private RabbitTemplate chargeTransRabbitTemplate;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier(DishTransConfig.TEMPLATE)
|
|
|
|
+ private RabbitTemplate dishTransRabbitTemplate;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ @Qualifier(ChargeProduceConfig.TEMPLATE)
|
|
|
|
+ private RabbitTemplate cart;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public String sendDirectMessageDish() {
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("seq",1);
|
|
|
|
+ map.put("create_date",new Date());
|
|
|
|
+ map.put("card",1);
|
|
|
|
+ map.put("card_no",1);
|
|
|
|
+ map.put("type",1);
|
|
|
|
+ map.put("term",1);
|
|
|
|
+ map.put("shop",1);
|
|
|
|
+ map.put("term_name",1);
|
|
|
|
+ map.put("shop_name",1);
|
|
|
|
+ map.put("amt",1);
|
|
|
|
+ map.put("balance",1);
|
|
|
|
+ map.put("account",1);
|
|
|
|
+ Map<String,Object> details = new HashMap<>();
|
|
|
|
+ details.put("pid",1);
|
|
|
|
+ details.put("name",1);
|
|
|
|
+ details.put("price",1.0);
|
|
|
|
+ details.put("amt",1.0);
|
|
|
|
+ List<Object> objectList = new ArrayList<>();
|
|
|
|
+ objectList.add(details);
|
|
|
|
+ map.put("details",objectList);
|
|
|
|
+ Map<String,Object> payments = new HashMap<>();
|
|
|
|
+ payments.put("type",1);
|
|
|
|
+ payments.put("amt",1.0);
|
|
|
|
+ payments.put("balance",1.0);
|
|
|
|
+ List<Object> objectList1 = new ArrayList<>();
|
|
|
|
+ objectList1.add(payments);
|
|
|
|
+ map.put("payments",objectList1);
|
|
|
|
+ dishTransRabbitTemplate.convertAndSend(DishTransConfig.NAME, DishTransConfig.NAME, map);
|
|
|
|
+ return "ok";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void cartPay(@RequestParam("id") Long id){
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("seq",id.toString());
|
|
|
|
+ map.put("seq_charge",1111);
|
|
|
|
+ map.put("code","1");
|
|
|
|
+ map.put("msd","成功");
|
|
|
|
+ cart.convertAndSend(ChargeProduceConfig.NAME, ChargeProduceConfig.NAME, map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
- void contextLoads() {
|
|
|
|
|
|
+ public void getLearn(){
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("seq",1);
|
|
|
|
+ map.put("create_date",new Date());
|
|
|
|
+ map.put("card",1);
|
|
|
|
+ map.put("card_no",1);
|
|
|
|
+ map.put("type",1);
|
|
|
|
+ map.put("term",1);
|
|
|
|
+ map.put("shop",1);
|
|
|
|
+ map.put("term_name",1);
|
|
|
|
+ map.put("shop_name",1);
|
|
|
|
+ map.put("amt",1);
|
|
|
|
+ map.put("balance",1);
|
|
|
|
+ map.put("account",1);
|
|
|
|
+ chargeTransRabbitTemplate.convertAndSend(ChargeTransConfig.NAME, ChargeTransConfig.NAME, map);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|