| | |
| | | //package com.stylefeng.guns; |
| | | // |
| | | //import org.junit.runner.RunWith; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | //import org.springframework.test.context.junit4.SpringRunner; |
| | | // |
| | | //@RunWith(SpringRunner.class) |
| | | //@SpringBootTest |
| | | //public class GunsApplicationTest { |
| | | // |
| | | //} |
| | | 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(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("111-111-111-111"); |
| | | tokenRequest.setTradeTerminalInfo(tradeTerminalInfo); |
| | | tokenRequest.setType("04"); |
| | | try { |
| | | String token = TokenUtil.getToken(tokenRequest); |
| | | System.err.println(token); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |