Pu Zhibing
2025-08-04 959168df4cd876a188012758083ca25e8f76b307
修改bug
1个文件已修改
82 ■■■■■ 已修改文件
DriverQYTTravel/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DriverQYTTravel/guns-admin/src/test/java/com/stylefeng/guns/GunsApplicationTest.java
@@ -1,36 +1,48 @@
package com.stylefeng.guns;
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.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GunsApplicationTest {
    @Autowired
    private MongoTemplate mongoTemplate;
    @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();
//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.TokenUtil;
//import com.stylefeng.guns.modular.system.util.zhenglian.model.TokenRequest;
//import com.stylefeng.guns.modular.system.util.zhenglian.model.TradeTerminalInfo;
//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.data.mongodb.core.MongoTemplate;
//import org.springframework.test.context.junit4.SpringRunner;
//
//@RunWith(SpringRunner.class)
//@SpringBootTest
//public class GunsApplicationTest {
//
//    @Autowired
//    private MongoTemplate mongoTemplate;
//    @Autowired
//    private IDriverService driverService;
//
//
//    @Test
//    public void test() {
//
//        Driver driver = driverService.selectById(driverId);
//        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("");
//        tokenRequest.setTradeTerminalInfo(tradeTerminalInfo);
//        tokenRequest.setType(type);
//        String token = null;
//        try {
//            token = TokenUtil.getToken(tokenRequest);
//        } catch (Exception e) {
//            throw new RuntimeException(e);
//        }
//        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);
    }
}
//        System.err.println(token);
//    }
//}