guns-admin/pom.xml
@@ -9,7 +9,7 @@ <relativePath>../pom.xml</relativePath> </parent> <artifactId>driver</artifactId> <artifactId>vehicleInspection</artifactId> <name>guns-admin</name> <description>guns 的spring boot版本</description> guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java
@@ -30,7 +30,7 @@ * @Date 2024/12/17 20:18 */ @RestController @RequestMapping("/base/patrolTask") @RequestMapping("/api/patrolTask") public class PatrolTaskController extends BaseController { @Resource @@ -44,18 +44,22 @@ @GetMapping("/getTaskDetailList") @ApiOperation(value = "获取任务列表数据", tags = {"任务管理"}) public PageInfoBT<TaskDetailList> getTaskDetailList(TaskDetailListVo vo){ Page<TaskDetailList> pageInfo = new Page(vo.getOffset(), vo.getPageSize()); Page<TaskDetailList> pageInfo = new Page(vo.getLimit(), vo.getOffset()); List<TaskDetailList> taskDetailList = taskDetailService.getTaskDetailList(pageInfo, vo); pageInfo.setRecords(taskDetailList); return super.packForBT(pageInfo); PageInfoBT<TaskDetailList> taskDetailListPageInfoBT = super.packForBT(pageInfo); taskDetailListPageInfoBT.setSize(vo.getOffset()); taskDetailListPageInfoBT.setCurrent(vo.getLimit()); return taskDetailListPageInfoBT; } @DeleteMapping("/delTaskDetail") @ApiOperation(value = "删除任务", tags = {"任务管理"}) public ResultUtil delTaskDetail(List<Integer> ids){ taskDetailService.delTaskDetail(ids); public ResultUtil delTaskDetail(String ids){ List<String> id = Arrays.asList(ids.split(",")); taskDetailService.delTaskDetail(id); return ResultUtil.success(); } @@ -110,18 +114,38 @@ @GetMapping("/getVehicleList") @ApiOperation(value = "获取车辆列表", tags = {"任务管理"}) public ResultUtil<List<Vehicle>> getVehicleList(){ public ResultUtil<List<Vehicle>> getVehicleList(Integer year){ List<Vehicle> vehicleList = VideoGateway.getVehicleList(null, null, null, 0); return ResultUtil.success(vehicleList); List<Vehicle> list = new ArrayList<>(); if(null != year){ for (Vehicle vehicle : vehicleList) { if("2".equals(year)){ list.add(vehicle); } } }else{ list = vehicleList; } return ResultUtil.success(list); } @GetMapping("/getShipList") @ApiOperation(value = "获取船舶列表", tags = {"任务管理"}) public ResultUtil<List<Ship>> getShipList(){ public ResultUtil<List<Ship>> getShipList(Integer year){ List<Ship> shipList = VideoGateway.getShipList(null, null, null, 0); return ResultUtil.success(shipList); List<Ship> list = new ArrayList<>(); if(null != year){ for (Ship vehicle : shipList) { if("2".equals(year)){ list.add(vehicle); } } }else{ list = shipList; } return ResultUtil.success(list); } @@ -129,10 +153,13 @@ @GetMapping("/getTaskRecordList") @ApiOperation(value = "获取任务记录列表", tags = {"任务记录"}) public PageInfoBT<TaskRecordList> getTaskRecordList(TaskRecordListVo vo){ Page<TaskRecordList> pageInfo = new Page(vo.getOffset(), vo.getPageSize()); Page<TaskRecordList> pageInfo = new Page(vo.getLimit(), vo.getOffset()); List<TaskRecordList> taskRecordList = taskDetailService.getTaskRecordList(pageInfo, vo); pageInfo.setRecords(taskRecordList); return super.packForBT(pageInfo); PageInfoBT<TaskRecordList> taskRecordListPageInfoBT = super.packForBT(pageInfo); taskRecordListPageInfoBT.setSize(vo.getOffset()); taskRecordListPageInfoBT.setCurrent(vo.getLimit()); return taskRecordListPageInfoBT; } @@ -144,22 +171,25 @@ return ResultUtil.success(taskRecordInfo); } @GetMapping("/getPictureDetailsVehicle") @PostMapping("/getPictureDetailsVehicle") @ApiOperation(value = "获取任务记录详情中的车船数据", tags = {"任务记录"}) public ResultUtil<PictureDetailsVehicle> getPictureDetailsVehicle(PictureDetailsVo vo){ public ResultUtil<PictureDetailsVehicle> getPictureDetailsVehicle(@RequestBody PictureDetailsVo vo){ PictureDetailsVehicle pictureDetailsVehicle = taskDetailService.getPictureDetailsVehicle(vo); return ResultUtil.success(pictureDetailsVehicle); } @GetMapping("/getPictureDetails") @PostMapping("/getPictureDetails") @ApiOperation(value = "获取任务记录详情中的视频通道数据", tags = {"任务记录"}) public PageInfoBT<PictureDetails> getPictureDetails(PictureDetailsVo vo){ Page<PictureDetails> pageInfo = new Page(vo.getOffset(), vo.getPageSize()); public PageInfoBT<PictureDetails> getPictureDetails(@RequestBody PictureDetailsVo vo){ Page<PictureDetails> pageInfo = new Page(vo.getLimit(), vo.getOffset()); List<PictureDetails> pictureDetails = taskDetailService.getPictureDetails(pageInfo, vo); pageInfo.setRecords(pictureDetails); return super.packForBT(pageInfo); PageInfoBT<PictureDetails> pictureDetailsPageInfoBT = super.packForBT(pageInfo); pictureDetailsPageInfoBT.setSize(vo.getOffset()); pictureDetailsPageInfoBT.setCurrent(vo.getLimit()); return pictureDetailsPageInfoBT; } guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml
@@ -76,7 +76,7 @@ left join sys_user e on (d.artificial_user_id = e.id) where b.del_flag = 0 <if test="null != ids and ids.size() > 0"> and d.id in and b.id in <foreach collection="ids" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailVehiclesChannelMapper.xml
@@ -13,11 +13,10 @@ DATE_FORMAT(a.sys_create_time, '%Y-%m-%d %H:%i:%s') as sysCreateTime, a.artificial_status as artificialStatus, DATE_FORMAT(a.artificial_create_time, '%Y-%m-%d %H:%i:%s') as artificialCreateTime, b.`name` as artificialUserName, a.verify b.`name` as artificialUserName from t_task_detail_vehicles_channel a left join sys_user b on (a.artificial_user_id = b.id) where 1 = 1 <where> <if test="null != taskDetailVehiclesIdList and taskDetailVehiclesIdList.size() > 0"> and a.task_detail_vehicles_id in <foreach collection="taskDetailVehiclesIdList" item="item" index="index" open="(" separator="," close=")"> @@ -30,5 +29,7 @@ <if test="null != artificialStatus"> and a.artificial_status = #{artificialStatus} </if> </where> </select> </mapper> guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/vo/PictureDetails.java
@@ -28,7 +28,5 @@ private String artificialCreateTime; @ApiModelProperty("人工审核人") private String artificialUserName; @ApiModelProperty("是否确认(0=否,1=是)") private Integer verify; } guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/vo/TaskDetailList.java
@@ -21,4 +21,6 @@ private Integer type; @ApiModelProperty("执行时间") private String executionTime; @ApiModelProperty("执行状态(1=待执行,2=进行中,3=成功,4=失败)") private Integer status; } guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITaskDetailService.java
@@ -28,7 +28,7 @@ * 删除任务 * @param ids */ void delTaskDetail(List<Integer> ids); void delTaskDetail(List<String> ids); /** guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PatrolTaskServiceImpl.java
@@ -36,6 +36,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * @author zhibing.pu @@ -65,21 +68,25 @@ */ @Override public void addPatrolTask(PatrolTaskVo vo, String userId) { if(vo.getStartTime().isAfter(vo.getEndTime())){ if(vo.getType() == 1 && vo.getStartTime().isAfter(vo.getEndTime())){ throw new RuntimeException("结束时间不能小于开始时间"); } ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); threadPoolExecutor.execute(new Runnable() { @Override public void run() { //构建主数据 PatrolTask patrolTask = new PatrolTask(); BeanUtils.copyProperties(vo, patrolTask); patrolTask.setCreateTime(LocalDateTime.now()); patrolTask.setCreateUserId(Integer.valueOf(userId)); this.insert(patrolTask); PatrolTaskServiceImpl.this.insert(patrolTask); if(vo.getType() == 2){ //实时任务,手动添加后续逻辑中需要的数据 LocalDateTime now = LocalDateTime.now(); vo.setWeeks("[" + now.getDayOfWeek().getValue() + "]"); vo.setStartTime(now); vo.setExecutionTime(now.plusSeconds(5).format(DateTimeFormatter.ofPattern("HH:mm:ss"))); vo.setExecutionTime(now.plusSeconds(5).format(DateTimeFormatter.ofPattern("HH:mm"))); vo.setEndTime(now.plusSeconds(10)); } String weeks = vo.getWeeks(); @@ -98,7 +105,7 @@ taskDetail.setPatrolTaskId(patrolTask.getId()); taskDetail.setStatus(1); String executionTime = startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " " + vo.getExecutionTime(); taskDetail.setExecutionTime(LocalDateTime.parse(executionTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); taskDetail.setExecutionTime(LocalDateTime.parse(executionTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))); taskDetail.setDelFlag(0); taskDetailService.insert(taskDetail); @@ -135,7 +142,7 @@ //添加定时任务 JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("id", taskDetail.getId()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); try { quartzUtil.addSimpleQuartzTask(PatrolTaskJob.class,patrolTask.getName() + "_" + taskDetail.getId(), QuartzEnum.DEFAULT_GROUP.getValue(), jobDataMap , sdf.parse(executionTime), 0, 0); @@ -148,8 +155,8 @@ //添加一天 startTime = startTime.plusDays(1); } } }); } guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaskDetailServiceImpl.java
@@ -84,7 +84,7 @@ * @param ids */ @Override public void delTaskDetail(List<Integer> ids) { public void delTaskDetail(List<String> ids) { this.baseMapper.deleteBatchIds(ids); List<TaskDetail> taskDetails = this.selectBatchIds(ids); for (TaskDetail taskDetail : taskDetails) { @@ -237,7 +237,7 @@ public ResultUtil manualAudit(ManualAuditVo vo) { List<TaskDetailVehiclesChannel> taskDetailVehiclesChannels = taskDetailVehiclesChannelService.selectBatchIds(vo.getId()); for (TaskDetailVehiclesChannel taskDetailVehiclesChannel : taskDetailVehiclesChannels) { if(1 == taskDetailVehiclesChannel.getArtificialStatus()){ if(null != taskDetailVehiclesChannel.getArtificialStatus() && 1 == taskDetailVehiclesChannel.getArtificialStatus()){ return ResultUtil.error("不能重复审核"); } taskDetailVehiclesChannel.setArtificialStatus(vo.getStatus()); guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/imageModel/ImageModelUtil.java
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.stylefeng.guns.modular.system.model.enums.ImageModelEnum; import com.stylefeng.guns.modular.system.util.UUIDUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -41,10 +42,11 @@ */ private static List<String> closedTopModel(String url){ try { String fileName = url.substring(url.lastIndexOf(".")); URLConnection urlConnection = new URL(url).openConnection(); urlConnection.connect(); InputStream inputStream = urlConnection.getInputStream(); File file = FileUtil.writeFromStream(inputStream, filePath); File file = FileUtil.writeFromStream(inputStream, filePath + UUIDUtil.getTimeStr() + fileName); inputStream.close(); return closedTopModel(file); } catch (MalformedURLException e) { @@ -86,10 +88,11 @@ */ private static List<String> cameraFaultModel(String url){ try { String fileName = url.substring(url.lastIndexOf(".")); URLConnection urlConnection = new URL(url).openConnection(); urlConnection.connect(); InputStream inputStream = urlConnection.getInputStream(); File file = FileUtil.writeFromStream(inputStream, filePath); File file = FileUtil.writeFromStream(inputStream, filePath + UUIDUtil.getTimeStr() + fileName); inputStream.close(); return cameraFaultModel(file); } catch (MalformedURLException e) { @@ -132,10 +135,11 @@ */ private static List<String> constructionWasteLoadModel(String url){ try { String fileName = url.substring(url.lastIndexOf(".")); URLConnection urlConnection = new URL(url).openConnection(); urlConnection.connect(); InputStream inputStream = urlConnection.getInputStream(); File file = FileUtil.writeFromStream(inputStream, filePath); File file = FileUtil.writeFromStream(inputStream, filePath + UUIDUtil.getTimeStr() + fileName); inputStream.close(); return constructionWasteLoadModel(file); } catch (MalformedURLException e) { guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/model/Ship.java
@@ -46,4 +46,9 @@ */ @ApiModelProperty("年审结束时间,格式:yyyy-MM-dd") private String inspectPeriodEnd; /** * 协议类型:808-guangzhou(这个是18协议)、2(这个是23协议) */ @ApiModelProperty("协议类型:808-guangzhou(这个是18协议)、2(这个是23协议)") private String vehicleGpsProtocol; } guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/model/Vehicle.java
@@ -39,4 +39,9 @@ */ @ApiModelProperty("年审结束时间,格式:yyyy-MM-dd") private String inspectPeriodEnd; /** * 协议类型:808-guangzhou(这个是18协议)、2(这个是23协议) */ @ApiModelProperty("协议类型:808-guangzhou(这个是18协议)、2(这个是23协议)") private String vehicleGpsProtocol; } guns-admin/src/main/resources/application.yml
@@ -44,6 +44,15 @@ db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat #线上环境 #spring: # datasource: # url: jdbc:mysql://rm-m5e57gbu0gdv901ub.mysql.rds.aliyuncs.com:3306/vehicle_inspection?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai # username: vehicleInspection # password: SYzt1953123456 # db-name: guns #用来搜集数据库的所有表 # filters: wall,mergeStat #多数据源情况的配置 guns: @@ -90,4 +99,4 @@ threadsInheritContextClassLoaderOfInitializingThread: true --- filePath: d:/file/ filePath: /home/file/image/ guns-admin/src/main/resources/logback-spring.xml
@@ -7,7 +7,7 @@ <contextName>logback</contextName> <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> <property name="log.path" value="/home/igotechgh/app/log/driver"/> <property name="log.path" value="/home/file/log"/> <!--0. 日志格式和颜色渲染 --> <!-- 彩色日志依赖的渲染类 --> guns-core/src/main/resources/default-config.properties
@@ -21,6 +21,7 @@ mybatis-plus.configuration.lazyLoadingEnabled=true # \u5F00\u542F\u7684\u8BDD\uFF0C\u5EF6\u65F6\u52A0\u8F7D\u4E00\u4E2A\u5C5E\u6027\u65F6\u4F1A\u52A0\u8F7D\u8BE5\u5BF9\u8C61\u5168\u90E8\u5C5E\u6027\uFF0C\u5426\u5219\u6309\u9700\u52A0\u8F7D\u5C5E\u6027 mybatis-plus.configuration.multipleResultSetsEnabled=true mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl ########################## beetl\u9ED8\u8BA4\u914D\u7F6E ###########################