cnas-device/src/main/java/com/ruoyi/device/controller/DeviceExaminePlanController.java
@@ -90,7 +90,7 @@ * @return */ @ApiOperation(value = "è®¾å¤æ ¸æ¥è®¡åå é¤") @GetMapping("/delQualitySupervise") @DeleteMapping("/delQualitySupervise") public Result delQualitySupervise(Integer planId){ return Result.success(deviceExaminePlanService.removeById(planId)); } @@ -122,7 +122,7 @@ * @return */ @ApiOperation(value = "è®¾å¤æ ¸æ¥è®¡åå表") @PostMapping("/pageDeviceExaminePlan") @GetMapping("/pageDeviceExaminePlan") public Result<IPage<DeviceExaminePlanDto>> pageDeviceExaminePlan(Page page, DeviceExaminePlan DeviceExaminePlan) { return Result.success(deviceExaminePlanService.pageDeviceExaminePlan(page, DeviceExaminePlan)); } @@ -132,7 +132,7 @@ * @return */ @ApiOperation(value = "è®¾å¤æ ¸æ¥è®¡å详æ å表") @PostMapping("/pageDeviceExaminePlanDetail") @GetMapping("/pageDeviceExaminePlanDetail") public Result<IPage<DeviceExaminePlanDetails>> pageDeviceExaminePlanDetail(Page page, DeviceExaminePlanDetails deviceExaminePlanDetails) { return Result.success(deviceExaminePlanService.pageDeviceExaminePlanDetail(page, deviceExaminePlanDetails)); } @@ -165,7 +165,7 @@ * @return */ @ApiOperation(value = "å é¤è®¾å¤æ ¸æ¥è®¡å详æ ") @GetMapping("/delDeviceExaminePlanDetail") @DeleteMapping("/delDeviceExaminePlanDetail") public Result delDeviceExaminePlanDetail(Integer planDetailsId){ return Result.success(deviceExaminePlanDetailsService.removeById(planDetailsId)); } cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenancePlanController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,108 @@ package com.ruoyi.device.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.Result; import com.ruoyi.device.dto.DeviceMaintenancePlanDto; import com.ruoyi.device.pojo.DeviceMaintenancePlan; import com.ruoyi.device.service.DeviceMaintenancePlanService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.SneakyThrows; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.Map; /** * <p> * 设å¤ä¿å »è®¡å表 å端æ§å¶å¨ * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:10:52 */ @Api(tags = "设å¤ä¿å »è®¡å") @RestController @RequestMapping("/deviceMaintenancePlan") public class DeviceMaintenancePlanController { @Resource private DeviceMaintenancePlanService deviceMaintenancePlanService; /** * å页æ¥è¯¢è®¾å¤ä¿å »è®¡å * @return */ @ApiOperation("å页æ¥è¯¢è®¾å¤ä¿å »è®¡å") @GetMapping("selectDeviceMaintenancePlanByPage") public Result<IPage<DeviceMaintenancePlan>> selectDeviceMaintenancePlanByPage(IPage page, DeviceMaintenancePlanDto itemParameter){ return deviceMaintenancePlanService.selectDeviceMaintenancePlanByPage(page, itemParameter); } /** * æ°å¢è®¾å¤ä¿å »è®¡å * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @ApiOperation("æ°å¢è®¾å¤ä¿å »è®¡å") @PostMapping("/addMaintenancePlan") public Result addMaintenancePlan(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) { return deviceMaintenancePlanService.addMaintenancePlan(deviceMaintenancePlanDto); } /** * ä¿®æ¹è®¾å¤ä¿å »è®¡å * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @ApiOperation("ä¿®æ¹è®¾å¤ä¿å »è®¡å") @PostMapping("/updateMaintenancePlan") public Result updateMaintenancePlan(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) { return deviceMaintenancePlanService.updateMaintenancePlan(deviceMaintenancePlanDto); } /** * å é¤è®¾å¤ä¿å »è®¡å * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @ApiOperation("å é¤è®¾å¤ä¿å »è®¡å") @GetMapping("/deleteMaintenancePlan") public Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { return deviceMaintenancePlanService.deleteMaintenancePlan(deviceMaintenancePlanDto); } /** * æ¥è¯¢è®¾å¤ä¿å »è®¡å详æ */ @ApiOperation("æ¥è¯¢è®¾å¤ä¿å »è®¡å详æ ") @GetMapping("/getMaintenancePlanDetail") public Result<DeviceMaintenancePlanDto> getMaintenancePlanDetail(Integer maintenancePlanId) { return deviceMaintenancePlanService.getMaintenancePlanDetail(maintenancePlanId); } /** * 导åºè®¾å¤ä¿å »è®¡å */ @ApiOperation("导åºè®¾å¤ä¿å »è®¡å") @GetMapping("/exportDeviceMaintenancePlan") public Result exportDeviceMaintenancePlan(@RequestParam("maintenancePlanId") Integer maintenancePlanId, HttpServletResponse response) { return deviceMaintenancePlanService.exportDeviceMaintenancePlanDto(maintenancePlanId, response); } /** * æäº¤å®¡æ ¸ */ @ApiOperation("æäº¤å®¡æ ¸") @PostMapping("/submitReviewMaintenancePlanStatus") public Result submitReviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) { return deviceMaintenancePlanService.submitReviewMaintenancePlanStatus(deviceMaintenancePlanDto); } /** * å®¡æ ¸è®¾å¤ä¿å »è®¡åç¶æ */ @ApiOperation("å®¡æ ¸è®¾å¤ä¿å »è®¡åç¶æ") @PostMapping("/reviewMaintenancePlanStatus") public Result reviewMaintenancePlanStatus(@RequestBody DeviceMaintenancePlanDto deviceMaintenancePlanDto) { return deviceMaintenancePlanService.reviewMaintenancePlanStatus(deviceMaintenancePlanDto); } } cnas-device/src/main/java/com/ruoyi/device/dto/DeviceMaintenancePlanDetailsDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ package com.ruoyi.device.dto; import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * Author: yuan * Date: 2024-12-17 ææäº 9:26:48 * Description: 设å¤ä¿å »è®¡å详æ */ @Data public class DeviceMaintenancePlanDetailsDto extends DeviceMaintenancePlanDetails { @ApiModelProperty("åºå·") private Integer index; @ApiModelProperty("仪å¨è®¾å¤åç§°") private String deviceName; @ApiModelProperty("仪å¨è®¾å¤ç¼å·") private String deviceNumber; @ApiModelProperty("仪å¨è®¾å¤åå·") private String specificationModel; @ApiModelProperty("仪å¨ç¼å·") private String managementNumber; @ApiModelProperty("å½å±å®éªå®¤") private String storagePoint; } cnas-device/src/main/java/com/ruoyi/device/dto/DeviceMaintenancePlanDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,30 @@ package com.ruoyi.device.dto; import com.baomidou.mybatisplus.annotation.TableField; import com.ruoyi.device.pojo.DeviceMaintenancePlan; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; /** * Author: yuan * Date: 2024-12-16 ææä¸ 18:26:59 * Description: */ @Data public class DeviceMaintenancePlanDto extends DeviceMaintenancePlan { @ApiModelProperty("设å¤ä¿å »è®¡å详æ ") @TableField(exist = false) private List<DeviceMaintenancePlanDetailsDto> deviceMaintenancePlanDetails; @ApiModelProperty("ç¼å¶æ¥æ") private String datePreparationStr; @ApiModelProperty("å®¡æ ¸æ¥æ") private String auditDateStr; @ApiModelProperty("设å¤Id") private Integer deviceId; } cnas-device/src/main/java/com/ruoyi/device/mapper/DeviceMaintenancePlanDetailsMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ package com.ruoyi.device.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto; import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails; import org.apache.ibatis.annotations.Param; import java.util.List; /** * <p> * 设å¤ä¿å »è®¡å详æ 表 Mapper æ¥å£ * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:11:46 */ public interface DeviceMaintenancePlanDetailsMapper extends BaseMapper<DeviceMaintenancePlanDetails> { /** * æ¥è¯¢è®¾å¤ä¿å »è¯¦æ * @param maintenancePlanId 设å¤ä¿å »è®¡åid */ List<DeviceMaintenancePlanDetailsDto> deviceInspectionRecordDetailsList(@Param("maintenancePlanId") Integer maintenancePlanId); } cnas-device/src/main/java/com/ruoyi/device/mapper/DeviceMaintenancePlanMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,34 @@ package com.ruoyi.device.mapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ruoyi.device.dto.DeviceMaintenancePlanDto; import com.ruoyi.device.pojo.DeviceMaintenancePlan; import org.apache.ibatis.annotations.Param; /** * <p> * 设å¤ä¿å »è®¡å表 Mapper æ¥å£ * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:10:52 */ public interface DeviceMaintenancePlanMapper extends BaseMapper<DeviceMaintenancePlan> { /** * å页æ¥è¯¢è®¾å¤ä¿å »è®¡å * @param page å½å页 * @param queryWrappers æ¥è¯¢æ¡ä»¶ * @return */ IPage<DeviceMaintenancePlan> selectDeviceParameterPage(IPage page, @Param("ew") QueryWrapper<DeviceMaintenancePlanDto> queryWrappers); /** * æ ¹æ®ä¿å »è®¡åidæ¥è¯¢è®¾å¤ä¿å »è®¡å * @param maintenancePlanId ä¿å »è®¡åid * @return */ DeviceMaintenancePlanDto selectMaintenancePlanById(@Param("maintenancePlanId") Integer maintenancePlanId); } cnas-device/src/main/java/com/ruoyi/device/pojo/DeviceMaintenancePlan.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,75 @@ package com.ruoyi.device.pojo; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.io.Serializable; import java.time.LocalDateTime; /** * <p> * 设å¤ä¿å »è®¡å表 * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:10:52 */ @Getter @Setter @TableName("device_maintenance_plan") @ApiModel(value = "DeviceMaintenancePlan对象", description = "设å¤ä¿å »è®¡å表") public class DeviceMaintenancePlan implements Serializable { @ApiModelProperty("设å¤ä¿å »è®¡åid") @TableId(value = "maintenance_plan_id", type = IdType.AUTO) private Integer maintenancePlanId; @ApiModelProperty("ç¼å¶äºº") private String compiler; @ApiModelProperty("计ååç§°") private String planName; @ApiModelProperty("计å年份") private String planYear; @ApiModelProperty("ç¼å¶äººid") private Integer compilerId; @ApiModelProperty("ç¼å¶æ¥æ") private LocalDateTime datePreparation; @ApiModelProperty("å®¡æ ¸ç¶æï¼0æªå®¡æ ¸ï¼1å®¡æ ¸") private Integer status; @ApiModelProperty("å®¡æ ¸äººid") private Integer auditId; @ApiModelProperty("å®¡æ ¸äºº") private String audit; @ApiModelProperty("å®¡æ ¸æ¥æ") private LocalDateTime auditDate; @ApiModelProperty("å®¡æ ¸ä¿¡æ¯") private String auditRemark; @ApiModelProperty("å建人") @TableField(fill = FieldFill.INSERT) private Integer createUser; @ApiModelProperty("å建æ¶é´") @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; @ApiModelProperty("ä¿®æ¹äºº") @TableField(fill = FieldFill.INSERT_UPDATE) private Integer updateUser; @ApiModelProperty("ä¿®æ¹æ¶é´") @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; } cnas-device/src/main/java/com/ruoyi/device/pojo/DeviceMaintenancePlanDetails.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,62 @@ package com.ruoyi.device.pojo; import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import java.io.Serializable; import java.time.LocalDateTime; /** * <p> * 设å¤ä¿å »è®¡å详æ 表 * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:11:46 */ @Getter @Setter @TableName("device_maintenance_plan_details") @ApiModel(value = "DeviceMaintenancePlanDetails对象", description = "设å¤ä¿å »è®¡å详æ 表") public class DeviceMaintenancePlanDetails implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("ä¿å »è®¡å详æ id") @TableId(value = "maintenance_plan_detail_id", type = IdType.AUTO) private Integer maintenancePlanDetailId; @ApiModelProperty("ä¿å »è®¡åid") private Integer maintenancePlanId; @ApiModelProperty("设å¤id") private Integer deviceId; @ApiModelProperty("ä¿å »å ³é®é¨ä½") private String maintenanceSite; @ApiModelProperty("ä¿å »å 容") private String maintenanceContent; @ApiModelProperty("ä¿å »å¨æ") private String maintenanceIntervals; @ApiModelProperty("å建人") @TableField(fill = FieldFill.INSERT) private Integer createUser; @ApiModelProperty("å建æ¶é´") @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; @ApiModelProperty("ä¿®æ¹äºº") @TableField(fill = FieldFill.INSERT_UPDATE) private Integer updateUser; @ApiModelProperty("ä¿®æ¹æ¶é´") @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; } cnas-device/src/main/java/com/ruoyi/device/service/DeviceMaintenancePlanDetailsService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,17 @@ package com.ruoyi.device.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails; /** * <p> * 设å¤ä¿å »è®¡å详æ 表 æå¡ç±» * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:11:46 */ public interface DeviceMaintenancePlanDetailsService extends IService<DeviceMaintenancePlanDetails> { } cnas-device/src/main/java/com/ruoyi/device/service/DeviceMaintenancePlanService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,78 @@ package com.ruoyi.device.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.Result; import com.ruoyi.device.dto.DeviceMaintenancePlanDto; import com.ruoyi.device.pojo.DeviceMaintenancePlan; import javax.servlet.http.HttpServletResponse; /** * <p> * 设å¤ä¿å »è®¡å表 æå¡ç±» * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:10:52 */ public interface DeviceMaintenancePlanService extends IService<DeviceMaintenancePlan> { /** * å页æ¥è¯¢è®¾å¤ä¿å »è®¡å * @param page å½å页 * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å * @return */ Result<IPage<DeviceMaintenancePlan>> selectDeviceMaintenancePlanByPage(IPage page, DeviceMaintenancePlanDto deviceMaintenancePlanDto); /** * æ°å¢è®¾å¤ä¿å »è®¡å * * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ Result addMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto); /** * ä¿®æ¹è®¾å¤ä¿å »è®¡å * * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ Result updateMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto); /** * å é¤è®¾å¤ä¿å »è®¡å * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto); /** * 导åºè®¾å¤ä¿å »è®¡å * * @param maintenancePlanId 设å¤ä¿å »è®¡åid * @param response ååº */ Result exportDeviceMaintenancePlanDto(Integer maintenancePlanId, HttpServletResponse response); /** * æ¥ç设å¤ä¿å »è®¡å详æ * @param maintenancePlanId 设å¤ä¿å »è®¡åid * @return */ Result<DeviceMaintenancePlanDto> getMaintenancePlanDetail(Integer maintenancePlanId); /** * æäº¤å®¡æ ¸ * @param deviceMaintenancePlanDto * @return */ Result submitReviewMaintenancePlanStatus(DeviceMaintenancePlanDto deviceMaintenancePlanDto); /** * å®¡æ ¸è®¾å¤ä¿å »è®¡åç¶æ * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å * @return */ Result reviewMaintenancePlanStatus(DeviceMaintenancePlanDto deviceMaintenancePlanDto); } cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenancePlanDetailsServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,20 @@ package com.ruoyi.device.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.device.mapper.DeviceMaintenancePlanDetailsMapper; import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails; import com.ruoyi.device.service.DeviceMaintenancePlanDetailsService; import org.springframework.stereotype.Service; /** * <p> * 设å¤ä¿å »è®¡å详æ 表 æå¡å®ç°ç±» * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:11:46 */ @Service public class DeviceMaintenancePlanDetailsServiceImpl extends ServiceImpl<DeviceMaintenancePlanDetailsMapper, DeviceMaintenancePlanDetails> implements DeviceMaintenancePlanDetailsService { } cnas-device/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenancePlanServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,289 @@ package com.ruoyi.device.service.impl; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.entity.InformationNotification; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.utils.QueryWrappers; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.WxCpUtils; import com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto; import com.ruoyi.device.dto.DeviceMaintenancePlanDto; import com.ruoyi.device.mapper.DeviceMaintenancePlanDetailsMapper; import com.ruoyi.device.mapper.DeviceMaintenancePlanMapper; import com.ruoyi.device.pojo.DeviceMaintenancePlan; import com.ruoyi.device.pojo.DeviceMaintenancePlanDetails; import com.ruoyi.device.service.DeviceMaintenancePlanDetailsService; import com.ruoyi.device.service.DeviceMaintenancePlanService; import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; import com.ruoyi.inspect.util.UserUtils; import com.ruoyi.system.mapper.UserMapper; import com.ruoyi.system.service.InformationNotificationService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.io.OutputStream; import java.net.URLEncoder; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; /** * <p> * 设å¤ä¿å »è®¡å表 æå¡å®ç°ç±» * </p> * * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-12-16 06:10:52 */ @Service public class DeviceMaintenancePlanServiceImpl extends ServiceImpl<DeviceMaintenancePlanMapper, DeviceMaintenancePlan> implements DeviceMaintenancePlanService { @Resource private DeviceMaintenancePlanDetailsService deviceMaintenancePlanDetailsService; @Resource private DeviceMaintenancePlanDetailsMapper deviceMaintenancePlanDetailsMapper; @Resource private ThreadPoolTaskExecutor threadPoolTaskExecutor; @Resource private InformationNotificationService informationNotificationService; @Resource private UserMapper userMapper; /** * å页æ¥è¯¢è®¾å¤ä¿å »è®¡å * * @param page * @return */ @Override public Result<IPage<DeviceMaintenancePlan>> selectDeviceMaintenancePlanByPage(IPage page, DeviceMaintenancePlanDto deviceMaintenancePlanDto) { IPage<DeviceMaintenancePlan> iPage = baseMapper.selectDeviceParameterPage(page, QueryWrappers.queryWrappers(deviceMaintenancePlanDto)); return Result.success(iPage); } /** * æ°å¢è®¾å¤ä¿å »è®¡å * * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @Override public Result addMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { Integer userId = SecurityUtils.getUserId().intValue(); User user = userMapper.selectById(userId); deviceMaintenancePlanDto.setCompilerId(userId); deviceMaintenancePlanDto.setCompiler(user.getName()); deviceMaintenancePlanDto.setDatePreparation(LocalDateTime.now()); // æ¥è¯¢å®¡æ ¸äººid if (deviceMaintenancePlanDto.getAuditId() != null) { User auditUser = userMapper.selectById(deviceMaintenancePlanDto.getAuditId()); deviceMaintenancePlanDto.setAudit(auditUser.getName()); } this.saveOrUpdate(deviceMaintenancePlanDto); // 详æ èµå¼å¹¶ä¿å List<DeviceMaintenancePlanDetailsDto> deviceMaintenancePlanDetails = deviceMaintenancePlanDto.getDeviceMaintenancePlanDetails(); if (CollectionUtils.isNotEmpty(deviceMaintenancePlanDetails)) { // 详æ ä¸ä¸ºç©º List<DeviceMaintenancePlanDetails> collect = deviceMaintenancePlanDetails.stream().map(deviceMaintenancePlanDetail -> { // éå详æ deviceMaintenancePlanDetail.setDeviceId(deviceMaintenancePlanDetail.getDeviceId()); // 设å¤ID deviceMaintenancePlanDetail.setMaintenancePlanId(deviceMaintenancePlanDto.getMaintenancePlanId()); // ä¿å »è®¡åID DeviceMaintenancePlanDetails planDetails = new DeviceMaintenancePlanDetails(); BeanUtils.copyProperties(deviceMaintenancePlanDetail, planDetails); return planDetails; }).collect(Collectors.toList()); deviceMaintenancePlanDetailsService.saveBatch(collect); } return Result.success(); } /** * ä¿®æ¹è®¾å¤ä¿å »è®¡å * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @Override public Result updateMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { // æ¥è¯¢å®¡æ ¸äººid if (deviceMaintenancePlanDto.getAuditId() != null) { User auditUser = userMapper.selectById(deviceMaintenancePlanDto.getAuditId()); deviceMaintenancePlanDto.setAudit(auditUser.getName()); } this.saveOrUpdate(deviceMaintenancePlanDto); // å é¤åæ¬ç详æ deviceMaintenancePlanDetailsService.remove(Wrappers.<DeviceMaintenancePlanDetails>lambdaQuery().eq(DeviceMaintenancePlanDetails::getMaintenancePlanId, deviceMaintenancePlanDto.getMaintenancePlanId())); // 详æ èµå¼å¹¶ä¿å List<DeviceMaintenancePlanDetailsDto> deviceMaintenancePlanDetails = deviceMaintenancePlanDto.getDeviceMaintenancePlanDetails(); if (CollectionUtils.isNotEmpty(deviceMaintenancePlanDetails)) { // 详æ ä¸ä¸ºç©º List<DeviceMaintenancePlanDetails> collect = deviceMaintenancePlanDetails.stream().map(deviceMaintenancePlanDetail -> { // éå详æ deviceMaintenancePlanDetail.setDeviceId(deviceMaintenancePlanDto.getDeviceId()); // 设å¤ID deviceMaintenancePlanDetail.setMaintenancePlanId(deviceMaintenancePlanDto.getMaintenancePlanId()); // ä¿å »è®¡åID DeviceMaintenancePlanDetails planDetails = new DeviceMaintenancePlanDetails(); BeanUtils.copyProperties(deviceMaintenancePlanDetail, planDetails); return planDetails; }).collect(Collectors.toList()); deviceMaintenancePlanDetailsService.saveBatch(collect); } return Result.success(); } /** * å é¤è®¾å¤ä¿å »è®¡å * * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @Override public Result deleteMaintenancePlan(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { this.removeById(deviceMaintenancePlanDto); deviceMaintenancePlanDetailsService.remove(Wrappers.<DeviceMaintenancePlanDetails>lambdaQuery().eq(DeviceMaintenancePlanDetails::getMaintenancePlanId, deviceMaintenancePlanDto.getMaintenancePlanId())); return Result.success(); } /** * 导åºè®¾å¤ä¿å »è®¡å * * @param maintenancePlanId 设å¤ä¿å »è®¡åid * @param response ååº */ @Override public Result exportDeviceMaintenancePlanDto(Integer maintenancePlanId, HttpServletResponse response) { // æ¥è¯¢è®¾å¤ä¿å »è®¡å DeviceMaintenancePlanDto deviceMaintenancePlan = baseMapper.selectMaintenancePlanById(maintenancePlanId); // æ¥è¯¢è®¾å¤ä¿å »è®¡å详æ List<DeviceMaintenancePlanDetailsDto> deviceMaintenancePlanDetailsDtoList = deviceMaintenancePlanDetailsMapper.deviceInspectionRecordDetailsList(maintenancePlanId); // 设置åºå· deviceMaintenancePlanDetailsDtoList.forEach(deviceInspectionRecordDetails -> { deviceInspectionRecordDetails.setIndex(deviceMaintenancePlanDetailsDtoList.indexOf(deviceInspectionRecordDetails) + 1); }); // è·åè·¯å¾ InputStream inputStream = this.getClass().getResourceAsStream("/static/word/maintenance-plan.docx"); Configure configure = Configure.builder() .bind("deviceMaintenancePlanDetailsDtoList", new HackLoopTableRenderPolicy()) .build(); XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( new HashMap<String, Object>() {{ put("deviceMaintenancePlan", deviceMaintenancePlan); put("deviceMaintenancePlanDetailsDtoList", deviceMaintenancePlanDetailsDtoList); // ç¼å¶äººç¾åå°å put("compilerUrl", UserUtils.getFinalUserSignatureUrl(deviceMaintenancePlan.getCompilerId())); // å®¡æ ¸äººç¾åå°å put("auditUrl", UserUtils.getFinalUserSignatureUrl(deviceMaintenancePlan.getAuditId())); }}); try { response.setContentType("application/msword"); String fileName = URLEncoder.encode( "设å¤ä¿å »è®¡å表", "UTF-8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".docx"); OutputStream os = response.getOutputStream(); template.write(os); os.flush(); os.close(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("导åºå¤±è´¥"); } return Result.success(); } /** * æ¥è¯¢è®¾å¤ä¿å »è®¡å详æ * * @param maintenancePlanId 设å¤ä¿å »è®¡åid */ @Override public Result<DeviceMaintenancePlanDto> getMaintenancePlanDetail(Integer maintenancePlanId) { // æ¥è¯¢è®¾å¤ä¿å »è®¡å DeviceMaintenancePlan deviceMaintenancePlan = baseMapper.selectById(maintenancePlanId); // æ¥è¯¢è¯¦æ DeviceMaintenancePlanDto deviceMaintenancePlanDto = new DeviceMaintenancePlanDto(); BeanUtils.copyProperties(deviceMaintenancePlan, deviceMaintenancePlanDto); deviceMaintenancePlanDto.setDeviceMaintenancePlanDetails(deviceMaintenancePlanDetailsMapper.deviceInspectionRecordDetailsList(maintenancePlanId)); return Result.success(deviceMaintenancePlanDto); } /** * æäº¤å®¡æ ¸ * @param deviceMaintenancePlanDto * @return */ @Override public Result submitReviewMaintenancePlanStatus(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { User audit = userMapper.selectById(deviceMaintenancePlanDto.getAuditId()); this.update(Wrappers.<DeviceMaintenancePlan>lambdaUpdate() .eq(DeviceMaintenancePlan::getMaintenancePlanId, deviceMaintenancePlanDto.getMaintenancePlanId()) .set(DeviceMaintenancePlan::getAuditId, audit.getId()) .set(DeviceMaintenancePlan::getAudit, audit.getName()) .set(DeviceMaintenancePlan::getStatus, null) .set(DeviceMaintenancePlan::getAuditRemark, null) .set(DeviceMaintenancePlan::getAuditDate, null) ); DeviceMaintenancePlan deviceMaintenancePlan = baseMapper.selectById(deviceMaintenancePlanDto.getMaintenancePlanId()); // åéæ¶æ¯ Integer userId = SecurityUtils.getUserId().intValue(); User user = userMapper.selectById(userId); // æ¶æ¯åé InformationNotification info = new InformationNotification(); // åé人 info.setCreateUser(user.getName()); info.setMessageType("6"); info.setTheme("CNAS设å¤ä¿å »è®¡åå®¡æ ¸éç¥"); info.setContent(deviceMaintenancePlan.getPlanYear() + "å¹´ç设å¤ä¿å »è®¡åå¾ å®¡æ ¸"); info.setSenderId(userId); // æ¥æ¶äºº info.setConsigneeId(audit.getId()); info.setJumpPath("a6-device"); informationNotificationService.addInformationNotification(info); // åéä¼ä¸å¾®ä¿¡éç¥ threadPoolTaskExecutor.execute(() -> { String message = ""; message += "CNAS设å¤ä¿å »è®¡åæ ¸éç¥"; message += "\n请å»èµæºç®¡ç-设å¤ä¸å±ç®å½-设å¤ä¿å »è®¡åå¡«å"; message += "\n" + deviceMaintenancePlan.getPlanYear() + "å¹´ç设å¤ä¿å »è®¡åå¾ æ ¸"; //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ try { WxCpUtils.inform(audit.getAccount(), message, null); } catch (Exception e) { throw new RuntimeException(e); } }); return Result.success(); } /** * å®¡æ ¸è®¾å¤ä¿å »è®¡å * * @param deviceMaintenancePlanDto 设å¤ä¿å »è®¡å */ @Override public Result reviewMaintenancePlanStatus(DeviceMaintenancePlanDto deviceMaintenancePlanDto) { LambdaUpdateWrapper<DeviceMaintenancePlan> wrapper = Wrappers.<DeviceMaintenancePlan>lambdaUpdate() .eq(DeviceMaintenancePlan::getMaintenancePlanId, deviceMaintenancePlanDto.getMaintenancePlanId()) .set(DeviceMaintenancePlan::getStatus, deviceMaintenancePlanDto.getStatus()) .set(DeviceMaintenancePlan::getAuditRemark, deviceMaintenancePlanDto.getAuditRemark()) .set(DeviceMaintenancePlan::getAuditDate, LocalDateTime.now()); this.update(wrapper); // æ´æ° return Result.success(); } } cnas-device/src/main/resources/mapper/DeviceMaintenancePlanDetailsMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.device.mapper.DeviceMaintenancePlanDetailsMapper"> <select id="deviceInspectionRecordDetailsList" resultType="com.ruoyi.device.dto.DeviceMaintenancePlanDetailsDto"> select dmpd.*, d.device_name, d.management_number device_number, d.specification_model, d.management_number, d.storage_point from device_maintenance_plan_details dmpd left join device d on dmpd.device_id = d.id where dmpd.maintenance_plan_id = #{maintenancePlanId} </select> </mapper> cnas-device/src/main/resources/mapper/DeviceMaintenancePlanMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.device.mapper.DeviceMaintenancePlanMapper"> <!-- æ ¹æ®è®¾å¤idæ¥è¯¢è®¾å¤çä¿å »è®¡å --> <select id="selectDeviceParameterPage" resultType="com.ruoyi.device.pojo.DeviceMaintenancePlan"> select * from device_maintenance_plan <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} </if> </select> <select id="selectMaintenancePlanById" resultType="com.ruoyi.device.pojo.DeviceMaintenancePlan"> select dmp.*, date_format(dmp.date_preparation, '%Y-%m-%d') as datePreparationStr, date_format(dmp.audit_date, '%Y-%m-%d') as auditDateStr from device_maintenance_plan dmp where dmp.maintenance_plan_id = #{maintenancePlanId} </select> </mapper>