il y a 1 an
Parent
commit
ca9bfd7c14

+ 31 - 0
platform-rest/src/main/java/com/platform/rest/task/RepairApplicationFormTask.java

@@ -0,0 +1,31 @@
+package com.platform.rest.task;
+
+import com.platform.service.check.CheckJobService;
+import com.platform.service.repair.RepairApplicationFormService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description 点巡检任务处理
+ * @Author liuyu
+ * @Date 2020-05-09 16:40:01
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Slf4j
+@Component("repairApplicationFormTask")
+@AllArgsConstructor
+public class RepairApplicationFormTask {
+    private RepairApplicationFormService repairApplicationFormService;
+
+    /**
+     * 点检任务生成-废弃
+     */
+    public void sendMessage () {
+        repairApplicationFormService.sendMessage();
+    }
+
+
+
+
+}

+ 3 - 3
platform-rest/src/main/resources/application-dev.yml

@@ -53,11 +53,11 @@ spring:
       maxRequestSize: "1000MB"
   mail:
     host: smtp.qq.com #发送邮件服务器
-    username: 370516181@qq.com #发送邮件的邮箱地址
-    password: aycpczvrnthpbgie #客户端授权码,不是邮箱密码,这个在qq邮箱设置里面自动生成的
+    username: 3254194295@qq.com #发送邮件的邮箱地址
+    password: nexgiwlizaenchaj #客户端授权码,不是邮箱密码,这个在qq邮箱设置里面自动生成的
     #password: p8ba59KF8wijE7yU
     properties.mail.smtp.port: 465 #端口号465或587
-    from: 370516181@qq.com # 发送邮件的地址,和上面username一致
+    from: 3254194295@qq.com # 发送邮件的地址,和上面username一致
     properties.mail.smtp.starttls.enable: true
     properties.mail.smtp.starttls.required: true
     properties.mail.smtp.ssl.enable: true

+ 1 - 0
platform-service/src/main/java/com/platform/service/repair/RepairApplicationFormService.java

@@ -25,6 +25,7 @@ import java.util.List;
  * @Version Copyright (c) 2019,北京乾元坤和科技有限公司 All rights reserved.
  */
 public interface RepairApplicationFormService extends IBaseService<RepairApplicationForm, RepairApplicationFormDTO> {
+    void sendMessage();
 
     public List<RepairApplicationFormVO> getVOListByDTO(RepairApplicationFormDTO model);
 

+ 29 - 0
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -65,6 +65,8 @@ import freemarker.template.Template;
 import freemarker.template.TemplateException;
 import lombok.AllArgsConstructor;
 import org.springframework.core.io.ClassPathResource;
+import org.springframework.mail.SimpleMailMessage;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import tk.mybatis.mapper.weekend.Weekend;
@@ -101,6 +103,33 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
     private final SbInfoService sbInfoService;
     private final SysFileMapper sysFileMapper;
     private final SysUserMapper userMapper;
+    @Resource
+    JavaMailSenderImpl mailSender;
+
+    @Override
+    public void sendMessage() {
+        Weekend<RepairApplicationForm> weekend = new Weekend(RepairApplicationForm.class);
+        weekend.weekendCriteria().andEqualTo(RepairApplicationForm::getStatus,RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
+        LocalDateTime time = LocalDateTime.now().minusHours(1);
+        weekend.weekendCriteria().andLessThan(RepairApplicationForm::getCreatedTime,time);
+        List<RepairApplicationForm> list = mapper.selectAll();
+        if (list!=null&&list.size()>0){
+            SimpleMailMessage mailMessage = new SimpleMailMessage();
+            mailMessage.setTo("janson-jian.zhang@hitachienergy.com");
+            mailMessage.setSubject("报修单超时未接单提醒");
+            mailMessage.setFrom("3254194295@qq.com");
+            StringBuffer sb = new StringBuffer();
+            sb.append("单号为:");
+            for (RepairApplicationForm form:list){
+                sb.append(form.getNo()+",");
+            }
+            String str = sb.toString().substring(0,sb.toString().length()-1);
+            str = str + "报修单已超过一小时没有人接单!";
+            mailMessage.setText(str);
+            mailSender.send(mailMessage);
+        }
+
+    }
 
     @Override
     public List<RepairApplicationFormVO> getVOListByDTO(RepairApplicationFormDTO model) {