增加外来临时车辆

This commit is contained in:
pengjie 2024-05-03 22:04:39 +08:00
parent c7b5423106
commit d65724686c

View File

@ -85,11 +85,18 @@ public class CarInfoController {
public Result<CarInfo> save(@RequestBody Map<String, Object> map) { public Result<CarInfo> save(@RequestBody Map<String, Object> map) {
Object alarmPushWorkerId = map.get("alarmPushWorkerId"); Object alarmPushWorkerId = map.get("alarmPushWorkerId");
Object enterpriseId = map.get("enterpriseId"); Object enterpriseId = map.get("enterpriseId");
Object driverWorkerName = map.get("driverWorkerName");
List<String> carType = (List<String>) map.get("carType"); List<String> carType = (List<String>) map.get("carType");
List<String> driverWorkerId = (List<String>) map.get("driverWorkerId"); List<String> driverWorkerId = (List<String>) map.get("driverWorkerId");
Integer carModuleType = MapUtils.getString(map, "carModuleType").equals("临时车辆") ? 2 : 1; Integer carModuleType = MapUtils.getString(map, "carModuleType").equals("临时车辆") ? 2 : 3;
CarInfo carInfo = new CarInfo(); CarInfo carInfo = new CarInfo();
if(driverWorkerId != null) {
carInfo.setDriverWorkerId(driverWorkerId.get(0).toString());
}
if(driverWorkerName != null) {
carInfo.setDriverWorkerName(driverWorkerName.toString());
}
if (alarmPushWorkerId != null) { if (alarmPushWorkerId != null) {
List<String> alarmPushWorkerIds = (List<String>) alarmPushWorkerId; List<String> alarmPushWorkerIds = (List<String>) alarmPushWorkerId;
carInfo.setAlarmPushWorkerId(alarmPushWorkerIds.get(0).toString()); carInfo.setAlarmPushWorkerId(alarmPushWorkerIds.get(0).toString());
@ -111,7 +118,6 @@ public class CarInfoController {
carInfo.setCarNumber(map.get("carNumber").toString()); carInfo.setCarNumber(map.get("carNumber").toString());
carInfo.setCarColor(map.get("carColor").toString()); carInfo.setCarColor(map.get("carColor").toString());
carInfo.setCarType(Long.valueOf(carType.get(0).toString())); carInfo.setCarType(Long.valueOf(carType.get(0).toString()));
carInfo.setDriverWorkerId(driverWorkerId.get(0).toString());
carInfo.setDriverTelephone(map.get("driverTelephone").toString()); carInfo.setDriverTelephone(map.get("driverTelephone").toString());
List<Map<String, Object>> carPhotosUrl = (List<Map<String, Object>>) map.get("carPhotosUrl"); List<Map<String, Object>> carPhotosUrl = (List<Map<String, Object>>) map.get("carPhotosUrl");
List<Map<String, Object>> carPhotosUrls = new ArrayList<>(); List<Map<String, Object>> carPhotosUrls = new ArrayList<>();
@ -123,7 +129,51 @@ public class CarInfoController {
carPhotosUrls.add(teMap); carPhotosUrls.add(teMap);
} }
} }
List<Map<String, Object>> jsz = (List<Map<String, Object>>) map.get("jsz");
List<Map<String, Object>> jszList = new ArrayList<>();
if (jsz != null) {
for (Map<String, Object> file : jsz) {
Map<String, Object> teMap = new HashMap<>();
teMap.put("name", file.get("name"));
teMap.put("url", file.get("url"));
jszList.add(teMap);
}
}
List<Map<String, Object>> xsz = (List<Map<String, Object>>) map.get("xsz");
List<Map<String, Object>> xszList = new ArrayList<>();
if (xsz != null) {
for (Map<String, Object> file : xsz) {
Map<String, Object> teMap = new HashMap<>();
teMap.put("name", file.get("name"));
teMap.put("url", file.get("url"));
xszList.add(teMap);
}
}
List<Map<String, Object>> jqx = (List<Map<String, Object>>) map.get("jqx");
List<Map<String, Object>> jqxList = new ArrayList<>();
if (jqx != null) {
for (Map<String, Object> file : jqx) {
Map<String, Object> teMap = new HashMap<>();
teMap.put("name", file.get("name"));
teMap.put("url", file.get("url"));
jqxList.add(teMap);
}
}
List<Map<String, Object>> otherProve = (List<Map<String, Object>>) map.get("otherProve");
List<Map<String, Object>> otherProveList = new ArrayList<>();
if (otherProve != null) {
for (Map<String, Object> file : otherProve) {
Map<String, Object> teMap = new HashMap<>();
teMap.put("name", file.get("name"));
teMap.put("url", file.get("url"));
otherProveList.add(teMap);
}
}
carInfo.setCarPhotosUrl(JSON.toJSONString(carPhotosUrls)); carInfo.setCarPhotosUrl(JSON.toJSONString(carPhotosUrls));
carInfo.setJsz(JSON.toJSONString(jszList));
carInfo.setXsz(JSON.toJSONString(xszList));
carInfo.setJqx(JSON.toJSONString(jqxList));
carInfo.setOtherProve(JSON.toJSONString(otherProveList));
carInfo.setProjectSn(map.get("projectSn").toString()); carInfo.setProjectSn(map.get("projectSn").toString());
carInfo.setIsBlack(MapUtils.getInteger(map, "isBlack")); carInfo.setIsBlack(MapUtils.getInteger(map, "isBlack"));
carInfoService.addCarInfo(carInfo); carInfoService.addCarInfo(carInfo);