Commit 0589d8f6 authored by wujiang's avatar wujiang

车辆坐标修改

parent 294dc31b
......@@ -247,14 +247,24 @@ public class CarController extends AbstractBaseController {
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// saveFile(carInstance); 图片视频后期统一处理
//如果默认有id值则认为是更新
if (car.getId()!=null) {
// 如果默认有id值则认为是更新
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);
CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshAllCount();
return car2;
}
// 验证车辆code唯一性
String iotCode = car.getIotCode();
if (StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())) {
......@@ -288,11 +298,11 @@ public class CarController extends AbstractBaseController {
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
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());
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");
if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName"));
}
}
......@@ -428,8 +438,8 @@ public class CarController extends AbstractBaseController {
if (ObjectUtils.isEmpty(car.getBizOrgName()) && !ObjectUtils.isEmpty(car.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");
if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName"));
}
}
......@@ -1419,7 +1429,7 @@ public class CarController extends AbstractBaseController {
public ResponseModel<Object> getQRCode(long id) throws Exception {
return ResponseHelper.buildResponse(iCarService.getQRCode(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/location", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取二维码图片", notes = "获取二维码图片")
......
......@@ -14,5 +14,5 @@ public class Coordinate {
private double speed;
//时间
private String time;
private long time;
}
......@@ -66,7 +66,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
List<Object> list = result.getResult();
List<Coordinate> coordinateList = new ArrayList<Coordinate>();
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) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
if (jsonObject.get("FireCar_Longitude") != null && jsonObject.get("FireCar_Latitude") != null) {
......@@ -76,10 +77,19 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
lnglat.add(jsonObject.getDoubleValue("FireCar_Latitude"));
coordinate.setLnglat(lnglat);
coordinate.setSpeed(jsonObject.getDoubleValue("FireCar_Speed"));
try {
coordinate.setTime(String.valueOf(format.parse(jsonObject.getString("time")).getTime()));
} catch (ParseException e) {
e.printStackTrace();
String time = jsonObject.getString("time");
if (time.length() > 20) {
try {
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);
}
......@@ -93,7 +103,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Override
public Map<String, Boolean> getCalender(long id, Date date) {
List<String> daylist = new ArrayList<String>();
Map<String, Boolean> map =new HashMap<>();
Map<String, Boolean> map = new HashMap<>();
Car car = iCarService.getById(id);
if (car == null || car.getIotCode() == null || date == null) {
return map;
......@@ -112,10 +122,10 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
c.setTime(date);
c.add(Calendar.MONTH, 1);
daylist.addAll(getDayByMonth(c.getTime()));
List<Map<String, Object>> hasList = this
.listMaps(new QueryWrapper<WlCarMileage>().select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode())
.between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1))
.groupBy(WlCarMileage::getDate));
List<Map<String, Object>> hasList = this.listMaps(new QueryWrapper<WlCarMileage>()
.select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode())
.between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1))
.groupBy(WlCarMileage::getDate));
Map<String, Object> hasMap = new HashMap<>();
for (Map<String, Object> mapOne : hasList) {
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