| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!--mqtt jarå
--> |
| | | <!-- https://mvnrepository.com/artifact/org.springframework.integration/spring-integration-mqtt --> |
| | | <dependency> |
| | | <groupId>org.springframework.integration</groupId> |
| | | <artifactId>spring-integration-mqtt</artifactId> |
| | | </dependency> |
| | | <!--mqttéè¦çjarå
--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-integration</artifactId> |
| | | </dependency> |
| | | <!--mqttéè¦çjarå
--> |
| | | <dependency> |
| | | <groupId>org.springframework.integration</groupId> |
| | | <artifactId>spring-integration-stream</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å é¤è®¾å¤éªæ¶") |
| | | @GetMapping("/delDeviceAcceptance") |
| | | @DeleteMapping("/delDeviceAcceptance") |
| | | public Result delDeviceAcceptance(Integer acceptanceId){ |
| | | return Result.success(deviceAcceptanceService.removeById(acceptanceId)); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.device.pojo.DeviceAccidentReport; |
| | | import com.ruoyi.device.service.DeviceAccidentReportService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤äºæ
æ¥åå å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 06:31:12 |
| | | */ |
| | | @Api(tags = "设å¤äºæ
æ¥åå") |
| | | @AllArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/deviceAccidentReport") |
| | | public class DeviceAccidentReportController { |
| | | |
| | | private DeviceAccidentReportService deviceAccidentReportService; |
| | | |
| | | |
| | | /** |
| | | * 设å¤äºæ
æ¥åå表 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "设å¤äºæ
æ¥åå表") |
| | | @GetMapping("/pageDeviceAccidentReport") |
| | | public Result<IPage<DeviceAccidentReport>> pageDeviceAccidentReport(Page page, DeviceAccidentReport deviceAccidentReport){ |
| | | return Result.success(deviceAccidentReportService.pageDeviceAccidentReport(page, deviceAccidentReport)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤äºæ
æ¥å |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢è®¾å¤äºæ
æ¥å") |
| | | @GetMapping("/getDeviceAccidentReport") |
| | | public Result getDeviceAccidentReport(Integer accidentReportId){ |
| | | return Result.success(deviceAccidentReportService.getById(accidentReportId)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è®¾å¤äºæ
æ¥å |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å é¤è®¾å¤äºæ
æ¥å") |
| | | @DeleteMapping("/delDeviceAccidentReport") |
| | | public Result delDeviceAccidentReport(Integer accidentReportId){ |
| | | return Result.success(deviceAccidentReportService.removeById(accidentReportId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤äºæ
æ¥å |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ°å¢è®¾å¤äºæ
æ¥å") |
| | | @PostMapping("/addDeviceAccidentReport") |
| | | public Result addDeviceAccidentReport(@RequestBody DeviceAccidentReport deviceAccidentReport){ |
| | | return Result.success(deviceAccidentReportService.addDeviceAccidentReport(deviceAccidentReport)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¾å¤äºæ
æ¥å |
| | | * @param accidentReportId 设å¤äºæ
æ¥åid |
| | | * @param response ååº |
| | | */ |
| | | @ApiOperation(value = "导åºè®¾å¤äºæ
æ¥å") |
| | | @GetMapping("/exportDeviceAccidentReport") |
| | | public Result exportDeviceAccidentReport(Integer accidentReportId, HttpServletResponse response) { |
| | | deviceAccidentReportService.exportDeviceAccidentReport(accidentReportId, response); |
| | | return Result.success(); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | //å页 |
| | | @PostMapping("/deviceBorrowPage") |
| | | @GetMapping("/deviceBorrowPage") |
| | | public Result deviceBorrowPage(Page page, DeviceBorrow deviceBorrow) throws Exception { |
| | | return Result.success(deviceBorrowService.deviceBorrowPage(page, deviceBorrow)); |
| | | } |
| | |
| | | } |
| | | |
| | | //å é¤ |
| | | @PostMapping("/deleteDeviceBorrow") |
| | | @DeleteMapping("/deleteDeviceBorrow") |
| | | public Result deleteDeviceBorrow(Integer id) { |
| | | return Result.success(deviceBorrowService.removeById(id)); |
| | | } |
| | | |
| | | //å¯¼åº |
| | | @PostMapping("/deviceBorrowExport") |
| | | @GetMapping("/deviceBorrowExport") |
| | | public Result deviceBorrowExport(@RequestParam("deviceId") Integer deviceId, HttpServletResponse response) throws Exception { |
| | | List<DeviceBorrow> deviceBorrows = deviceBorrowService.getDeviceBorrowBydeviceId(deviceId); |
| | | response.setHeader("requestType", "excel"); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.device.dto.DeviceBreakdownMaintenance; |
| | | import com.ruoyi.device.service.DeviceBreakdownMaintenanceService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤æ
é维修表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 04:50:57 |
| | | */ |
| | | @Api(tags = "è®¾å¤æ
é维修表") |
| | | @AllArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/deviceBreakdownMaintenance") |
| | | public class DeviceBreakdownMaintenanceController { |
| | | |
| | | private DeviceBreakdownMaintenanceService deviceBreakdownMaintenanceService; |
| | | |
| | | |
| | | /** |
| | | * è®¾å¤æ
éç»´ä¿®å表 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "è®¾å¤æ
éç»´ä¿®å表") |
| | | @GetMapping("/pageDeviceBreakdownMaintenance") |
| | | public Result<IPage<DeviceBreakdownMaintenance>> pageDeviceBreakdownMaintenance(Page page, DeviceBreakdownMaintenance deviceBreakdownMaintenance) { |
| | | return Result.success(deviceBreakdownMaintenanceService.pageDeviceBreakdownMaintenance(page, deviceBreakdownMaintenance)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤æ
éç»´ä¿® |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢è®¾å¤æ
éç»´ä¿®") |
| | | @GetMapping("/getDeviceBreakdownMaintenance") |
| | | public Result getDeviceBreakdownMaintenance(Integer maintenanceId){ |
| | | return Result.success(deviceBreakdownMaintenanceService.getById(maintenanceId)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è®¾å¤æ
éç»´ä¿® |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å é¤è®¾å¤æ
éç»´ä¿®") |
| | | @DeleteMapping("/delDeviceBreakdownMaintenance") |
| | | public Result delDeviceBreakdownMaintenance(Integer maintenanceId){ |
| | | return Result.success(deviceBreakdownMaintenanceService.removeById(maintenanceId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤æ
éç»´ä¿® |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ°å¢è®¾å¤æ
éç»´ä¿®") |
| | | @PostMapping("/addDeviceBreakdownMaintenance") |
| | | public Result addDeviceBreakdownMaintenance(@RequestBody DeviceBreakdownMaintenance deviceBreakdownMaintenance){ |
| | | return Result.success(deviceBreakdownMaintenanceService.addDeviceBreakdownMaintenance(deviceBreakdownMaintenance)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¾å¤æ
éç»´ä¿® |
| | | * @param maintenanceId è®¾å¤æ
éç»´ä¿®id |
| | | * @param response ååº |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "导åºè®¾å¤æ
éç»´ä¿®") |
| | | @GetMapping("/exportDeviceBreakdownMaintenance") |
| | | public Result exportDeviceBreakdownMaintenance(Integer maintenanceId, HttpServletResponse response){ |
| | | deviceBreakdownMaintenanceService.exportDeviceBreakdownMaintenance(maintenanceId, response); |
| | | return Result.success(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.device.dto.DeviceInspectionRecordDto; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecord; |
| | | import com.ruoyi.device.service.DeviceInspectionRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ç¹æ£è®°å½è¡¨ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:25:14 |
| | | */ |
| | | @Api(tags = "设å¤ç¹æ£è®°å½") |
| | | @RestController |
| | | @RequestMapping("/deviceInspectionRecord") |
| | | public class DeviceInspectionRecordController { |
| | | @Resource |
| | | private DeviceInspectionRecordService deviceInspectionRecordService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ç¹æ£è®°å½ |
| | | */ |
| | | @ApiOperation("å页æ¥è¯¢è®¾å¤ç¹æ£è®°å½") |
| | | @GetMapping("/getDeviceInspectionRecordByPage") |
| | | public Result<IPage<DeviceInspectionRecord>> getDeviceInspectionRecordByPage(IPage page, DeviceInspectionRecordDto itemParameter) { |
| | | return deviceInspectionRecordService.getDeviceInspectionRecordByPage(page, itemParameter); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¹æ£è¯¦æ
|
| | | */ |
| | | @ApiOperation("æ¥è¯¢ç¹æ£è¯¦æ
") |
| | | @GetMapping("/getDeviceInspectionRecord") |
| | | public Result getDeviceInspectionRecord(Integer inspectionRecordId) { |
| | | return deviceInspectionRecordService.getDeviceInspectionRecord(inspectionRecordId); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤ç¹æ£è®°å½ |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | @ApiOperation("æ°å¢è®¾å¤ç¹æ£è®°å½") |
| | | @PostMapping("/addDeviceInspectionRecord") |
| | | public Result addDeviceInspectionRecord(@RequestBody DeviceInspectionRecordDto deviceInspectionRecord) { |
| | | return deviceInspectionRecordService.addDeviceInspectionRecord(deviceInspectionRecord); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹è®¾å¤ç¹æ£è®°å½ |
| | | */ |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ç¹æ£è®°å½") |
| | | @PostMapping("/updateDeviceInspectionRecord") |
| | | public Result updateDeviceInspectionRecord(@RequestBody DeviceInspectionRecordDto deviceInspectionRecord) { |
| | | return deviceInspectionRecordService.updateInspectionRecordAndDetails(deviceInspectionRecord); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è®¾å¤ç¹æ£è®°å½ |
| | | */ |
| | | @ApiOperation("å é¤è®¾å¤ç¹æ£è®°å½") |
| | | @DeleteMapping("/deleteDeviceInspectionRecord") |
| | | public Result deleteDeviceInspectionRecord(DeviceInspectionRecordDto deviceInspectionRecord) { |
| | | return deviceInspectionRecordService.deleteDeviceInspectionRecordOrDetails(deviceInspectionRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 夿 ¸ç¹æ£è®°å½ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "夿 ¸æ ¸æ¥è®°å½") |
| | | @PostMapping("/reviewDeviceInspectionRecord") |
| | | public Result reviewDeviceInspectionRecord(@RequestBody DeviceInspectionRecordDto deviceExamineRecordDto){ |
| | | return deviceInspectionRecordService.reviewDeviceInspectionRecord(deviceExamineRecordDto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导åºè®¾å¤ç¹æ£è®°å½ |
| | | */ |
| | | @ApiOperation("导åºè®¾å¤ç¹æ£è®°å½") |
| | | @GetMapping("/exportDeviceInspectionRecord") |
| | | public Result exportDeviceInspectionRecord(@RequestParam("inspectionRecordId") Integer inspectionRecordId, HttpServletResponse response) { |
| | | return deviceInspectionRecordService.exportDeviceInspectionRecord(inspectionRecordId, response); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceInstructionDto; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.pojo.DeviceInstruction; |
| | | import com.ruoyi.device.pojo.OperationInstruction; |
| | | import com.ruoyi.device.service.DeviceInstructionService; |
| | | import com.ruoyi.device.service.DeviceOperationInstructionService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä½ä¸æå¯¼ä¹¦æ·»å åæ§æä»¶è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:29:18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/deviceInstruction") |
| | | public class DeviceInstructionController { |
| | | |
| | | @Autowired |
| | | private DeviceInstructionService deviceInstructionService; |
| | | |
| | | @Autowired |
| | | private DeviceOperationInstructionService deviceOperationInstructionService; |
| | | |
| | | |
| | | @ApiOperation(value = "ä½ä¸æå¯¼ä¹¦ å页") |
| | | @GetMapping("/pageByPageQueryOfHomeworkInstructions") |
| | | public Result<IPage<DeviceInstruction>> pageByPageQueryOfHomeworkInstructions(Page page, DeviceOperationInstructionDto operationInstructionDto){ |
| | | return Result.success(deviceInstructionService.pageByPageQueryOfHomeworkInstructions(page, operationInstructionDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä½ä¸æå¯¼ä¹¦æ°å¢") |
| | | @PostMapping("/newHomeworkGuidebookAdded") |
| | | public Result newHomeworkGuidebookAdded(@RequestBody DeviceInstructionDto instructionDto){ |
| | | deviceInstructionService.newHomeworkGuidebookAdded(instructionDto); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä½ä¸æå¯¼ä¹¦ç¼è¾") |
| | | @GetMapping("/homeworkGuidebookEditor") |
| | | public Result<Map<String, Object>> homeworkGuidebookEditor(Integer instructionId){ |
| | | DeviceInstruction instruction = deviceInstructionService.getById(instructionId); |
| | | List<DeviceOperationInstructionDto> list = deviceOperationInstructionService.homeworkGuidebookEditor(instructionId); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("list", list); |
| | | map.put("instruction", instruction); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä½ä¸æå¯¼ä¹¦åæ§æä»¶å é¤") |
| | | @GetMapping("/deleteHomeworkGuidebook") |
| | | public Result deleteHomeworkGuidebook(String ids){ |
| | | if (ObjectUtils.isNotEmpty(ids)) { |
| | | String[] idArray = ids.split(","); |
| | | deviceOperationInstructionService.removeBatchByIds(Arrays.asList(idArray)); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä½ä¸æå¯¼ä¹¦å é¤") |
| | | @GetMapping("/homeworkGuidebook") |
| | | public Result homeworkGuidebook(String id, String instructionId){ |
| | | // å é¤åè¡¨æ°æ® |
| | | deviceOperationInstructionService.removeById(id); |
| | | // 妿åè¡¨æ°æ®ä¸ºç©º |
| | | long count = deviceOperationInstructionService.count(Wrappers.<OperationInstruction>lambdaQuery() |
| | | .eq(OperationInstruction::getInstructionId, instructionId)); |
| | | // é£ä¹å°±å é¤ç¶è¡¨æ°æ® |
| | | if (count < 1) { |
| | | deviceInstructionService.removeById(id); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "ä½ä¸æå¯¼ä¹¦å®¡æ¹") |
| | | @GetMapping("/approvalOfHomeworkInstructionManual") |
| | | public Result approvalOfHomeworkInstructionManual(String id, Boolean status){ |
| | | deviceOperationInstructionService.update(Wrappers.<OperationInstruction>lambdaUpdate() |
| | | .eq(OperationInstruction::getId, id) |
| | | .set(OperationInstruction::getStatus, status) |
| | | .set(OperationInstruction::getApproverId, SecurityUtils.getUserId().intValue()) |
| | | .set(OperationInstruction::getEntryIntoForceTime, LocalDateTime.now())); |
| | | return Result.success(); |
| | | } |
| | | } |
| | |
| | | * @param deviceMaintenancePlanDto 设å¤ä¿å
»è®¡å |
| | | */ |
| | | @ApiOperation("å é¤è®¾å¤ä¿å
»è®¡å") |
| | | @GetMapping("/deleteMaintenancePlan") |
| | | @DeleteMapping("/deleteMaintenancePlan") |
| | | public Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { |
| | | return deviceMaintenancePlanService.deleteMaintenancePlan(deviceMaintenancePlanDto); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "è®¾å¤æ¥åºç³è¯·å表") |
| | | @PostMapping("/pageDeviceScrapped") |
| | | @GetMapping("/pageDeviceScrapped") |
| | | public Result<IPage<DeviceScrapped>> pageDeviceScrapped(Page page, DeviceScrapped deviceScrapped) { |
| | | return Result.success(deviceScrappedService.pageDeviceScrapped(page, deviceScrapped)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å é¤è®¾å¤æ¥åºç³è¯·") |
| | | @GetMapping("/delDeviceScrapped") |
| | | @DeleteMapping("/delDeviceScrapped") |
| | | public Result delDeviceScrapped(Integer scrappedId){ |
| | | return Result.success(deviceScrappedService.removeById(scrappedId)); |
| | | } |
| | |
| | | * @param deviceTraceabilityManagementDto é弿º¯æºè®¡å |
| | | */ |
| | | @ApiOperation("å é¤é弿º¯æºè®¡å") |
| | | @GetMapping("/deleteTraceabilityManagement") |
| | | @DeleteMapping("/deleteTraceabilityManagement") |
| | | public Result deleteTraceabilityManagement(DeviceTraceabilityManagementDto deviceTraceabilityManagementDto) { |
| | | return deviceTraceabilityManagementService.deleteTraceabilityManagement(deviceTraceabilityManagementDto); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.ruoyi.device.pojo.DeviceAccidentReport; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Author: yuan |
| | | * Date: 2024-12-18 ææä¸ 10:00:48 |
| | | * Description: |
| | | */ |
| | | @Data |
| | | public class DeviceAccidentReportDto extends DeviceAccidentReport { |
| | | @ApiModelProperty("æ¶é´") |
| | | private String accidentDateStr; |
| | | |
| | | @ApiModelProperty("æ¥åäººå¡«åæ¶é´") |
| | | private String reportDateStr; |
| | | |
| | | @ApiModelProperty("è¯ä¼°äººå¡«åæ¶é´") |
| | | private String assessorDateStr; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººå¡«åæ¶é´") |
| | | private String departmentHeadDateStr; |
| | | |
| | | @ApiModelProperty("ææ¯è´è´£äººå¡«åæ¶é´") |
| | | private String technicalDirectorDateStr; |
| | | |
| | | @ApiModelProperty("䏻任填忶é´") |
| | | private String directorHeadDateStr; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤æ
é维修表 |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 04:50:57 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_breakdown_maintenance") |
| | | @ApiModel(value = "DeviceBreakdownMaintenance对象", description = "è®¾å¤æ
é维修表") |
| | | public class DeviceBreakdownMaintenance { |
| | | |
| | | @TableId(value = "maintenance_id", type = IdType.AUTO) |
| | | private Integer maintenanceId; |
| | | |
| | | @ApiModelProperty("设å¤id") |
| | | private Integer deviceId; |
| | | |
| | | @ApiModelProperty("å®è£
å°å") |
| | | private String location; |
| | | |
| | | @ApiModelProperty("æåææ
éæ
åµ") |
| | | private String damageOrMalfunction; |
| | | |
| | | @ApiModelProperty("ç³è¯·äººid") |
| | | private Integer applicantUserId; |
| | | |
| | | @ApiModelProperty("ç³è¯·äºº") |
| | | private String applicantUser; |
| | | |
| | | @ApiModelProperty("è¦æ±ä¿®å¤æ¶é´") |
| | | private LocalDate repairDate; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººæè§") |
| | | private String departmentHeadOpinion; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººid") |
| | | private Integer departmentHeadUserId; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äºº") |
| | | private String departmentHeadUser; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººå¡«åæ¶é´") |
| | | private LocalDate departmentHeadDate; |
| | | |
| | | @ApiModelProperty("维修记äº") |
| | | private String maintenanceRecord; |
| | | |
| | | @ApiModelProperty("维修人") |
| | | private String maintenanceUser; |
| | | |
| | | @ApiModelProperty("ç»´ä¿®æ¶é´") |
| | | private LocalDate maintenanceDate; |
| | | |
| | | @ApiModelProperty("æ¯å¦ç»æ,0 æªç»æ, 1ç»æ") |
| | | private Integer isFinish; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(exist = false,select = false) |
| | | @ApiModelProperty("æµç¨, 0:ç³è¯·, 1ç³è¯·é¨é¨è´è´£äººæè§, 2:维修记äº") |
| | | private Integer flowType; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecord; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecordDetails; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Author: yuan |
| | | * Date: 2024-12-16 ææä¸ 17:23:22 |
| | | * Description: |
| | | */ |
| | | @Data |
| | | public class DeviceInspectionRecordDto extends DeviceInspectionRecord { |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("æµè¯è¯¦æ
å
容") |
| | | private List<DeviceInspectionRecordDetails> details; |
| | | |
| | | @ApiModelProperty("æµè¯æ¶é´") |
| | | private String testDateString; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.ruoyi.device.pojo.DeviceInstruction; |
| | | import com.ruoyi.device.pojo.OperationInstruction; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeviceInstructionDto extends DeviceInstruction { |
| | | |
| | | private List<OperationInstruction> feTempHumRecordList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.ruoyi.device.pojo.OperationInstruction; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class DeviceOperationInstructionDto extends OperationInstruction { |
| | | @ApiModelProperty("ç³è¯·ç¼å·") |
| | | private String applicationNumber; |
| | | |
| | | @ApiModelProperty("ç³è¯·é¨é¨") |
| | | private String applicationDepartment; |
| | | |
| | | @ApiModelProperty("责任人") |
| | | private String personLiable; |
| | | |
| | | @ApiModelProperty("åæ§ç³è¯·è¯´æ") |
| | | private String controlledApplicationDescription; |
| | | |
| | | @ApiModelProperty("管çç¼å·") |
| | | private String deviceNumber; |
| | | |
| | | @ApiModelProperty("åå·") |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("ä¸ä¼ 人") |
| | | private String uploaderName; |
| | | |
| | | @ApiModelProperty("审æ¹äºº") |
| | | private String approverName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceAccidentReportDto; |
| | | import com.ruoyi.device.pojo.DeviceAccidentReport; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤äºæ
æ¥åå Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 06:31:12 |
| | | */ |
| | | public interface DeviceAccidentReportMapper extends BaseMapper<DeviceAccidentReport> { |
| | | |
| | | /** |
| | | * 设å¤äºæ
æ¥åå表 |
| | | * @param page |
| | | * @param ew |
| | | * @return |
| | | */ |
| | | IPage<DeviceAccidentReport> pageDeviceAccidentReport(Page page, @Param("ew") QueryWrapper<DeviceAccidentReport> ew); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤äºæ
æ¥å详æ
|
| | | * @param accidentReportId 设å¤äºæ
æ¥åid |
| | | * @return |
| | | */ |
| | | DeviceAccidentReportDto selectDeviceAccidentReportById(Integer accidentReportId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceBreakdownMaintenance; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤æ
é维修表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 04:50:57 |
| | | */ |
| | | public interface DeviceBreakdownMaintenanceMapper extends BaseMapper<DeviceBreakdownMaintenance> { |
| | | |
| | | /** |
| | | * è®¾å¤æ
éç»´ä¿®å表 |
| | | * @param page |
| | | * @param ew |
| | | * @return |
| | | */ |
| | | IPage<DeviceBreakdownMaintenance> pageDeviceBreakdownMaintenance(Page page, @Param("ew") QueryWrapper<DeviceBreakdownMaintenance> ew); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecordDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:27:32 |
| | | */ |
| | | public interface DeviceInspectionRecordDetailsMapper extends BaseMapper<DeviceInspectionRecordDetails> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.device.dto.DeviceInspectionRecordDto; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:25:14 |
| | | */ |
| | | public interface DeviceInspectionRecordMapper extends BaseMapper<DeviceInspectionRecord> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ç¹æ£è®°å½ |
| | | * @param page |
| | | * @param queryWrappers |
| | | * @return |
| | | */ |
| | | IPage<DeviceInspectionRecord> selectDeviceParameterPage(IPage page, @Param("ew") QueryWrapper<DeviceInspectionRecordDto> queryWrappers); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.pojo.DeviceInstruction; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä½ä¸æå¯¼ä¹¦æ·»å åæ§æä»¶è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:29:18 |
| | | */ |
| | | public interface InstructionMapper extends BaseMapper<DeviceInstruction> { |
| | | |
| | | |
| | | IPage<DeviceInstruction> pageByPageQueryOfHomeworkInstructions(Page page, @Param("ew") QueryWrapper<DeviceOperationInstructionDto> ew); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.pojo.OperationInstruction; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤ - ä½ä¸æå¯¼ä¹¦ æ·»å åæ§æä»¶ å Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:43:32 |
| | | */ |
| | | public interface OperationInstructionMapper extends BaseMapper<OperationInstruction> { |
| | | |
| | | List<DeviceOperationInstructionDto> homeworkGuidebookEditor(Integer instructionId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mqtt; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class MQBean { |
| | | |
| | | @Bean("mqClient") // å¯å¨WEBæå¡å¨çæ¶åè°ç¨æ¤æ¹æ³åå§å |
| | | public MQClient myMQTTClient(){ |
| | | MQClient mqClient = new MQClient(); |
| | | return mqClient; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mqtt; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.device.service.CollectBridgeService; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; |
| | | import org.eclipse.paho.client.mqttv3.MqttCallback; |
| | | import org.eclipse.paho.client.mqttv3.MqttMessage; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MQCallback<component> implements MqttCallback { |
| | | |
| | | private MQClient mqClient; // MQTTè¿æ¥æ°æ® |
| | | |
| | | private MQConfig mqConfig; // ymlé
ç½®æ°æ® |
| | | |
| | | private static MQCallback mqCallback; |
| | | |
| | | @Resource |
| | | private CollectBridgeService collectBridgeService; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | mqCallback = this; |
| | | // åä½¿åæ¶å°å·²éæåçconfigParamå®ä¾å |
| | | mqCallback.collectBridgeService = this.collectBridgeService; |
| | | } |
| | | |
| | | public MQCallback(MQClient mqClient, MQConfig mqConfig) { |
| | | this.mqClient = mqClient; |
| | | this.mqConfig = mqConfig; |
| | | } |
| | | |
| | | /** è¿æ¥ä¸¢å¤±åï¼ä¸è¬å¨è¿éé¢è¿è¡éè¿ **/ |
| | | @SneakyThrows |
| | | @Override |
| | | public void connectionLost(Throwable cause) { |
| | | /** è¿æ¥ä¸¢å¤±åï¼ä¸è¬å¨è¿éé¢è¿è¡éè¿ **/ |
| | | if (mqClient != null) { |
| | | while (true) { |
| | | try { |
| | | log.info("==============ããã[MQTT] è¿æ¥ä¸¢å¤±ï¼å°è¯éè¿..."); |
| | | MQClient mqttPushClient = new MQClient(); |
| | | mqttPushClient.connect(mqConfig); |
| | | if (mqClient.getClient().isConnected()) { |
| | | log.info("=============>>éè¿æå"); |
| | | } |
| | | break; |
| | | } catch (Exception e) { |
| | | log.error("=============>>>[MQTT] è¿æ¥æå¼ï¼éè¿å¤±è´¥ï¼<<============="); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | log.info(cause.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * MQTTæå¡å¨åWEBæå¡å¨åéçæ°æ®ä¼æ§è¡å°è¿éé¢ï¼å®æ¹è¯ç§°ä¸ºï¼è®¢é
åçæ¶æ¯ |
| | | * @param topic 主é¢ï¼ä¹ç§°ä¸ºåºå±ç½å
³å¯ä¸æ è¯ |
| | | * @param message ä¿¡æ¯ |
| | | * @throws Exception æ¥é |
| | | */ |
| | | @Override |
| | | public void messageArrived(String topic, MqttMessage message) throws Exception { |
| | | try { |
| | | String parse = new String(message.getPayload()); |
| | | JSONObject jsonObject = JSONObject.parseObject(parse); |
| | | // å¡«å
ééæ°æ® |
| | | mqCallback.collectBridgeService.addBridgeValue(jsonObject); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.info("============ããæ¥æ¶æ¶æ¯ä¸»é¢å¼å¸¸ : " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * WEBæå¡å¨åMQTTæå¡å¨åéçæ°æ®ä¼æ§è¡å°è¿éé¢ |
| | | * 宿¹è¯ç§°ä¸ºï¼åå¸å伿§è¡å°è¿é |
| | | * @param token è¿æ¥token |
| | | */ |
| | | @Override |
| | | public void deliveryComplete(IMqttDeliveryToken token) { |
| | | // log.info("==========åå¸ä¿¡æ¯={}==========", token.isComplete()); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mqtt; |
| | | |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.MqttClient; |
| | | import org.eclipse.paho.client.mqttv3.MqttConnectOptions; |
| | | import org.eclipse.paho.client.mqttv3.MqttException; |
| | | import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MQClient { |
| | | |
| | | private static MqttClient client; |
| | | public static MqttClient getClient() { |
| | | return client; |
| | | } |
| | | public static void setClient(MqttClient client) { |
| | | MQClient.client = client; |
| | | } |
| | | |
| | | /** |
| | | * WEBæå¡å¨è¿æ¥MQTTæå¡å¨çé
ç½® |
| | | * @param userName è´¦å· |
| | | * @param password å¯ç |
| | | * @param outTime è¶
æ¶æ¶é´ |
| | | * @param KeepAlive å¿è·³æ£æµæ¶é´ |
| | | * @return |
| | | */ |
| | | private MqttConnectOptions getOption(String userName, String password, int outTime, int KeepAlive) { |
| | | MqttConnectOptions option = new MqttConnectOptions(); |
| | | // 设置æ¯å¦æ¸
空session,false表示æå¡å¨ä¼ä¿ç客æ·ç«¯çè¿æ¥è®°å½ï¼trueè¡¨ç¤ºæ¯æ¬¡è¿æ¥å°æå¡å¨é½ä»¥æ°çèº«ä»½è¿æ¥ |
| | | option.setCleanSession(true); |
| | | // è®¾ç½®è¿æ¥çç¨æ·å |
| | | option.setUserName(userName); |
| | | // è®¾ç½®è¿æ¥çå¯ç |
| | | option.setPassword(password.toCharArray()); |
| | | // 设置è¶
æ¶æ¶é´ åä½ä¸ºç§ |
| | | option.setConnectionTimeout(outTime); |
| | | // 设置ä¼è¯å¿è·³æ¶é´ åä½ä¸ºç§ æå¡å¨ä¼æ¯é(1.5*keepTime)ç§çæ¶é´å客æ·ç«¯åéä¸ªæ¶æ¯å¤æå®¢æ·ç«¯æ¯å¦å¨çº¿ï¼ä½è¿ä¸ªæ¹æ³å¹¶æ²¡æéè¿çæºå¶ |
| | | option.setKeepAliveInterval(KeepAlive); |
| | | // setWillæ¹æ³ï¼å¦æé¡¹ç®ä¸éè¦ç¥é客æ·ç«¯æ¯å¦æçº¿å¯ä»¥è°ç¨è¯¥æ¹æ³ã设置æç»ç«¯å£çéç¥æ¶æ¯ |
| | | // option.setWill(topic, "close".getBytes(), 2, true); |
| | | //设置æå¤§é度 |
| | | option.setMaxInflight(1000); |
| | | log.info("================>>>MQTTè¿æ¥è®¤è¯æå<<======================"); |
| | | return option; |
| | | } |
| | | |
| | | /** |
| | | * WEBæå¡å¨è¿æ¥MQTTæå¡å¨å½æ° |
| | | * @param mqttConfig ymlä¸MQTTçé
ç½® |
| | | */ |
| | | public void connect(MQConfig mqttConfig) throws MqttException { |
| | | client = new MqttClient(mqttConfig.getUrl(), mqttConfig.getClientId(), new MemoryPersistence()); |
| | | MqttConnectOptions options = getOption(mqttConfig.getUsername(), mqttConfig.getPassword(), |
| | | mqttConfig.getTimeout(), mqttConfig.getKeepAlive()); |
| | | MQClient.setClient(client); |
| | | //è¿æ¥å¤±è´¥è°ç¨åè°å½æ°ï¼éæ°è¿æ¥ |
| | | client.setCallback(new MQCallback<Object>(this, mqttConfig)); |
| | | if (!client.isConnected()) { |
| | | client.connect(options); |
| | | // 订é
ä¸»é¢ |
| | | MQSubscribe.subscribe_0(mqttConfig.getSubscribe()); |
| | | log.info("================>>>MQTTè¿æ¥æå<<======================"); |
| | | } else {// è¿éçé»è¾æ¯å¦æè¿æ¥ä¸æåå°±éæ°è¿æ¥ |
| | | client.disconnect(); |
| | | client.connect(options); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * WEBæå¡å¨ä¸MQTTæå¡å¨çæçº¿éè¿ |
| | | * @throws Exception |
| | | */ |
| | | public Boolean reConnect() throws Exception { |
| | | Boolean isConnected = false; |
| | | if (null != client) { |
| | | client.connect(); |
| | | if (client.isConnected()) { |
| | | isConnected = true; |
| | | } |
| | | } |
| | | return isConnected; |
| | | } |
| | | |
| | | /** |
| | | * å¼å¸¸å
³éæå¡ï¼WEBæå¡å¨ä¸MQTTæå¡å¨çæå¼è¿æ¥å½æ° |
| | | */ |
| | | @SneakyThrows |
| | | public void close(){ |
| | | client.close(); |
| | | client.disconnect(); |
| | | log.info("================>>å¼å¸¸å
³éä¸mqttæå¡å¨çè¿æ¥<<======================"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mqtt; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Data |
| | | public class MQConfig { |
| | | |
| | | /** |
| | | * MQTT-æå¡ç«¯-IP |
| | | */ |
| | | @Value("${mqtt.url}") |
| | | private String url; |
| | | |
| | | /** |
| | | * MQTT-æå¡ç«¯-ç¨æ·å |
| | | */ |
| | | @Value("${mqtt.username}") |
| | | private String username; |
| | | |
| | | /** |
| | | * MQTT-æå¡ç«¯-å¯ç |
| | | */ |
| | | @Value("${mqtt.password}") |
| | | private String password; |
| | | |
| | | /** |
| | | * è¶
æ¶æ¶é´ |
| | | */ |
| | | @Value("${mqtt.timeout}") |
| | | private int timeout; |
| | | |
| | | /** |
| | | * å¿è·³æ£æµæ¶é´ |
| | | */ |
| | | @Value("${mqtt.keepalive}") |
| | | private int keepAlive; |
| | | |
| | | /** |
| | | * å¿è·³å
çº§å« |
| | | */ |
| | | @Value("${mqtt.qos}") |
| | | private int qos; |
| | | |
| | | /** |
| | | * æå¡ç«¯è¿æ¥è¶
æ¶æ¶é´ |
| | | */ |
| | | @Value("${mqtt.completion-timeout}") |
| | | private int completionTimeout; |
| | | |
| | | /** |
| | | * clientId |
| | | */ |
| | | @Value("${mqtt.clientId}") |
| | | private String clientId; |
| | | |
| | | /** |
| | | * 订é
ä¸»é¢ |
| | | */ |
| | | @Value("${mqtt.subscribe}") |
| | | private String subscribe; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mqtt; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MQPublic { |
| | | |
| | | /** |
| | | * éä¿¡è´¨éqos为0ï¼è¡¨ç¤ºWEBæå¡å¨åMQTTæå¡å¨åªåé䏿¬¡ï¼ä¸ç®¡MQTTæå¡å¨ææ²¡ææ¶å° |
| | | * WEBæå¡å¨åMQTTæå¡å¨å叿°æ®ï¼æ¤æ¹æ³å°è£
äºpublish彿° |
| | | * @param topic ååºå±ç½å
³åéæ°æ®ï¼å®æ¹è¯ï¼ç§°æ¤ä¸ºä¸»é¢ï¼åé£ä¸ªä¸»é¢åéæ°æ® ç½å
³ï¼å³ä¸»é¢ï¼è®¾å¤å¯ä¸æ è¯ |
| | | * @param pushMessage WEBæå¡å¨åMQTTæå¡å¨åéçæ°æ® |
| | | */ |
| | | public void publish_0(int qos, String topic, byte[] pushMessage) { |
| | | publish(0, false, topic, pushMessage); |
| | | } |
| | | |
| | | /** |
| | | * éä¿¡è´¨éqos为1ï¼è¡¨ç¤ºWEBæå¡å¨åMQTTæå¡å¨åéæ°æ®ï¼MQTTæå¡å¨ä¸å®ä¼æ¶å°ä¸æ¬¡æ°æ®ï¼å¦æMQTTæå¡å¨æ²¡æååºâæ¶å°æ°æ®âï¼é£ä¹WEBæå¡å¨å°±ä¼ä¸ç´åéæ°æ® |
| | | * WEBæå¡å¨åMQTTæå¡å¨å叿°æ®ï¼è°ç¨æ¤å½æ°ï¼æ¤æ¹æ³å°è£
äºpublish彿°ï¼éä¿¡è´¨éqos为1 |
| | | * @param topic ååºå±ç½å
³åéæ°æ®ï¼å®æ¹è¯ï¼ç§°æ¤ä¸ºä¸»é¢ï¼åé£ä¸ªä¸»é¢åéæ°æ® ç½å
³ï¼å³ä¸»é¢ï¼è®¾å¤å¯ä¸æ è¯ |
| | | * @param pushMessage WEBæå¡å¨åMQTTæå¡å¨åéçæ°æ® |
| | | */ |
| | | public void publish_1(String topic, byte[] pushMessage) { |
| | | publish(1, false, topic, pushMessage); |
| | | } |
| | | |
| | | /** |
| | | *éä¿¡è´¨éqos为2ï¼è¡¨ç¤ºWEBæå¡å¨åMQTTæå¡å¨åéæ°æ®ï¼ä¸¤è
ä¼è¿è¡è³å°ä¸¤æ¬¡è¯·æ±/ååºæµç¨ï¼é¿å
æ°æ®å¨ä¼ è¾ä¸ç丢失ï¼ä½æ¯ç¸åºçä¹ä¼æ¶èè®¡ç®æºä¸çèµæº |
| | | * WEBæå¡å¨åMQTTæå¡å¨å叿°æ®ï¼æ¤æ¹æ³å°è£
äºpublish彿°ï¼éä¿¡è´¨éï¼2 |
| | | * @param topic ååºå±ç½å
³åéæ°æ®ï¼å®æ¹è¯ï¼ç§°æ¤ä¸ºä¸»é¢ï¼åé£ä¸ªä¸»é¢åéæ°æ® ç½å
³ï¼å³ä¸»é¢ï¼è®¾å¤å¯ä¸æ è¯ |
| | | * @param pushMessage WEBæå¡å¨åMQTTæå¡å¨åéçæ°æ® |
| | | */ |
| | | public void publish_2(String topic, byte[] pushMessage) { |
| | | publish(2,false, topic, pushMessage); |
| | | } |
| | | |
| | | /** |
| | | * åå¸å½æ°ï¼WEBæå¡å¨åMQTTæå¡å¨åéæ°æ® |
| | | * |
| | | * @param qos éä¿¡è´¨é |
| | | * @param retained é»è®¤ï¼false-éæä¹
åï¼æ¯æä¸æ¡æ¶æ¯æ¶è´¹å®ï¼å°±ä¼è¢«å é¤ï¼æä¹
åï¼æ¶è´¹å®ï¼è¿ä¼ä¿å卿å¡å¨ä¸ï¼å½æ°ç订é
è
åºç°ï¼ç»§ç»ç»æ°è®¢é
è
æ¶è´¹ï¼ |
| | | * @param topic ååºå±ç½å
³åéæ°æ®ï¼å®æ¹è¯ï¼ç§°æ¤ä¸ºä¸»é¢ï¼åé£ä¸ªä¸»é¢åéæ°æ® ç½å
³ï¼å³ä¸»é¢ï¼è®¾å¤å¯ä¸æ è¯ |
| | | * @param pushMessage WEBæå¡å¨åMQTTæå¡å¨åéçæ°æ® |
| | | */ |
| | | public void publish(int qos, boolean retained, String topic, byte[] pushMessage) { |
| | | MqttMessage message = new MqttMessage(); |
| | | message.setQos(qos); |
| | | message.setRetained(retained); |
| | | // å°String[]æ°ç»è½¬æ¢ä¸ºbyteæ°ç»åé |
| | | message.setPayload(pushMessage); |
| | | MqttTopic mTopic = MQClient.getClient().getTopic(topic); |
| | | if (null == mTopic) { |
| | | log.error("===============>>>MQTT {} ä¸åå¨<<=======================",topic); |
| | | } |
| | | MqttDeliveryToken token; |
| | | try { |
| | | token = mTopic.publish(message); |
| | | token.waitForCompletion(); |
| | | } catch (MqttPersistenceException e) { |
| | | e.printStackTrace(); |
| | | } catch (MqttException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mqtt; |
| | | |
| | | import org.eclipse.paho.client.mqttv3.MqttException; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class MQSubscribe { |
| | | |
| | | /** |
| | | * 订é
æä¸ªä¸»é¢ï¼MQTTæå¡å¨åWEBæå¡å¨åéæ°æ® |
| | | *主é¢ï¼ä¹ç§°ä¸ºåºå±ç½å
³å¯ä¸æ è¯ |
| | | * @param topic 设å¤ç¼å·ï¼ä¸åºå±äº¤äºçå¯ä¸æ è¯ |
| | | * @param qos MQTTæå¡å¨åWEBæå¡å¨åéæ°æ® |
| | | * qos为0ï¼åªåWEBæå¡å¨åé䏿¬¡ï¼ |
| | | * qos为1ï¼è³å°åWEBæå¡å¨åé䏿¬¡ï¼æ¥æ¶æ¹ä¼ååºä¸ä¸ªæ¥æï¼ |
| | | * qos为2ï¼ä¸¤è
ä¼è¿è¡è³å°ä¸¤æ¬¡è¯·æ±/ååºæµç¨ï¼é¿å
æ°æ®å¨ä¼ è¾ä¸ç丢失 |
| | | */ |
| | | private static void subscribe(String topic, int qos) { |
| | | try { |
| | | MQClient.getClient().subscribe(topic,qos); |
| | | } catch (MqttException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 订é
æä¸ªä¸»é¢ï¼éä¿¡è´¨éï¼qosé»è®¤ä¸º0 |
| | | * 主é¢ï¼ä¹ç§°ä¸ºåºå±ç½å
³å¯ä¸æ è¯ |
| | | * @param topic 设å¤ç¼å·ï¼ä¸åºå±äº¤äºçå¯ä¸æ è¯ |
| | | */ |
| | | public static void subscribe_0(String topic) { |
| | | subscribe(topic, 0); |
| | | } |
| | | |
| | | /** |
| | | * 订é
æä¸ªä¸»é¢ï¼éä¿¡è´¨éï¼qosé»è®¤ä¸º1 |
| | | * 主é¢ï¼ä¹ç§°ä¸ºåºå±ç½å
³å¯ä¸æ è¯ |
| | | * @param topic 设å¤ç¼å·ï¼ä¸åºå±äº¤äºçå¯ä¸æ è¯ |
| | | */ |
| | | public void subscribe_1(String topic) { |
| | | subscribe(topic, 1); |
| | | } |
| | | |
| | | /** |
| | | * 订é
æä¸ªä¸»é¢ï¼éä¿¡è´¨éï¼qosé»è®¤ä¸º2 |
| | | * 主é¢ï¼ä¹ç§°ä¸ºåºå±ç½å
³å¯ä¸æ è¯ |
| | | * @param topic 设å¤ç¼å·ï¼ä¸åºå±äº¤äºçå¯ä¸æ è¯ |
| | | */ |
| | | public void subscribe_2(String topic) { |
| | | subscribe(topic, 2); |
| | | } |
| | | |
| | | public void OffSubscribe(String topic) { |
| | | try { |
| | | MQClient.getClient().unsubscribe(topic); |
| | | } catch (MqttException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤äºæ
æ¥åå |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 06:31:12 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_accident_report") |
| | | @ApiModel(value = "DeviceAccidentReport对象", description = "设å¤äºæ
æ¥åå") |
| | | public class DeviceAccidentReport { |
| | | |
| | | @TableId(value = "accident_report_id", type = IdType.AUTO) |
| | | private Integer accidentReportId; |
| | | |
| | | @ApiModelProperty("设å¤id") |
| | | private Integer deviceId; |
| | | |
| | | @ApiModelProperty("å°å") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("æ¶é´") |
| | | private LocalDateTime accidentDate; |
| | | |
| | | @ApiModelProperty("äºæ
æ
åµæè¿°") |
| | | private String descriptionOfAccident; |
| | | |
| | | @ApiModelProperty("æ¥å人id") |
| | | private Integer reportUserId; |
| | | |
| | | @ApiModelProperty("æ¥å人") |
| | | private String reportUser; |
| | | |
| | | @ApiModelProperty("æ¥åäººå¡«åæ¶é´") |
| | | private LocalDate reportDate; |
| | | |
| | | @ApiModelProperty("è¯ä¼°äººæè§") |
| | | private String assessorOpinion; |
| | | |
| | | @ApiModelProperty("è¯ä¼°äººid") |
| | | private Integer assessorUserId; |
| | | |
| | | @ApiModelProperty("è¯ä¼°äºº") |
| | | private String assessorUser; |
| | | |
| | | @ApiModelProperty("è¯ä¼°äººå¡«åæ¶é´") |
| | | private LocalDate assessorDate; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººæè§") |
| | | private String departmentHeadOpinion; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººid") |
| | | private Integer departmentHeadUserId; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äºº") |
| | | private String departmentHeadUser; |
| | | |
| | | @ApiModelProperty("é¨é¨è´è´£äººå¡«åæ¶é´") |
| | | private LocalDate departmentHeadDate; |
| | | |
| | | @ApiModelProperty("ææ¯è´è´£äººæè§") |
| | | private String technicalDirectorOpinion; |
| | | |
| | | @ApiModelProperty("ææ¯è´è´£äººid") |
| | | private Integer technicalDirectorUserId; |
| | | |
| | | @ApiModelProperty("ææ¯è´è´£äºº") |
| | | private String technicalDirectorUser; |
| | | |
| | | @ApiModelProperty("ææ¯è´è´£äººå¡«åæ¶é´") |
| | | private LocalDate technicalDirectorDate; |
| | | |
| | | @ApiModelProperty("主任æè§") |
| | | private String directorHeadOpinion; |
| | | |
| | | @ApiModelProperty("主任id") |
| | | private Integer directorHeadUserId; |
| | | |
| | | @ApiModelProperty("主任") |
| | | private String directorHeadUser; |
| | | |
| | | @ApiModelProperty("䏻任填忶é´") |
| | | private LocalDate directorHeadDate; |
| | | |
| | | @ApiModelProperty("æ¯å¦ç»æ,0 æªç»æ, 1ç»æ") |
| | | private Integer isFinish; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(exist = false,select = false) |
| | | @ApiModelProperty("æµç¨, 0:æ¥å, 1è¯ä¼°, 2:é¨é¨è´è´£äººæè§, 3:ææ¯è´è´£äººæè§, 4:主任æè§") |
| | | private Integer flowType; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ç¹æ£è®°å½ |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:25:14 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_inspection_record") |
| | | @ApiModel(value = "DeviceInspectionRecord对象", description = "") |
| | | public class DeviceInspectionRecord implements Serializable { |
| | | |
| | | @ApiModelProperty("设å¤ç¹æ£è®°å½id") |
| | | @TableId(value = "inspection_record_id", type = IdType.AUTO) |
| | | private Integer inspectionRecordId; |
| | | |
| | | @ApiModelProperty("设å¤id") |
| | | private Integer deviceId; |
| | | |
| | | @ApiModelProperty("æµéèå´") |
| | | private String measurementScope; |
| | | |
| | | @ApiModelProperty("ç¹æ£ä½¿ç¨ç©è´¨åç§°") |
| | | private String materialName; |
| | | |
| | | @ApiModelProperty("ç¹æ£ä½¿ç¨ç©è´¨è§æ ¼åå·") |
| | | private String materialModel; |
| | | |
| | | @ApiModelProperty("ç¹æ£ä½¿ç¨ç©è´¨ç®¡çç¼å·") |
| | | private String materialManagementNumber; |
| | | |
| | | @ApiModelProperty("ç¹æ£ä½¿ç¨ç©è´¨ç²¾åº¦ç级") |
| | | private String materialAccuracyGrade; |
| | | |
| | | @ApiModelProperty("温度") |
| | | private String temperature; |
| | | |
| | | @ApiModelProperty("湿度") |
| | | private String humidity; |
| | | |
| | | @ApiModelProperty("æµè¯ç»è®º") |
| | | private String testConclusion; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("ç¶æï¼æ¯å¦å¤æ ¸ï¼0æªå¤æ ¸ï¼1夿 ¸") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("æµè¯äºº") |
| | | private String recorder; |
| | | |
| | | @ApiModelProperty("æµè¯äººid") |
| | | private Integer recorderId; |
| | | |
| | | @ApiModelProperty("夿 ¸äºº") |
| | | private String reviewer; |
| | | |
| | | @ApiModelProperty("夿 ¸äººid") |
| | | private Integer reviewerId; |
| | | |
| | | @ApiModelProperty("夿 ¸ä¿¡æ¯") |
| | | private String reviewerRemark; |
| | | |
| | | @ApiModelProperty("æµè¯æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDateTime testDate; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äººid") |
| | | private Integer updateUserId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:27:32 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_inspection_record_details") |
| | | @ApiModel(value = "DeviceInspectionRecordDetails对象", description = "") |
| | | public class DeviceInspectionRecordDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("ç¹æ£è¯¦æ
id") |
| | | @TableId(value = "inspection_record_detail_id", type = IdType.AUTO) |
| | | private Integer inspectionRecordDetailId; |
| | | |
| | | @ApiModelProperty("ç¹æ£id") |
| | | private Integer inspectionRecordId; |
| | | |
| | | @ApiModelProperty("æµè¯é¡¹ç®") |
| | | private String testItems; |
| | | |
| | | @ApiModelProperty("æ åå¼") |
| | | private String standardValue; |
| | | |
| | | @ApiModelProperty("宿µå¼") |
| | | private String measuredValue; |
| | | |
| | | @ApiModelProperty("示å¼è¯¯å·®") |
| | | private String indicationError; |
| | | |
| | | @ApiModelProperty("å
许误差") |
| | | private String allowableError; |
| | | |
| | | @ApiModelProperty("å项ç»è®º") |
| | | private String singleItemConclusion; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äººid") |
| | | private Integer updateUserId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä½ä¸æå¯¼ä¹¦æ·»å åæ§æä»¶è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:29:18 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_instruction") |
| | | @ApiModel(value = "Instruction对象", description = "ä½ä¸æå¯¼ä¹¦æ·»å åæ§æä»¶è¡¨") |
| | | public class DeviceInstruction implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("ç³è¯·ç¼å·") |
| | | private String applicationNumber; |
| | | |
| | | @ApiModelProperty("ç³è¯·é¨é¨") |
| | | private String applicationDepartment; |
| | | |
| | | @ApiModelProperty("责任人") |
| | | private String personLiable; |
| | | |
| | | @ApiModelProperty("åæ§ç³è¯·è¯´æ") |
| | | private String controlledApplicationDescription; |
| | | |
| | | @ApiModelProperty("ç³»ç»çæåç§°") |
| | | private String fileName; |
| | | |
| | | @ApiModelProperty("ç³»ç»çæåç§°") |
| | | private String fileSystemName; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤ - ä½ä¸æå¯¼ä¹¦ æ·»å åæ§æä»¶ å |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:43:32 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_operation_instruction") |
| | | public class OperationInstruction { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("设å¤ä¸»é®id") |
| | | private String deviceId; |
| | | |
| | | @ApiModelProperty("æä»¶ç±»å") |
| | | private String documentType; |
| | | |
| | | @ApiModelProperty("ææ¡£ç¼å·") |
| | | private String documentNumber; |
| | | |
| | | @ApiModelProperty("æä»¶çæ¬") |
| | | private String documentVersion; |
| | | |
| | | @ApiModelProperty("ä½è
") |
| | | private String author; |
| | | |
| | | @ApiModelProperty("æäº¤æ¥æ") |
| | | private LocalDate submitDate; |
| | | |
| | | @ApiModelProperty("ææ¡£è¯´æ") |
| | | private String documentNote; |
| | | |
| | | @ApiModelProperty("ç³»ç»çæåç§°") |
| | | private String fileName; |
| | | |
| | | @ApiModelProperty("ç³»ç»çæåç§°") |
| | | private String fileSystemName; |
| | | |
| | | @ApiModelProperty("ä½ä¸æå¯¼ä¹¦id") |
| | | private Integer instructionId; |
| | | |
| | | @ApiModelProperty("ä¸ä¼ 人id") |
| | | private Integer uploader; |
| | | |
| | | @ApiModelProperty("审æ¹äººid") |
| | | private Integer approverId; |
| | | |
| | | @ApiModelProperty("审æ¹ç¶æ") |
| | | private Boolean status; |
| | | |
| | | @ApiModelProperty("çææ¶é´") |
| | | private LocalDateTime entryIntoForceTime; |
| | | |
| | | @ApiModelProperty("ä¸ä¼ æ¶é´") |
| | | private LocalDateTime uploadTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°äººid") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("å建人id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.CollectBridge; |
| | | |
| | | /** |
| | | * æ°åçµæ¡¥éé |
| | | * |
| | | * @author zhuo |
| | | * @since 2025-02-19 |
| | | */ |
| | | public interface CollectBridgeService extends IService<CollectBridge> { |
| | | |
| | | /** |
| | | * å¡«å
ééæ°æ® |
| | | * @param jsonObject |
| | | */ |
| | | void addBridgeValue(JSONObject jsonObject); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.DeviceAccidentReport; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤äºæ
æ¥åå æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 06:31:12 |
| | | */ |
| | | public interface DeviceAccidentReportService extends IService<DeviceAccidentReport> { |
| | | |
| | | /** |
| | | * 设å¤äºæ
æ¥åå表 |
| | | * @param page |
| | | * @param deviceAccidentReport |
| | | * @return |
| | | */ |
| | | IPage<DeviceAccidentReport> pageDeviceAccidentReport(Page page, DeviceAccidentReport deviceAccidentReport); |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤äºæ
æ¥å |
| | | * @param deviceAccidentReport |
| | | * @return |
| | | */ |
| | | boolean addDeviceAccidentReport(DeviceAccidentReport deviceAccidentReport); |
| | | |
| | | /** |
| | | * 导åºè®¾å¤äºæ
æ¥å |
| | | * @param accidentReportId 设å¤äºæ
æ¥åid |
| | | * @param response ååº |
| | | */ |
| | | void exportDeviceAccidentReport(Integer accidentReportId, HttpServletResponse response); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceBreakdownMaintenance; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤æ
é维修表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 04:50:57 |
| | | */ |
| | | public interface DeviceBreakdownMaintenanceService extends IService<DeviceBreakdownMaintenance> { |
| | | |
| | | /** |
| | | * è®¾å¤æ
éç»´ä¿®å表 |
| | | * @param page |
| | | * @param deviceBreakdownMaintenance |
| | | * @return |
| | | */ |
| | | IPage<DeviceBreakdownMaintenance> pageDeviceBreakdownMaintenance(Page page, DeviceBreakdownMaintenance deviceBreakdownMaintenance); |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤æ
éç»´ä¿® |
| | | * @param deviceBreakdownMaintenance |
| | | * @return |
| | | */ |
| | | boolean addDeviceBreakdownMaintenance(DeviceBreakdownMaintenance deviceBreakdownMaintenance); |
| | | |
| | | /** |
| | | * 导åºè®¾å¤æ
éç»´ä¿® |
| | | * @param maintenanceId è®¾å¤æ
éç»´ä¿®id |
| | | * @param response ååº |
| | | */ |
| | | void exportDeviceBreakdownMaintenance(Integer maintenanceId, HttpServletResponse response); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecordDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:27:32 |
| | | */ |
| | | public interface DeviceInspectionRecordDetailsService extends IService<DeviceInspectionRecordDetails> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.device.dto.DeviceInspectionRecordDto; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecord; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ç¹æ£è®°å½è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:25:14 |
| | | */ |
| | | public interface DeviceInspectionRecordService extends IService<DeviceInspectionRecord> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ç¹æ£è®°å½ |
| | | * @param page |
| | | */ |
| | | Result<IPage<DeviceInspectionRecord>> getDeviceInspectionRecordByPage(IPage page, DeviceInspectionRecordDto deviceInspectionRecord); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¹æ£è¯¦æ
|
| | | * @param inspectionRecordId |
| | | * @return |
| | | */ |
| | | Result getDeviceInspectionRecord(Integer inspectionRecordId); |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | Result addDeviceInspectionRecord(DeviceInspectionRecordDto deviceInspectionRecord); |
| | | |
| | | /** |
| | | * ä¿®æ¹è®¾å¤ç¹æ£è®°å½ |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | Result updateInspectionRecordAndDetails(DeviceInspectionRecordDto deviceInspectionRecord); |
| | | |
| | | /** |
| | | * å é¤è®¾å¤ç¹æ£è®°å½ |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | Result deleteDeviceInspectionRecordOrDetails(DeviceInspectionRecordDto deviceInspectionRecord); |
| | | |
| | | /** |
| | | * 夿 ¸ç¹æ£è®°å½ |
| | | * @param deviceExamineRecordDto |
| | | * @return |
| | | */ |
| | | Result reviewDeviceInspectionRecord(DeviceInspectionRecordDto deviceExamineRecordDto); |
| | | |
| | | /** |
| | | * 导åºè®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param deviceInspectionRecordId 设å¤ç¹æ£è®°å½id |
| | | * @param response |
| | | */ |
| | | Result exportDeviceInspectionRecord(Integer deviceInspectionRecordId, HttpServletResponse response); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceInstructionDto; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.pojo.DeviceInstruction; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä½ä¸æå¯¼ä¹¦æ·»å åæ§æä»¶è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:29:18 |
| | | */ |
| | | public interface DeviceInstructionService extends IService<DeviceInstruction> { |
| | | |
| | | IPage<DeviceInstruction> pageByPageQueryOfHomeworkInstructions(Page page, DeviceOperationInstructionDto operationInstructionDto); |
| | | |
| | | void newHomeworkGuidebookAdded(DeviceInstructionDto instructionDto); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.pojo.OperationInstruction; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤ - ä½ä¸æå¯¼ä¹¦ æ·»å åæ§æä»¶ å æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:43:32 |
| | | */ |
| | | public interface DeviceOperationInstructionService extends IService<OperationInstruction> { |
| | | |
| | | List<DeviceOperationInstructionDto> homeworkGuidebookEditor(Integer instructionId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.device.mapper.CollectBridgeMapper; |
| | | import com.ruoyi.device.pojo.CollectBridge; |
| | | import com.ruoyi.device.service.CollectBridgeService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.Duration; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | |
| | | /** |
| | | * æ°åçµæ¡¥éé |
| | | * |
| | | * @author zhuo |
| | | * @since 2025-02-19 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class CollectBridgeServiceImpl extends ServiceImpl<CollectBridgeMapper, CollectBridge> implements CollectBridgeService { |
| | | |
| | | /** |
| | | * å¡«å
ééæ°æ® |
| | | * @param jsonObject |
| | | */ |
| | | @Override |
| | | public void addBridgeValue(JSONObject jsonObject) { |
| | | JSONArray dataArray = jsonObject.getJSONArray("data"); |
| | | for (int i = 0; i < dataArray.size(); i++) { |
| | | JSONObject listInfo = dataArray.getJSONObject(i); |
| | | // å卿°æ® |
| | | String dataStream = listInfo.getString("dataStream"); |
| | | if (dataStream.equals("DQCS.DQCS.SN")) { |
| | | JSONArray dataPoints = listInfo.getJSONArray("dataPoints"); |
| | | JSONObject pointsJSONObject = dataPoints.getJSONObject(0); |
| | | String entrustCode = pointsJSONObject.getString("value"); |
| | | // è§£ææ¶é´æ³ |
| | | Instant instant = Instant.ofEpochMilli(pointsJSONObject.getLong("time")); |
| | | LocalDateTime collectDate = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); |
| | | |
| | | // å
åå¨ç¼å·, åç»åå¨å¼ |
| | | CollectBridge collectBridge = new CollectBridge(); |
| | | collectBridge.setEntrustCode(entrustCode); |
| | | collectBridge.setCollectDate(collectDate); |
| | | baseMapper.insert(collectBridge); |
| | | |
| | | } |
| | | // å¯åå¨å°åçäº64è·åç»æå¼ |
| | | if (dataStream.equals("DQCS.DQCS.64")) { |
| | | JSONArray dataPoints = listInfo.getJSONArray("dataPoints"); |
| | | JSONObject pointsJSONObject = dataPoints.getJSONObject(0); |
| | | String value = pointsJSONObject.getString("value"); |
| | | |
| | | if (value.equals("64")) { |
| | | for (int j = 0; j < dataArray.size(); j++) { |
| | | JSONObject listInfo2 = dataArray.getJSONObject(j); |
| | | String dataStream2 = listInfo2.getString("dataStream"); |
| | | // å¯åå¨å°åçäº64è·åç»æå¼ |
| | | if (dataStream2.equals("DQCS.DQCS.DZZ")) { |
| | | JSONArray dataPoints2 = listInfo2.getJSONArray("dataPoints"); |
| | | JSONObject pointsJSONObject2 = dataPoints2.getJSONObject(0); |
| | | String collectValue = pointsJSONObject2.getString("value"); |
| | | |
| | | // è§£ææ¶é´æ³ |
| | | Instant instant = Instant.ofEpochMilli(pointsJSONObject2.getLong("time")); |
| | | LocalDateTime collectDate = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); |
| | | |
| | | // æ¥è¯¢ææ°ä¸æ¡æ°æ® |
| | | CollectBridge collectBridge = baseMapper.selectOne(Wrappers.<CollectBridge>lambdaQuery() |
| | | .orderByDesc(CollectBridge::getCollectDate) |
| | | .last("limit 1")); |
| | | |
| | | // å¤æä¸¤æ¡æ°æ®æ¯å¦ç¸å·®å¨10åéä¹å
åææ²¡æç¼å· |
| | | if (isWithinTenMinutes(collectDate, collectBridge.getCollectDate()) && |
| | | StringUtils.isNotBlank(collectBridge.getEntrustCode())) { |
| | | // ä¿®æ¹æ£éªå¼ |
| | | collectBridge.setCollectValue(collectValue); |
| | | baseMapper.updateById(collectBridge); |
| | | } else { |
| | | // åªåå¨å¼ |
| | | CollectBridge bridge = new CollectBridge(); |
| | | bridge.setCollectValue(collectValue); |
| | | bridge.setCollectDate(collectDate); |
| | | baseMapper.insert(bridge); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static boolean isWithinTenMinutes(LocalDateTime dateTime1, LocalDateTime dateTime2) { |
| | | Duration duration = Duration.between(dateTime1, dateTime2); |
| | | long minutesDifference = Math.abs(duration.toMinutes()); |
| | | return minutesDifference <= 10; |
| | | } |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | 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.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceAccidentReportDto; |
| | | import com.ruoyi.device.mapper.DeviceAccidentReportMapper; |
| | | import com.ruoyi.device.mapper.DeviceMapper; |
| | | import com.ruoyi.device.pojo.Device; |
| | | import com.ruoyi.device.pojo.DeviceAccidentReport; |
| | | import com.ruoyi.device.service.DeviceAccidentReportService; |
| | | import com.ruoyi.inspect.util.UserUtils; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤äºæ
æ¥åå æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 06:31:12 |
| | | */ |
| | | @Service |
| | | public class DeviceAccidentReportServiceImpl extends ServiceImpl<DeviceAccidentReportMapper, DeviceAccidentReport> implements DeviceAccidentReportService { |
| | | |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | |
| | | |
| | | @Resource |
| | | private DeviceMapper deivceMapper; |
| | | |
| | | /** |
| | | * 设å¤äºæ
æ¥åå表 |
| | | * @param page |
| | | * @param deviceAccidentReport |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<DeviceAccidentReport> pageDeviceAccidentReport(Page page, DeviceAccidentReport deviceAccidentReport) { |
| | | return baseMapper.pageDeviceAccidentReport(page, QueryWrappers.queryWrappers(deviceAccidentReport)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤äºæ
æ¥å |
| | | * @param deviceAccidentReport |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addDeviceAccidentReport(DeviceAccidentReport deviceAccidentReport) { |
| | | DeviceAccidentReport accidentReport = new DeviceAccidentReport(); |
| | | User user = userMapper.selectById(SecurityUtils.getUserId().intValue()); |
| | | switch (deviceAccidentReport.getFlowType()) { |
| | | case 0: |
| | | // æ¥å |
| | | BeanUtils.copyProperties(deviceAccidentReport, accidentReport); |
| | | accidentReport.setDescriptionOfAccident(deviceAccidentReport.getDescriptionOfAccident()); |
| | | accidentReport.setReportUserId(user.getId()); |
| | | accidentReport.setReportUser(user.getName()); |
| | | accidentReport.setReportDate(LocalDate.now()); |
| | | |
| | | // è¯ä¼°äººä¿¡æ¯ |
| | | User assessorUser = userMapper.selectById(deviceAccidentReport.getAssessorUserId()); |
| | | accidentReport.setAssessorUserId(assessorUser.getId()); |
| | | accidentReport.setAssessorUser(assessorUser.getName()); |
| | | |
| | | baseMapper.insert(accidentReport); |
| | | break; |
| | | case 1: |
| | | accidentReport.setAccidentReportId(deviceAccidentReport.getAccidentReportId()); |
| | | // è¯ä¼° |
| | | accidentReport.setAssessorOpinion(deviceAccidentReport.getAssessorOpinion()); |
| | | accidentReport.setAssessorDate(LocalDate.now()); |
| | | |
| | | // é¨é¨è´è´£äºº |
| | | User departmentHeadUser = userMapper.selectById(deviceAccidentReport.getDepartmentHeadUserId()); |
| | | accidentReport.setDepartmentHeadUserId(departmentHeadUser.getId()); |
| | | accidentReport.setDepartmentHeadUser(departmentHeadUser.getName()); |
| | | |
| | | baseMapper.updateById(accidentReport); |
| | | |
| | | break; |
| | | case 2: |
| | | accidentReport.setAccidentReportId(deviceAccidentReport.getAccidentReportId()); |
| | | // é¨é¨è´è´£äººæè§ |
| | | accidentReport.setDepartmentHeadOpinion(deviceAccidentReport.getDepartmentHeadOpinion()); |
| | | accidentReport.setDepartmentHeadDate(LocalDate.now()); |
| | | |
| | | // ææ¯è´è´£äººä¿¡æ¯ |
| | | User technicalDirectorUser = userMapper.selectById(deviceAccidentReport.getTechnicalDirectorUserId()); |
| | | accidentReport.setTechnicalDirectorUserId(technicalDirectorUser.getId()); |
| | | accidentReport.setTechnicalDirectorUser(technicalDirectorUser.getName()); |
| | | |
| | | baseMapper.updateById(accidentReport); |
| | | |
| | | break; |
| | | case 3: |
| | | accidentReport.setAccidentReportId(deviceAccidentReport.getAccidentReportId()); |
| | | // ææ¯è´è´£äººæè§ |
| | | accidentReport.setTechnicalDirectorOpinion(deviceAccidentReport.getTechnicalDirectorOpinion()); |
| | | accidentReport.setTechnicalDirectorDate(LocalDate.now()); |
| | | |
| | | // ä¸»ä»»ä¿¡æ¯ |
| | | User directorHeadUser = userMapper.selectById(deviceAccidentReport.getDirectorHeadUserId()); |
| | | accidentReport.setDirectorHeadUserId(directorHeadUser.getId()); |
| | | accidentReport.setDirectorHeadUser(directorHeadUser.getName()); |
| | | |
| | | baseMapper.updateById(accidentReport); |
| | | |
| | | break; |
| | | case 4: |
| | | accidentReport.setAccidentReportId(deviceAccidentReport.getAccidentReportId()); |
| | | // 主任æè§ |
| | | accidentReport.setDirectorHeadOpinion(deviceAccidentReport.getDirectorHeadOpinion()); |
| | | accidentReport.setDirectorHeadDate(LocalDate.now()); |
| | | |
| | | accidentReport.setIsFinish(1); |
| | | baseMapper.updateById(accidentReport); |
| | | break; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¾å¤äºæ
æ¥å |
| | | * @param accidentReportId 设å¤äºæ
æ¥åid |
| | | * @param response ååº |
| | | */ |
| | | @Override |
| | | public void exportDeviceAccidentReport(Integer accidentReportId, HttpServletResponse response) { |
| | | // æ¥è¯¢äºæ
æ¥å |
| | | DeviceAccidentReportDto deviceAccidentReport = baseMapper.selectDeviceAccidentReportById(accidentReportId); |
| | | |
| | | Device device = deivceMapper.selectById(deviceAccidentReport.getDeviceId()); |
| | | device = device == null ? new Device() : device; |
| | | |
| | | // è·åè·¯å¾ |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/word/device-accident-report.docx"); |
| | | Configure configure = Configure.builder() |
| | | .build(); |
| | | Device finalDevice = device; |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("deviceAccidentReport", deviceAccidentReport); |
| | | put("device", finalDevice); |
| | | // æ¥å人ç¾å |
| | | put("reportUserUrl", UserUtils.getFinalUserSignatureUrl(deviceAccidentReport.getReportUserId())); |
| | | // è¯ä¼°äººç¾å |
| | | put("assessorUserUrl", UserUtils.getFinalUserSignatureUrl(deviceAccidentReport.getAssessorUserId())); |
| | | // é¨é¨è´è´£äººç¾å |
| | | put("departmentHeadUserUrl", UserUtils.getFinalUserSignatureUrl(deviceAccidentReport.getDepartmentHeadUserId())); |
| | | // ææ¯è´è´£äººç¾å |
| | | put("technicalDirectorUserUrl", UserUtils.getFinalUserSignatureUrl(deviceAccidentReport.getTechnicalDirectorUserId())); |
| | | // 主任ç¾å |
| | | put("directorHeadUserUrl", UserUtils.getFinalUserSignatureUrl(deviceAccidentReport.getDepartmentHeadUserId())); |
| | | }}); |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String deviceName = device.getDeviceName() == null ? "" : device.getDeviceName(); |
| | | String fileName = URLEncoder.encode( |
| | | deviceName + "设å¤äºæ
æ¥åå", "UTF-8"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | 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.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceBreakdownMaintenance; |
| | | import com.ruoyi.device.mapper.DeviceBreakdownMaintenanceMapper; |
| | | import com.ruoyi.device.mapper.DeviceMapper; |
| | | import com.ruoyi.device.pojo.Device; |
| | | import com.ruoyi.device.service.DeviceBreakdownMaintenanceService; |
| | | import com.ruoyi.inspect.util.UserUtils; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤æ
é维修表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-17 04:50:57 |
| | | */ |
| | | @Service |
| | | public class DeviceBreakdownMaintenanceServiceImpl extends ServiceImpl<DeviceBreakdownMaintenanceMapper, DeviceBreakdownMaintenance> implements DeviceBreakdownMaintenanceService { |
| | | |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private DeviceMapper deivceMapper; |
| | | |
| | | /** |
| | | * è®¾å¤æ
éç»´ä¿®å表 |
| | | * @param page |
| | | * @param deviceBreakdownMaintenance |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<DeviceBreakdownMaintenance> pageDeviceBreakdownMaintenance(Page page, DeviceBreakdownMaintenance deviceBreakdownMaintenance) { |
| | | return baseMapper.pageDeviceBreakdownMaintenance(page, QueryWrappers.queryWrappers(deviceBreakdownMaintenance)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤æ
éç»´ä¿® |
| | | * @param deviceBreakdownMaintenance |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addDeviceBreakdownMaintenance(DeviceBreakdownMaintenance deviceBreakdownMaintenance) { |
| | | DeviceBreakdownMaintenance breakdownMaintenance = new DeviceBreakdownMaintenance(); |
| | | //å½åç»å½ç¨æ· |
| | | User user = userMapper.selectById(SecurityUtils.getUserId().intValue()); |
| | | |
| | | switch (deviceBreakdownMaintenance.getFlowType()) { |
| | | case 0: |
| | | BeanUtils.copyProperties(deviceBreakdownMaintenance, breakdownMaintenance); |
| | | // ç³è¯· |
| | | breakdownMaintenance.setDamageOrMalfunction(deviceBreakdownMaintenance.getDamageOrMalfunction()); |
| | | breakdownMaintenance.setApplicantUserId(user.getId()); |
| | | breakdownMaintenance.setApplicantUser(user.getName()); |
| | | breakdownMaintenance.setRepairDate(deviceBreakdownMaintenance.getRepairDate()); |
| | | |
| | | // å¤çäººä¿¡æ¯ |
| | | User departmentHeadUser = userMapper.selectById(deviceBreakdownMaintenance.getDepartmentHeadUserId()); |
| | | breakdownMaintenance.setApplicantUserId(departmentHeadUser.getId()); |
| | | breakdownMaintenance.setApplicantUser(departmentHeadUser.getName()); |
| | | |
| | | baseMapper.insert(breakdownMaintenance); |
| | | break; |
| | | case 1: |
| | | breakdownMaintenance.setMaintenanceId(deviceBreakdownMaintenance.getMaintenanceId()); |
| | | // ç³è¯·é¨é¨è´è´£äººæè§ |
| | | breakdownMaintenance.setDepartmentHeadOpinion(deviceBreakdownMaintenance.getDepartmentHeadOpinion()); |
| | | breakdownMaintenance.setDepartmentHeadDate(LocalDate.now()); |
| | | |
| | | baseMapper.updateById(breakdownMaintenance); |
| | | break; |
| | | case 2: |
| | | breakdownMaintenance.setMaintenanceId(deviceBreakdownMaintenance.getMaintenanceId()); |
| | | // 计é室æè§ |
| | | breakdownMaintenance.setMaintenanceRecord(deviceBreakdownMaintenance.getMaintenanceRecord()); |
| | | breakdownMaintenance.setMaintenanceUser(deviceBreakdownMaintenance.getMaintenanceUser()); |
| | | breakdownMaintenance.setMaintenanceDate(deviceBreakdownMaintenance.getMaintenanceDate()); |
| | | |
| | | breakdownMaintenance.setIsFinish(1); |
| | | |
| | | baseMapper.updateById(breakdownMaintenance); |
| | | break; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¾å¤æ
éç»´ä¿® |
| | | * @param maintenanceId è®¾å¤æ
éç»´ä¿®id |
| | | * @param response ååº |
| | | */ |
| | | @Override |
| | | public void exportDeviceBreakdownMaintenance(Integer maintenanceId, HttpServletResponse response) { |
| | | // æ¥è¯¢å¤é¨è®¾å¤ç³è¯· |
| | | DeviceBreakdownMaintenance deviceBreakdownMaintenance = baseMapper.selectById(maintenanceId); |
| | | |
| | | Device device = null; |
| | | if (deviceBreakdownMaintenance.getDeviceId() != null) { |
| | | device = deivceMapper.selectById(deviceBreakdownMaintenance.getDeviceId()); |
| | | device = device == null ? new Device() : device; |
| | | } |
| | | // è·åè·¯å¾ |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/word/device-breakdown-maintenance.docx"); |
| | | Configure configure = Configure.builder() |
| | | .build(); |
| | | Device finalDevice = device; |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("deviceBreakdownMaintenance", deviceBreakdownMaintenance); |
| | | put("device", finalDevice); |
| | | // ç³è¯·äººç¾å |
| | | put("applicantUrl", UserUtils.getFinalUserSignatureUrl(deviceBreakdownMaintenance.getApplicantUserId())); |
| | | // é¨é¨è´è´£äººç¾å |
| | | put("headUrl", UserUtils.getFinalUserSignatureUrl(deviceBreakdownMaintenance.getDepartmentHeadUserId())); |
| | | }}); |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String deviceName = device.getDeviceName() == null ? "" : device.getDeviceName(); |
| | | String fileName = URLEncoder.encode( |
| | | deviceName + "è®¾å¤æ
éç»´ä¿®ç³è¯·è¡¨", "UTF-8"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.device.mapper.DeviceInspectionRecordDetailsMapper; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecordDetails; |
| | | import com.ruoyi.device.service.DeviceInspectionRecordDetailsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:27:32 |
| | | */ |
| | | @Service |
| | | public class DeviceInspectionRecordDetailsServiceImpl extends ServiceImpl<DeviceInspectionRecordDetailsMapper, DeviceInspectionRecordDetails> implements DeviceInspectionRecordDetailsService { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceInspectionRecordDto; |
| | | import com.ruoyi.device.mapper.DeviceInspectionRecordMapper; |
| | | import com.ruoyi.device.mapper.DeviceMapper; |
| | | import com.ruoyi.device.pojo.Device; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecord; |
| | | import com.ruoyi.device.pojo.DeviceInspectionRecordDetails; |
| | | import com.ruoyi.device.service.DeviceInspectionRecordDetailsService; |
| | | import com.ruoyi.device.service.DeviceInspectionRecordService; |
| | | import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.inspect.util.UserUtils; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ç¹æ£è®°å½è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author æ±èéµ·éç½ç»ç§ææéå
¬å¸ |
| | | * @since 2024-12-16 04:25:14 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class DeviceInspectionRecordServiceImpl extends ServiceImpl<DeviceInspectionRecordMapper, DeviceInspectionRecord> implements DeviceInspectionRecordService { |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private DeviceMapper deviceMapper; |
| | | @Resource |
| | | private DeviceInspectionRecordDetailsService deviceInspectionRecordDetailsService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param page å½å页ç |
| | | */ |
| | | @Override |
| | | public Result<IPage<DeviceInspectionRecord>> getDeviceInspectionRecordByPage(IPage page, DeviceInspectionRecordDto deviceInspectionRecordDto) { |
| | | IPage<DeviceInspectionRecord> iPage = baseMapper.selectDeviceParameterPage(page, QueryWrappers.queryWrappers(deviceInspectionRecordDto)); |
| | | return Result.success(iPage); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¹æ£è¯¦æ
|
| | | * @param inspectionRecordId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result getDeviceInspectionRecord(Integer inspectionRecordId) { |
| | | DeviceInspectionRecord deviceInspectionRecord = baseMapper.selectById(inspectionRecordId); |
| | | DeviceInspectionRecordDto dto = new DeviceInspectionRecordDto(); |
| | | BeanUtils.copyProperties(deviceInspectionRecord, dto); |
| | | List<DeviceInspectionRecordDetails> list = deviceInspectionRecordDetailsService.list(Wrappers.<DeviceInspectionRecordDetails>lambdaQuery().eq(DeviceInspectionRecordDetails::getInspectionRecordId, inspectionRecordId)); |
| | | dto.setDetails(list); |
| | | return Result.success(dto); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result addDeviceInspectionRecord(DeviceInspectionRecordDto deviceInspectionRecord) { |
| | | |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | User user = userMapper.selectById(userId); |
| | | deviceInspectionRecord.setRecorderId(userId); |
| | | deviceInspectionRecord.setRecorder(user.getName()); |
| | | |
| | | // æ¥è¯¢å¤æ ¸äººid |
| | | if (deviceInspectionRecord.getReviewerId() != null) { |
| | | User reviewUser = userMapper.selectById(deviceInspectionRecord.getReviewerId()); |
| | | deviceInspectionRecord.setReviewer(reviewUser.getName()); |
| | | } |
| | | this.saveOrUpdate(deviceInspectionRecord); |
| | | if (CollectionUtils.isNotEmpty(deviceInspectionRecord.getDetails())) { |
| | | for (DeviceInspectionRecordDetails detail : deviceInspectionRecord.getDetails()) { |
| | | detail.setInspectionRecordId(deviceInspectionRecord.getInspectionRecordId()); |
| | | } |
| | | deviceInspectionRecordDetailsService.saveBatch( deviceInspectionRecord.getDetails()); |
| | | } |
| | | |
| | | return Result.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹è®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | @Override |
| | | public Result updateInspectionRecordAndDetails(DeviceInspectionRecordDto deviceInspectionRecord) { |
| | | // æ¥è¯¢å¤æ ¸äººid |
| | | if (deviceInspectionRecord.getReviewerId() != null) { |
| | | User reviewUser = userMapper.selectById(deviceInspectionRecord.getReviewerId()); |
| | | deviceInspectionRecord.setReviewer(reviewUser.getName()); |
| | | } |
| | | this.saveOrUpdate(deviceInspectionRecord); |
| | | deviceInspectionRecordDetailsService.remove(Wrappers.<DeviceInspectionRecordDetails>lambdaQuery().eq(DeviceInspectionRecordDetails::getInspectionRecordId, deviceInspectionRecord.getInspectionRecordId())); |
| | | if (CollectionUtils.isNotEmpty(deviceInspectionRecord.getDetails())) { |
| | | for (DeviceInspectionRecordDetails detail : deviceInspectionRecord.getDetails()) { |
| | | detail.setInspectionRecordId(deviceInspectionRecord.getInspectionRecordId()); |
| | | } |
| | | deviceInspectionRecordDetailsService.saveBatch( deviceInspectionRecord.getDetails()); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param deviceInspectionRecord 设å¤ç¹æ£è®°å½ |
| | | */ |
| | | @Override |
| | | public Result deleteDeviceInspectionRecordOrDetails(DeviceInspectionRecordDto deviceInspectionRecord) { |
| | | this.removeById(deviceInspectionRecord); |
| | | deviceInspectionRecordDetailsService.remove(Wrappers.<DeviceInspectionRecordDetails>lambdaQuery().eq(DeviceInspectionRecordDetails::getInspectionRecordId, deviceInspectionRecord.getInspectionRecordId())); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 夿 ¸ç¹æ£è®°å½ |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result reviewDeviceInspectionRecord(DeviceInspectionRecordDto dto) { |
| | | LambdaUpdateWrapper<DeviceInspectionRecord> wrapper = Wrappers.<DeviceInspectionRecord>lambdaUpdate() |
| | | .eq(DeviceInspectionRecord::getInspectionRecordId, dto.getInspectionRecordId()) |
| | | .set(DeviceInspectionRecord::getStatus, dto.getStatus()) |
| | | .set(DeviceInspectionRecord::getReviewerRemark, dto.getReviewerRemark()); |
| | | |
| | | // 为0æ¸
é¤å®¡æ ¸äºº |
| | | if (dto.getStatus().equals(0)) { |
| | | wrapper.set(DeviceInspectionRecord::getReviewerId, null) |
| | | .set(DeviceInspectionRecord::getReviewer, null); |
| | | } |
| | | this.update(wrapper); |
| | | |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¾å¤ç¹æ£è®°å½ |
| | | * |
| | | * @param deviceInspectionRecordId 设å¤ç¹æ£è®°å½id |
| | | * @param response ååº |
| | | */ |
| | | @Override |
| | | public Result exportDeviceInspectionRecord(Integer deviceInspectionRecordId, HttpServletResponse response) { |
| | | DeviceInspectionRecord deviceInspectionRecord = baseMapper.selectById(deviceInspectionRecordId); |
| | | DeviceInspectionRecordDto deviceInspectionRecordDto = new DeviceInspectionRecordDto(); |
| | | BeanUtils.copyProperties(deviceInspectionRecord, deviceInspectionRecordDto); |
| | | DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | deviceInspectionRecordDto.setTestDateString(deviceInspectionRecord.getTestDate() == null ? null : deviceInspectionRecord.getTestDate().format(dateFormatter)); |
| | | |
| | | List<DeviceInspectionRecordDetails> deviceInspectionRecordDetailsList = deviceInspectionRecordDetailsService.list(Wrappers.<DeviceInspectionRecordDetails>lambdaQuery().eq(DeviceInspectionRecordDetails::getInspectionRecordId, deviceInspectionRecordId)); |
| | | |
| | | Integer deviceId = deviceInspectionRecord.getDeviceId(); |
| | | |
| | | Device device = deviceMapper.selectById(deviceId); |
| | | |
| | | // è·åè·¯å¾ |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/word/device-inspection-record.docx"); |
| | | Configure configure = Configure.builder() |
| | | .bind("deviceInspectionRecordDetailsList", new HackLoopTableRenderPolicy()) |
| | | .build(); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("deviceInspectionRecord", deviceInspectionRecordDto); |
| | | put("deviceInspectionRecordDetailsList", deviceInspectionRecordDetailsList); |
| | | put("device", device); |
| | | put("recorderUrl", UserUtils.getFinalUserSignatureUrl(deviceInspectionRecordDto.getRecorderId())); |
| | | put("reviewerUrl", UserUtils.getFinalUserSignatureUrl(deviceInspectionRecordDto.getReviewerId())); |
| | | }}); |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | device.getDeviceName() + "ç¹æ£è®°å½", "UTF-8"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | return Result.success(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceInstructionDto; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.mapper.InstructionMapper; |
| | | import com.ruoyi.device.pojo.DeviceInstruction; |
| | | import com.ruoyi.device.service.DeviceInstructionService; |
| | | import com.ruoyi.device.service.DeviceOperationInstructionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä½ä¸æå¯¼ä¹¦æ·»å åæ§æä»¶è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:29:18 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class DeviceInstructionServiceImpl extends ServiceImpl<InstructionMapper, DeviceInstruction> implements DeviceInstructionService { |
| | | |
| | | @Autowired |
| | | private DeviceOperationInstructionService operationInstructionService; |
| | | |
| | | @Autowired |
| | | private NumberGenerator<DeviceInstruction> numberGenerator; |
| | | |
| | | @Override |
| | | public IPage<DeviceInstruction> pageByPageQueryOfHomeworkInstructions(Page page, DeviceOperationInstructionDto operationInstructionDto) { |
| | | return baseMapper.pageByPageQueryOfHomeworkInstructions(page, QueryWrappers.queryWrappers(operationInstructionDto)); |
| | | } |
| | | |
| | | @Override |
| | | public void newHomeworkGuidebookAdded(DeviceInstructionDto instructionDto) { |
| | | if (ObjectUtils.isEmpty(instructionDto.getApplicationNumber())) { |
| | | String year = new SimpleDateFormat("yy", Locale.CHINESE).format(new Date()); |
| | | String month = new SimpleDateFormat("MM", Locale.CHINESE).format(new Date()); |
| | | String day = new SimpleDateFormat("dd", Locale.CHINESE).format(new Date()); |
| | | String processNumber = numberGenerator.generateNumberWithPrefix(3, "WJSK" + year + month + day, DeviceInstruction::getApplicationNumber); |
| | | instructionDto.setApplicationNumber(processNumber); |
| | | } |
| | | saveOrUpdate(instructionDto); |
| | | if (ObjectUtils.isNotEmpty(instructionDto.getFeTempHumRecordList())) { |
| | | instructionDto.getFeTempHumRecordList().forEach(i -> { |
| | | i.setInstructionId(instructionDto.getId()); |
| | | i.setUploader(SecurityUtils.getUserId().intValue()); |
| | | i.setUpdateTime(LocalDateTime.now()); |
| | | }); |
| | | operationInstructionService.saveOrUpdateBatch(instructionDto.getFeTempHumRecordList()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.device.dto.DeviceOperationInstructionDto; |
| | | import com.ruoyi.device.mapper.OperationInstructionMapper; |
| | | import com.ruoyi.device.pojo.OperationInstruction; |
| | | import com.ruoyi.device.service.DeviceOperationInstructionService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * è®¾å¤ - ä½ä¸æå¯¼ä¹¦ æ·»å åæ§æä»¶ å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2024-12-04 10:43:32 |
| | | */ |
| | | @Service |
| | | public class DeviceOperationInstructionServiceImpl extends ServiceImpl<OperationInstructionMapper, OperationInstruction> implements DeviceOperationInstructionService { |
| | | |
| | | @Override |
| | | public List<DeviceOperationInstructionDto> homeworkGuidebookEditor(Integer instructionId) { |
| | | return baseMapper.homeworkGuidebookEditor(instructionId); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.task; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.device.dto.DeviceRecordDto; |
| | | import com.ruoyi.device.mapper.DeviceRecordMapper; |
| | | import com.ruoyi.device.pojo.DeviceRecord; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½æé |
| | | */ |
| | | @Component |
| | | public class DeviceRecordSchedule { |
| | | @Resource |
| | | private DeviceRecordMapper deviceRecordMapper; |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | |
| | | /** |
| | | * æéå¡«å设å¤ä½¿ç¨è®°å½ |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 9 * * 6") // æ¯å¨å
æ§è¡ä¸æ¬¡ |
| | | public void task1() { |
| | | // æ¥è¯¢æªå¡«åç设å¤ä½¿ç¨è®°å½ |
| | | List<DeviceRecordDto> deviceRecords = deviceRecordMapper.selectNotFilled(); |
| | | Map<Integer, List<DeviceRecordDto>> userPersonIdMap = deviceRecords.stream().collect(Collectors.groupingBy(DeviceRecord::getUsePersonId)); |
| | | userPersonIdMap.forEach((userId, recordList) -> { |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // ä¼ä¸å¾®ä¿¡éç¥å¡«å设å¤ä½¿ç¨è®°å½ |
| | | User user = userMapper.selectById(userId); |
| | | String message = ""; |
| | | message += "设å¤ä½¿ç¨è®°å½æªå¡«åæééç¥"; |
| | | for (DeviceRecordDto deviceRecord : recordList) { |
| | | message += "\n设å¤åç§°ç¼å·: " + deviceRecord.getDeviceName() + "-" + deviceRecord.getManagementNumber(); |
| | | message += "\nå§æç¼å·: " + deviceRecord.getSampleCode(); |
| | | message += "\n"; |
| | | } |
| | | message += "\n请å»å¡«å设å¤ä½¿ç¨è®°å½"; |
| | | |
| | | //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ |
| | | try { |
| | | WxCpUtils.inform(user.getAccount(), message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | }); |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.device.mapper.DeviceAccidentReportMapper"> |
| | | |
| | | <!-- 设å¤äºæ
æ¥åå表 --> |
| | | <select id="pageDeviceAccidentReport" resultType="com.ruoyi.device.pojo.DeviceAccidentReport"> |
| | | select * from ( |
| | | select * |
| | | from device_accident_report |
| | | order by create_time desc |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="selectDeviceAccidentReportById" resultType="com.ruoyi.device.dto.DeviceAccidentReportDto"> |
| | | select |
| | | d.*, |
| | | date_format(d.accident_date,'%Y-%m-%d') accidentDateStr, -- æ¶é´ |
| | | date_format(d.report_date,'%Y-%m-%d') reportDateStr, -- æ¥åäººå¡«åæ¶é´ |
| | | date_format(d.assessor_date,'%Y-%m-%d') assessorDateStr, -- è¯ä¼°äººå¡«åæ¶é´ |
| | | date_format(d.department_head_date,'%Y-%m-%d') departmentHeadDateStr, -- é¨é¨è´è´£äººå¡«åæ¶é´ |
| | | date_format(d.technical_director_date,'%Y-%m-%d') technicalDirectorDateStr, -- ææ¯è´è´£äººå¡«åæ¶é´ |
| | | date_format(d.director_head_date,'%Y-%m-%d') directorHeadDateStr -- ä¸»ä»»å¡«åæ¶é´ |
| | | from device_accident_report d |
| | | where d.accident_report_id = #{accidentReportId} |
| | | </select> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.device.mapper.DeviceBreakdownMaintenanceMapper"> |
| | | |
| | | <!--è®¾å¤æ
éç»´ä¿®å表--> |
| | | <select id="pageDeviceBreakdownMaintenance" resultType="com.ruoyi.device.dto.DeviceBreakdownMaintenance"> |
| | | select * from ( |
| | | select * |
| | | from device_breakdown_maintenance |
| | | order by create_time desc |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.device.mapper.DeviceInspectionRecordMapper"> |
| | | |
| | | |
| | | <select id="selectDeviceParameterPage" resultType="com.ruoyi.device.pojo.DeviceInspectionRecord"> |
| | | SELECT |
| | | * |
| | | from device_inspection_record |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.device.mapper.InstructionMapper"> |
| | | |
| | | |
| | | <select id="pageByPageQueryOfHomeworkInstructions" resultType="com.ruoyi.device.pojo.DeviceInstruction"> |
| | | SELECT |
| | | doi.*,di.*,d.device_name, d.management_number device_number, d.specification_model device_model, u.name uploader_name, u1.name approver_name |
| | | FROM |
| | | device_operation_instruction doi |
| | | LEFT JOIN device_instruction di ON di.id = doi.instruction_id |
| | | left join device d on d.id = doi.device_id |
| | | left join user u on u.id = doi.uploader |
| | | left join user u1 on u1.id = doi.approver_id |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.device.mapper.OperationInstructionMapper"> |
| | | |
| | | <select id="homeworkGuidebookEditor" resultType="com.ruoyi.device.dto.DeviceOperationInstructionDto"> |
| | | SELECT |
| | | doi.*,d.device_name, d.management_number device_number, d.specification_model device_model |
| | | FROM |
| | | device_operation_instruction doi |
| | | left join device d on d.id = doi.device_id |
| | | where doi.instruction_id = #{instructionId} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web; |
| | | |
| | | import com.ruoyi.device.mqtt.MQClient; |
| | | import com.ruoyi.device.mqtt.MQConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MqttApplicationRunner implements ApplicationRunner { |
| | | |
| | | @Autowired |
| | | private MQConfig mqConfig; |
| | | |
| | | @Value("${mqtt.client}") |
| | | private Boolean client; |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | if (client) { |
| | | MQClient mqttPushClient = new MQClient(); |
| | | mqttPushClient.connect(mqConfig); |
| | | } |
| | | } |
| | | } |
| | |
| | | custorder: http://192.168.20.47/PurchService.ashx? |
| | | custorder-port: http://192.168.20.47:8008/PurchService.ashx? |
| | | erp-services: http://192.168.20.47:8081 |
| | | |
| | | # 夿³¨ 18083å¯ç ï¼zttZTT123!@ |
| | | mqtt: |
| | | url: tcp://mqtt-ztt.zttiot.com:1883 # æå¡å¨ip |
| | | username: forwarder # MQTT-æå¡ç«¯-ç¨æ·å,åæä¼ä¿®æ¹ä¸ºç¨æ·ç»å½å |
| | | password: ZTlink12345 # MQTT-æå¡ç«¯-å¯ç ï¼,åæä¼ä¿®æ¹ä¸ºç¨æ·ç»å½å¯ç |
| | | timeout: 100 # è¶
æ¶æ¶é´ ï¼åä½ï¼ç§ï¼ |
| | | keepalive: 60 # å¿è·³ ï¼åä½ï¼ç§ï¼ |
| | | qos: 1 # å¿è·³å
çº§å« |
| | | completion-timeout: 3000 # è¿æ¥è¶
æ¶æ¶é´ï¼åä½ï¼ç§ï¼ |
| | | clientId: javaPublish # clientId |
| | | subscribe: /ztt/v3/2443521/publish # 订é
ä¸»é¢ |
| | | client: false # 妿å¼åéè¦å¯å¨æµè¯ï¼éè¦æ¹ä¸ºfalseä¸ç¶ä¼ä¸ç´æ¥é |