人员车辆

This commit is contained in:
pengjie 2024-04-24 18:15:08 +08:00
parent 3e0283cbbb
commit 45563576f3
3 changed files with 95 additions and 24 deletions

View File

@ -1,5 +1,8 @@
package com.zhgd.xmgl.modules.car.controller; package com.zhgd.xmgl.modules.car.controller;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog; import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
@ -13,12 +16,15 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -68,6 +74,62 @@ public class CarInfoController {
return Result.ok(); return Result.ok();
} }
/**
* 添加
* @param map
* @return
*/
@OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息")
@ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<CarInfo> save(@RequestBody Map<String, Object> map) {
Object alarmPushWorkerId = map.get("alarmPushWorkerId");
Object enterpriseId = map.get("enterpriseId");
List<String> carType = (List<String>) map.get("carType");
List<String> driverWorkerId = (List<String>) map.get("driverWorkerId");
Integer carModuleType = MapUtils.getString(map, "carModuleType").equals("临时车辆") ? 2 : 1;
CarInfo carInfo = new CarInfo();
if (alarmPushWorkerId != null) {
List<String> alarmPushWorkerIds = (List<String>) alarmPushWorkerId;
carInfo.setAlarmPushWorkerId(alarmPushWorkerIds.get(0).toString());
}
if (enterpriseId != null) {
List<String> enterpriseIds = (List<String>) enterpriseId;
String string = enterpriseIds.get(0).toString();
if (StringUtils.isNotBlank(string)) {
carInfo.setEnterpriseId(Long.valueOf(string));
}
}
carInfo.setCarModuleType(carModuleType);
if (carModuleType == 2) {
Integer entryAndExitPermit = MapUtils.getString(map, "entryAndExitPermit").equals("单次") ? 0 : 1;
carInfo.setReserveStartTime(DateUtil.parse(map.get("reserveStartTime").toString() + ":00", DatePattern.NORM_DATETIME_FORMAT));
carInfo.setReserveEndTime(DateUtil.parse(map.get("reserveEndTime").toString() + ":00", DatePattern.NORM_DATETIME_FORMAT));
carInfo.setEntryAndExitPermit(entryAndExitPermit);
}
carInfo.setCarNumber(map.get("carNumber").toString());
carInfo.setCarColor(map.get("carColor").toString());
carInfo.setCarType(Long.valueOf(carType.get(0).toString()));
carInfo.setDriverWorkerId(driverWorkerId.get(0).toString());
carInfo.setDriverTelephone(map.get("driverTelephone").toString());
List<Map<String, Object>> carPhotosUrl = (List<Map<String, Object>>) map.get("carPhotosUrl");
List<Map<String, Object>> carPhotosUrls = new ArrayList<>();
if (carPhotosUrl != null) {
for (Map<String, Object> file : carPhotosUrl) {
Map<String, Object> teMap = new HashMap<>();
teMap.put("name", file.get("name"));
teMap.put("url", file.get("url"));
carPhotosUrls.add(teMap);
}
}
carInfo.setCarPhotosUrl(JSON.toJSONString(carPhotosUrls));
carInfo.setProjectSn(map.get("projectSn").toString());
carInfo.setIsBlack(MapUtils.getInteger(map, "isBlack"));
carInfoService.addCarInfo(carInfo);
return Result.ok();
}
/** /**
* 编辑 * 编辑
* @param carInfo * @param carInfo

View File

@ -30,6 +30,7 @@ import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
@ -208,9 +209,16 @@ public class XzWorkerInfoAuditRecordController {
}) })
@PostMapping(value = "/adoptWorkerInfo") @PostMapping(value = "/adoptWorkerInfo")
public Result<WorkerInfoAuditRecord> adoptWorkerInfo(@RequestBody Map<String, Object> paramMap) { public Result<WorkerInfoAuditRecord> adoptWorkerInfo(@RequestBody Map<String, Object> paramMap) {
List<String> ids = (List<String>) paramMap.get("id");
List<String> ufaceDevId = (List<String>) paramMap.get("ufaceDevId");
String ufaceDevIds = ufaceDevId.stream().collect(Collectors.joining(","));
for (String id : ids) {
paramMap.put("id", id);
paramMap.put("ufaceDevId", ufaceDevIds);
paramMap.put("accountType", 2); paramMap.put("accountType", 2);
paramMap.put("registerType", 2); paramMap.put("registerType", 2);
workerInfoAuditRecordService.adoptWorkerInfo(paramMap); workerInfoAuditRecordService.adoptWorkerInfo(paramMap);
}
return Result.ok(); return Result.ok();
} }

View File

@ -371,6 +371,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/xmgl/xzWorkerInfoAuditRecord/submit").permitAll() .antMatchers("/xmgl/xzWorkerInfoAuditRecord/submit").permitAll()
.antMatchers("/xz/xzMaterial/save").permitAll() .antMatchers("/xz/xzMaterial/save").permitAll()
.antMatchers("/xmgl/dangerousEngineeringRecord/save").permitAll() .antMatchers("/xmgl/dangerousEngineeringRecord/save").permitAll()
.antMatchers("/xmgl/carInfo/save").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
.anyRequest().authenticated() // 剩下所有的验证都需要验证. .anyRequest().authenticated() // 剩下所有的验证都需要验证.
.and() .and()