Commit 0589d8f6 authored by wujiang's avatar wujiang

车辆坐标修改

parent 294dc31b
...@@ -247,14 +247,24 @@ public class CarController extends AbstractBaseController { ...@@ -247,14 +247,24 @@ public class CarController extends AbstractBaseController {
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList); // Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// saveFile(carInstance); 图片视频后期统一处理 // saveFile(carInstance); 图片视频后期统一处理
//如果默认有id值则认为是更新 // 如果默认有id值则认为是更新
if (car.getId()!=null) { if (car.getId() != null) {
Car car1 = this.iCarService.getById(car.getId());
if (car.getOrgCode() != null && !car.getBizOrgCode().equals(car1.getBizOrgCode())) {
FeignClientResult<Map<String, Object>> result = Privilege.companyClient
.queryByOrgcode(car.getBizOrgCode());
System.out.println("==============================" + JSONObject.toJSONString(result.getResult()));
if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName"));
}
}
Car car2 = updateCar(car); Car car2 = updateCar(car);
CarController controllerProxy = SpringUtils.getBean(CarController.class); CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshAllCount(); controllerProxy.refreshAllCount();
return car2; return car2;
} }
// 验证车辆code唯一性 // 验证车辆code唯一性
String iotCode = car.getIotCode(); String iotCode = car.getIotCode();
if (StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())) { if (StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())) {
...@@ -288,11 +298,11 @@ public class CarController extends AbstractBaseController { ...@@ -288,11 +298,11 @@ public class CarController extends AbstractBaseController {
Equipment equipment = iEquipmentService.getById(car.getEquipmentId()); Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
car.setName(equipment != null ? equipment.getName() : null); car.setName(equipment != null ? equipment.getName() : null);
} }
if (!ObjectUtils.isEmpty(car.getBizOrgCode())) { if (ObjectUtils.isEmpty(car.getBizOrgName()) && !ObjectUtils.isEmpty(car.getBizOrgCode())) {
FeignClientResult<Map<String, Object>> result = Privilege.companyClient.queryByOrgcode(car.getBizOrgCode()); FeignClientResult<Map<String, Object>> result = Privilege.companyClient.queryByOrgcode(car.getBizOrgCode());
System.out.println("==============================" + JSONObject.toJSONString(result.getResult())); System.out.println("==============================" + JSONObject.toJSONString(result.getResult()));
if (result.getResult() != null&&result.getResult().containsKey("compnay")) { if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String,String> map = (Map<String, String>) result.getResult().get("compnay"); Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName")); car.setBizOrgName(map.get("companyName"));
} }
} }
...@@ -428,8 +438,8 @@ public class CarController extends AbstractBaseController { ...@@ -428,8 +438,8 @@ public class CarController extends AbstractBaseController {
if (ObjectUtils.isEmpty(car.getBizOrgName()) && !ObjectUtils.isEmpty(car.getBizOrgCode())) { if (ObjectUtils.isEmpty(car.getBizOrgName()) && !ObjectUtils.isEmpty(car.getBizOrgCode())) {
FeignClientResult<Map<String, Object>> result = Privilege.companyClient.queryByOrgcode(car.getBizOrgCode()); FeignClientResult<Map<String, Object>> result = Privilege.companyClient.queryByOrgcode(car.getBizOrgCode());
System.out.println("==============================" + JSONObject.toJSONString(result.getResult())); System.out.println("==============================" + JSONObject.toJSONString(result.getResult()));
if (result.getResult() != null&&result.getResult().containsKey("compnay")) { if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String,String> map = (Map<String, String>) result.getResult().get("compnay"); Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName")); car.setBizOrgName(map.get("companyName"));
} }
} }
...@@ -1419,7 +1429,7 @@ public class CarController extends AbstractBaseController { ...@@ -1419,7 +1429,7 @@ public class CarController extends AbstractBaseController {
public ResponseModel<Object> getQRCode(long id) throws Exception { public ResponseModel<Object> getQRCode(long id) throws Exception {
return ResponseHelper.buildResponse(iCarService.getQRCode(id)); return ResponseHelper.buildResponse(iCarService.getQRCode(id));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/location", method = RequestMethod.GET) @RequestMapping(value = "/location", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取二维码图片", notes = "获取二维码图片") @ApiOperation(httpMethod = "GET", value = "获取二维码图片", notes = "获取二维码图片")
......
...@@ -14,5 +14,5 @@ public class Coordinate { ...@@ -14,5 +14,5 @@ public class Coordinate {
private double speed; private double speed;
//时间 //时间
private String time; private long time;
} }
...@@ -66,7 +66,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -66,7 +66,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
List<Object> list = result.getResult(); List<Object> list = result.getResult();
List<Coordinate> coordinateList = new ArrayList<Coordinate>(); List<Coordinate> coordinateList = new ArrayList<Coordinate>();
if (list != null) { if (list != null) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
for (Object object : list) { for (Object object : list) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
if (jsonObject.get("FireCar_Longitude") != null && jsonObject.get("FireCar_Latitude") != null) { if (jsonObject.get("FireCar_Longitude") != null && jsonObject.get("FireCar_Latitude") != null) {
...@@ -76,10 +77,19 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -76,10 +77,19 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
lnglat.add(jsonObject.getDoubleValue("FireCar_Latitude")); lnglat.add(jsonObject.getDoubleValue("FireCar_Latitude"));
coordinate.setLnglat(lnglat); coordinate.setLnglat(lnglat);
coordinate.setSpeed(jsonObject.getDoubleValue("FireCar_Speed")); coordinate.setSpeed(jsonObject.getDoubleValue("FireCar_Speed"));
try { String time = jsonObject.getString("time");
coordinate.setTime(String.valueOf(format.parse(jsonObject.getString("time")).getTime())); if (time.length() > 20) {
} catch (ParseException e) { try {
e.printStackTrace(); coordinate.setTime(format1.parse(jsonObject.getString("time")).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
} else {
try {
coordinate.setTime(format2.parse(jsonObject.getString("time")).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
} }
coordinateList.add(coordinate); coordinateList.add(coordinate);
} }
...@@ -93,7 +103,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -93,7 +103,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Override @Override
public Map<String, Boolean> getCalender(long id, Date date) { public Map<String, Boolean> getCalender(long id, Date date) {
List<String> daylist = new ArrayList<String>(); List<String> daylist = new ArrayList<String>();
Map<String, Boolean> map =new HashMap<>(); Map<String, Boolean> map = new HashMap<>();
Car car = iCarService.getById(id); Car car = iCarService.getById(id);
if (car == null || car.getIotCode() == null || date == null) { if (car == null || car.getIotCode() == null || date == null) {
return map; return map;
...@@ -112,10 +122,10 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -112,10 +122,10 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
c.setTime(date); c.setTime(date);
c.add(Calendar.MONTH, 1); c.add(Calendar.MONTH, 1);
daylist.addAll(getDayByMonth(c.getTime())); daylist.addAll(getDayByMonth(c.getTime()));
List<Map<String, Object>> hasList = this List<Map<String, Object>> hasList = this.listMaps(new QueryWrapper<WlCarMileage>()
.listMaps(new QueryWrapper<WlCarMileage>().select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode()) .select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode())
.between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1)) .between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1))
.groupBy(WlCarMileage::getDate)); .groupBy(WlCarMileage::getDate));
Map<String, Object> hasMap = new HashMap<>(); Map<String, Object> hasMap = new HashMap<>();
for (Map<String, Object> mapOne : hasList) { for (Map<String, Object> mapOne : hasList) {
hasMap.put(String.valueOf(mapOne.get("date")), mapOne.get("count")); hasMap.put(String.valueOf(mapOne.get("date")), mapOne.get("count"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment