liujie
2025-08-05 66ce6ba7337cc1580c42dd69d7b9c2d1157eadb2
DriverQYTTravel/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java
@@ -1,5 +1,11 @@
package com.stylefeng.guns;
import com.stylefeng.guns.modular.system.model.Driver;
import com.stylefeng.guns.modular.system.service.IDriverService;
import com.stylefeng.guns.modular.system.util.zhenglian.ZhengLianUtil;
import com.stylefeng.guns.modular.system.util.zhenglian.model.TokenRequest;
import com.stylefeng.guns.modular.system.util.zhenglian.model.TradeTerminalInfo;
import com.stylefeng.guns.modular.system.util.zhenglian.model.ZLUserInfo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -10,27 +16,32 @@
@RunWith(SpringRunner.class)
@SpringBootTest
public class GunsApplicationTest {
   @Autowired
   private MongoTemplate mongoTemplate;
   @Autowired
   private IDriverService driverService;
   @Test
   public void test(){
//      GeoJsonPoint point = new GeoJsonPoint(new Point(Double.parseDouble("104.043149"),
//            Double.parseDouble("30.642483")));
//      DriverPosition position = mongoTemplate.findOne(Query.query(Criteria.where("driverId")
//            .is(14)), DriverPosition.class);
//      if(null == position){
//         position = new DriverPosition();
//      }
//      position.setDriverId(14);
//      position.setPoint(point);
//      mongoTemplate.save(position);
//      Query query = Query.query(Criteria.where("point").nearSphere(new Point(Double.parseDouble("104.043149"), Double.parseDouble("30.642483"))).maxDistance(5000));
//      List<DriverPosition> driverPositions = mongoTemplate.find(query, DriverPosition.class);
//      System.err.println(driverPositions);
   public void test() {
      Driver driver = driverService.selectById(14);
      TokenRequest tokenRequest = new TokenRequest();
      tokenRequest.setAppUserId(driver.getEmpId().toString());
      tokenRequest.setUserName(driver.getName());
      tokenRequest.setCertNo(driver.getIdCard());
      tokenRequest.setPhone(driver.getPhone());
      TradeTerminalInfo tradeTerminalInfo = new TradeTerminalInfo();
      tradeTerminalInfo.setIp("127.0.0.1");
      tradeTerminalInfo.setTerminal("1");
      tradeTerminalInfo.setMac("");
      ZLUserInfo userInfo = null;
      try {
         userInfo = ZhengLianUtil.getUserInfo("11448158", tradeTerminalInfo);
      } catch (Exception e) {
         throw new RuntimeException(e);
      }
      System.err.println(userInfo);
   }
}