Helius
2022-05-27 4351e71d782741143a98f86f6648acd16689165f
zq-erp/src/test/java/com/matrix/JyyTests.java
@@ -1,74 +1,123 @@
package com.matrix;
import com.matrix.system.hive.bean.SysVipInfo;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.matrix.system.hive.bean.MoneyCardUse;
import com.matrix.system.hive.dao.MoneyCardUseDao;
import com.matrix.system.hive.service.imp.SysVipInfoServiceImpl;
import com.matrix.system.score.dao.ScoreVipDetailDao;
import com.matrix.system.score.service.ScoreVipDetailService;
import com.matrix.system.shopXcx.dao.ShopOrderV2Dao;
import com.matrix.system.shopXcx.mqTask.OrderDingDingNoticeTask;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
 * 测试类示例
 *
 *
 * @author jiangyouyao
 * @email 512061637@qq.com
 * @date 2019年2月25日
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT)
@SpringBootTest(classes = {ZqErpApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class JyyTests {
   @Autowired
   private ShopOrderV2Dao shopOrderV2Dao;
    @Autowired
    private ShopOrderV2Dao shopOrderV2Dao;
   @Autowired
   ScoreVipDetailDao scoreVipDetailDao;
    @Autowired
    ScoreVipDetailDao scoreVipDetailDao;
   @Autowired
   ScoreVipDetailService scoreVipDetailService;
    @Autowired
    ScoreVipDetailService scoreVipDetailService;
   @Autowired
   SysVipInfoServiceImpl sysVipInfoService;
    @Autowired
    SysVipInfoServiceImpl sysVipInfoService;
    @Autowired
    OrderDingDingNoticeTask orderDingDingNoticeTask;
    @Autowired
    MoneyCardUseDao moneyCardUseDao;
    @Test
    public void finxMoneyCardUserId() throws IOException {
        long id=2531;
        final List<MoneyCardUse> moneyCardUses = moneyCardUseDao.selectList(new LambdaQueryWrapper<MoneyCardUse>().gt(MoneyCardUse::getId, 2531));
        for (MoneyCardUse moneyCardUs : moneyCardUses) {
            moneyCardUseDao.updateId(moneyCardUs.getId(),++id);
        }
        System.out.println(moneyCardUses.size());
    }
    @Test
    @Rollback
    public void testNoticeTask() throws IOException {
    //    orderDingDingNoticeTask.handle("",new Delivery(null,null,"1295".getBytes()));
        List<JSONObject> storeReceiptWares =new ArrayList<>();
        JSONObject o=new JSONObject();
        o.put("id",12);
        o.put("createBy","");
        storeReceiptWares.add(o);
        moneyCardUseDao.saveInTimeReceiptWare(storeReceiptWares);
   @Test
   public void scoreVipDetailService() throws InterruptedException {
      scoreVipDetailService.addScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null,null,null,15,1L,1,"测试");
   }
   /**
    *
    */
   @Test
   public void scoreVipDetailDao() throws InterruptedException {
      System.out.println( scoreVipDetailDao.selectUserTotalScore("oJkRK4yelehsY4S7I6Ee1ydWtQMI",null));
   }
   @Test
   public void testSelectReceivedOrderCount() throws InterruptedException {
      System.out.println( shopOrderV2Dao.selectReceivedOrderCount("oJkRK4yelehsY4S7I6Ee1ydWtQMI"));
   }
   @Test
   public void testCountOrderAmount() throws InterruptedException {
      System.out.println( shopOrderV2Dao.countOrderAmount("oJkRK4yelehsY4S7I6Ee1ydWtQMI"));
   }
    }
   @Test
   public void countBuyZdcp() throws InterruptedException {
      System.out.println( shopOrderV2Dao.countBuyZdcp("oJkRK4yelehsY4S7I6Ee1ydWtQMI","1167,1263,1262"));
   }
    @Test
    public void testRedis() {
        /*List<SysFunction> fnList = new ArrayList<>();
        fnList.add(new SysFunction());
        Map map = new HashMap();
        map.put("a", fnList);
        redisClient.saveMapValue("map", map);
*/
    }
    @Test
    public void testRedis2() {
/*
        String map = redisClient.getCachedValue("map");
        JSONObject json = JSONUtil.parseObj(map);
        String a = json.get("a").toString();
        JSONArray jsonArray = JSONUtil.parseArray(a);
       for (int i=0;i<jsonArray.size();i++){
           SysFunction sysFunction = jsonArray.get(i, SysFunction.class);
           System.out.println(sysFunction.getHasThisFn());
       }
*/
    }
}