diff --git a/pom.xml b/pom.xml index e401043fe..3be6e5f69 100644 --- a/pom.xml +++ b/pom.xml @@ -988,7 +988,10 @@ org.spring wflow-server-1.0-SNAPSHOT.jar + A6F449ECD7E1024F703F37F2294AC8F2D41D8CD98F00B204E9800998ECF8427ED41D8CD98F00B204E9800998ECF8427E + + diff --git a/src/main/java/com/zhgd/mybatis/DataScopeHandler.java b/src/main/java/com/zhgd/mybatis/DataScopeHandler.java index 1e50a6e36..2f3b81fc2 100644 --- a/src/main/java/com/zhgd/mybatis/DataScopeHandler.java +++ b/src/main/java/com/zhgd/mybatis/DataScopeHandler.java @@ -100,6 +100,7 @@ public class DataScopeHandler implements DataPermissionHandler { tables.put("exam_train_record", "enterprise_id"); tables.put("exam_course_record", "enterprise_id"); tables.put("xz_worker_safe_watch_alarm", "enterprise_id"); + tables.put("dangerous_engineering_record", "responsibility_company_id"); if (!environmentUtil.isBaise()) { tables.put("car_info", "enterprise_id"); tables.put("enterprise_info", "id"); diff --git a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java index 18286d1ad..c09f5a9b4 100644 --- a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java +++ b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java @@ -1412,7 +1412,7 @@ public class HikvisionCall { JSONObject rs = addAlarmCarForHttp(project, addJo); sendNoticeAndSetStatusForCarInfo("车辆添加黑名单到海康isc", rs.toJSONString(), carInfo, 7, null, null, true); } else { - sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", null, carInfo, 7, null, true, false); + sendNoticeAndSetStatusForCarInfo("车辆取消黑名单到海康isc", null, carInfo, 7, null, true, false); } } else { if (carInfo.getIsBlack() == 1) { @@ -1423,7 +1423,7 @@ public class HikvisionCall { JSONObject deleteJo = new JSONObject(); deleteJo.put("alarmSyscodes", alarmSyscode); JSONObject rs = this.deletionAlarmCarForHttp(project, deleteJo); - sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", rs.toJSONString(), carInfo, 7, null, null, true); + sendNoticeAndSetStatusForCarInfo("车辆取消黑名单到海康isc", rs.toJSONString(), carInfo, 7, null, null, true); } } } else { diff --git a/src/main/java/com/zhgd/xmgl/modules/car/controller/CarInfoController.java b/src/main/java/com/zhgd/xmgl/modules/car/controller/CarInfoController.java index 2c9473dea..e78eb305c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/controller/CarInfoController.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/controller/CarInfoController.java @@ -14,7 +14,6 @@ import com.zhgd.xmgl.modules.car.entity.vo.CountCarModuleTypeVo; import com.zhgd.xmgl.modules.car.service.ICarInfoService; import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService; import com.zhgd.xmgl.security.util.SecurityUtils; -import com.zhgd.xmgl.util.MessageUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -26,6 +25,7 @@ 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 springfox.documentation.annotations.ApiIgnore; import java.util.ArrayList; import java.util.HashMap; @@ -33,11 +33,11 @@ import java.util.List; import java.util.Map; - /** +/** * @Title: Controller * @Description: 车辆黑白名单管理 * @author: pds - * @date: 2020-09-29 + * @date: 2020-09-29 * @version: V1.0 */ @RestController @@ -45,224 +45,236 @@ import java.util.Map; @Slf4j @Api(tags = "车辆黑白名单管理") public class CarInfoController { - @Autowired - private ICarInfoService carInfoService; + @Autowired + private ICarInfoService carInfoService; - @Autowired - private ISystemUserService systemUserService; + @Autowired + private ISystemUserService systemUserService; - @Autowired - private IWorkerInfoService workerInfoService; + @Autowired + private IWorkerInfoService workerInfoService; - @ApiOperation(value = "分页列表查询项目下车辆黑白名单", notes = "分页列表查询项目下车辆黑白名单", httpMethod = "POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "isBlack", value = "是否黑名单,0白名单,1黑名单", paramType = "body", required = false, dataType = "String"), - @ApiImplicitParam(name = "carNumber", value = "车牌号", paramType = "body", required = true, dataType = "String"), - @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "carModuleType", value = "车辆类型(1、固定车,2、预约车辆(临时)、3外来车辆)", paramType = "body", required = false, dataType = "Integer"), - }) - @PostMapping(value = "/selectCarList") - public Result> selectCarPage(@RequestBody Map map) { - return Result.success(carInfoService.selectCarListPage(map)); - } + @ApiOperation(value = "分页列表查询项目下车辆黑白名单", notes = "分页列表查询项目下车辆黑白名单", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "isBlack", value = "是否黑名单,0白名单,1黑名单", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "carNumber", value = "车牌号", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "carModuleType", value = "车辆类型(1、固定车,2、预约车辆(临时)、3外来车辆)", paramType = "body", required = false, dataType = "Integer"), + }) + @PostMapping(value = "/selectCarList") + public Result> selectCarPage(@RequestBody Map map) { + return Result.success(carInfoService.selectCarListPage(map)); + } - @ApiOperation(value = "列表查询项目下车辆黑白名单", notes = "列表查询项目下车辆黑白名单", httpMethod = "POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "isBlack", value = "是否黑名单,0白名单,1黑名单", paramType = "body", required = false, dataType = "String"), - @ApiImplicitParam(name = "carNumber", value = "车牌号", paramType = "body", required = true, dataType = "String"), - @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "carModuleType", value = "车辆类型(1、固定车,2、预约车辆(临时)、3外来车辆)", paramType = "body", required = false, dataType = "Integer"), - }) - @PostMapping(value = "/list") - public Result> selectCarList(@RequestBody Map map) { - return Result.success(carInfoService.selectCarList(map)); - } + @ApiOperation(value = "列表查询项目下车辆黑白名单", notes = "列表查询项目下车辆黑白名单", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "isBlack", value = "是否黑名单,0白名单,1黑名单", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "carNumber", value = "车牌号", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "carModuleType", value = "车辆类型(1、固定车,2、预约车辆(临时)、3外来车辆)", paramType = "body", required = false, dataType = "Integer"), + }) + @PostMapping(value = "/list") + public Result> selectCarList(@RequestBody Map map) { + return Result.success(carInfoService.selectCarList(map)); + } - @OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息") - @ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST") - @PostMapping(value = "/add") - public Result add(@RequestBody CarInfo carInfo) { - carInfo.setCreateBy(SecurityUtils.getUser().getUserId()); - carInfoService.addCarInfo(carInfo); - return Result.ok(); - } + @OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息") + @ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody CarInfo carInfo) { + carInfo.setCreateBy(SecurityUtils.getUser().getUserId()); + carInfoService.addCarInfo(carInfo); + return Result.ok(); + } - /** - * 添加 - * @param map - * @return - */ - @OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息") - @ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST") - @PostMapping(value = "/save") - public Result save(@RequestBody Map map) { - log.info("开始添加车辆" + map); - Object alarmPushWorkerId = map.get("alarmPushWorkerId"); - String userId = String.valueOf(map.get("enterpriseId")); - Object driverWorkerName = map.get("driverWorkerName"); - List carType = (List) map.get("carType"); - List driverWorkerId = (List) map.get("driverWorkerId"); - Integer carModuleType = MapUtils.getString(map, "carModuleType").equals("临时车辆") ? 2 : 3; - List userIds = (List) map.get("userIds"); - CarInfo carInfo = new CarInfo(); - if(driverWorkerId != null) { - carInfo.setDriverWorkerId(driverWorkerId.get(0).toString()); - } - if(driverWorkerName != null) { - carInfo.setDriverWorkerName(driverWorkerName.toString()); - } - if (alarmPushWorkerId != null) { - List alarmPushWorkerIds = (List) alarmPushWorkerId; - carInfo.setAlarmPushWorkerId(alarmPushWorkerIds.get(0).toString()); - } - if (userId != null) { - carInfo.setCreateBy(Long.valueOf(userId)); - Long workerId = systemUserService.getOne(Wrappers.lambdaQuery().eq(SystemUser::getUserId, userId)).getWorkerId(); - carInfo.setEnterpriseId(workerInfoService.getById(workerId).getEnterpriseId()); - } - carInfo.setCarModuleType(carModuleType); - 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(String.valueOf(map.get("carNumber"))); - Object carColor = map.get("carColor"); - if (carColor != null) { - carInfo.setCarColor(String.valueOf(carColor)); - } - carInfo.setCarType(Long.valueOf(carType.get(0).toString())); - carInfo.setDriverTelephone(String.valueOf(map.get("driverTelephone"))); - List> carPhotosUrl = (List>) map.get("carPhotosUrl"); - List> carPhotosUrls = new ArrayList<>(); - if (carPhotosUrl != null) { - for (Map file : carPhotosUrl) { - Map teMap = new HashMap<>(); - teMap.put("name", file.get("name")); - teMap.put("url", file.get("url")); - carPhotosUrls.add(teMap); - } - } - List> jsz = (List>) map.get("jsz"); - List> jszList = new ArrayList<>(); - if (jsz != null) { - for (Map file : jsz) { - Map teMap = new HashMap<>(); - teMap.put("name", file.get("name")); - teMap.put("url", file.get("url")); - jszList.add(teMap); - } - } - List> xsz = (List>) map.get("xsz"); - List> xszList = new ArrayList<>(); - if (xsz != null) { - for (Map file : xsz) { - Map teMap = new HashMap<>(); - teMap.put("name", file.get("name")); - teMap.put("url", file.get("url")); - xszList.add(teMap); - } - } - List> jqx = (List>) map.get("jqx"); - List> jqxList = new ArrayList<>(); - if (jqx != null) { - for (Map file : jqx) { - Map teMap = new HashMap<>(); - teMap.put("name", file.get("name")); - teMap.put("url", file.get("url")); - jqxList.add(teMap); - } - } - List> otherProve = (List>) map.get("otherProve"); - List> otherProveList = new ArrayList<>(); - if (otherProve != null) { - for (Map file : otherProve) { - Map teMap = new HashMap<>(); - teMap.put("name", file.get("name")); - teMap.put("url", file.get("url")); - otherProveList.add(teMap); - } - } - if (userIds != null && userIds.size() > 0) { - carInfo.setUserIds(userIds); - } - 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(String.valueOf(map.get("projectSn"))); - carInfo.setIsBlack(MapUtils.getInteger(map, "isBlack")); - Object outsideDriverIdCard = map.get("outsideDriverIdCard"); - if (outsideDriverIdCard != null) { - carInfo.setOutsideDriverIdCard(outsideDriverIdCard.toString()); - } - carInfoService.addCarInfo(carInfo); - return Result.ok(); - } + /** + * 添加 + * + * @param map + * @return + */ + @OperLog(operModul = "车辆管理", operType = "添加车辆黑白名单", operDesc = "添加车辆黑白名单管理信息") + @ApiOperation(value = "添加车辆黑白名单管理信息", notes = "添加车辆黑白名单管理信息", httpMethod = "POST") + @PostMapping(value = "/save") + public Result save(@RequestBody Map map) { + log.info("开始添加车辆" + map); + Object alarmPushWorkerId = map.get("alarmPushWorkerId"); + String userId = String.valueOf(map.get("enterpriseId")); + Object driverWorkerName = map.get("driverWorkerName"); + List carType = (List) map.get("carType"); + List driverWorkerId = (List) map.get("driverWorkerId"); + Integer carModuleType = MapUtils.getString(map, "carModuleType").equals("临时车辆") ? 2 : 3; + List userIds = (List) map.get("userIds"); + CarInfo carInfo = new CarInfo(); + if (driverWorkerId != null) { + carInfo.setDriverWorkerId(driverWorkerId.get(0).toString()); + } + if (driverWorkerName != null) { + carInfo.setDriverWorkerName(driverWorkerName.toString()); + } + if (alarmPushWorkerId != null) { + List alarmPushWorkerIds = (List) alarmPushWorkerId; + carInfo.setAlarmPushWorkerId(alarmPushWorkerIds.get(0).toString()); + } + if (userId != null) { + carInfo.setCreateBy(Long.valueOf(userId)); + Long workerId = systemUserService.getOne(Wrappers.lambdaQuery().eq(SystemUser::getUserId, userId)).getWorkerId(); + carInfo.setEnterpriseId(workerInfoService.getById(workerId).getEnterpriseId()); + } + carInfo.setCarModuleType(carModuleType); + 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(String.valueOf(map.get("carNumber"))); + Object carColor = map.get("carColor"); + if (carColor != null) { + carInfo.setCarColor(String.valueOf(carColor)); + } + carInfo.setCarType(Long.valueOf(carType.get(0).toString())); + carInfo.setDriverTelephone(String.valueOf(map.get("driverTelephone"))); + List> carPhotosUrl = (List>) map.get("carPhotosUrl"); + List> carPhotosUrls = new ArrayList<>(); + if (carPhotosUrl != null) { + for (Map file : carPhotosUrl) { + Map teMap = new HashMap<>(); + teMap.put("name", file.get("name")); + teMap.put("url", file.get("url")); + carPhotosUrls.add(teMap); + } + } + List> jsz = (List>) map.get("jsz"); + List> jszList = new ArrayList<>(); + if (jsz != null) { + for (Map file : jsz) { + Map teMap = new HashMap<>(); + teMap.put("name", file.get("name")); + teMap.put("url", file.get("url")); + jszList.add(teMap); + } + } + List> xsz = (List>) map.get("xsz"); + List> xszList = new ArrayList<>(); + if (xsz != null) { + for (Map file : xsz) { + Map teMap = new HashMap<>(); + teMap.put("name", file.get("name")); + teMap.put("url", file.get("url")); + xszList.add(teMap); + } + } + List> jqx = (List>) map.get("jqx"); + List> jqxList = new ArrayList<>(); + if (jqx != null) { + for (Map file : jqx) { + Map teMap = new HashMap<>(); + teMap.put("name", file.get("name")); + teMap.put("url", file.get("url")); + jqxList.add(teMap); + } + } + List> otherProve = (List>) map.get("otherProve"); + List> otherProveList = new ArrayList<>(); + if (otherProve != null) { + for (Map file : otherProve) { + Map teMap = new HashMap<>(); + teMap.put("name", file.get("name")); + teMap.put("url", file.get("url")); + otherProveList.add(teMap); + } + } + if (userIds != null && userIds.size() > 0) { + carInfo.setUserIds(userIds); + } + 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(String.valueOf(map.get("projectSn"))); + carInfo.setIsBlack(MapUtils.getInteger(map, "isBlack")); + Object outsideDriverIdCard = map.get("outsideDriverIdCard"); + if (outsideDriverIdCard != null) { + carInfo.setOutsideDriverIdCard(outsideDriverIdCard.toString()); + } + carInfoService.addCarInfo(carInfo); + return Result.ok(); + } - /** - * 编辑 - * @param carInfo - * @return - */ - @OperLog(operModul = "车辆管理",operType = "编辑车辆黑白名单管理",operDesc = "编辑车辆黑白名单管理信息") - @ApiOperation(value = "编辑车辆黑白名单管理信息", notes = "编辑车辆黑白名单管理信息" , httpMethod="POST") - @PostMapping(value = "/edit") - public Result edit(@RequestBody CarInfo carInfo) { + /** + * 编辑 + * + * @param carInfo + * @return + */ + @OperLog(operModul = "车辆管理", operType = "编辑车辆黑白名单管理", operDesc = "编辑车辆黑白名单管理信息") + @ApiOperation(value = "编辑车辆黑白名单管理信息", notes = "编辑车辆黑白名单管理信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody CarInfo carInfo) { carInfoService.editCarInfo(carInfo); return Result.ok(); - } + } - /** - * 通过id删除 - * @param - * @return - */ - @OperLog(operModul = "车辆管理",operType = "删除车辆黑白名单管理",operDesc = "删除车辆黑白名单管理信息") + /** + * 通过id删除 + * + * @param + * @return + */ + @OperLog(operModul = "车辆管理", operType = "删除车辆黑白名单管理", operDesc = "删除车辆黑白名单管理信息") @ApiOperation(value = "删除车辆黑白名单管理信息", notes = "删除车辆黑白名单管理信息", httpMethod = "POST") @ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer") @PostMapping(value = "/delete") - public Result delete(@RequestBody Map map) { - carInfoService.delete(map); - return Result.ok(); - } + public Result delete(@RequestBody Map map) { + carInfoService.delete(map); + return Result.ok(); + } - /** - * 通过id查询 - * @param - * @return - */ + /** + * 通过id查询 + * + * @param + * @return + */ @ApiOperation(value = "通过id查询车辆黑白名单管理信息", notes = "通过id查询车辆黑白名单管理信息", httpMethod = "POST") @ApiImplicitParam(name = "id", value = "车辆黑白名单管理ID", paramType = "body", required = true, dataType = "Integer") @PostMapping(value = "/queryById") - public Result queryById(@RequestBody Map map) { - String id = MapUtils.getString(map, "id"); - return Result.success(carInfoService.queryById(id)); - } + public Result queryById(@RequestBody Map map) { + String id = MapUtils.getString(map, "id"); + return Result.success(carInfoService.queryById(id)); + } - @ApiOperation(value = "统计项目下各车辆黑白名单情况", notes = "统计项目下各车辆黑白名单情况", httpMethod = "POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), - }) - @PostMapping(value = "/selectCarTypeCount") - public Result> selectCarTypeCount(@RequestBody Map map) { - return Result.success(carInfoService.selectCarTypeCount(map)); - } + @ApiOperation(value = "统计项目下各车辆黑白名单情况", notes = "统计项目下各车辆黑白名单情况", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/selectCarTypeCount") + public Result> selectCarTypeCount(@RequestBody Map map) { + return Result.success(carInfoService.selectCarTypeCount(map)); + } - @ApiOperation(value = "统计项目下各车辆类型情况", notes = "统计项目下各车辆类型情况", httpMethod = "POST") - @ApiImplicitParams({ - @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), - }) - @PostMapping(value = "/countCarModuleType") - public Result countCarModuleType(@RequestBody Map map) { - return Result.success(carInfoService.countCarModuleType(map)); - } + @ApiOperation(value = "统计项目下各车辆类型情况", notes = "统计项目下各车辆类型情况", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/countCarModuleType") + public Result countCarModuleType(@RequestBody Map map) { + return Result.success(carInfoService.countCarModuleType(map)); + } - - } + @ApiOperation(value = "更新车辆二维码,如果为空", notes = "更新车辆二维码,如果为空", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + }) + @PostMapping(value = "/updateCarQrCode") + public Result updateCarQrCode(@ApiIgnore @RequestBody Map param) { + carInfoService.updateCarQrCode(param); + return Result.ok(); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/car/entity/CarInfo.java b/src/main/java/com/zhgd/xmgl/modules/car/entity/CarInfo.java index b6eb97662..b90b90068 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/entity/CarInfo.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/entity/CarInfo.java @@ -132,6 +132,8 @@ public class CarInfo implements Serializable { private Integer sendSuccessStatus; @ApiModelProperty(value = "外来车人员身份证号") private java.lang.String outsideDriverIdCard; + @ApiModelProperty(value = "车辆二维码") + private java.lang.String carQrCode; @TableField(exist = false) @ApiModelProperty(value = "企业名称") @@ -146,4 +148,8 @@ public class CarInfo implements Serializable { private String hikvisionVehicleId; @TableField(exist = false) private String carTypeName; + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + } diff --git a/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarInfoMapper.xml b/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarInfoMapper.xml index 4c5e75660..48111c964 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarInfoMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarInfoMapper.xml @@ -29,8 +29,11 @@ t.send_success_status, t.create_by, b.car_type_name, - ei.enterprise_name + ei.enterprise_name, + p.project_name, + t.car_qr_code FROM car_info t + join project p on p.project_sn = t.project_sn LEFT JOIN car_type b ON (t.car_type = b.id and t.project_sn = b.project_sn) left join enterprise_info ei on ei.id = t.enterprise_id left join worker_info wi diff --git a/src/main/java/com/zhgd/xmgl/modules/car/service/ICarInfoService.java b/src/main/java/com/zhgd/xmgl/modules/car/service/ICarInfoService.java index 4337469e3..e45737f09 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/service/ICarInfoService.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/service/ICarInfoService.java @@ -46,4 +46,6 @@ public interface ICarInfoService extends IService { void deleteCarInfoForHikvision(CarInfo carInfo, boolean isSetBlack); void editCarInfoForHikvision(CarInfo carInfo, CarInfo old); + + void updateCarQrCode(Map param); } diff --git a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java index 67e57fe90..3b906810a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java @@ -2,16 +2,22 @@ package com.zhgd.xmgl.modules.car.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.qrcode.QrCodeUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gexin.fastjson.JSON; +import com.gexin.fastjson.JSONObject; import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.redis.lock.redisson.DistributedLock; import com.zhgd.xmgl.async.AsyncHikvision; import com.zhgd.xmgl.async.AsyncWorker; +import com.zhgd.xmgl.constant.Cts; import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl; import com.zhgd.xmgl.modules.car.entity.*; import com.zhgd.xmgl.modules.car.entity.vo.CountCarModuleTypeVo; @@ -25,6 +31,7 @@ import com.zhgd.xmgl.modules.xz.entity.XzHikvisionSync; import com.zhgd.xmgl.modules.xz.mapper.XzHikvisionSyncMapper; import com.zhgd.xmgl.util.MessageUtil; import com.zhgd.xmgl.util.PageUtil; +import com.zhgd.xmgl.util.PathUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -124,6 +131,9 @@ public class CarInfoServiceImpl extends ServiceImpl impl } } else { carInfoMapper.insert(c); + // 生成指定url对应的二维码到文件,宽和高都是300像素 + setQrCode(c); + carInfoMapper.updateById(c); addCarInfoForApprovalFlowIf(c); //同步海康 addCarInfoForHikvision(c, asyncHikvision); @@ -197,6 +207,18 @@ public class CarInfoServiceImpl extends ServiceImpl impl editCar(carInfo); } + private void setQrCode(CarInfo carInfo) { + // 生成指定url对应的二维码到文件,宽和高都是300像素 + String url = UUID.randomUUID() + ".jpg"; + String path = PathUtil.getBasePath() + "/" + url; + log.info(path); + + carInfo.setCarQrCode(url); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("id", carInfo.getId().toString()); + QrCodeUtil.generate(JSON.toJSONString(jsonObject), 300, 300, FileUtil.file(path)); + } + private void editCar(CarInfo carInfo) { CarInfo old = carInfoMapper.selectById(carInfo.getId()); carInfoMapper.updateById(carInfo); @@ -355,9 +377,13 @@ public class CarInfoServiceImpl extends ServiceImpl impl if (!hikvisionConfig) { return; } - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + if (!isSetBlack || Objects.equals(carInfo.getCarModuleType(), 1)) { + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + } + if (!isSetBlack || !Objects.equals(carInfo.getCarModuleType(), 1)) { + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + } xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(7).setOperate(isSetBlack ? 1 : 3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); asyncHikvision.deleteCarInfoForHikvisionAsync(carInfo, isSetBlack); } @@ -384,4 +410,17 @@ public class CarInfoServiceImpl extends ServiceImpl impl asyncHikvision.editCarInfoForHikvisionAsync(carInfo, old); } } + + @Override + public void updateCarQrCode(Map param) { + String projectSn = MapUtils.getString(param, Cts.PROJECT_SN); + List carInfos = carInfoMapper.selectList(new LambdaQueryWrapper() + .eq(CarInfo::getProjectSn, projectSn)); + for (CarInfo carInfo : carInfos) { + if (StrUtil.isBlank(carInfo.getCarQrCode())) { + this.setQrCode(carInfo); + baseMapper.updateById(carInfo); + } + } + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/dangerous/mapper/DangerousEngineeringRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/dangerous/mapper/DangerousEngineeringRecordMapper.java index f1ff9853b..7f78730c7 100644 --- a/src/main/java/com/zhgd/xmgl/modules/dangerous/mapper/DangerousEngineeringRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/dangerous/mapper/DangerousEngineeringRecordMapper.java @@ -18,7 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @version: V1.0 */ @Mapper -@DataScope +@DataScope(includeTable = "dangerous_engineering_record") public interface DangerousEngineeringRecordMapper extends BaseMapper { List queryDangerousEngineeringPageList(Page page, @Param("param")Map map); diff --git a/src/main/java/com/zhgd/xmgl/modules/dangerous/service/impl/DangerousEngineeringRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/dangerous/service/impl/DangerousEngineeringRecordServiceImpl.java index d68cb3f54..3d7c70fa8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/dangerous/service/impl/DangerousEngineeringRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/dangerous/service/impl/DangerousEngineeringRecordServiceImpl.java @@ -81,9 +81,6 @@ public class DangerousEngineeringRecordServiceImpl extends ServiceImpl page = new Page<>(pageNo, pageSize); - if (systemUserService.isSubProject()) { - map.put("personLiableId", SecurityUtils.getUser().getUserId()); - } List list = dangerousEngineeringRecordMapper.queryDangerousEngineeringPageList(page, map); if (list.size() > 0) { for (EntityMap data : list) { diff --git a/src/main/java/com/zhgd/xmgl/security/RequestIdFilter.java b/src/main/java/com/zhgd/xmgl/security/RequestIdFilter.java index 4da2c0b60..a30d9a719 100644 --- a/src/main/java/com/zhgd/xmgl/security/RequestIdFilter.java +++ b/src/main/java/com/zhgd/xmgl/security/RequestIdFilter.java @@ -19,7 +19,6 @@ public class RequestIdFilter implements Filter { RequestIdUtil.setRequestId("-i"); ThreadLocalUtil.addInKey(Cts.TL_IS_FROM_WEB, true); ThreadLocalUtil.addInKey(Cts.TL_AUTH_USER, SecurityUtils.getUser()); - log.info("接口开始..."); try { filterChain.doFilter(servletRequest, servletResponse); } finally { diff --git a/src/main/java/com/zhgd/xmgl/task/WorkerTask.java b/src/main/java/com/zhgd/xmgl/task/WorkerTask.java index 17a9e7760..fa443a07c 100644 --- a/src/main/java/com/zhgd/xmgl/task/WorkerTask.java +++ b/src/main/java/com/zhgd/xmgl/task/WorkerTask.java @@ -9,7 +9,6 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.basicdata.entity.Notice; import com.zhgd.xmgl.modules.basicdata.entity.SystemUser; import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper; @@ -22,7 +21,6 @@ import com.zhgd.xmgl.modules.project.entity.ProjectExternalSystemService; import com.zhgd.xmgl.modules.project.mapper.ProjectExternalSystemServiceMapper; import com.zhgd.xmgl.modules.project.mapper.ProjectMapper; import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService; -import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord; import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance; import com.zhgd.xmgl.modules.worker.entity.WorkerBlacklist; import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; @@ -52,7 +50,6 @@ import com.zhgd.xmgl.modules.xz.service.impl.XzCertificateExpireAlarmRecordServi import com.zhgd.xmgl.util.ElecardUtil; import lombok.extern.slf4j.Slf4j; import net.javacrumbs.shedlock.core.SchedulerLock; -import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -107,7 +104,7 @@ public class WorkerTask { @Autowired private IWorkerMonthAttendanceStatisticsService workerMonthAttendanceStatisticsService; - + @Autowired private XzSecurityQualityInspectionRecordMapper xzSecurityQualityInspectionRecordMapper; @@ -292,7 +289,7 @@ public class WorkerTask { @RequestMapping("/workerSafeWatchAlarm") public void workerSafeWatchAlarm() { log.info("开始执行对人员未履职情况进行监测"); - String [] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"}; + String[] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"}; List projects = projectMapper.selectList(Wrappers.lambdaQuery().eq(Project::getStatus, 2)); int day = DateUtil.dayOfMonth(new Date()); for (Project project : projects) { @@ -331,7 +328,7 @@ public class WorkerTask { XzSecurityInspectTaskRecord xzSecurityInspectTaskRecord = xzSecurityInspectTaskRecords.stream().filter(s -> s.getId().toString().equals(data.getTaskId().toString())).collect(Collectors.toList()).get(0); SystemUser systemUser = systemUserMapper.selectById(xzSecurityInspectTaskRecord.getInspectUser()); WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId()); - if(workerInfo != null) { + if (workerInfo != null) { int count = 0; if (xzSecurityInspectTaskRecord.getType() == 1) { count = hiddenDangerInspectRecordService.count(Wrappers.lambdaQuery() @@ -359,7 +356,7 @@ public class WorkerTask { while (iterator.hasNext()) { String value = obj.getString(iterator.next()); if (value.equals("0")) { - number ++ ; + number++; } if (number > dayNum) { personSn.add(workerMonthAttendanceStatistics.getPersonSn()); @@ -379,7 +376,7 @@ public class WorkerTask { while (iterator.hasNext()) { String value = obj.getString(iterator.next()); if (value.equals("2")) { - number ++ ; + number++; } if (number > dayNum) { personSn.add(workerMonthAttendanceStatistics.getPersonSn()); @@ -471,7 +468,7 @@ public class WorkerTask { Long id = xzWorkerSafeWatchConfig.getId(); List userIds = Arrays.asList(xzWorkerSafeWatchManagerService.list(Wrappers.lambdaQuery() - .eq(XzWorkerSafeWatchManager::getWatchConfigId, id)) + .eq(XzWorkerSafeWatchManager::getWatchConfigId, id)) .stream().map(l -> l.getUserId()).collect(Collectors.joining(",")).split(",")); for (String userId : userIds) { if (StringUtils.isNotBlank(userId)) { @@ -496,6 +493,7 @@ public class WorkerTask { } } + /** * 添加通知 * @@ -560,4 +558,20 @@ public class WorkerTask { } } + /** + * (定制)安全履职预警增加规则,一、二、三、四级安全隐患预警规则,分级对未整改、未复查、未核验超过多少时间进行循环通知。 + */ + @Scheduled(cron = "0 0/1 * * * ?") + @RequestMapping("/workerSafeWatchAlarmForHidden") + public void workerSafeWatchAlarmForHidden() { + //List list = xzWorkerSafeWatchConfigService.list(Wrappers.lambdaQuery() + // .eq(XzWorkerSafeWatchConfig::getProjectSn, project.getProjectSn())); + +// xzSecurityQualityInspectionRecordMapper.getWorkerSafeWatchAlarmList(); + //有一条四级未整改安全隐患预警,设置超时的时间是4分钟 + +//SELECT * FROM xz_security_quality_inspection_record WHERE inspect_time = '2024-05-16 22:21:42'; +// +//select timestampdiff(MINUTE,'2024-05-16 22:21:42','2024-05-16 22:57:45') % 5; + } }