人员车辆

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;
@ -35,13 +41,13 @@ import java.util.Map;
@Slf4j @Slf4j
@Api(tags = "车辆黑白名单管理") @Api(tags = "车辆黑白名单管理")
public class CarInfoController { public class CarInfoController {
@Autowired @Autowired
private ICarInfoService carInfoService; private ICarInfoService carInfoService;
/** /**
* 分页列表查询 * 分页列表查询
* @return * @return
*/ */
@ApiOperation(value = "分页列表查询项目下车辆黑白名单", notes = "分页列表查询项目下车辆黑白名单", httpMethod = "POST") @ApiOperation(value = "分页列表查询项目下车辆黑白名单", notes = "分页列表查询项目下车辆黑白名单", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "isBlack", value = "是否黑名单0白名单1黑名单", paramType = "body", required = false, dataType = "String"), @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)); return Result.success(carInfoService.selectCarList(map));
} }
/** /**
* 添加 * 添加
* @param carInfo * @param carInfo
* @return * @return
*/ */
@OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息") @OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息")
@ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST") @ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ -68,11 +74,67 @@ 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
* @return * @return
*/ */
@OperLog(operModul = "车辆管理",operType = "编辑车辆黑白名单管理",operDesc = "编辑车辆黑白名单管理信息") @OperLog(operModul = "车辆管理",operType = "编辑车辆黑白名单管理",operDesc = "编辑车辆黑白名单管理信息")
@ApiOperation(value = "编辑车辆黑白名单管理信息", notes = "编辑车辆黑白名单管理信息" , httpMethod="POST") @ApiOperation(value = "编辑车辆黑白名单管理信息", notes = "编辑车辆黑白名单管理信息" , httpMethod="POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
@ -81,11 +143,11 @@ public class CarInfoController {
return Result.ok(); return Result.ok();
} }
/** /**
* 通过id删除 * 通过id删除
* @param * @param
* @return * @return
*/ */
@OperLog(operModul = "车辆管理",operType = "删除车辆黑白名单管理",operDesc = "删除车辆黑白名单管理信息") @OperLog(operModul = "车辆管理",operType = "删除车辆黑白名单管理",operDesc = "删除车辆黑白名单管理信息")
@ApiOperation(value = "删除车辆黑白名单管理信息", notes = "删除车辆黑白名单管理信息", httpMethod = "POST") @ApiOperation(value = "删除车辆黑白名单管理信息", notes = "删除车辆黑白名单管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer") @ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer")
@ -96,11 +158,11 @@ public class CarInfoController {
} }
/** /**
* 通过id查询 * 通过id查询
* @param * @param
* @return * @return
*/ */
@ApiOperation(value = "通过id查询车辆黑白名单管理信息", notes = "通过id查询车辆黑白名单管理信息", httpMethod = "POST") @ApiOperation(value = "通过id查询车辆黑白名单管理信息", notes = "通过id查询车辆黑白名单管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer") @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.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) {
paramMap.put("accountType", 2); List<String> ids = (List<String>) paramMap.get("id");
paramMap.put("registerType", 2); List<String> ufaceDevId = (List<String>) paramMap.get("ufaceDevId");
workerInfoAuditRecordService.adoptWorkerInfo(paramMap); 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(); 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()