| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | //获取证联数据 |
| | | if(null == driver.getCustId() || 0 == driver.getAccOpenFlag()){ |
| | | TradeTerminalInfo tradeTerminalInfo = new TradeTerminalInfo(); |
| | | tradeTerminalInfo.setIp("127.0.0.1"); |
| | | tradeTerminalInfo.setTerminal("1"); |
| | | tradeTerminalInfo.setMac(""); |
| | | InetAddress inetAddress = InetAddress.getLocalHost(); |
| | | String ip = inetAddress.getHostAddress(); |
| | | tradeTerminalInfo.setIp(ip); |
| | | NetworkInterface networkInterface = NetworkInterface.getByInetAddress(inetAddress); |
| | | byte[] mac = networkInterface.getHardwareAddress(); |
| | | StringBuilder macAddress = new StringBuilder(); |
| | | for (int i = 0; i < mac.length; i++) { |
| | | macAddress.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); |
| | | } |
| | | |
| | | tradeTerminalInfo.setMac(macAddress.toString()); |
| | | ZLUserInfo userInfo = ZhengLianUtil.getUserInfo(driver.getEmpId().toString(), tradeTerminalInfo); |
| | | if(null != userInfo){ |
| | | driver.setCustId(userInfo.getCustId()); |