| | |
| | | package com.ruoyi.sy.service.impl; |
| | | |
| | | import java.awt.geom.Point2D; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.domain.entity.SysConfig; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.sy.domain.ArdSyUser; |
| | |
| | | import com.ruoyi.system.mapper.SysConfigMapper; |
| | | import com.ruoyi.utils.forest.SYClient; |
| | | import com.ruoyi.utils.gps.GeoTools; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.Response; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | String paramsStr = lockNum + "02" + process + checkNum; |
| | | paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + paramsStr + "%22%7D"; |
| | | Map<String,Object> result = sYClient.sendCmd(syURL, ardSyUser.getUserId(), carId, 199, "DataDownTransfer", paramsStr, sessionId); |
| | | |
| | | Map<String,Object> result = sendCmd(syURL, ardSyUser.getUserId(), carId, 199, "DataDownTransfer", paramsStr, sessionId); |
| | | System.out.println("111111111111"); |
| | | System.out.println(result); |
| | | if(((String)result.get("rspCode")).equals("0")){ |
| | | ArdTankLockProcessLog ardTankLockProcessLog = new ArdTankLockProcessLog(); |
| | | /*ArdTankLockProcessLog ardTankLockProcessLog = new ArdTankLockProcessLog(); |
| | | ardTankLockProcessLog.setId(IdUtils.simpleUUID()); |
| | | ardTankLockProcessLog.setLockId(lockId); |
| | | ardTankLockProcessLog.setLockNum(lockNum); |
| | |
| | | ardTankLockProcessLog.setLongitude(lng); |
| | | ardTankLockProcessLog.setLatitude(lat); |
| | | ardTankLockProcessLog.setProcessTime(this.sdf.format(new Date())); |
| | | ardTankLockProcessLogMapper.insertArdTankLockProcessLog(ardTankLockProcessLog); |
| | | ardTankLockProcessLogMapper.insertArdTankLockProcessLog(ardTankLockProcessLog);*/ |
| | | return "发送成功"; |
| | | }else{ |
| | | return "发送失败"; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Map<String,Object> sendCmd(String syURL,String userId,String carId,Integer cmdId,String cmd,String paramsStr,String sessionId){ |
| | | OkHttpClient okHttpClient = new OkHttpClient(); |
| | | |
| | | Request request = new Request.Builder() |
| | | .url(syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId) |
| | | .build(); |
| | | //System.out.println("url = " + syURL + "/gps-web/api/send_cmd.jsp?params="+paramsStr+"&userId="+userId+"&carId="+carId+"&cmdId="+cmdId+"&cmd="+cmd+"&sessionId="+sessionId); |
| | | Response response = null; |
| | | try { |
| | | response = okHttpClient.newCall(request).execute(); |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | okhttp3.ResponseBody responseBody = response.body(); |
| | | |
| | | try { |
| | | String message = responseBody.string();// 响应体 |
| | | Map<String,Object> map = (Map<String, Object>) JSON.parse(message); |
| | | return map; |
| | | } catch (IOException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | return new HashMap(); |
| | | } |
| | | } |
| | | } |