| | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.sy.domain.ArdAccessFence; |
| | | import com.ruoyi.utils.gis.GisUtil; |
| | | import com.ruoyi.utils.gis.Point; |
| | | import com.ruoyi.scheduling.domian.SchedulingParam; |
| | |
| | | import okhttp3.Response; |
| | | import okhttp3.ResponseBody; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.sy.mapper.ArdSyCarMapper; |
| | | import com.ruoyi.sy.domain.ArdSyCar; |
| | |
| | | RedisCache redisCache; |
| | | @Resource |
| | | private ArdSyCarDayMapper ardSyCarDayMapper; |
| | | |
| | | @Value("${minio.endpoint}") |
| | | private String minioEndpoint; |
| | | |
| | | private Map<Integer, Map<String, String>> logInMap = new HashMap(); |
| | | |
| | |
| | | for (Result<Item> result : myObjects) { |
| | | Item item = result.get(); |
| | | Map<String, String> map = new HashMap(); |
| | | String[] strArr = item.objectName().split("/"); |
| | | map.put("carType", strArr[1]); |
| | | map.put("carModel", "sycar/" + item.objectName()); |
| | | switch (item.objectName()) { |
| | | /*switch (item.objectName()) { |
| | | case "carmodel/aodi.glb": |
| | | map.put("carType", "奥迪"); |
| | | break; |
| | |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | }*/ |
| | | listObjetcName.add(map); |
| | | } |
| | | return listObjetcName; |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | //log.error("minio获取桶下对象异常:" + ex.getMessage()); |
| | | } |
| | | } |
| | |
| | | if (result != null) { |
| | | if (result.get("carPicture") != null) { |
| | | if (!((String) result.get("carPicture")).equals("")) { |
| | | String url = ((String) result.get("carPicture")).split("sycar")[0]; |
| | | String carModel = url + (String) result.get("carModel"); |
| | | /*String url = ((String) result.get("carPicture")).split("sycar")[0]; |
| | | String carModel = url + (String) result.get("carModel");*/ |
| | | String carModel = this.minioEndpoint + "/" + (String) result.get("carModel"); |
| | | result.put("carModel", carModel); |
| | | } |
| | | } |
| | |
| | | for (int i = 0; i < carList.size(); i++) { |
| | | ArdSyCar ardSyCar = carList.get(i); |
| | | if (carId.equals(ardSyCar.getCarId())) { |
| | | String url = ""; |
| | | /*String url = ""; |
| | | if (ardSyCar.getCarPicture() != null) { |
| | | if (!ardSyCar.getCarPicture().equals("")) { |
| | | url = ardSyCar.getCarPicture().split("sycar")[0]; |
| | | } |
| | | } |
| | | m.put("carModel", url + ardSyCar.getCarModel());//zns |
| | | }*/ |
| | | m.put("carModel", this.minioEndpoint + "/" + ardSyCar.getCarModel());//zns |
| | | //m.put("carModel",ardSyCar.getCarModel()); |
| | | m.put("carTypeArd", ardSyCar.getCarType()); |
| | | m.put("carBrand", ardSyCar.getCarBrand()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Results getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser) { |
| | | public Map<String, Object> getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser) { |
| | | Map<String, String> result = logInMap.get(Integer.parseInt(usersId)); |
| | | //31用户名密码 |
| | | String username31 = ardSyUser.getUserId(); |
| | |
| | | result = new HashMap(); |
| | | result.put("userId", username31); |
| | | result.put("sessionId", (String) result1.get("sessionId")); |
| | | Map<String, Object> result0 = new HashMap(); |
| | | result0 = sYClient.getCarNearPositionByCarId(syURL, carId, result.get("userId"), result.get("sessionId")); |
| | | return Results.succeed(result0); |
| | | return sYClient.getCarNearPositionByCarId(syURL, carId, result.get("userId"), result.get("sessionId")); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getCarPicture(String carId, String syURL, String sessionId) { |
| | | return sYClient.getCarPicture(syURL, carId, sessionId); |
| | | } |
| | | |
| | | @Override |
| | | public String getSessionId(String syURL,ArdSyUser ardSyUser) { |
| | | String username31 = ardSyUser.getUserId(); |
| | | String password31 = ardSyUser.getPassword(); |
| | | String passwordMd5 = DigestUtils.md5Hex(password31); |
| | | System.out.println(passwordMd5); |
| | | Map<String, Object> result1 = sYClient.logIn(syURL, passwordMd5, username31); |
| | | return (String) result1.get("sessionId"); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> sendCmd(String userId,String syURL, String sessionId, String carId, List<String> channelList) throws UnsupportedEncodingException { |
| | | // for (int i = 0; i < channelList.size(); i++) { |
| | | Map<String,String> params = new HashMap(); |
| | | params.put("channel", channelList.get(1));//选择通道1 |
| | | params.put("interval", "0");//每隔0s照一次 |
| | | params.put("photoNum", "1");//照1张 |
| | | params.put("action", "0");//上传模式 |
| | | String paramsStr = com.alibaba.fastjson2.JSON.toJSONString(params); |
| | | paramsStr = URLEncoder.encode(paramsStr,"UTF-8"); |
| | | System.out.println("拍照参数:"+paramsStr); |
| | | return sYClient.sendCmd(syURL,userId,carId,301,"MediaTake",paramsStr,sessionId); |
| | | // } |
| | | // return sendCmdMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getPhoto(String syURL, String carId, String sessionId,String startTime) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String endTime = sdf.format(new Date()); |
| | | System.out.println("开始时间:"+startTime+" 结束时间:"+endTime); |
| | | return sYClient.getPhoto(syURL,carId,startTime,endTime,sessionId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getVideo(String syURL,String carId,ArdSyUser ardSyUser) { |
| | | //31用户名密码 |
| | | String username = ardSyUser.getUserId(); |
| | | String password31 = ardSyUser.getPassword(); |
| | | String password = DigestUtils.md5Hex(password31); |
| | | // Map<String, Object> result1 = sYClient.logIn(syURL, passwordMd5, username31); |
| | | return sYClient.getVideo(syURL,username,password,"黑E12401",1); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Results chaseCarByCarId(String usersId, String carId, String cycle) { |
| | |
| | | } |
| | | return filteredList; |
| | | } |
| | | |
| | | @Override |
| | | public List<ArdSyCar> all() { |
| | | QueryWrapper<ArdSyCar> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ne("reserved_1",""); |
| | | return ardSyCarMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | } |