| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.constant.MenuJumpPathConstants; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.device.dto.DeviceExamineRecordDto; |
| | | import com.ruoyi.device.mapper.DeviceExaminePlanDetailsMapper; |
| | | import com.ruoyi.device.mapper.DeviceExamineRecordMapper; |
| | |
| | | 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.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private DeviceMapper deviceMapper; |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | |
| | | @Resource |
| | | private InformationNotificationService informationNotificationService; |
| | | |
| | | /** |
| | | * 查询核查记录 |
| | |
| | | if (deviceExamineRecordDto.getReviewUserId() != null) { |
| | | User reviewUser = userMapper.selectById(deviceExamineRecordDto.getReviewUserId()); |
| | | deviceExamineRecordDto.setReviewUser(reviewUser.getName()); |
| | | |
| | | // 消息发送 |
| | | InformationNotification info = new InformationNotification(); |
| | | // 发送人 |
| | | info.setCreateUser(user.getName()); |
| | | info.setMessageType("6"); |
| | | info.setTheme("CNAS设备核查计划待批准"); |
| | | info.setContent("设备编号为: " + deviceExamineRecordDto.getDeviceNumber() + " 设备核查计划待审批"); |
| | | info.setSenderId(userId); |
| | | // 接收人 |
| | | info.setConsigneeId(deviceExamineRecordDto.getReviewUserId()); |
| | | info.setJumpPath(MenuJumpPathConstants.DEVICE); |
| | | informationNotificationService.addInformationNotification(info); |
| | | |
| | | // 发送企业微信通知 |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // 查询发送人 |
| | | User people = userMapper.selectById(deviceExamineRecordDto.getReviewUserId()); |
| | | String message = ""; |
| | | message += "CNAS设备核查计划待批准"; |
| | | message += "\n请去资源要求-设备-设备核查计划审批"; |
| | | message += "\n" + "设备编号为: " + deviceExamineRecordDto.getDeviceNumber() + "设备核查计划待审批"; |
| | | //发送企业微信消息通知 |
| | | try { |
| | | WxCpUtils.inform(people.getAccount(), message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导出失败"); |