|
@@ -1,104 +1,28 @@
|
|
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 com.usky.dxtop.service.job.FileJob;
|
|
|
|
|
|
+import com.usky.dxtop.model.SysFile;
|
|
|
|
+import com.usky.dxtop.service.SysFileService;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.runner.RunWith;
|
|
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.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.test.context.junit4.SpringRunner;
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
@RunWith(SpringRunner.class)
|
|
@SpringBootTest
|
|
@SpringBootTest
|
|
class DxtopApplicationTests {
|
|
class DxtopApplicationTests {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- @Qualifier(ChargeTransConfig.TEMPLATE)
|
|
|
|
- private RabbitTemplate chargeTransRabbitTemplate;
|
|
|
|
|
|
+ private SysFileService sysFileService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- @Qualifier(DishTransConfig.TEMPLATE)
|
|
|
|
- private RabbitTemplate dishTransRabbitTemplate;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- @Qualifier(ChargeProduceConfig.TEMPLATE)
|
|
|
|
- private RabbitTemplate cart;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private FileJob fileJob;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- 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
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
@Test
|
|
@Test
|
|
- public void fileJob(){
|
|
|
|
- fileJob.deleteInvalidFile();
|
|
|
|
|
|
+ public void test(){
|
|
|
|
+ List<SysFile> fileByExpireAt = sysFileService.getFileByExpireAt(new Date());
|
|
|
|
+ for (SysFile sysFile:fileByExpireAt) {
|
|
|
|
+ System.out.println(sysFile);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|