人员车辆

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;
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.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
@ -13,12 +16,15 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -35,13 +41,13 @@ import java.util.Map;
@Slf4j
@Api(tags = "车辆黑白名单管理")
public class CarInfoController {
@Autowired
private ICarInfoService carInfoService;
@Autowired
private ICarInfoService carInfoService;
/**
/**
* 分页列表查询
* @return
*/
* @return
*/
@ApiOperation(value = "分页列表查询项目下车辆黑白名单", notes = "分页列表查询项目下车辆黑白名单", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "isBlack", value = "是否黑名单0白名单1黑名单", paramType = "body", required = false, dataType = "String"),
@ -55,11 +61,11 @@ public class CarInfoController {
return Result.success(carInfoService.selectCarList(map));
}
/**
/**
* 添加
* @param carInfo
* @return
*/
* @param carInfo
* @return
*/
@OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息")
@ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST")
@PostMapping(value = "/add")
@ -68,11 +74,67 @@ public class CarInfoController {
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
* @return
*/
* @param carInfo
* @return
*/
@OperLog(operModul = "车辆管理",operType = "编辑车辆黑白名单管理",operDesc = "编辑车辆黑白名单管理信息")
@ApiOperation(value = "编辑车辆黑白名单管理信息", notes = "编辑车辆黑白名单管理信息" , httpMethod="POST")
@PostMapping(value = "/edit")
@ -81,11 +143,11 @@ public class CarInfoController {
return Result.ok();
}
/**
/**
* 通过id删除
* @param
* @return
*/
* @param
* @return
*/
@OperLog(operModul = "车辆管理",operType = "删除车辆黑白名单管理",operDesc = "删除车辆黑白名单管理信息")
@ApiOperation(value = "删除车辆黑白名单管理信息", notes = "删除车辆黑白名单管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer")
@ -96,11 +158,11 @@ public class CarInfoController {
}
/**
/**
* 通过id查询
* @param
* @return
*/
* @param
* @return
*/
@ApiOperation(value = "通过id查询车辆黑白名单管理信息", notes = "通过id查询车辆黑白名单管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer")

View File

@ -30,6 +30,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -208,9 +209,16 @@ public class XzWorkerInfoAuditRecordController {
})
@PostMapping(value = "/adoptWorkerInfo")
public Result<WorkerInfoAuditRecord> adoptWorkerInfo(@RequestBody Map<String, Object> paramMap) {
paramMap.put("accountType", 2);
paramMap.put("registerType", 2);
workerInfoAuditRecordService.adoptWorkerInfo(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("registerType", 2);
workerInfoAuditRecordService.adoptWorkerInfo(paramMap);
}
return Result.ok();
}

View File

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