| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | |
| | | public enum FileNameType { |
| | | |
| | | SALE(1), // éå® |
| | |
| | | MEASURING(5), //计éå¨å
·å°è´¦ |
| | | MEASURINGRecord(6),//计éå¨å
·å°è´¦è®°å½ |
| | | ApproveNode(7), //åå审æ¹èç¹å®¡æ ¸ |
| | | ApproveProcess(8); //åå审æ¹ä¸»æ°æ® |
| | | ApproveProcess(8),//åå审æ¹ä¸»æ°æ® |
| | | SHIP(9),//åè´§å°è´¦ |
| | | INSPECTION_PRODUCTION_BEFORE(10), |
| | | INSPECTION_PRODUCTION_AFTER(11), |
| | | INSPECTION(12);//å·¡æ£ ç产å |
| | | |
| | | private final int value; |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceDefectRecordDto; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.execl.DeviceLedgerExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.ehcache.spi.service.MaintainableService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "设å¤å°è´¦ç®¡ç") |
| | |
| | | |
| | | @PostMapping("import") |
| | | @ApiModelProperty("导å
¥è®¾å¤å°è´¦") |
| | | @Log(title = "设å¤å°è´¦å¯¼å
¥", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | @PostMapping("/downloadTemplate") |
| | | @ApiModelProperty("ä¸è½½å¯¼å
¥æ¨¡æ¿") |
| | | @Log(title = "设å¤å°è´¦å¯¼å
¥", businessType = BusinessType.IMPORT) |
| | | public void downloadTemplate(HttpServletResponse response) { |
| | | ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<DeviceLedgerExeclDto>(DeviceLedgerExeclDto.class); |
| | | util.importTemplateExcel(response, "设å¤å°è´¦æ¨¡æ¿"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @ApiModelProperty("è·å设å¤å°è´¦") |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "设å¤ä¿å
»") |
| | | @RestController |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æå¹´ä»½æ¥è¯¢æ¯ææ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦2025ï¼ |
| | | */ |
| | | @GetMapping("/monthlyAmount") |
| | | @ApiModelProperty("æå¹´ä»½æ¥è¯¢æ¯ææ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼") |
| | | public AjaxResult getMonthlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) { |
| | | List<DeviceMonthlyRepairTableDTO> result = deviceMaintenanceService.getMonthlyRepairAmountByYear(year); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | /** |
| | | * æå¹´ä»½æ¥è¯¢æ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦2025ï¼ |
| | | */ |
| | | @GetMapping("/yearlyAmount") |
| | | @ApiModelProperty("æå¹´ä»½æ¥è¯¢æ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼") |
| | | public AjaxResult yearlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) { |
| | | List<RepairAmountGroupDTO> result = deviceMaintenanceService.getRepairAmountByYear(year); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | import com.ruoyi.device.service.DeviceMaintenanceFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ä¿å
»éä»¶ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-27 09:48:09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/maintenanceTaskFile") |
| | | @Api(tags = "设å¤ä¿å
»éä»¶") |
| | | public class DeviceMaintenanceFileController { |
| | | |
| | | @Resource |
| | | private DeviceMaintenanceFileService deviceMaintenanceFileService; |
| | | |
| | | |
| | | /** |
| | | * æ°å¢ |
| | | * @param deviceMaintenanceFile |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | *å页æ¥è¯¢ |
| | | * @param page |
| | | * @param deviceMaintenanceFile |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.page(page, Wrappers.<DeviceMaintenanceFile>lambdaQuery().eq(DeviceMaintenanceFile::getDeviceMaintenanceId,deviceMaintenanceFile.getDeviceMaintenanceId()))); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "è®¾å¤æ¥ä¿®ç®¡ç") |
| | | @RequestMapping("/device/repair") |
| | |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceRepairService.export(response, ids); |
| | | } |
| | | |
| | | /** |
| | | * æå¹´ä»½æ¥è¯¢æ¯ææ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦2025ï¼ |
| | | */ |
| | | @GetMapping("/monthlyAmount") |
| | | @ApiModelProperty("æå¹´ä»½æ¥è¯¢æ¯ææ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼") |
| | | public AjaxResult getMonthlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) { |
| | | List<DeviceMonthlyRepairTableDTO> result = deviceRepairService.getMonthlyRepairAmountByYear(year); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | /** |
| | | * æå¹´ä»½æ¥è¯¢æ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦2025ï¼ |
| | | */ |
| | | @GetMapping("/yearlyAmount") |
| | | @ApiModelProperty("æå¹´ä»½æ¥è¯¢æ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼") |
| | | public AjaxResult yearlyAmount(@RequestParam(defaultValue = "2025", required = true,name = "year") String year) { |
| | | List<RepairAmountGroupDTO> result = deviceRepairService.getRepairAmountByYear(year); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.device.service.MaintenanceTaskService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/12/22 14:58 |
| | | */ |
| | | @Api(tags = "设å¤ä¿å
»å®æ¶ä»»å¡ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/deviceMaintenanceTask") |
| | | public class MaintenanceTaskController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private MaintenanceTaskService maintenanceTaskService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation(value = "设å¤ä¿å
»å®æ¶ä»»å¡å表") |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.listPage(page,maintenanceTask); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "æ·»å 设å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.add(maintenanceTask); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation(value = "ä¿®æ¹è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.updateByMaintenanceTaskId(maintenanceTask); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "å é¤è®¾å¤ä¿å
»å®æ¶ä»»å¡") |
| | | @Log(title = "设å¤ä¿å
»å®æ¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | return maintenanceTaskService.delete(ids); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | private BigDecimal number; |
| | | |
| | | private String deviceBrand; |
| | | |
| | | private String storageLocation; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | |
| | | */ |
| | | private BigDecimal unTaxIncludingPriceTotal; |
| | | |
| | | private String deviceBrand; |
| | | |
| | | private String storageLocation; |
| | | |
| | | /** |
| | | * å½å
¥æ¶é´ |
| | | */ |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class DeviceMaintenanceDto { |
| | |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»éé¢") |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/19 10:58 |
| | | */ |
| | | @Data |
| | | public class DeviceMonthlyRepairTableDTO { |
| | | |
| | | private String deviceName; // 设å¤åç§° |
| | | private BigDecimal month1; // 1æéé¢ |
| | | private BigDecimal month2; // 2æéé¢ |
| | | private BigDecimal month3; // 3æéé¢ |
| | | private BigDecimal month4; // 4æéé¢ |
| | | private BigDecimal month5; // 5æéé¢ |
| | | private BigDecimal month6; // 6æéé¢ |
| | | private BigDecimal month7; // 7æéé¢ |
| | | private BigDecimal month8; // 8æéé¢ |
| | | private BigDecimal month9; // 9æéé¢ |
| | | private BigDecimal month10; // 10æéé¢ |
| | | private BigDecimal month11; // 11æéé¢ |
| | | private BigDecimal month12; // 12æéé¢ |
| | | private BigDecimal total; // æ»è®¡ |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class DeviceRepairDto { |
| | | |
| | | @ApiModelProperty("ç£å人") |
| | | private String supervisoryName; |
| | | |
| | | @ApiModelProperty("å®¡æ ¸äºº") |
| | | private String auditName; |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®éé¢") |
| | | private BigDecimal repairPrice; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String deviceName; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/19 10:44 |
| | | */ |
| | | @Data |
| | | public class RepairAmountGroupDTO { |
| | | |
| | | // å¹´æï¼æ ¼å¼ï¼MMï¼ |
| | | private String repairYearMonth; |
| | | // 设å¤å°è´¦id |
| | | private Long deviceLedgerId; |
| | | // 设å¤å°è´¦åç§° |
| | | private String deviceName; |
| | | // è¯¥è®¾å¤æ¥ä¿®é颿»å |
| | | private BigDecimal totalRepairPrice; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.device.execl; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class DeviceLedgerExeclDto { |
| | |
| | | * æ°é |
| | | */ |
| | | @Excel(name = "æ°é",sort = 5) |
| | | private BigDecimal number; |
| | | private Integer number; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | * èµäº§åå¼ |
| | | */ |
| | | @Excel(name = "å«ç¨åä»·",sort = 6) |
| | | @Excel(name = "èµäº§åå¼",sort = 6) |
| | | private BigDecimal taxIncludingPriceUnit; |
| | | // |
| | | // /** |
| | | // * å«ç¨æ»ä»· |
| | | // */ |
| | | // @Excel(name = "å«ç¨æ»ä»·",sort = 7) |
| | | // private BigDecimal taxIncludingPriceTotal; |
| | | // |
| | | // /** |
| | | // * ç¨ç |
| | | // */ |
| | | // @Excel(name = "ç¨ç",sort = 8) |
| | | // private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "å«ç¨æ»ä»·",sort = 7) |
| | | private BigDecimal taxIncludingPriceTotal; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | @Excel(name = "ç¨ç",sort = 8) |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·",sort = 9) |
| | | private BigDecimal unTaxIncludingPriceTotal; |
| | | // /** |
| | | // * ä¸å«ç¨æ»ä»· |
| | | // */ |
| | | // @Excel(name = "ä¸å«ç¨æ»ä»·",sort = 9) |
| | | // private BigDecimal unTaxIncludingPriceTotal; |
| | | // |
| | | // /** |
| | | // * å½å
¥æ¶é´ |
| | |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @Excel(name = "åæ¾å°ç¹",sort = 7) |
| | | private String storageLocation; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @Excel(name = "设å¤åç",sort = 8) |
| | | private String deviceBrand; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | |
| | | @Excel(name = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»éé¢") |
| | | @Excel(name = "设å¤ä¿å
»éé¢") |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | @Excel(name = "è§æ ¼åå·") |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | | private String deviceModel; |
| | |
| | | package com.ruoyi.device.execl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | |
| | | @Excel(name = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®éé¢") |
| | | @Excel(name = "æ¥ä¿®éé¢") |
| | | private BigDecimal repairPrice; |
| | | |
| | | @ApiModelProperty("设å¤åå·") |
| | | @Excel(name = "设å¤åå·") |
| | | private String deviceModel; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ä¿å
»éä»¶ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-27 09:48:09 |
| | | */ |
| | | @Mapper |
| | | public interface DeviceMaintenanceFileMapper extends BaseMapper<DeviceMaintenanceFile> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | List<DeviceMaintenance> list1(Long id); |
| | | |
| | | /** |
| | | * æâæå®å¹´ä»½çå¹´æ+设å¤å°è´¦idâåç»ï¼æ±åæ¥ä¿®éé¢ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦"2025"ï¼ |
| | | */ |
| | | @Select("SELECT " + |
| | | " DATE_FORMAT(maintenance_actually_time, '%m') AS repairYearMonth, " + |
| | | " device_ledger_id AS deviceLedgerId, " + |
| | | " SUM(maintenance_price) AS totalRepairPrice " + |
| | | "FROM device_maintenance " + |
| | | "WHERE DATE_FORMAT(maintenance_actually_time, '%Y') = #{year} " + // åªæ¥è¯¢æå®å¹´ä»½çæ°æ® |
| | | "GROUP BY device_ledger_id,DATE_FORMAT(maintenance_actually_time, '%Y-%m') " + |
| | | "ORDER BY repairYearMonth ASC") // ææä»½æåºï¼æ¹ä¾¿å端å±ç¤º |
| | | List<RepairAmountGroupDTO> groupByMonthAndDeviceLedger(@Param("year") String year); |
| | | |
| | | /** |
| | | * æâ设å¤å°è´¦idâåç»ï¼æ±åæ¥ä¿®éé¢ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦"2025"ï¼ |
| | | */ |
| | | @Select("SELECT " + |
| | | " device_ledger_id AS deviceLedgerId, " + |
| | | " SUM(maintenance_price) AS totalRepairPrice " + |
| | | "FROM device_maintenance " + |
| | | "WHERE DATE_FORMAT(maintenance_actually_time, '%Y') = #{year} " + // åªæ¥è¯¢æå®å¹´ä»½çæ°æ® |
| | | "GROUP BY device_ledger_id ") // ææä»½æåºï¼æ¹ä¾¿å端å±ç¤º |
| | | List<RepairAmountGroupDTO> groupByDeviceLedger(@Param("year") String year); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface DeviceRepairMapper extends BaseMapper<DeviceRepair> { |
| | | IPage<DeviceRepairDto> queryPage(Page page, @Param("deviceRepairDto") DeviceRepairDto deviceRepairDto); |
| | | |
| | | DeviceRepairDto detailById(Long id); |
| | | |
| | | |
| | | /** |
| | | * æâæå®å¹´ä»½çå¹´æ+设å¤å°è´¦idâåç»ï¼æ±åæ¥ä¿®éé¢ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦"2025"ï¼ |
| | | */ |
| | | @Select("SELECT " + |
| | | " DATE_FORMAT(repair_time, '%m') AS repairYearMonth, " + |
| | | " device_ledger_id AS deviceLedgerId, " + |
| | | " SUM(repair_price) AS totalRepairPrice " + |
| | | "FROM device_repair " + |
| | | "WHERE DATE_FORMAT(repair_time, '%Y') = #{year} " + // åªæ¥è¯¢æå®å¹´ä»½çæ°æ® |
| | | "GROUP BY device_ledger_id,DATE_FORMAT(repair_time, '%Y-%m') " + |
| | | "ORDER BY repairYearMonth ASC") // ææä»½æåºï¼æ¹ä¾¿å端å±ç¤º |
| | | List<RepairAmountGroupDTO> groupByMonthAndDeviceLedger(@Param("year") String year); |
| | | |
| | | /** |
| | | * æâ设å¤å°è´¦idâåç»ï¼æ±åæ¥ä¿®éé¢ |
| | | * @param year åç«¯ä¼ å
¥ç年份ï¼å¦"2025"ï¼ |
| | | */ |
| | | @Select("SELECT " + |
| | | " device_ledger_id AS deviceLedgerId, " + |
| | | " SUM(repair_price) AS totalRepairPrice " + |
| | | "FROM device_repair " + |
| | | "WHERE DATE_FORMAT(repair_time, '%Y') = #{year} " + // åªæ¥è¯¢æå®å¹´ä»½çæ°æ® |
| | | "GROUP BY device_ledger_id ") // ææä»½æåºï¼æ¹ä¾¿å端å±ç¤º |
| | | List<RepairAmountGroupDTO> groupByDeviceLedger(@Param("year") String year); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/12/22 14:56 |
| | | */ |
| | | public interface MaintenanceTaskMapper extends BaseMapper<MaintenanceTask> { |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 设å¤å°è´¦å®ä½ç±» |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("device_maintenance") |
| | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»éé¢") |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | @ApiModelProperty("ä¿å
»ä»»å¡id") |
| | | private Long maintenanceTaskId; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡") |
| | | private String frequencyType; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡è¯¦æ
") |
| | | private String frequencyDetail; |
| | | |
| | | @ApiModelProperty(value = "䏿¬¡æ§è¡æ¶é´") |
| | | private LocalDateTime nextExecutionTime; |
| | | |
| | | @ApiModelProperty(value = "æåæ§è¡æ¶é´") |
| | | private LocalDateTime lastExecutionTime; |
| | | |
| | | |
| | | private String deviceName; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 2026-01-27 09:48:09 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("device_maintenance_file") |
| | | @ApiModel(value = "DeviceMaintenanceFile对象", description = "设å¤ä¿å
»è®°å½éä»¶") |
| | | public class DeviceMaintenanceFile implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty("æä»¶å¤§å°") |
| | | private Integer fileSize; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»è®°å½ID") |
| | | private Integer deviceMaintenanceId; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import nonapi.io.github.classgraph.json.Id; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®éé¢") |
| | | private BigDecimal repairPrice; |
| | | |
| | | private String deviceName; |
| | | |
| | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ç»´ä¿® 1å®ç»") |
| | | @ApiModelProperty("ç¶æ 0 å¾
ç»´ä¿® 1å®ç» 2å¾
å®¡æ ¸ 3å®¡æ ¸ä¸éè¿") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å®¡æ ¸äºº") |
| | | private String auditName; |
| | | |
| | | @ApiModelProperty("ç£å人") |
| | | private String supervisoryName; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/19 10:27 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | @TableName("maintenance_task") |
| | | public class MaintenanceTask { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "è§æ ¼åå·") |
| | | private String deviceModel; |
| | | |
| | | /** |
| | | * 主é®ID |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | @Excel(name = "ä¿å
»ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private Long taskId; |
| | | |
| | | @ApiModelProperty(value = "æ¹é设å¤id") |
| | | private String taskIds; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡") |
| | | @Excel(name = "颿¬¡") |
| | | private String frequencyType; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡è¯¦æ
") |
| | | @Excel(name = "å¼å§æ¥æä¸æ¶é´") |
| | | private String frequencyDetail; |
| | | |
| | | @ApiModelProperty(value = "䏿¬¡æ§è¡æ¶é´") |
| | | private LocalDateTime nextExecutionTime; |
| | | |
| | | @ApiModelProperty(value = "æåæ§è¡æ¶é´") |
| | | private LocalDateTime lastExecutionTime; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦æ¿æ´»") |
| | | private boolean isActive; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | @Excel(name = "夿³¨") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥äººid") |
| | | private Long registrantId; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥äºº") |
| | | @Excel(name = "å½å
¥äºº") |
| | | private String registrant; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¥æ") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate registrationDate; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ å¾
å®¡æ ¸ å®¡æ ¸ä¸éè¿ å®¡æ ¸éè¿") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | @Excel(name = "å®¡æ ¸äºº") |
| | | private String auditName; |
| | | |
| | | @ApiModelProperty("ç£å人") |
| | | private String supervisoryName; |
| | | |
| | | @ApiModelProperty(value = "软å 餿 å¿ï¼0=æªå é¤ï¼1=å·²å é¤") |
| | | private Integer deleted; |
| | | |
| | | @TableField(exist = false) |
| | | private String dateStr; |
| | | |
| | | @ApiModelProperty(value = "å建该记å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½å建æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | // @JsonFormat(pattern = "yyyy-MM-dd") |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½æåæ´æ°æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ä¿å
»éä»¶ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-27 09:48:09 |
| | | */ |
| | | public interface DeviceMaintenanceFileService extends IService<DeviceMaintenanceFile> { |
| | | |
| | | } |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | |
| | | public interface IDeviceLedgerService extends IService<DeviceLedger> { |
| | | IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface IDeviceMaintenanceService extends IService<DeviceMaintenance> { |
| | | |
| | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceMaintenanceDto detailById(Long id); |
| | | |
| | | List<DeviceMonthlyRepairTableDTO> getMonthlyRepairAmountByYear(String year); |
| | | |
| | | List<RepairAmountGroupDTO> getRepairAmountByYear(String year); |
| | | } |
| | |
| | | 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.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface IDeviceRepairService extends IService<DeviceRepair> { |
| | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | DeviceRepairDto detailById(Long id); |
| | | |
| | | List<DeviceMonthlyRepairTableDTO> getMonthlyRepairAmountByYear(String year); |
| | | |
| | | List<RepairAmountGroupDTO> getRepairAmountByYear(String year); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/12/22 14:56 |
| | | */ |
| | | public interface MaintenanceTaskService extends IService<MaintenanceTask> { |
| | | AjaxResult listPage(Page page, MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult add(MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.utils.SecurityUtils; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.time.ZoneOffset; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel()); |
| | | if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | | return AjaxResult.error("设å¤åå·å·²åå¨"); |
| | | } |
| | | // LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel()); |
| | | // if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | | // return AjaxResult.error("设å¤åå·å·²åå¨"); |
| | | // } |
| | | boolean save = this.save(deviceLedger); |
| | | if (save){ |
| | | return AjaxResult.success(); |
| | |
| | | ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<DeviceLedgerExeclDto>(DeviceLedgerExeclDto.class); |
| | | List<DeviceLedgerExeclDto> userList = util.importExcel(file.getInputStream()); |
| | | userList.forEach(c -> { |
| | | DeviceLedger deviceLedger = new DeviceLedger(); |
| | | SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser()); |
| | | if (sysUser!=null) { |
| | | deviceLedger.setCreateUser(sysUser.getUserId().intValue()); |
| | | }else { |
| | | deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue()); |
| | | for (Integer i = 0; i < c.getNumber(); i++) { |
| | | DeviceLedger deviceLedger = new DeviceLedger(); |
| | | SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser()); |
| | | if (sysUser!=null) { |
| | | deviceLedger.setCreateUser(sysUser.getUserId().intValue()); |
| | | }else { |
| | | deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue()); |
| | | } |
| | | BeanUtils.copyProperties(c,deviceLedger); |
| | | deviceLedger.setNumber(new BigDecimal(1)); |
| | | deviceLedgerMapper.insert(deviceLedger); |
| | | } |
| | | BeanUtils.copyProperties(c,deviceLedger); |
| | | deviceLedgerMapper.insert(deviceLedger); |
| | | }); |
| | | |
| | | return true; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceFileMapper; |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | import com.ruoyi.device.service.DeviceMaintenanceFileService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 设å¤ä¿å
»éä»¶ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-27 09:48:09 |
| | | */ |
| | | @Service |
| | | public class DeviceMaintenanceFileServiceImpl extends ServiceImpl<DeviceMaintenanceFileMapper, DeviceMaintenanceFile> implements DeviceMaintenanceFileService { |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.execl.DeviceMaintenanceExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceMaintenanceMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | return deviceMaintenanceMapper.detailById(id); |
| | | } |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Override |
| | | public List<DeviceMonthlyRepairTableDTO> getMonthlyRepairAmountByYear(String year) { |
| | | List<RepairAmountGroupDTO> repairAmountGroupDTOS = deviceMaintenanceMapper.groupByMonthAndDeviceLedger(year); |
| | | // 1. å
éè¿è®¾å¤å°è´¦idå
³è设å¤åç§°ï¼å¦æRepairAmountGroupDTO没ædeviceNameï¼éå
æ¥è®¾å¤å°è´¦è¡¨ï¼ |
| | | // è¿éåè®¾ä½ è½éè¿deviceLedgerIdè·åå°deviceNameï¼æ¯å¦ï¼ |
| | | Map<Long, String> deviceNameMap = new HashMap<>(); // key:deviceLedgerId, value:deviceName |
| | | // ï¼å®é
éè°ç¨è®¾å¤å°è´¦çMapperæ¥è¯¢ï¼deviceNameMap = deviceLedgerMapper.listAll().stream().collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName))ï¼ |
| | | deviceNameMap = deviceLedgerMapper.selectList(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName)); |
| | | if(CollectionUtils.isEmpty(deviceNameMap)){ |
| | | return Collections.emptyList(); |
| | | } |
| | | // 2. æè®¾å¤åç§°åç»ï¼å卿¯ä¸ªè®¾å¤çåæéé¢ |
| | | Map<String, DeviceMonthlyRepairTableDTO> deviceTableMap = new HashMap<>(); |
| | | |
| | | for (RepairAmountGroupDTO dto : repairAmountGroupDTOS) { |
| | | // æårepairYearMonth为æä»½ï¼å¦"2025-01" â "01" â 1ï¼ |
| | | String yearMonth = dto.getRepairYearMonth(); // æ ¼å¼ï¼yyyy-MM |
| | | int month = Integer.parseInt(yearMonth); // æåMMå¹¶è½¬ææ°åï¼1-12ï¼ |
| | | |
| | | // è·å设å¤åç§° |
| | | String deviceName = deviceNameMap.get(dto.getDeviceLedgerId()); |
| | | if (deviceName == null) { |
| | | deviceName = "æªç¥è®¾å¤"; // å
åº |
| | | } |
| | | |
| | | // ä»Mapä¸è·å该设å¤çè¡¨æ ¼DTOï¼ä¸åå¨ååå§å |
| | | DeviceMonthlyRepairTableDTO tableDTO = deviceTableMap.getOrDefault(deviceName, new DeviceMonthlyRepairTableDTO()); |
| | | tableDTO.setDeviceName(deviceName); |
| | | |
| | | // æ ¹æ®æä»½å¡«å
éé¢ï¼BigDecimalé»è®¤0ï¼é¿å
nullï¼ |
| | | BigDecimal amount = dto.getTotalRepairPrice() == null ? BigDecimal.ZERO : dto.getTotalRepairPrice(); |
| | | switch (month) { |
| | | case 1: tableDTO.setMonth1(amount); break; |
| | | case 2: tableDTO.setMonth2(amount); break; |
| | | case 3: tableDTO.setMonth3(amount); break; |
| | | case 4: tableDTO.setMonth4(amount); break; |
| | | case 5: tableDTO.setMonth5(amount); break; |
| | | case 6: tableDTO.setMonth6(amount); break; |
| | | case 7: tableDTO.setMonth7(amount); break; |
| | | case 8: tableDTO.setMonth8(amount); break; |
| | | case 9: tableDTO.setMonth9(amount); break; |
| | | case 10: tableDTO.setMonth10(amount); break; |
| | | case 11: tableDTO.setMonth11(amount); break; |
| | | case 12: tableDTO.setMonth12(amount); break; |
| | | } |
| | | |
| | | // éæ°æ¾å
¥Map |
| | | deviceTableMap.put(deviceName, tableDTO); |
| | | } |
| | | |
| | | |
| | | // 3. è®¡ç®æ¯ä¸ªè®¾å¤çæ»è®¡ï¼å¹¶è¡¥å
åºå· |
| | | List<DeviceMonthlyRepairTableDTO> resultList = new ArrayList<>(); |
| | | for (DeviceMonthlyRepairTableDTO tableDTO : deviceTableMap.values()) { |
| | | // è®¡ç®æ»è®¡ï¼1-12æéé¢ç¸å |
| | | BigDecimal total = Stream.of( |
| | | tableDTO.getMonth1(), tableDTO.getMonth2(), tableDTO.getMonth3(), |
| | | tableDTO.getMonth4(), tableDTO.getMonth5(), tableDTO.getMonth6(), |
| | | tableDTO.getMonth7(), tableDTO.getMonth8(), tableDTO.getMonth9(), |
| | | tableDTO.getMonth10(), tableDTO.getMonth11(), tableDTO.getMonth12() |
| | | ) |
| | | .map(amt -> amt == null ? BigDecimal.ZERO : amt) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tableDTO.setTotal(total); |
| | | resultList.add(tableDTO); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public List<RepairAmountGroupDTO> getRepairAmountByYear(String year) { |
| | | List<RepairAmountGroupDTO> repairAmountGroupDTOS = deviceMaintenanceMapper.groupByDeviceLedger(year); |
| | | Map<Long, String> deviceNameMap = new HashMap<>(); // key:deviceLedgerId, value:deviceName |
| | | // ï¼å®é
éè°ç¨è®¾å¤å°è´¦çMapperæ¥è¯¢ï¼deviceNameMap = deviceLedgerMapper.listAll().stream().collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName))ï¼ |
| | | deviceNameMap = deviceLedgerMapper.selectList(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName)); |
| | | if(CollectionUtils.isEmpty(deviceNameMap)){ |
| | | return Collections.emptyList(); |
| | | } |
| | | Map<Long, String> finalDeviceNameMap = deviceNameMap; |
| | | repairAmountGroupDTOS.forEach(dto -> { |
| | | dto.setDeviceName(finalDeviceNameMap.get(dto.getDeviceLedgerId())); |
| | | }); |
| | | return repairAmountGroupDTOS; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceDefectRecordDto; |
| | | import com.ruoyi.device.dto.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.execl.DeviceRepairExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceDefectRecordMapper; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceRepair.getDeviceLedgerId()); |
| | | deviceRepair.setDeviceName(byId.getDeviceName()); |
| | | deviceRepair.setDeviceModel(byId.getDeviceModel()); |
| | | deviceRepair.setStatus(2); |
| | | boolean save = this.save(deviceRepair); |
| | | if (save){ |
| | | return AjaxResult.success(); |
| | |
| | | return deviceRepairMapper.detailById(id); |
| | | } |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Override |
| | | public List<DeviceMonthlyRepairTableDTO> getMonthlyRepairAmountByYear(String year) { |
| | | List<RepairAmountGroupDTO> repairAmountGroupDTOS = deviceRepairMapper.groupByMonthAndDeviceLedger(year); |
| | | // 1. å
éè¿è®¾å¤å°è´¦idå
³è设å¤åç§°ï¼å¦æRepairAmountGroupDTO没ædeviceNameï¼éå
æ¥è®¾å¤å°è´¦è¡¨ï¼ |
| | | // è¿éåè®¾ä½ è½éè¿deviceLedgerIdè·åå°deviceNameï¼æ¯å¦ï¼ |
| | | Map<Long, String> deviceNameMap = new HashMap<>(); // key:deviceLedgerId, value:deviceName |
| | | // ï¼å®é
éè°ç¨è®¾å¤å°è´¦çMapperæ¥è¯¢ï¼deviceNameMap = deviceLedgerMapper.listAll().stream().collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName))ï¼ |
| | | deviceNameMap = deviceLedgerMapper.selectList(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName)); |
| | | if(CollectionUtils.isEmpty(deviceNameMap)){ |
| | | return Collections.emptyList(); |
| | | } |
| | | // 2. æè®¾å¤åç§°åç»ï¼å卿¯ä¸ªè®¾å¤çåæéé¢ |
| | | Map<String, DeviceMonthlyRepairTableDTO> deviceTableMap = new HashMap<>(); |
| | | |
| | | for (RepairAmountGroupDTO dto : repairAmountGroupDTOS) { |
| | | // æårepairYearMonth为æä»½ï¼å¦"2025-01" â "01" â 1ï¼ |
| | | String yearMonth = dto.getRepairYearMonth(); // æ ¼å¼ï¼yyyy-MM |
| | | int month = Integer.parseInt(yearMonth); // æåMMå¹¶è½¬ææ°åï¼1-12ï¼ |
| | | |
| | | // è·å设å¤åç§° |
| | | String deviceName = deviceNameMap.get(dto.getDeviceLedgerId()); |
| | | if (deviceName == null) { |
| | | deviceName = "æªç¥è®¾å¤"; // å
åº |
| | | } |
| | | |
| | | // ä»Mapä¸è·å该设å¤çè¡¨æ ¼DTOï¼ä¸åå¨ååå§å |
| | | DeviceMonthlyRepairTableDTO tableDTO = deviceTableMap.getOrDefault(deviceName, new DeviceMonthlyRepairTableDTO()); |
| | | tableDTO.setDeviceName(deviceName); |
| | | |
| | | // æ ¹æ®æä»½å¡«å
éé¢ï¼BigDecimalé»è®¤0ï¼é¿å
nullï¼ |
| | | BigDecimal amount = dto.getTotalRepairPrice() == null ? BigDecimal.ZERO : dto.getTotalRepairPrice(); |
| | | switch (month) { |
| | | case 1: tableDTO.setMonth1(amount); break; |
| | | case 2: tableDTO.setMonth2(amount); break; |
| | | case 3: tableDTO.setMonth3(amount); break; |
| | | case 4: tableDTO.setMonth4(amount); break; |
| | | case 5: tableDTO.setMonth5(amount); break; |
| | | case 6: tableDTO.setMonth6(amount); break; |
| | | case 7: tableDTO.setMonth7(amount); break; |
| | | case 8: tableDTO.setMonth8(amount); break; |
| | | case 9: tableDTO.setMonth9(amount); break; |
| | | case 10: tableDTO.setMonth10(amount); break; |
| | | case 11: tableDTO.setMonth11(amount); break; |
| | | case 12: tableDTO.setMonth12(amount); break; |
| | | } |
| | | |
| | | // éæ°æ¾å
¥Map |
| | | deviceTableMap.put(deviceName, tableDTO); |
| | | } |
| | | |
| | | |
| | | // 3. è®¡ç®æ¯ä¸ªè®¾å¤çæ»è®¡ï¼å¹¶è¡¥å
åºå· |
| | | List<DeviceMonthlyRepairTableDTO> resultList = new ArrayList<>(); |
| | | for (DeviceMonthlyRepairTableDTO tableDTO : deviceTableMap.values()) { |
| | | // è®¡ç®æ»è®¡ï¼1-12æéé¢ç¸å |
| | | BigDecimal total = Stream.of( |
| | | tableDTO.getMonth1(), tableDTO.getMonth2(), tableDTO.getMonth3(), |
| | | tableDTO.getMonth4(), tableDTO.getMonth5(), tableDTO.getMonth6(), |
| | | tableDTO.getMonth7(), tableDTO.getMonth8(), tableDTO.getMonth9(), |
| | | tableDTO.getMonth10(), tableDTO.getMonth11(), tableDTO.getMonth12() |
| | | ) |
| | | .map(amt -> amt == null ? BigDecimal.ZERO : amt) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tableDTO.setTotal(total); |
| | | resultList.add(tableDTO); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public List<RepairAmountGroupDTO> getRepairAmountByYear(String year) { |
| | | List<RepairAmountGroupDTO> repairAmountGroupDTOS = deviceRepairMapper.groupByDeviceLedger(year); |
| | | Map<Long, String> deviceNameMap = new HashMap<>(); // key:deviceLedgerId, value:deviceName |
| | | // ï¼å®é
éè°ç¨è®¾å¤å°è´¦çMapperæ¥è¯¢ï¼deviceNameMap = deviceLedgerMapper.listAll().stream().collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName))ï¼ |
| | | deviceNameMap = deviceLedgerMapper.selectList(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(DeviceLedger::getId, DeviceLedger::getDeviceName)); |
| | | if(CollectionUtils.isEmpty(deviceNameMap)){ |
| | | return Collections.emptyList(); |
| | | } |
| | | Map<Long, String> finalDeviceNameMap = deviceNameMap; |
| | | repairAmountGroupDTOS.forEach(dto -> { |
| | | dto.setDeviceName(finalDeviceNameMap.get(dto.getDeviceLedgerId())); |
| | | }); |
| | | return repairAmountGroupDTOS; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import org.quartz.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.YearMonth; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Component |
| | | @DisallowConcurrentExecution // ç¦æ¢å¹¶åæ§è¡åä¸ä¸ªJob |
| | | public class MaintenanceTaskJob implements Job, Serializable { |
| | | private static final long serialVersionUID = 1L; // å¿
é¡»å®ä¹åºååID |
| | | |
| | | @Autowired |
| | | private DeviceMaintenanceServiceImpl deviceMaintenanceService; |
| | | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | | JobDataMap jobDataMap = context.getJobDetail().getJobDataMap(); |
| | | // ä¿®å¤ç±»å转æ¢éè¯¯ï¼æ£ç¡®è·åtaskId |
| | | Long taskId = jobDataMap.getLong("maintenanceTaskId"); |
| | | |
| | | try { |
| | | // 3. å°è¯æ¥è¯¢ä½ çä¸å¡æ°æ® |
| | | // éè¿JDBCæ¨¡æ¿æ¥è¯¢å®æ¶ä»»å¡ä¿¡æ¯ï¼ä½¿ç¨åæ°åæ¥è¯¢é²æ¢SQL注å
¥ |
| | | String yourSql = "SELECT * FROM maintenance_task where id = ? and status = 'å®¡æ ¸éè¿'"; |
| | | List<MaintenanceTask> tasks = jdbcTemplate.query( |
| | | yourSql, |
| | | new BeanPropertyRowMapper<>(MaintenanceTask.class), |
| | | taskId |
| | | ); |
| | | MaintenanceTask timingTask = tasks.isEmpty() ? null : tasks.get(0); |
| | | if (timingTask == null) { |
| | | throw new JobExecutionException("MaintenanceTaskJobæ¾ä¸å°å®æ¶ä»»å¡: " + taskId); |
| | | } |
| | | |
| | | // 2. å建并ä¿åå·¡æ£ä»»å¡è®°å½ - è¿å°±æ¯æ¨æä¾ç代ç åºè¯¥æ¾çä½ç½® |
| | | List<DeviceMaintenance> deviceMaintenance = createInspectionTask(timingTask); |
| | | deviceMaintenanceService.saveBatch(deviceMaintenance); |
| | | |
| | | // 3. æ´æ°å®æ¶ä»»å¡çæ§è¡æ¶é´ |
| | | if (!tasks.isEmpty()) { |
| | | MaintenanceTask task = tasks.get(0); |
| | | |
| | | // æ´æ°æåæ§è¡æ¶é´ä¸ºå½åæ¶é´ |
| | | LocalDateTime lastExecutionTime = LocalDateTime.now(); |
| | | |
| | | // 计ç®ä¸æ¬¡æ§è¡æ¶é´ |
| | | LocalDateTime nextExecutionTime = calculateNextExecutionTime( |
| | | task.getFrequencyType(), |
| | | task.getFrequencyDetail(), |
| | | lastExecutionTime |
| | | ); |
| | | |
| | | // æ§è¡æ´æ°æä½ |
| | | String updateSql = "UPDATE maintenance_task " + |
| | | "SET last_execution_time = ?, next_execution_time = ? " + |
| | | "WHERE id = ?"; |
| | | |
| | | jdbcTemplate.update( |
| | | updateSql, |
| | | lastExecutionTime, |
| | | nextExecutionTime, |
| | | taskId |
| | | ); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new JobExecutionException(e); |
| | | } |
| | | } |
| | | |
| | | // è¿å°±æ¯æ¨æä¾ç代ç å°è£
æçæ¹æ³ |
| | | private List<DeviceMaintenance> createInspectionTask(MaintenanceTask timingTask) { |
| | | List<DeviceMaintenance> inspectionTasks = new java.util.ArrayList<>(); |
| | | String[] split = timingTask.getTaskIds().split(","); |
| | | String[] split1 = timingTask.getTaskName().split(","); |
| | | String[] split2 = timingTask.getDeviceModel().split(","); |
| | | int i = 0; |
| | | for (String s : split) { |
| | | DeviceMaintenance inspectionTask = new DeviceMaintenance(); |
| | | // å¤å¶åºæ¬å±æ§ |
| | | inspectionTask.setDeviceName(split1[i]); |
| | | inspectionTask.setMaintenanceTaskId(timingTask.getId()); |
| | | inspectionTask.setDeviceLedgerId(Long.parseLong(s)); |
| | | inspectionTask.setMaintenancePlanTime(LocalDateTime.now()); |
| | | inspectionTask.setFrequencyType(timingTask.getFrequencyType()); |
| | | inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail()); |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | inspectionTask.setStatus(0); |
| | | inspectionTask.setDeviceModel(split2[i]); |
| | | inspectionTask.setCreateUser(Integer.parseInt(timingTask.getRegistrantId().toString())); |
| | | inspectionTask.setUpdateTime(LocalDateTime.now()); |
| | | inspectionTask.setCreateTime(LocalDateTime.now()); |
| | | inspectionTask.setUpdateUser(Integer.parseInt(timingTask.getRegistrantId().toString())); |
| | | i++; |
| | | inspectionTasks.add(inspectionTask); |
| | | } |
| | | |
| | | return inspectionTasks; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计ç®ä¸æ¬¡æ§è¡æ¶é´ |
| | | */ |
| | | private LocalDateTime calculateNextExecutionTime(String frequencyType, |
| | | String frequencyDetail, |
| | | LocalDateTime currentTime) { |
| | | try { |
| | | switch (frequencyType) { |
| | | case "DAILY": |
| | | return calculateDailyNextTime(frequencyDetail, currentTime); |
| | | case "WEEKLY": |
| | | return calculateWeeklyNextTime(frequencyDetail, currentTime); |
| | | case "MONTHLY": |
| | | return calculateMonthlyNextTime(frequencyDetail, currentTime); |
| | | case "QUARTERLY": |
| | | return calculateQuarterlyNextTime(frequencyDetail, currentTime); |
| | | default: |
| | | throw new IllegalArgumentException("䏿¯æçé¢çç±»å: " + frequencyType); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("计ç®ä¸æ¬¡æ§è¡æ¶é´å¤±è´¥: " + e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¯æ¥ä»»å¡ç䏿¬¡æ§è¡æ¶é´ |
| | | */ |
| | | private LocalDateTime calculateDailyNextTime(String timeStr, LocalDateTime current) { |
| | | LocalTime executionTime = LocalTime.parse(timeStr); // è§£ææ ¼å¼ "HH:mm" |
| | | LocalDateTime nextTime = LocalDateTime.of(current.toLocalDate(), executionTime); |
| | | |
| | | // 妿ä»å¤©çæ¶é´å·²è¿ï¼å宿æå¤© |
| | | return current.isBefore(nextTime) ? nextTime : nextTime.plusDays(1); |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¯å¨ä»»å¡ç䏿¬¡æ§è¡æ¶é´ |
| | | */ |
| | | private LocalDateTime calculateWeeklyNextTime(String detail, LocalDateTime current) { |
| | | String[] parts = detail.split(","); |
| | | String dayOfWeekStr = parts[0]; // å¦ "MON" æ "MON|WED|FRI" |
| | | LocalTime time = LocalTime.parse(parts[1]); // æ¶é´é¨å |
| | | |
| | | // è§£æææå (æ¯æå¤ä¸ªææ) |
| | | Set<DayOfWeek> targetDays = parseDayOfWeeks(dayOfWeekStr); |
| | | |
| | | // ä»å½åæ¶é´å¼å§æ¾ä¸ä¸ä¸ªç¬¦åæ¡ä»¶çææå |
| | | LocalDateTime nextTime = current; |
| | | while (true) { |
| | | nextTime = nextTime.plusDays(1); |
| | | if (targetDays.contains(nextTime.getDayOfWeek())) { |
| | | return LocalDateTime.of(nextTime.toLocalDate(), time); |
| | | } |
| | | |
| | | // 鲿¢æ é循ç¯(ç论ä¸ä¸ä¼åç) |
| | | if (nextTime.isAfter(current.plusYears(1))) { |
| | | throw new RuntimeException("æ æ³æ¾å°ä¸æ¬¡æ§è¡æ¶é´"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¯æä»»å¡ç䏿¬¡æ§è¡æ¶é´ |
| | | */ |
| | | private LocalDateTime calculateMonthlyNextTime(String detail, LocalDateTime current) { |
| | | String[] parts = detail.split(","); |
| | | int dayOfMonth = Integer.parseInt(parts[0]); |
| | | LocalTime time = LocalTime.parse(parts[1]); |
| | | |
| | | // ä»ä¸ä¸ªæå¼å§è®¡ç® |
| | | LocalDateTime nextTime = current.plusMonths(1) |
| | | .withDayOfMonth(Math.min(dayOfMonth, current.plusMonths(1).toLocalDate().lengthOfMonth())) |
| | | .with(time); |
| | | |
| | | return nextTime; |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¯å£åº¦ä»»å¡ç䏿¬¡æ§è¡æ¶é´ |
| | | */ |
| | | private LocalDateTime calculateQuarterlyNextTime(String detail, LocalDateTime current) { |
| | | String[] parts = detail.split(","); |
| | | int quarterMonth = Integer.parseInt(parts[0]); // 1=第1个æï¼2=第2个æï¼3=第3个æ |
| | | int dayOfMonth = Integer.parseInt(parts[1]); |
| | | LocalTime time = LocalTime.parse(parts[2]); |
| | | |
| | | // 计ç®å½åå£åº¦ |
| | | int currentQuarter = (current.getMonthValue() - 1) / 3 + 1; |
| | | int currentMonthInQuarter = (current.getMonthValue() - 1) % 3 + 1; |
| | | |
| | | YearMonth targetYearMonth; |
| | | if (currentMonthInQuarter < quarterMonth) { |
| | | // æ¬å£åº¦å
è¿ææ§è¡æºä¼ |
| | | targetYearMonth = YearMonth.from(current) |
| | | .plusMonths(quarterMonth - currentMonthInQuarter); |
| | | } else { |
| | | // éè¦å°ä¸ä¸ªå£åº¦ |
| | | targetYearMonth = YearMonth.from(current) |
| | | .plusMonths(3 - currentMonthInQuarter + quarterMonth); |
| | | } |
| | | |
| | | // å¤çææ«æ¥æ |
| | | int adjustedDay = Math.min(dayOfMonth, targetYearMonth.lengthOfMonth()); |
| | | |
| | | return LocalDateTime.of( |
| | | targetYearMonth.getYear(), |
| | | targetYearMonth.getMonthValue(), |
| | | adjustedDay, |
| | | time.getHour(), |
| | | time.getMinute() |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * è§£æææå å符串 |
| | | */ |
| | | private Set<DayOfWeek> parseDayOfWeeks(String dayOfWeekStr) { |
| | | Set<DayOfWeek> days = new HashSet<>(); |
| | | String[] dayStrs = dayOfWeekStr.split("\\|"); |
| | | |
| | | for (String dayStr : dayStrs) { |
| | | switch (dayStr) { |
| | | case "MON": days.add(DayOfWeek.MONDAY); break; |
| | | case "TUE": days.add(DayOfWeek.TUESDAY); break; |
| | | case "WED": days.add(DayOfWeek.WEDNESDAY); break; |
| | | case "THU": days.add(DayOfWeek.THURSDAY); break; |
| | | case "FRI": days.add(DayOfWeek.FRIDAY); break; |
| | | case "SAT": days.add(DayOfWeek.SATURDAY); break; |
| | | case "SUN": days.add(DayOfWeek.SUNDAY); break; |
| | | default: throw new IllegalArgumentException("æ æçææå : " + dayStr); |
| | | } |
| | | } |
| | | |
| | | return days; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.quartz.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/12/22 15:16 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class MaintenanceTaskScheduler { |
| | | |
| | | @Autowired |
| | | private Scheduler scheduler; |
| | | |
| | | /** |
| | | * æ·»å æ°ä»»å¡å°è°åº¦å¨ |
| | | */ |
| | | public void scheduleMaintenanceTask(MaintenanceTask task){ |
| | | try { |
| | | JobDetail jobDetail = buildJobDetail(task); |
| | | Trigger trigger = buildJobTrigger(task, jobDetail); |
| | | scheduler.scheduleJob(jobDetail, trigger); |
| | | }catch (SchedulerException e){ |
| | | log.error("SchedulerException scheduleMaintenanceTask ERROR",e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°å·²æä»»å¡ |
| | | */ |
| | | public void rescheduleMaintenanceTask(MaintenanceTask task){ |
| | | try{ |
| | | TriggerKey triggerKey = new TriggerKey("triggerMaintenanceTask_" + task.getId()); |
| | | |
| | | // è·åç°æè§¦åå¨å¹¶è½¬æ¢ä¸º CronTrigger |
| | | Trigger oldTrigger = scheduler.getTrigger(triggerKey); |
| | | if (!(oldTrigger instanceof CronTrigger)) { |
| | | throw new SchedulerException("Existing trigger is not a CronTrigger"); |
| | | } |
| | | |
| | | // 3. æå»ºCronTriggerï¼ç¡®ä¿æä¹
åé
ç½® |
| | | CronTrigger newTrigger = TriggerBuilder.newTrigger() |
| | | .withIdentity(triggerKey) // å¯ä¸æ è¯ï¼ç¨äºæä¹
ååå¨ |
| | | .withDescription(task.getTaskName() + "_TRIGGER") // 触åå¨æè¿° |
| | | .forJob(oldTrigger.getJobKey()) // å
³è对åºçJob |
| | | .withSchedule(CronScheduleBuilder |
| | | .cronSchedule(convertToCronExpression(task)) // éè¿æ§è¡æ¶ççç¥ï¼æ ¹æ®ä¸å¡è°æ´ï¼ |
| | | ) |
| | | // 4. 设置å¼å§æ¶é´ï¼è¥ä¸ºnullåç«å³çæï¼ |
| | | .startAt(task.getNextExecutionTime() != null |
| | | ? Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant()) |
| | | : new Date()) |
| | | .build(); |
| | | scheduler.rescheduleJob(triggerKey, newTrigger); |
| | | }catch (SchedulerException e){ |
| | | log.error("SchedulerException rescheduleMaintenanceTask ERROR",e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æåä»»å¡ |
| | | */ |
| | | public void pauseMaintenanceTask(Long taskId) throws SchedulerException { |
| | | JobKey jobKey = new JobKey("MaintenanceTask_" + taskId); |
| | | scheduler.pauseJob(jobKey); |
| | | } |
| | | |
| | | /** |
| | | * æ¢å¤ä»»å¡ |
| | | */ |
| | | public void resumeMaintenanceTask(Long taskId) throws SchedulerException { |
| | | JobKey jobKey = new JobKey("MaintenanceTask_" + taskId); |
| | | scheduler.resumeJob(jobKey); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä»»å¡ |
| | | */ |
| | | public void unscheduleMaintenanceTask(Long taskId){ |
| | | try { |
| | | JobKey jobKey = new JobKey("MaintenanceTask_" + taskId); |
| | | scheduler.deleteJob(jobKey); |
| | | }catch (SchedulerException e){ |
| | | log.error("SchedulerException unscheduleMaintenanceTask ERROR",e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | private JobDetail buildJobDetail(MaintenanceTask task) { |
| | | // 1. æå»ºå¯ä¸JobKeyï¼åºäºä»»å¡IDï¼ç¡®ä¿éå¯åè½è¯å«ï¼ |
| | | JobKey jobKey = new JobKey("MaintenanceTask_" + task.getId()); |
| | | |
| | | // 2. å°è£
任塿°æ®ï¼ä»
使ç¨åºæ¬ç±»åï¼ç¡®ä¿å¯åºååï¼ |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("maintenanceTaskId", task.getId()); // ä»»å¡IDï¼Longï¼å¯åºååï¼ |
| | | jobDataMap.put("taskName", task.getTaskName()); // ä»»å¡åç§°ï¼Stringï¼å¯åºååï¼ |
| | | jobDataMap.put("taskType", task.getFrequencyType()); // ä»»å¡ç±»åï¼Stringï¼ |
| | | // æéæ·»å å
¶ä»å¿
è¦çåºæ¬ç±»ååæ° |
| | | |
| | | // 3. æå»ºJobDetailï¼è®¾ç½®æä¹
åç¸å
³å±æ§ |
| | | return JobBuilder.newJob(MaintenanceTaskJob.class) |
| | | .withIdentity(jobKey) // å¯ä¸æ è¯ï¼ç¨äºæä¹
ååå¨ |
| | | .withDescription(task.getTaskName()) // ä»»å¡æè¿°ï¼åå
¥æ°æ®åº |
| | | .usingJobData(jobDataMap) // ç»å®ä»»å¡æ°æ® |
| | | .storeDurably(true) // å³ä½¿æ²¡æè§¦åå¨å
³è乿ä¹
åä¿å |
| | | .requestRecovery(true) // å½è°åº¦å¨å´©æºåæ¢å¤æ¶ï¼éæ°æ§è¡æªå®æçä»»å¡ |
| | | .build(); |
| | | } |
| | | |
| | | private Trigger buildJobTrigger(MaintenanceTask task, JobDetail jobDetail) { |
| | | // 1. æå»ºå¯ä¸TriggerKeyï¼åºäºä»»å¡IDï¼ |
| | | TriggerKey triggerKey = new TriggerKey("triggerMaintenanceTask_" + task.getId()); |
| | | |
| | | // 2. çæCron表达å¼ï¼åé»è¾ä¸åï¼ |
| | | String cronExpression = convertToCronExpression(task); |
| | | |
| | | // 3. æå»ºCronTriggerï¼ç¡®ä¿æä¹
åé
ç½® |
| | | return TriggerBuilder.newTrigger() |
| | | .withIdentity(triggerKey) // å¯ä¸æ è¯ï¼ç¨äºæä¹
ååå¨ |
| | | .withDescription(task.getTaskName() + "_TRIGGER") // 触åå¨æè¿° |
| | | .forJob(jobDetail) // å
³è对åºçJob |
| | | .withSchedule(CronScheduleBuilder |
| | | .cronSchedule(cronExpression) |
| | | .withMisfireHandlingInstructionDoNothing() // éè¿æ§è¡æ¶ççç¥ï¼æ ¹æ®ä¸å¡è°æ´ï¼ |
| | | ) |
| | | // 4. 设置å¼å§æ¶é´ï¼è¥ä¸ºnullåç«å³çæï¼ |
| | | .startAt(task.getNextExecutionTime() != null |
| | | ? Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant()) |
| | | : new Date()) |
| | | .build(); |
| | | } |
| | | private String convertToCronExpression(MaintenanceTask task) { |
| | | // åæ°æ ¡éª |
| | | if (task == null || task.getFrequencyType() == null || task.getFrequencyDetail() == null) { |
| | | throw new IllegalArgumentException("ä»»å¡åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // 使ç¨switchç¡®ä¿æ¡ä»¶äºæ¥ |
| | | String frequencyType = task.getFrequencyType().toUpperCase(); // ç»ä¸è½¬ä¸ºå¤§åæ¯è¾ |
| | | switch (frequencyType) { |
| | | case "DAILY": |
| | | return convertDailyToCron(task.getFrequencyDetail()); |
| | | case "WEEKLY": |
| | | return convertWeeklyToCron(task.getFrequencyDetail()); |
| | | case "MONTHLY": |
| | | return convertMonthlyToCron(task.getFrequencyDetail()); |
| | | case "QUARTERLY": |
| | | return convertQuarterlyToCron(task.getFrequencyDetail()); |
| | | default: |
| | | throw new IllegalArgumentException("䏿¯æçé¢çç±»å: " + task.getFrequencyType()); |
| | | } |
| | | } |
| | | |
| | | // æ¯æ¥ä»»å¡è½¬æ¢ |
| | | private String convertDailyToCron(String frequencyDetail) { |
| | | LocalTime time = parseTime(frequencyDetail); |
| | | return String.format("0 %d %d * * ?", time.getMinute(), time.getHour()); |
| | | } |
| | | |
| | | // æ¯å¨ä»»å¡è½¬æ¢ |
| | | private String convertWeeklyToCron(String frequencyDetail) { |
| | | String[] parts = validateAndSplit(frequencyDetail, ",", 2); |
| | | String daysOfWeek = convertDayNamesToCron(parts[0]); |
| | | LocalTime time = parseTime(parts[1]); |
| | | return String.format("0 %d %d ? * %s", time.getMinute(), time.getHour(), daysOfWeek); |
| | | } |
| | | |
| | | // æ¯æä»»å¡è½¬æ¢ |
| | | private String convertMonthlyToCron(String frequencyDetail) { |
| | | String[] parts = validateAndSplit(frequencyDetail, ",", 2); |
| | | int day = validateDayOfMonth(parts[0]); |
| | | LocalTime time = parseTime(parts[1]); |
| | | return String.format("0 %d %d %d * ?", time.getMinute(), time.getHour(), day); |
| | | } |
| | | |
| | | // æ¯å£åº¦ä»»å¡è½¬æ¢ |
| | | private String convertQuarterlyToCron(String frequencyDetail) { |
| | | String[] parts = validateAndSplit(frequencyDetail, ",", 3); |
| | | int month = validateMonth(parts[0]); // éªè¯æä»½(1-12) |
| | | int day = validateDayOfMonth(parts[1]); // éªè¯æ¥æ |
| | | LocalTime time = parseTime(parts[2]); // è§£ææ¶é´ |
| | | |
| | | // 计ç®å£åº¦èµ·å§æä»½(1æ=1, 4æ=4, 7æ=7, 10æ=10) |
| | | int quarterStartMonth = ((month - 1) / 3) * 3 + 1; |
| | | |
| | | return String.format("0 %d %d %d %d/3 ?", |
| | | time.getMinute(), |
| | | time.getHour(), |
| | | day, |
| | | quarterStartMonth); |
| | | } |
| | | |
| | | // æ°å¢éªè¯æä»½çæ¹æ³(1-12) |
| | | private int validateMonth(String monthStr) { |
| | | try { |
| | | int month = Integer.parseInt(monthStr); |
| | | if (month < 1 || month > 12) { |
| | | throw new IllegalArgumentException("æä»½å¿
é¡»å¨1-12ä¹é´"); |
| | | } |
| | | return month; |
| | | } catch (NumberFormatException e) { |
| | | throw new IllegalArgumentException("æ æçæä»½æ ¼å¼"); |
| | | } |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼è§£ææ¶é´ |
| | | private LocalTime parseTime(String timeStr) { |
| | | try { |
| | | return LocalTime.parse(timeStr); |
| | | } catch (DateTimeParseException e) { |
| | | throw new IllegalArgumentException("æ¶é´æ ¼å¼å¿
须为HH:mm", e); |
| | | } |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼éªè¯å¹¶åå²å符串 |
| | | private String[] validateAndSplit(String input, String delimiter, int expectedParts) { |
| | | String[] parts = input.split(delimiter); |
| | | if (parts.length != expectedParts) { |
| | | throw new IllegalArgumentException( |
| | | String.format("æ ¼å¼é误ï¼åºä¸º%dé¨åç¨'%s'åé", expectedParts, delimiter)); |
| | | } |
| | | return parts; |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼éªè¯æä»½ä¸çæ¥ |
| | | private int validateDayOfMonth(String dayStr) { |
| | | int day = Integer.parseInt(dayStr); |
| | | if (day < 1 || day > 31) { |
| | | throw new IllegalArgumentException("æ¥æå¿
é¡»å¨1-31ä¹é´"); |
| | | } |
| | | return day; |
| | | } |
| | | |
| | | // è¾
婿¹æ³ï¼éªè¯å£åº¦ä¸çæ |
| | | private int validateMonthInQuarter(String monthStr) { |
| | | int month = Integer.parseInt(monthStr); |
| | | if (month < 1 || month > 3) { |
| | | throw new IllegalArgumentException("å£åº¦æä»½å¿
é¡»æ¯1ã2æ3"); |
| | | } |
| | | return month; |
| | | } |
| | | |
| | | // è½¬æ¢ææå åç§° |
| | | private String convertDayNamesToCron(String dayNames) { |
| | | return Arrays.stream(dayNames.split("\\|")) |
| | | .map(this::convertSingleDayName) |
| | | .collect(Collectors.joining(",")); |
| | | } |
| | | |
| | | // 转æ¢å个ææå åç§° |
| | | private String convertSingleDayName(String dayName) { |
| | | switch (dayName.toUpperCase()) { |
| | | case "MON": return "MON"; |
| | | case "TUE": return "TUE"; |
| | | case "WED": return "WED"; |
| | | case "THU": return "THU"; |
| | | case "FRI": return "FRI"; |
| | | case "SAT": return "SAT"; |
| | | case "SUN": return "SUN"; |
| | | default: throw new IllegalArgumentException("æ æçææå : " + dayName); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.device.mapper.MaintenanceTaskMapper; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.device.service.MaintenanceTaskService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inspectiontask.pojo.TimingTask; |
| | | import com.ruoyi.inspectiontask.service.impl.TimingTaskServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/12/22 14:57 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class MaintenanceTaskServiceImpl extends ServiceImpl<MaintenanceTaskMapper, MaintenanceTask> implements MaintenanceTaskService { |
| | | |
| | | @Autowired |
| | | private MaintenanceTaskMapper maintenanceTaskMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private TimingTaskServiceImpl timingTaskService; |
| | | |
| | | @Autowired |
| | | private MaintenanceTaskScheduler maintenanceTaskScheduler; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, null); |
| | | // 2. å¦ææ²¡ææ°æ®ï¼ç´æ¥è¿å空å页 |
| | | if (taskPage.getRecords().isEmpty()) { |
| | | return AjaxResult.success(taskPage); |
| | | } |
| | | |
| | | // 3. æ¶éææéè¦æ¥è¯¢çç¨æ·ID |
| | | Set<Long> userIds = new HashSet<>(); |
| | | |
| | | // æ¶éç»è®°äººID |
| | | taskPage.getRecords().forEach(task -> { |
| | | if (task.getRegistrantId() != null) { |
| | | userIds.add(task.getRegistrantId()); |
| | | } |
| | | }); |
| | | |
| | | // 4. æ¹éæ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | Map<Long, String> userNickNameMap = new HashMap<>(); |
| | | if (!userIds.isEmpty()) { |
| | | List<SysUser> users = sysUserMapper.selectUserByIds((new ArrayList<>(userIds))); |
| | | users.forEach(user -> userNickNameMap.put(user.getUserId(), user.getNickName())); |
| | | } |
| | | taskPage.getRecords().forEach(task -> { |
| | | // 设置ç»è®°äººæµç§° |
| | | if (task.getRegistrantId() != null) { |
| | | task.setRegistrant(userNickNameMap.getOrDefault(task.getRegistrantId(), "æªç¥ç¨æ·")); |
| | | } |
| | | }); |
| | | return AjaxResult.success(taskPage); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(MaintenanceTask maintenanceTask) { |
| | | if(StringUtils.isEmpty(maintenanceTask.getAuditName())) { |
| | | return AjaxResult.warn("请填åå®¡æ ¸äºº"); |
| | | } |
| | | maintenanceTask.setActive(true); |
| | | // 计ç®é¦æ¬¡æ§è¡æ¶é´ |
| | | TimingTask task = new TimingTask(); |
| | | task.setFrequencyType(maintenanceTask.getFrequencyType()); |
| | | task.setFrequencyDetail(maintenanceTask.getFrequencyDetail()); |
| | | LocalDateTime firstExecutionTime = timingTaskService.calculateFirstExecutionTime(task); |
| | | maintenanceTask.setNextExecutionTime(firstExecutionTime); |
| | | maintenanceTask.setStatus("å¾
å®¡æ ¸"); |
| | | int insert = maintenanceTaskMapper.insert(maintenanceTask); |
| | | if (insert > 0) { |
| | | maintenanceTaskScheduler.scheduleMaintenanceTask(maintenanceTask); |
| | | } |
| | | return AjaxResult.success("æ·»å æå"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | MaintenanceTask maintenanceTask1 = maintenanceTaskMapper.selectById(maintenanceTask.getId()); |
| | | if (maintenanceTask1 == null) { |
| | | return AjaxResult.warn("æ²¡ææ¤æ°æ®"); |
| | | } |
| | | BeanUtils.copyProperties(maintenanceTask, maintenanceTask1); |
| | | int update = maintenanceTaskMapper.updateById(maintenanceTask1); |
| | | if (update > 0) { |
| | | maintenanceTaskScheduler.rescheduleMaintenanceTask(maintenanceTask1); |
| | | } |
| | | return AjaxResult.success("æ´æ°æå"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | int delete = maintenanceTaskMapper.deleteBatchIds(ids); |
| | | if (delete > 0) { |
| | | ids.forEach(id -> { |
| | | maintenanceTaskScheduler.unscheduleMaintenanceTask(id); |
| | | }); |
| | | } |
| | | return AjaxResult.success("å 餿å"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.inspectiontask.dto.InspectionTaskDto; |
| | | import com.ruoyi.inspectiontask.dto.TimingTaskDto; |
| | | import com.ruoyi.inspectiontask.pojo.InspectionTask; |
| | | import com.ruoyi.inspectiontask.service.InspectionTaskService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @PostMapping("/addOrEditInspectionTask") |
| | | @ApiOperation("å·¡æ£ä»»å¡è¡¨æ°å¢ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addOrEditInspectionTask(@RequestBody InspectionTaskDto inspectionTaskDto) { |
| | | public R addOrEditInspectionTask(@RequestBody InspectionTaskDto inspectionTaskDto) throws IOException { |
| | | return R.ok(inspectionTaskService.addOrEditInspectionTask(inspectionTaskDto)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.inspectiontask.service.QrCodeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import com.ruoyi.inspectiontask.service.QrCodeScanRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import com.ruoyi.inspectiontask.service.TimingTaskService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | package com.ruoyi.inspectiontask.dto; |
| | | |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.inspectiontask.pojo.InspectionTask; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | @Data |
| | | public class InspectionTaskDto extends InspectionTask { |
| | | |
| | | private List<StorageBlobDTO> storageBlobDTO; |
| | | private List<StorageBlobDTO> beforeProduction; |
| | | private List<StorageBlobDTO> afterProduction; |
| | | private List<StorageBlobDTO> productionIssues; |
| | | // private List<StorageBlobDTO> storageBlobDTO; |
| | | // private List<StorageBlobDTO> beforeProduction; |
| | | // private List<StorageBlobDTO> afterProduction; |
| | | // private List<StorageBlobDTO> productionIssues; |
| | | |
| | | private List<StorageAttachment> attachments; |
| | | private List<String> tempFileIds; |
| | | private List<CommonFile> commonFileList; //çäº§ä¸ |
| | | private List<CommonFile> commonFileListAfter; //ç产å |
| | | private List<CommonFile> commonFileListBefore; //ç产å |
| | | |
| | | private String searchAll; |
| | | |
| | | private String status; |
| | | |
| | | private String dateStr; |
| | | |
| | | // private List<StorageAttachment> attachments; |
| | | |
| | | } |
| | |
| | | private Integer deleted; |
| | | |
| | | @ApiModelProperty(value = "å建该记å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½å建æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "ç»è®°æ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½æåæ´æ°æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·") |
| | |
| | | private Integer deleted; |
| | | |
| | | @ApiModelProperty(value = "å建该记å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½å建æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "è®°å½æåæ´æ°æ¶é´") |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | } |
| | |
| | | @TableName("timing_task") |
| | | public class TimingTask { |
| | | |
| | | @TableField(exist = false) |
| | | private String searchAll; |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private Integer taskId; |
| | | |
| | | @ApiModelProperty(value = "æ¹é设å¤id") |
| | | private String taskIds; |
| | | |
| | | @ApiModelProperty(value = "å·¡æ£äºº") |
| | | @Excel(name = "æ§è¡å·¡æ£äºº") |
| | | private String inspectorIds; |
| | |
| | | import com.ruoyi.inspectiontask.dto.InspectionTaskDto; |
| | | import com.ruoyi.inspectiontask.pojo.InspectionTask; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/19 10:49 |
| | |
| | | |
| | | IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto); |
| | | |
| | | int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto); |
| | | int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto) throws IOException; |
| | | |
| | | int delByIds(Long[] ids); |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.mapper.StorageAttachmentMapper; |
| | | import com.ruoyi.basic.mapper.StorageBlobMapper; |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import com.ruoyi.basic.service.StorageAttachmentService; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.MinioUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | import com.ruoyi.inspectiontask.service.InspectionTaskService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.constant.StorageAttachmentConstants.StorageAttachmentFile; |
| | | import static com.ruoyi.common.enums.StorageAttachmentRecordType.InspectionTasks; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | |
| | | @Override |
| | | public IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto) { |
| | | LambdaQueryWrapper<InspectionTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if(inspectionTaskDto != null){ |
| | | if(StringUtils.isNotEmpty(inspectionTaskDto.getSearchAll())){ |
| | | queryWrapper.like(InspectionTask::getTaskName, inspectionTaskDto.getSearchAll()); |
| | | } |
| | | } |
| | | queryWrapper.orderByDesc(InspectionTask::getCreateTime); |
| | | IPage<InspectionTask> entityPage = inspectionTaskMapper.selectPage(page, queryWrapper); |
| | | |
| | |
| | | } else { |
| | | sysUserMap = new HashMap<>(); |
| | | } |
| | | //å·¡æ£äººids |
| | | List<String> inspectorIds = entityPage.getRecords().stream().map(InspectionTask::getInspectorId).collect(Collectors.toList()); |
| | | |
| | | //è·åææä¸éå¤çç¨æ·ID |
| | | Set<Long> allUserIds = entityPage.getRecords().stream() |
| | | .map(InspectionTask::getInspectorId) // è·å"2,3"è¿æ ·çå符串 |
| | |
| | | (existing, replacement) -> existing)); |
| | | |
| | | //å¤çéä»¶ |
| | | Map<Long, List<StorageAttachment>> attachmentsMap = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>().in(StorageAttachment::getRecordId, ids) |
| | | .eq(StorageAttachment::getRecordType, InspectionTasks.ordinal())) |
| | | .stream() |
| | | .collect(Collectors.groupingBy(StorageAttachment::getRecordId)); |
| | | // æ¹éæ¥è¯¢ææéè¦çæä»¶æ°æ® |
| | | Set<Long> blobIds = attachmentsMap.values() |
| | | .stream() |
| | | .flatMap(List::stream) |
| | | .map(StorageAttachment::getStorageBlobId) |
| | | .collect(Collectors.toSet()); |
| | | Map<Long, StorageBlob> blobMap = blobIds.isEmpty() |
| | | ? Collections.emptyMap() |
| | | : storageBlobMapper.selectList(new LambdaQueryWrapper<StorageBlob>().in(StorageBlob::getId, blobIds)) |
| | | .stream() |
| | | .collect(Collectors.toMap(StorageBlob::getId, Function.identity())); |
| | | |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .in(CommonFile::getCommonId, ids) |
| | | .in(CommonFile::getType, Arrays.asList(FileNameType.INSPECTION.getValue(), FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue(), FileNameType.INSPECTION_PRODUCTION_AFTER.getValue()))); |
| | | if(commonFiles == null){ |
| | | commonFiles = new ArrayList<>(); |
| | | } |
| | | List<CommonFile> finalCommonFiles1 = commonFiles; |
| | | List<InspectionTaskDto> dtoList = entityPage.getRecords().stream().map(inspectionTask -> { |
| | | InspectionTaskDto dto = new InspectionTaskDto(); |
| | | BeanUtils.copyProperties(inspectionTask, dto); // å¤å¶ä¸»å¯¹è±¡å±æ§ |
| | |
| | | dto.setInspector(inspectorNames); |
| | | } |
| | | |
| | | // åå§åä¸ä¸ªéä»¶å表 |
| | | dto.setBeforeProduction(new ArrayList<>()); |
| | | dto.setAfterProduction(new ArrayList<>()); |
| | | dto.setProductionIssues(new ArrayList<>()); |
| | | |
| | | // å¤çéä»¶åç±» |
| | | Optional.ofNullable(attachmentsMap.get(inspectionTask.getId())) |
| | | .orElse(Collections.emptyList()) |
| | | .forEach(attachment -> { |
| | | StorageBlob blob = blobMap.get(attachment.getStorageBlobId()); |
| | | if (blob != null) { |
| | | // å建éä»¶DTO |
| | | StorageBlobDTO blobDto = createBlobDto(blob); |
| | | |
| | | // æ ¹æ®typeåç±» |
| | | switch ((int) blob.getType().longValue()) { |
| | | case 0: |
| | | dto.getBeforeProduction().add(blobDto); |
| | | break; |
| | | case 1: |
| | | dto.getAfterProduction().add(blobDto); |
| | | break; |
| | | case 2: |
| | | dto.getProductionIssues().add(blobDto); |
| | | break; |
| | | default: |
| | | // å¯éï¼è®°å½æªå类类å |
| | | break; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | dto.setDateStr(inspectionTask.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | List<CommonFile> finalCommonFiles = finalCommonFiles1.stream().filter(commonFile -> commonFile.getCommonId().equals(inspectionTask.getId())).collect(Collectors.toList()); |
| | | dto.setCommonFileList(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListAfter(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_AFTER.getValue())).collect(Collectors.toList())); |
| | | dto.setCommonFileListBefore(finalCommonFiles.stream().filter(commonFile -> commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())).collect(Collectors.toList())); |
| | | if(CollectionUtils.isNotEmpty(dto.getCommonFileList()) || CollectionUtils.isNotEmpty(dto.getCommonFileListAfter()) || CollectionUtils.isNotEmpty(dto.getCommonFileListBefore())){ |
| | | dto.setStatus("已巡æ£"); |
| | | }else{ |
| | | dto.setStatus("æªå·¡æ£"); |
| | | } |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto) { |
| | | public int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto) throws IOException { |
| | | InspectionTask inspectionTask = new InspectionTask(); |
| | | BeanUtils.copyProperties(inspectionTaskDto, inspectionTask); |
| | | inspectionTask.setRegistrantId(SecurityUtils.getLoginUser().getUserId()); |
| | |
| | | i = inspectionTaskMapper.updateById(inspectionTask); |
| | | } |
| | | |
| | | if (inspectionTaskDto.getStorageBlobDTO() != null && !inspectionTaskDto.getStorageBlobDTO().isEmpty()) { |
| | | List<StorageAttachment> attachments = new ArrayList<>(); |
| | | |
| | | for (StorageBlobDTO storageBlobDTO : inspectionTaskDto.getStorageBlobDTO()) { |
| | | StorageAttachment storageAttachment = new StorageAttachment( |
| | | StorageAttachmentFile, |
| | | (long) InspectionTasks.ordinal(), |
| | | inspectionTask.getId() |
| | | ); |
| | | storageAttachment.setStorageBlobDTO(storageBlobDTO); |
| | | attachments.add(storageAttachment); |
| | | } |
| | | storageAttachmentService.saveStorageAttachment(attachments, inspectionTask.getId(), InspectionTasks, StorageAttachmentFile); |
| | | } |
| | | // if (inspectionTaskDto.getStorageBlobDTO() != null && !inspectionTaskDto.getStorageBlobDTO().isEmpty()) { |
| | | // List<StorageAttachment> attachments = new ArrayList<>(); |
| | | // |
| | | // for (StorageBlobDTO storageBlobDTO : inspectionTaskDto.getStorageBlobDTO()) { |
| | | // StorageAttachment storageAttachment = new StorageAttachment( |
| | | // StorageAttachmentFile, |
| | | // (long) InspectionTasks.ordinal(), |
| | | // inspectionTask.getId() |
| | | // ); |
| | | // storageAttachment.setStorageBlobDTO(storageBlobDTO); |
| | | // attachments.add(storageAttachment); |
| | | // } |
| | | // storageAttachmentService.saveStorageAttachment(attachments, inspectionTask.getId(), InspectionTasks, StorageAttachmentFile); |
| | | // } |
| | | commonFileService.migrateTempFilesToFormal(inspectionTask.getId(),inspectionTaskDto.getTempFileIds()); |
| | | return i; |
| | | } |
| | | |
| | |
| | | if (ids == null || ids.length == 0) { |
| | | return 0; |
| | | } |
| | | commonFileService.deleteByBusinessIds(Arrays.asList(ids),FileNameType.INSPECTION.getValue()); |
| | | commonFileService.deleteByBusinessIds(Arrays.asList(ids),FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue()); |
| | | commonFileService.deleteByBusinessIds(Arrays.asList(ids),FileNameType.INSPECTION_PRODUCTION_AFTER.getValue()); |
| | | return inspectionTaskMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.basic.pojo.StorageAttachment; |
| | | import com.ruoyi.basic.pojo.StorageBlob; |
| | | import com.ruoyi.basic.service.StorageAttachmentService; |
| | | import com.ruoyi.common.constant.StorageAttachmentConstants; |
| | | import com.ruoyi.common.utils.MinioUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.inspectiontask.dto.QrCodeScanRecordDto; |
| | |
| | | import com.ruoyi.inspectiontask.service.QrCodeScanRecordService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | package com.ruoyi.inspectiontask.service.impl; |
| | | |
| | | import org.quartz.Scheduler; |
| | | import org.quartz.spi.TriggerFiredBundle; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.config.AutowireCapableBeanFactory; |
| | |
| | | import org.springframework.scheduling.quartz.SchedulerFactoryBean; |
| | | import org.springframework.scheduling.quartz.SpringBeanJobFactory; |
| | | |
| | | import javax.sql.DataSource; |
| | | |
| | | @Configuration |
| | | public class QuartzConfig { |
| | | @Autowired |
| | | private ApplicationContext applicationContext; |
| | | |
| | | // å设已é
ç½®å为dataSourceçæ°æ®æºBean |
| | | @Autowired |
| | | private DataSource dataSource; |
| | | |
| | | @Bean |
| | | public SchedulerFactoryBean schedulerFactoryBean() { |
| | |
| | | jobFactory.setApplicationContext(applicationContext); |
| | | schedulerFactory.setJobFactory(jobFactory); |
| | | |
| | | // å¨schedulerFactoryBean()æ¹æ³ä¸æ·»å |
| | | schedulerFactory.setDataSource(dataSource); |
| | | // å
¶ä»é
ç½®... |
| | | return schedulerFactory; |
| | | } |
| | | |
| | | @Bean |
| | | public Scheduler scheduler() { |
| | | return schedulerFactoryBean().getScheduler(); |
| | | } |
| | | |
| | | // èªå®ä¹JobFactoryï¼æ¯æèªå¨æ³¨å
¥ |
| | | public static class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory |
| | | implements ApplicationContextAware { |
| | |
| | | package com.ruoyi.inspectiontask.service.impl; |
| | | |
| | | import org.quartz.JobExecutionContext; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.sql.DataSource; |
| | | import java.time.DayOfWeek; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | // } |
| | | |
| | | // 2. å建并ä¿åå·¡æ£ä»»å¡è®°å½ - è¿å°±æ¯æ¨æä¾ç代ç åºè¯¥æ¾çä½ç½® |
| | | InspectionTask inspectionTask = createInspectionTask(timingTask); |
| | | inspectionTaskMapper.insert(inspectionTask); |
| | | List<InspectionTask> inspectionTask = createInspectionTask(timingTask); |
| | | for (InspectionTask task : inspectionTask) { |
| | | inspectionTaskMapper.insert(task); |
| | | } |
| | | |
| | | |
| | | // 3. æ´æ°å®æ¶ä»»å¡çæ§è¡æ¶é´ |
| | | if (!tasks.isEmpty()) { |
| | |
| | | } |
| | | |
| | | // è¿å°±æ¯æ¨æä¾ç代ç å°è£
æçæ¹æ³ |
| | | private InspectionTask createInspectionTask(TimingTask timingTask) { |
| | | InspectionTask inspectionTask = new InspectionTask(); |
| | | private List<InspectionTask> createInspectionTask(TimingTask timingTask) { |
| | | List<InspectionTask> inspectionTasks = new java.util.ArrayList<>(); |
| | | String[] split = timingTask.getTaskIds().split(","); |
| | | String[] split1 = timingTask.getTaskName().split(","); |
| | | int i = 0; |
| | | for (String s : split) { |
| | | InspectionTask inspectionTask = new InspectionTask(); |
| | | // å¤å¶åºæ¬å±æ§ |
| | | inspectionTask.setTaskName(split1[i]); |
| | | inspectionTask.setTaskId(Integer.parseInt(s)); |
| | | inspectionTask.setInspectorId(timingTask.getInspectorIds()); |
| | | inspectionTask.setInspectionLocation(timingTask.getInspectionLocation()); |
| | | inspectionTask.setRemarks("èªå¨çæèªå®æ¶ä»»å¡ID: " + timingTask.getId()); |
| | | inspectionTask.setRegistrantId(timingTask.getRegistrantId()); |
| | | inspectionTask.setFrequencyType(timingTask.getFrequencyType()); |
| | | inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail()); |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | inspectionTasks.add(inspectionTask); |
| | | } |
| | | |
| | | // å¤å¶åºæ¬å±æ§ |
| | | inspectionTask.setTaskName(timingTask.getTaskName()); |
| | | inspectionTask.setTaskId(timingTask.getTaskId()); |
| | | inspectionTask.setInspectorId(timingTask.getInspectorIds()); |
| | | inspectionTask.setInspectionLocation(timingTask.getInspectionLocation()); |
| | | inspectionTask.setRemarks("èªå¨çæèªå®æ¶ä»»å¡ID: " + timingTask.getId()); |
| | | inspectionTask.setRegistrantId(timingTask.getRegistrantId()); |
| | | inspectionTask.setFrequencyType(timingTask.getFrequencyType()); |
| | | inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail()); |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | |
| | | return inspectionTask; |
| | | return inspectionTasks; |
| | | } |
| | | |
| | | |
| | |
| | | throw new SchedulerException("Existing trigger is not a CronTrigger"); |
| | | } |
| | | |
| | | // æå»ºæ°è§¦åå¨ |
| | | Trigger newTrigger = TriggerBuilder.newTrigger() |
| | | .withIdentity(triggerKey) |
| | | .withDescription(task.getTaskName()) |
| | | .withSchedule(CronScheduleBuilder.cronSchedule(convertToCronExpression(task))) |
| | | .startAt(Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant())) |
| | | .forJob(oldTrigger.getJobKey()) |
| | | // 3. æå»ºCronTriggerï¼ç¡®ä¿æä¹
åé
ç½® |
| | | CronTrigger newTrigger = TriggerBuilder.newTrigger() |
| | | .withIdentity(triggerKey) // å¯ä¸æ è¯ï¼ç¨äºæä¹
ååå¨ |
| | | .withDescription(task.getTaskName() + "_TRIGGER") // 触åå¨æè¿° |
| | | .forJob(oldTrigger.getJobKey()) // å
³è对åºçJob |
| | | .withSchedule(CronScheduleBuilder |
| | | .cronSchedule(convertToCronExpression(task)) // éè¿æ§è¡æ¶ççç¥ï¼æ ¹æ®ä¸å¡è°æ´ï¼ |
| | | ) |
| | | // 4. 设置å¼å§æ¶é´ï¼è¥ä¸ºnullåç«å³çæï¼ |
| | | .startAt(task.getNextExecutionTime() != null |
| | | ? Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant()) |
| | | : new Date()) |
| | | .build(); |
| | | |
| | | scheduler.rescheduleJob(triggerKey, newTrigger); |
| | | } |
| | | |
| | | /** |
| | | * æåä»»å¡ |
| | | */ |
| | |
| | | /** |
| | | * å é¤ä»»å¡ |
| | | */ |
| | | public void unscheduleTimingTask(Long taskId) throws SchedulerException { |
| | | JobKey jobKey = new JobKey("timingTask_" + taskId); |
| | | scheduler.deleteJob(jobKey); |
| | | public void unscheduleTimingTask(Long taskId) { |
| | | try { |
| | | JobKey jobKey = new JobKey("timingTask_" + taskId); |
| | | scheduler.deleteJob(jobKey); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private JobDetail buildJobDetail(TimingTask task) { |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("taskId", task.getId()); |
| | | // 1. æå»ºå¯ä¸JobKeyï¼åºäºä»»å¡IDï¼ç¡®ä¿éå¯åè½è¯å«ï¼ |
| | | JobKey jobKey = new JobKey("timingTask_" + task.getId()); |
| | | |
| | | // 2. å°è£
任塿°æ®ï¼ä»
使ç¨åºæ¬ç±»åï¼ç¡®ä¿å¯åºååï¼ |
| | | JobDataMap jobDataMap = new JobDataMap(); |
| | | jobDataMap.put("taskId", task.getId()); // ä»»å¡IDï¼Longï¼å¯åºååï¼ |
| | | jobDataMap.put("taskName", task.getTaskName()); // ä»»å¡åç§°ï¼Stringï¼å¯åºååï¼ |
| | | jobDataMap.put("taskType", task.getFrequencyType()); // ä»»å¡ç±»åï¼Stringï¼ |
| | | // æéæ·»å å
¶ä»å¿
è¦çåºæ¬ç±»ååæ° |
| | | |
| | | // 3. æå»ºJobDetailï¼è®¾ç½®æä¹
åç¸å
³å±æ§ |
| | | return JobBuilder.newJob(TimingTaskJob.class) |
| | | .withIdentity("timingTask_" + task.getId()) |
| | | .withDescription(task.getTaskName()) |
| | | .usingJobData(jobDataMap) |
| | | .storeDurably() |
| | | .withIdentity(jobKey) // å¯ä¸æ è¯ï¼ç¨äºæä¹
ååå¨ |
| | | .withDescription(task.getTaskName()) // ä»»å¡æè¿°ï¼åå
¥æ°æ®åº |
| | | .usingJobData(jobDataMap) // ç»å®ä»»å¡æ°æ® |
| | | .storeDurably(true) // å³ä½¿æ²¡æè§¦åå¨å
³è乿ä¹
åä¿å |
| | | .requestRecovery(true) // å½è°åº¦å¨å´©æºåæ¢å¤æ¶ï¼éæ°æ§è¡æªå®æçä»»å¡ |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | private Trigger buildJobTrigger(TimingTask task, JobDetail jobDetail) { |
| | | // 1. æå»ºå¯ä¸TriggerKeyï¼åºäºä»»å¡IDï¼ |
| | | TriggerKey triggerKey = new TriggerKey("trigger_" + task.getId()); |
| | | |
| | | // 2. çæCron表达å¼ï¼åé»è¾ä¸åï¼ |
| | | String cronExpression = convertToCronExpression(task); |
| | | |
| | | TriggerBuilder<CronTrigger> triggerBuilder = TriggerBuilder.newTrigger() |
| | | .withIdentity("trigger_" + task.getId()) |
| | | .withDescription(task.getTaskName()) |
| | | .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)); |
| | | |
| | | if (jobDetail != null) { |
| | | triggerBuilder.forJob(jobDetail); |
| | | } |
| | | |
| | | if (task.getNextExecutionTime() != null) { |
| | | triggerBuilder.startAt(Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant())); |
| | | } |
| | | |
| | | return triggerBuilder.build(); |
| | | // 3. æå»ºCronTriggerï¼ç¡®ä¿æä¹
åé
ç½® |
| | | return TriggerBuilder.newTrigger() |
| | | .withIdentity(triggerKey) // å¯ä¸æ è¯ï¼ç¨äºæä¹
ååå¨ |
| | | .withDescription(task.getTaskName() + "_TRIGGER") // 触åå¨æè¿° |
| | | .forJob(jobDetail) // å
³è对åºçJob |
| | | .withSchedule(CronScheduleBuilder |
| | | .cronSchedule(cronExpression) |
| | | .withMisfireHandlingInstructionDoNothing() // éè¿æ§è¡æ¶ççç¥ï¼æ ¹æ®ä¸å¡è°æ´ï¼ |
| | | ) |
| | | // 4. 设置å¼å§æ¶é´ï¼è¥ä¸ºnullåç«å³çæï¼ |
| | | .startAt(task.getNextExecutionTime() != null |
| | | ? Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant()) |
| | | : new Date()) |
| | | .build(); |
| | | } |
| | | |
| | | private String convertToCronExpression(TimingTask task) { |
| | | // åæ°æ ¡éª |
| | | if (task == null || task.getFrequencyType() == null || task.getFrequencyDetail() == null) { |
| | |
| | | package com.ruoyi.inspectiontask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | @Override |
| | | public IPage<TimingTaskDto> selectTimingTaskList(Page<TimingTask> page, TimingTask timingTask) { |
| | | // 1. å
å页æ¥è¯¢å®æ¶ä»»å¡æ°æ® |
| | | IPage<TimingTask> taskPage = timingTaskMapper.selectPage(page, null); |
| | | LambdaQueryWrapper<TimingTask> timingTaskLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(timingTask != null){ |
| | | if(StringUtils.isNotEmpty(timingTask.getSearchAll())){ |
| | | timingTaskLambdaQueryWrapper.like(TimingTask::getTaskName, timingTask.getSearchAll()); |
| | | } |
| | | } |
| | | IPage<TimingTask> taskPage = timingTaskMapper.selectPage(page, timingTaskLambdaQueryWrapper); |
| | | |
| | | // 2. å¦ææ²¡ææ°æ®ï¼ç´æ¥è¿å空å页 |
| | | if (taskPage.getRecords().isEmpty()) { |
| | |
| | | } |
| | | } |
| | | |
| | | private LocalDateTime calculateFirstExecutionTime(TimingTask task) { |
| | | public LocalDateTime calculateFirstExecutionTime(TimingTask task) { |
| | | // æ ¹æ®é¢çç±»åå详æ
计ç®é¦æ¬¡æ§è¡æ¶é´ |
| | | String frequencyType = task.getFrequencyType(); |
| | | if ("DAILY".equals(frequencyType)) { |
| | |
| | | |
| | | @Override |
| | | public int delByIds(Long[] ids) { |
| | | return timingTaskMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | int i = timingTaskMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | if(i > 0){ |
| | | for (Long id : ids) { |
| | | timingTaskScheduler.unscheduleTimingTask(id); |
| | | } |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerService; |
| | | import com.ruoyi.measuringinstrumentledger.service.impl.MeasuringInstrumentLedgerServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | package com.ruoyi.measuringinstrumentledger.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerMapper; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper; |
| | |
| | | package com.ruoyi.sales.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void deleteByBusinessId(Long businessId,Integer type) { |
| | | commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) |
| | | .eq(CommonFile::getType, type)); |
| | | } |
| | | |
| | | public void deleteByBusinessIds(List<Long> businessId,Integer type) { |
| | | commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().in(CommonFile::getCommonId, businessId) |
| | | .eq(CommonFile::getType, type)); |
| | | } |
| | | } |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-mxsc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | # Quartz宿¶ä»»å¡é
ç½®ï¼æ°å¢é¨åï¼ |
| | | quartz: |
| | | job-store-type: jdbc # ä½¿ç¨æ°æ®åºåå¨ |
| | | jdbc: |
| | | initialize-schema: never # 馿¬¡è¿è¡æ¶èªå¨åå»ºè¡¨ç»æï¼æååæ¹ä¸ºnever |
| | | schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQLè¡¨ç»æèæ¬ |
| | | properties: |
| | | org: |
| | | quartz: |
| | | scheduler: |
| | | instanceName: RuoYiScheduler |
| | | instanceId: AUTO |
| | | jobStore: |
| | | class: org.quartz.impl.jdbcjobstore.JobStoreTX |
| | | driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQLéé
|
| | | tablePrefix: qrtz_ # 表ååç¼ï¼ä¸èæ¬ä¸è´ |
| | | isClustered: false # åèç¹æ¨¡å¼ï¼éç¾¤éæ¹ä¸ºtrueï¼ |
| | | clusterCheckinInterval: 10000 |
| | | txIsolationLevelSerializable: true |
| | | threadPool: |
| | | class: org.quartz.simpl.SimpleThreadPool |
| | | threadCount: 10 # çº¿ç¨æ± å¤§å° |
| | | threadPriority: 5 |
| | | makeThreadsDaemons: true |
| | | updateCheck: false # å
³éçæ¬æ£æ¥ |
| | | |
| | | # tokené
ç½® |
| | | token: |
| | |
| | | |
| | | file: |
| | | temp-dir: D:/ruoyi/temp/uploads # 临æ¶ç®å½ |
| | | upload-dir: D:/ruoyi/prod/uploads # æ£å¼ç®å½ |
| | | upload-dir: D:/ruoyi/prod/uploads # æ£å¼ç®å½ |
| | | #æ¦æå¸å·¥ä¸åä¿¡æ¯å屿°æ®æ¨é |
| | | api: |
| | | ip: http://111.20.184.155:8888 #æ¨éipå°å |
| | | appid: 48b97e28e0aad7963e96fc50b9e63908 #ä¼ä¸åºç¨id |
| | | secret: 0db7a9fa112427df622c4207b4707432 #ä¼ä¸åºç¨ç§é¥ |
| | | entName: éè¾¹å¿ä¼å¾·å®ä¸æéå
¬å¸ #ä¼ä¸åç§° |
| | | socialCreditCode: 91610824MA703F1G4N #ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç |
| | | dayPowerConsumption: 50 #æ¥åç¨çµé |
| | | outputValuesBase: 210 #åä½äº§å¼åºæ°ï¼ä¸å
ï¼ |
| | | electricityCost: 0.14 #æçµè´¹ |
| | | # ç»å½æ¨éå¼å
³ |
| | | loginPush: false |
| | | # çµæ°æ®æ¨éå¼å
³ |
| | | push: false |
| | |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | # Quartz宿¶ä»»å¡é
ç½®ï¼æ°å¢é¨åï¼ |
| | | quartz: |
| | | job-store-type: jdbc # ä½¿ç¨æ°æ®åºåå¨ |
| | | jdbc: |
| | | initialize-schema: never # 馿¬¡è¿è¡æ¶èªå¨åå»ºè¡¨ç»æï¼æååæ¹ä¸ºnever |
| | | schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQLè¡¨ç»æèæ¬ |
| | | properties: |
| | | org: |
| | | quartz: |
| | | scheduler: |
| | | instanceName: RuoYiScheduler |
| | | instanceId: AUTO |
| | | jobStore: |
| | | class: org.quartz.impl.jdbcjobstore.JobStoreTX |
| | | driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQLéé
|
| | | tablePrefix: qrtz_ # 表ååç¼ï¼ä¸èæ¬ä¸è´ |
| | | isClustered: false # åèç¹æ¨¡å¼ï¼éç¾¤éæ¹ä¸ºtrueï¼ |
| | | clusterCheckinInterval: 10000 |
| | | txIsolationLevelSerializable: true |
| | | threadPool: |
| | | class: org.quartz.simpl.SimpleThreadPool |
| | | threadCount: 10 # çº¿ç¨æ± å¤§å° |
| | | threadPriority: 5 |
| | | makeThreadsDaemons: true |
| | | updateCheck: false # å
³éçæ¬æ£æ¥ |
| | | |
| | | # tokené
ç½® |
| | | token: |
| | |
| | | |
| | | file: |
| | | temp-dir: /javaWork/product-inventory-management/file/temp/uploads |
| | | upload-dir: /javaWork/product-inventory-management/file/prod/uploads |
| | | upload-dir: /javaWork/product-inventory-management/file/prod/uploads |
| | | |
| | | #æ¦æå¸å·¥ä¸åä¿¡æ¯å屿°æ®æ¨é |
| | | api: |
| | | ip: http://111.20.184.155:8888 #æ¨éipå°å |
| | | appid: 48b97e28e0aad7963e96fc50b9e63908 #ä¼ä¸åºç¨id |
| | | secret: 0db7a9fa112427df622c4207b4707432 #ä¼ä¸åºç¨ç§é¥ |
| | | entName: éè¾¹å¿ä¼å¾·å®ä¸æéå
¬å¸ #ä¼ä¸åç§° |
| | | socialCreditCode: 91610824MA703F1G4N #ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç |
| | | dayPowerConsumption: 50 #æ¥åç¨çµé |
| | | outputValuesBase: 210 #åä½äº§å¼åºæ°ï¼ä¸å
ï¼ |
| | | electricityCost: 0.14 #æçµè´¹ |
| | | # ç»å½æ¨éå¼å
³ |
| | | loginPush: false |
| | | # çµæ°æ®æ¨éå¼å
³ |
| | | push: false |
| | |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | # Quartz宿¶ä»»å¡é
ç½®ï¼æ°å¢é¨åï¼ |
| | | quartz: |
| | | job-store-type: jdbc # ä½¿ç¨æ°æ®åºåå¨ |
| | | jdbc: |
| | | initialize-schema: never # 馿¬¡è¿è¡æ¶èªå¨åå»ºè¡¨ç»æï¼æååæ¹ä¸ºnever |
| | | schema: classpath:org/quartz/impl/jdbcjobstore/tables_mysql_innodb.sql # MySQLè¡¨ç»æèæ¬ |
| | | properties: |
| | | org: |
| | | quartz: |
| | | scheduler: |
| | | instanceName: RuoYiScheduler |
| | | instanceId: AUTO |
| | | jobStore: |
| | | class: org.quartz.impl.jdbcjobstore.JobStoreTX |
| | | driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # MySQLéé
|
| | | tablePrefix: qrtz_ # 表ååç¼ï¼ä¸èæ¬ä¸è´ |
| | | isClustered: false # åèç¹æ¨¡å¼ï¼éç¾¤éæ¹ä¸ºtrueï¼ |
| | | clusterCheckinInterval: 10000 |
| | | txIsolationLevelSerializable: true |
| | | threadPool: |
| | | class: org.quartz.simpl.SimpleThreadPool |
| | | threadCount: 10 # çº¿ç¨æ± å¤§å° |
| | | threadPriority: 5 |
| | | makeThreadsDaemons: true |
| | | updateCheck: false # å
³éçæ¬æ£æ¥ |
| | | |
| | | # tokené
ç½® |
| | | token: |
| | |
| | | |
| | | file: |
| | | temp-dir: /javaWork/product-inventory-management/file/temp/uploads |
| | | upload-dir: /javaWork/product-inventory-management/file/prod/uploads |
| | | upload-dir: /javaWork/product-inventory-management/file/prod/uploads |
| | | |
| | | #æ¦æå¸å·¥ä¸åä¿¡æ¯å屿°æ®æ¨é |
| | | api: |
| | | ip: http://111.20.184.155:8888 #æ¨éipå°å |
| | | appid: 48b97e28e0aad7963e96fc50b9e63908 #ä¼ä¸åºç¨id |
| | | secret: 0db7a9fa112427df622c4207b4707432 #ä¼ä¸åºç¨ç§é¥ |
| | | entName: éè¾¹å¿ä¼å¾·å®ä¸æéå
¬å¸ #ä¼ä¸åç§° |
| | | socialCreditCode: 91610824MA703F1G4N #ç»ä¸ç¤¾ä¼ä¿¡ç¨ä»£ç |
| | | dayPowerConsumption: 50 #æ¥åç¨çµé |
| | | outputValuesBase: 210 #åä½äº§å¼åºæ°ï¼ä¸å
ï¼ |
| | | electricityCost: 0.14 #æçµè´¹ |
| | | # ç»å½æ¨éå¼å
³ |
| | | loginPush: false |
| | | # çµæ°æ®æ¨éå¼å
³ |
| | | push: false |
| | |
| | | # Springé
ç½® |
| | | spring: |
| | | profiles: |
| | | active: wdsy |
| | | active: dev |