| | |
| | | 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.core.conditions.query.QueryWrapper; |
| | | 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.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; |
| | |
| | | |
| | | @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.DeviceMonthlyRepairTableDTO; |
| | | import com.ruoyi.device.dto.RepairAmountGroupDTO; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "设å¤ä¿å
»") |
| | | @RestController |
| | |
| | | @PostMapping ("maintenance") |
| | | @ApiModelProperty("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | deviceMaintenance.setStatus(1); |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æå¹´ä»½æ¥è¯¢æ¯ææ¥ä¿®éé¢ï¼æè®¾å¤å°è´¦åç»ï¼ |
| | | * @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()))); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | 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 com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | @Autowired |
| | | private IApproveProcessService approveProcessService; |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®å表") |
| | | @GetMapping("/page") |
| | |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiModelProperty("æ·»å è®¾å¤æ¥ä¿®") |
| | | public AjaxResult add( @RequestBody DeviceRepair deviceRepair) throws Exception { |
| | | deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | // è·åå½åç»å½å
¬å¸ |
| | | Long tenantId = loginUser.getTenantId(); |
| | | if(null != tenantId){ |
| | | LambdaQueryWrapper<DeviceRepair> QueryWrapper = new LambdaQueryWrapper<>(); |
| | | QueryWrapper.eq(DeviceRepair::getDeviceLedgerId,deviceRepair.getDeviceLedgerId()) |
| | | .eq(DeviceRepair::getRemark,deviceRepair.getRemark()) |
| | | .eq(DeviceRepair::getDeviceName,deviceRepair.getDeviceName()) |
| | | .eq(DeviceRepair::getApproverId,deviceRepair.getApproverId()) |
| | | .eq(DeviceRepair::getRepairTime,deviceRepair.getRepairTime()); |
| | | DeviceRepair one = deviceRepairService.getOne(QueryWrapper); |
| | | if(ObjectUtils.isEmpty(one)){ |
| | | return AjaxResult.error("è®¾å¤æ¥ä¿®ä¸åå¨"); |
| | | } |
| | | //è·åå½åç»å½é¨é¨id |
| | | approveProcessVO.setApproveDeptId(tenantId); |
| | | //è·åå½åç»å½ç¨æ·id |
| | | approveProcessVO.setApproveUser(loginUser.getUserId()); |
| | | //è·åå½åæ¶é´ |
| | | approveProcessVO.setApproveTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | approveProcessVO.setApproveType(4); |
| | | approveProcessVO.setApproveUserIds(deviceRepair.getApproverId().toString()); |
| | | approveProcessVO.setApproveReason(deviceRepair.getRemark()); |
| | | approveProcessVO.setDeviceRepairId(one.getId()); |
| | | approveProcessVO.setMaintenancePrice(deviceRepair.getMaintenancePrice()); |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | } |
| | | return AjaxResult.success(); |
| | | public AjaxResult add( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | } |
| | | |
| | | @ApiModelProperty("æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | |
| | | @PostMapping ("repair") |
| | | @ApiModelProperty("设å¤ç»´ä¿®") |
| | | public AjaxResult repair( @RequestBody DeviceRepair deviceRepair) { |
| | | deviceRepair.setStatus(1); |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiModelProperty("å é¤è®¾å¤æ¥ä¿®") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | LambdaQueryWrapper<ApproveProcess> QueryWrapper = new LambdaQueryWrapper<>(); |
| | | QueryWrapper.in(ApproveProcess::getDeviceRepairId,ids); |
| | | List<ApproveProcess> approveProcessList = approveProcessService.list(QueryWrapper); |
| | | if(!approveProcessList.isEmpty()){ |
| | | approveProcessList.forEach(approveProcess -> { |
| | | if (approveProcess.getApproveStatus() != 0){ |
| | | //æåºå¼å¸¸ |
| | | throw new RuntimeException("ææ£å¨å¤çä¸çå®¡æ¹æµç¨ï¼ä¸è½å é¤"); |
| | | } |
| | | }); |
| | | } |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | private String deviceModel; |
| | | |
| | | /** |
| | | * 设å¤åç |
| | | */ |
| | | @ApiModelProperty("设å¤åç") |
| | | private String deviceBrand; |
| | | |
| | | /** |
| | | * åæ¾ä½ç½® |
| | | */ |
| | | @ApiModelProperty("åæ¾ä½ç½®") |
| | | private String storageLocation; |
| | | |
| | | |
| | | /** |
| | | * ä¾åºååç§° |
| | | */ |
| | | private String supplierName; |
| | |
| | | */ |
| | | 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; |
| | | |
| | | @Data |
| | |
| | | |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»id") |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»éé¢") |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | |
| | | private String maintenanceActuallyTimeReq; |
| | | |
| | | @ApiModelProperty("ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | private String maintenanceResult; |
| | | private Integer maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç»") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 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; |
| | | |
| | | @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; |
| | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ:0å®¡æ ¸ä¸,1å®¡æ ¸éè¿,2å®¡æ ¸å¤±è´¥,3ç»´ä¿®ä¸,4ç»´ä¿®éè¿,5维修失败") |
| | | @ApiModelProperty("ç¶æ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @ApiModelProperty("ç»´ä¿®ä»·æ ¼") |
| | | private String maintenancePrice; |
| | | |
| | | |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | * æ°é |
| | | */ |
| | | @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; |
| | | |
| | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | @Excel(name = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»éé¢") |
| | | @Excel(name = "设å¤ä¿å
»éé¢") |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | @Excel(name = "è§æ ¼åå·") |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | |
| | | @Excel(name = "ä¿å
ȍȾ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç»") |
| | | @Excel(name = "ç¶æ") |
| | | private String status; |
| | | |
| | |
| | | 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.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); |
| | | } |
| | |
| | | private String deviceModel; |
| | | |
| | | /** |
| | | * 设å¤åç |
| | | */ |
| | | @ApiModelProperty("设å¤åç") |
| | | private String deviceBrand; |
| | | |
| | | /** |
| | | * åæ¾ä½ç½® |
| | | */ |
| | | @ApiModelProperty("åæ¾ä½ç½®") |
| | | private String storageLocation; |
| | | |
| | | /** |
| | | * ä¾åºååç§° |
| | | */ |
| | | private String supplierName; |
| | |
| | | */ |
| | | private BigDecimal unTaxIncludingPriceTotal; |
| | | |
| | | private String deviceBrand; |
| | | |
| | | private String storageLocation; |
| | | |
| | | /** |
| | | * å½å
¥æ¶é´ |
| | | */ |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»éé¢") |
| | | private BigDecimal maintenancePrice; |
| | | |
| | | @ApiModelProperty("ä¿å
»ä»»å¡id") |
| | | private Long maintenanceTaskId; |
| | |
| | | private LocalDateTime maintenanceActuallyTime; |
| | | |
| | | @ApiModelProperty("ä¿å
»ç»æ 0 ç»´ä¿® 1 å®å¥½") |
| | | private String maintenanceResult; |
| | | private Integer maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç» 2 失败") |
| | | @ApiModelProperty("ç¶æ 0 å¾
ä¿å
» 1 å®ç»") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | @ApiModelProperty("设å¤åç§°") |
| | | |
| | | @ApiModelProperty("æ¥ä¿®éé¢") |
| | | private BigDecimal repairPrice; |
| | | |
| | | private String deviceName; |
| | | @ApiModelProperty("设å¤åå·") |
| | | |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ:0å®¡æ ¸ä¸,1å®¡æ ¸éè¿,2å®¡æ ¸å¤±è´¥,3ç»´ä¿®ä¸,4ç»´ä¿®éè¿,5维修失败") |
| | | @ApiModelProperty("ç¶æ 0 å¾
ç»´ä¿® 1å®ç» 2å¾
å®¡æ ¸ 3å®¡æ ¸ä¸éè¿") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å®¡æ ¸äºº") |
| | | private String auditName; |
| | | |
| | | @ApiModelProperty("ç£å人") |
| | | private String supervisoryName; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @ApiModelProperty("ç»´ä¿®ä»·æ ¼") |
| | | private BigDecimal maintenancePrice; |
| | | @ApiModelProperty("审æ¹äººid") |
| | | private Integer approverId; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private Long taskId; |
| | | |
| | | @ApiModelProperty(value = "æ¹é设å¤id") |
| | | private String taskIds; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡") |
| | | @Excel(name = "颿¬¡") |
| | | private String frequencyType; |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate registrationDate; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ") |
| | | @ApiModelProperty(value = "ç¶æ å¾
å®¡æ ¸ å®¡æ ¸ä¸éè¿ å®¡æ ¸éè¿") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | @Excel(name = "å®¡æ ¸äºº") |
| | | private String auditName; |
| | | |
| | | @ApiModelProperty("ç£å人") |
| | | private String supervisoryName; |
| | | |
| | | @ApiModelProperty(value = "软å 餿 å¿ï¼0=æªå é¤ï¼1=å·²å é¤") |
| | | private Integer deleted; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 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.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; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | 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::getDeviceName,deviceLedger.getDeviceName()); |
| | | 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 -> { |
| | | for (Integer i = 0; i < c.getNumber(); i++) { |
| | | DeviceLedger deviceLedger = new DeviceLedger(); |
| | | SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser()); |
| | | if (sysUser!=null) { |
| | |
| | | deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue()); |
| | | } |
| | | BeanUtils.copyProperties(c,deviceLedger); |
| | | deviceLedger.setNumber(new BigDecimal(1)); |
| | | 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.List; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | |
| | | @Service |
| | |
| | | supplierManageList.forEach(deviceMaintenance -> { |
| | | DeviceMaintenanceExeclDto deviceRepairExeclDto = new DeviceMaintenanceExeclDto(); |
| | | BeanUtils.copyProperties(deviceMaintenance,deviceRepairExeclDto); |
| | | deviceRepairExeclDto.setStatus(deviceMaintenance.getStatus() == 0 ? "å¾
ç»´ä¿®" : deviceMaintenance.getStatus() == 1 ? "å®ç»" : "失败"); |
| | | // deviceRepairExeclDto.setMaintenanceResult(deviceMaintenance.getMaintenanceResult() != null && deviceMaintenance.getMaintenanceResult() == 0 ? "ç»´ä¿®" : "å®å¥½"); |
| | | deviceRepairExeclDto.setStatus(deviceMaintenance.getStatus() == 0 ? "å¾
ç»´ä¿®" : "å®ç»"); |
| | | deviceRepairExeclDto.setMaintenanceResult(deviceMaintenance.getMaintenanceResult() != null && deviceMaintenance.getMaintenanceResult() == 0 ? "ç»´ä¿®" : "å®å¥½"); |
| | | |
| | | deviceLedgerExeclDtos.add(deviceRepairExeclDto); |
| | | }); |
| | | ExcelUtil<DeviceMaintenanceExeclDto> util = new ExcelUtil<DeviceMaintenanceExeclDto>(DeviceMaintenanceExeclDto.class); |
| | |
| | | |
| | | 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.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | |
| | | 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(); |
| | |
| | | supplierManageList.stream().forEach(deviceRepair -> { |
| | | DeviceRepairExeclDto deviceRepairExeclDto = new DeviceRepairExeclDto(); |
| | | BeanUtils.copyProperties(deviceRepair,deviceRepairExeclDto); |
| | | deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "å¾
ç»´ä¿®" : deviceRepair.getStatus() == 1 ? "å®ç»" : "失败"); |
| | | deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "å¾
ç»´ä¿®" : "å®ç»"); |
| | | |
| | | deviceLedgerExeclDtos.add(deviceRepairExeclDto); |
| | | }); |
| | |
| | | supplierManageList.stream().forEach(deviceRepair -> { |
| | | DeviceRepairExeclDto deviceRepairExeclDto = new DeviceRepairExeclDto(); |
| | | BeanUtils.copyProperties(deviceRepair,deviceRepairExeclDto); |
| | | deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "å¾
ç»´ä¿®" : deviceRepair.getStatus() == 1 ? "å®ç»" : "失败"); |
| | | deviceRepairExeclDto.setStatusStr(deviceRepair.getStatus() == 0 ? "å¾
ç»´ä¿®" : "å®ç»"); |
| | | |
| | | deviceLedgerExeclDtos.add(deviceRepairExeclDto); |
| | | }); |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | try { |
| | | // 3. å°è¯æ¥è¯¢ä½ çä¸å¡æ°æ® |
| | | // éè¿JDBCæ¨¡æ¿æ¥è¯¢å®æ¶ä»»å¡ä¿¡æ¯ï¼ä½¿ç¨åæ°åæ¥è¯¢é²æ¢SQL注å
¥ |
| | | String yourSql = "SELECT * FROM maintenance_task where id = ?"; |
| | | String yourSql = "SELECT * FROM maintenance_task where id = ? and status = 'å®¡æ ¸éè¿'"; |
| | | List<MaintenanceTask> tasks = jdbcTemplate.query( |
| | | yourSql, |
| | | new BeanPropertyRowMapper<>(MaintenanceTask.class), |
| | |
| | | } |
| | | |
| | | // 2. å建并ä¿åå·¡æ£ä»»å¡è®°å½ - è¿å°±æ¯æ¨æä¾ç代ç åºè¯¥æ¾çä½ç½® |
| | | DeviceMaintenance deviceMaintenance = createInspectionTask(timingTask); |
| | | deviceMaintenanceService.save(deviceMaintenance); |
| | | List<DeviceMaintenance> deviceMaintenance = createInspectionTask(timingTask); |
| | | deviceMaintenanceService.saveBatch(deviceMaintenance); |
| | | |
| | | // 3. æ´æ°å®æ¶ä»»å¡çæ§è¡æ¶é´ |
| | | if (!tasks.isEmpty()) { |
| | |
| | | } |
| | | |
| | | // è¿å°±æ¯æ¨æä¾ç代ç å°è£
æçæ¹æ³ |
| | | private DeviceMaintenance createInspectionTask(MaintenanceTask timingTask) { |
| | | 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(timingTask.getTaskName()); |
| | | inspectionTask.setDeviceName(split1[i]); |
| | | inspectionTask.setMaintenanceTaskId(timingTask.getId()); |
| | | inspectionTask.setDeviceLedgerId(timingTask.getTaskId()); |
| | | 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(timingTask.getDeviceModel()); |
| | | 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())); |
| | | return inspectionTask; |
| | | i++; |
| | | inspectionTasks.add(inspectionTask); |
| | | } |
| | | |
| | | return inspectionTasks; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @Override |
| | | public AjaxResult add(MaintenanceTask maintenanceTask) { |
| | | if(StringUtils.isEmpty(maintenanceTask.getAuditName())) { |
| | | return AjaxResult.warn("请填åå®¡æ ¸äºº"); |
| | | } |
| | | maintenanceTask.setActive(true); |
| | | // 计ç®é¦æ¬¡æ§è¡æ¶é´ |
| | | TimingTask task = new TimingTask(); |
| | |
| | | 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); |
| | |
| | | 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.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | 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.R; |
| | | import com.ruoyi.inspectiontask.dto.TimingTaskDto; |
| | |
| | | */ |
| | | @PostMapping("/addOrEditTimingTask") |
| | | @ApiOperation(value = "æ°å¢ä¿®æ¹å®æ¶ä»»å¡") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.INSERT) |
| | | public R addOrEditTimingTask(@RequestBody TimingTaskDto timingTaskDto) throws SchedulerException { |
| | | return R.ok(timingTaskService.addOrEditTimingTask(timingTaskDto)); |
| | | } |
| | |
| | | */ |
| | | @DeleteMapping("/delTimingTask") |
| | | @ApiOperation(value = "å é¤å®æ¶ä»»å¡") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | public R remove(@RequestBody Long[] ids) { |
| | | return R.ok(timingTaskService.delByIds(ids)); |
| | | } |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(exist = false) |
| | | private String dateStr; |
| | | } |
| | |
| | | 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; |
| | |
| | | @ApiModel |
| | | @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 = "æ§è¡å·¡æ£äºº") |
| | |
| | | @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") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æåä¿®æ¹è¯¥è®°å½çç¨æ·") |
| | |
| | | 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.setDateStr(inspectionTask.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | |
| | | // åå§åä¸ä¸ªéä»¶å表 |
| | | 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; |
| | | 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 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; |
| | |
| | | |
| | | @Component |
| | | @DisallowConcurrentExecution // ç¦æ¢å¹¶åæ§è¡åä¸ä¸ªJob |
| | | public class TimingTaskJob implements Job, Serializable { |
| | | private static final long serialVersionUID = 1L; // å¿
é¡»å®ä¹åºååID |
| | | public class TimingTaskJob implements Job { |
| | | |
| | | @Autowired |
| | | private TimingTaskMapper timingTaskMapper; |
| | |
| | | // } |
| | | |
| | | // 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) { |
| | | 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(timingTask.getTaskName()); |
| | | inspectionTask.setTaskId(timingTask.getTaskId()); |
| | | inspectionTask.setTaskName(split1[i]); |
| | | inspectionTask.setTaskId(Integer.parseInt(s)); |
| | | inspectionTask.setInspectorId(timingTask.getInspectorIds()); |
| | | inspectionTask.setInspectionLocation(timingTask.getInspectionLocation()); |
| | | inspectionTask.setRemarks("èªå¨çæèªå®æ¶ä»»å¡ID: " + timingTask.getId()); |
| | |
| | | inspectionTask.setFrequencyType(timingTask.getFrequencyType()); |
| | | inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail()); |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | inspectionTasks.add(inspectionTask); |
| | | } |
| | | |
| | | return inspectionTask; |
| | | |
| | | return inspectionTasks; |
| | | } |
| | | |
| | | |
| | |
| | | ? Date.from(task.getNextExecutionTime().atZone(ZoneId.systemDefault()).toInstant()) |
| | | : new Date()) |
| | | .build(); |
| | | |
| | | // æå»ºæ°è§¦åå¨ |
| | | // 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()) |
| | | // .build(); |
| | | |
| | | scheduler.rescheduleJob(triggerKey, newTrigger); |
| | | } |
| | | |
| | | /** |
| | | * æåä»»å¡ |
| | | */ |
| | |
| | | try { |
| | | JobKey jobKey = new JobKey("timingTask_" + taskId); |
| | | scheduler.deleteJob(jobKey); |
| | | }catch (SchedulerException e){ |
| | | throw new RuntimeException(e); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | private Trigger buildJobTrigger(TimingTask task, JobDetail jobDetail) { |
| | | // 1. æå»ºå¯ä¸TriggerKeyï¼åºäºä»»å¡IDï¼ |
| | | TriggerKey triggerKey = new TriggerKey("trigger_" + task.getId()); |
| | |
| | | : 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()) { |
| | |
| | | |
| | | // æ¶éå·¡æ£äººIDï¼å¤ä¸ªID以éå·åéï¼ |
| | | taskPage.getRecords().forEach(task -> { |
| | | task.setDateStr(task.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | if (StringUtils.isNotBlank(task.getInspectorIds())) { |
| | | Arrays.stream(task.getInspectorIds().split(",")) |
| | | .filter(StringUtils::isNotBlank) |
| | |
| | | public int addOrEditTimingTask(TimingTaskDto timingTaskDto) throws SchedulerException { |
| | | TimingTask timingTask = new TimingTask(); |
| | | BeanUtils.copyProperties(timingTaskDto, timingTask); |
| | | // 1. è§£æå符串为 LocalDateï¼åªå
å«å¹´ææ¥ï¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | LocalDate localDate = LocalDate.parse(timingTaskDto.getDateStr(), formatter); |
| | | |
| | | // 2. è·åå½åç³»ç»ç LocalTimeï¼å
嫿¶åç§ï¼ |
| | | LocalTime currentTime = LocalTime.now(); |
| | | |
| | | // 3. åå¹¶ LocalDate åå½å LocalTime 为 LocalDateTime |
| | | LocalDateTime localDateTime = LocalDateTime.of(localDate, currentTime); |
| | | timingTask.setCreateTime(localDateTime); |
| | | // 设置å建人信æ¯åé»è®¤å¼ |
| | | if (Objects.isNull(timingTaskDto.getId())) { |
| | | timingTask.setRegistrationDate(LocalDate.now()); |
| | |
| | | // 计ç®é¦æ¬¡æ§è¡æ¶é´ |
| | | LocalDateTime firstExecutionTime = calculateFirstExecutionTime(timingTask); |
| | | timingTask.setNextExecutionTime(firstExecutionTime); |
| | | |
| | | int result = timingTaskMapper.insert(timingTask); |
| | | if (result > 0) { |
| | | // æ°å¢æååæ·»å å°è°åº¦å¨ |
| | |
| | | } |
| | | return result; |
| | | } else { |
| | | |
| | | |
| | | int result = timingTaskMapper.updateById(timingTask); |
| | | if (result > 0) { |
| | | // æ´æ°æååéæ°è°åº¦ä»»å¡ |
| | |
| | | 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 lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | * å¤ä»¶åç±»ç¼å· |
| | | */ |
| | | private String sparePartsNo; |
| | | /** |
| | | * å¤ä»¶ä»·æ ¼ |
| | | */ |
| | | private BigDecimal price; |
| | | |
| | | /** |
| | | * 设å¤idéåï¼å符串,éå¼ï¼ |
| | | */ |
| | | private String deviceIds; |
| | | |
| | | /** |
| | | * 设å¤åç§°éåï¼å符串,éå¼ï¼ |
| | | */ |
| | | @TableField(exist = false) |
| | | private String deviceNameStr; |
| | | /** |
| | | * å¤ä»¶ç¶id |
| | | */ |
| | |
| | | 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.measuringinstrumentledger.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | 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.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class SparePartsServiceImpl extends ServiceImpl<SparePartsMapper, SpareParts> implements SparePartsService { |
| | | @Autowired |
| | | private SparePartsMapper sparePartsMapper; |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Override |
| | | public IPage<SparePartsDto> listPage(Page page, SpareParts spareParts) { |
| | | IPage<SparePartsDto> sparePartsDtoIPage = sparePartsMapper.listPage(page, spareParts); |
| | | for (SparePartsDto record : sparePartsDtoIPage.getRecords()) { |
| | | if(StringUtils.isNotEmpty(record.getDeviceIds())){ |
| | | List<String> deviceIds = StringUtils.str2List(record.getDeviceIds(), ",", true, true); |
| | | List<DeviceLedger> deviceLedgers = deviceLedgerMapper.selectBatchIds(deviceIds); |
| | | if(CollectionUtils.isNotEmpty(deviceLedgers)){ |
| | | record.setDeviceNameStr(deviceLedgers.stream().map(DeviceLedger::getDeviceName).collect(Collectors.joining( ","))); |
| | | } |
| | | } |
| | | } |
| | | return sparePartsDtoIPage; |
| | | return sparePartsMapper.listPage(page,spareParts); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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-hxsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |