Browse Source

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 7 months ago
parent
commit
bdaa0d8956

+ 2 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/WorkOrderRelationBean.java

@@ -5,6 +5,7 @@ import com.gree.mall.manager.plus.entity.*;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -15,6 +16,7 @@ public class WorkOrderRelationBean  extends ItfTblWorkOrder{
     private List<ItfTblWorkOrderFeedback> feedbackRespList;
 
     private List<ItfTblCollectionChargeBean> collectionChargeList;
+    List<ItfTblWorkOrderDetail> tblWorkOrderDetailList ;
 
 
     private List<ItfTblOldProductOrderDetail> tblOldProductOrderDetailList;

+ 9 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/policy/MailboxController.java

@@ -20,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.mail.MessagingException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -134,4 +135,12 @@ public class MailboxController {
         return ResponseHelper.success();
     }
 
+
+    @ApiOperation(value = "回执")
+    @PostMapping("huizhi")
+    public ResponseHelper huizhi() throws IOException, MessagingException {
+        agreementLogic.receEmail();
+        return ResponseHelper.success();
+    }
+
 }

+ 10 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/SyncOrderInfoLogic.java

@@ -103,6 +103,9 @@ public class SyncOrderInfoLogic {
     @Autowired
     ItfTblCollectionChargeService itfTblCollectionChargeService;
 
+    @Autowired
+    ItfTblWorkOrderDetailService itfTblWorkOrderDetailService;
+
 
     @Autowired
     ItfTblCollectionChargeDetailService itfTblCollectionChargeDetailService;
@@ -374,6 +377,7 @@ public class SyncOrderInfoLogic {
             List<ItfTblCollectionRepairPart> collectionRepairPartList = new ArrayList<>();
             List<ItfTblCollectionRepairProject> collectionRepairProjectList = new ArrayList<>();
             List<ItfTblCollectionRepair> collectionRepairSymptomReasonList = new ArrayList<>();
+            List<ItfTblWorkOrderDetail> tblWorkOrderDetailList = new ArrayList<>();
 
             List<ItfTblWorkOrder> itfTblWorkOrders = new ArrayList<>();
 
@@ -385,6 +389,8 @@ public class SyncOrderInfoLogic {
 
                 itfGreeSynDownloadRecBean.setDownloadBatchNo(batch);
 
+                tblWorkOrderDetailList.addAll(itfGreeSynDownloadRecBean.getTblWorkOrderDetailList());
+
 
                 feedbackRespList.addAll(itfGreeSynDownloadRecBean.getFeedbackRespList());
 
@@ -437,6 +443,10 @@ public class SyncOrderInfoLogic {
 
             feedbackRespList.stream().forEach(item -> item.setDownloadBatchNo(batch));
             itfTblWorkOrderFeedbackService.saveBatch(feedbackRespList);
+
+            tblWorkOrderDetailList.stream().forEach(item -> item.setDownloadBatchNo(batch));
+            itfTblWorkOrderDetailService.saveBatch(tblWorkOrderDetailList);
+
             collectionChargeList.stream().forEach(item -> item.setDownloadBatchNo(batch));
             itfTblCollectionChargeService.saveBatch(collectionChargeList);
             collectionChargeDetails.stream().forEach(item -> item.setDownloadBatchNo(batch));

+ 17 - 3
mall-server-api/src/main/java/com/gree/mall/manager/logic/policy/AgreementLogic.java

@@ -308,7 +308,7 @@ public class AgreementLogic {
         //分发邮件
 
         for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
-            emailUtilsNew.send(s,mailbox.getSendPassword(),"工伤险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
+            emailUtilsNew.send(s,mailbox.getSendMailbox(),"工伤险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
                     +mailbox.getSendName()+"保险人员名单详情见附件",filePath);
         }
 
@@ -360,7 +360,7 @@ public class AgreementLogic {
         //分发邮件
 
         for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
-            emailUtilsNew.send(s,mailbox.getSendPassword(),"雇主险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
+            emailUtilsNew.send(s,mailbox.getSendMailbox(),"雇主险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
                     +mailbox.getSendName()+"保险人员名单详情见附件",filePath);
         }
 
@@ -404,6 +404,7 @@ public class AgreementLogic {
         String filePath = String.format("%s-%s.xlsx",path,mailboxSendRecord.getSendBatch()+"-意外险");
         ExcelData excelData = new ExcelData();
         excelData.setTitles(Arrays.asList(titles));
+        excelData.setRows(rows);
         ExcelUtils.createExcel(filePath,excelData);
         File excel = new File(filePath);
 
@@ -413,7 +414,7 @@ public class AgreementLogic {
         //分发邮件
 
         for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
-            emailUtilsNew.send(s,mailbox.getSendPassword(),"意外险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
+            emailUtilsNew.send(s,mailbox.getSendMailbox(),"意外险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
                     +mailbox.getSendName()+"保险人员名单详情见附件",filePath);
         }
 
@@ -426,6 +427,7 @@ public class AgreementLogic {
         agreementService.removeById(id);
     }
 
+    @Transactional(rollbackFor = Exception.class)
     public void sendEmailSche() {
 
 
@@ -485,6 +487,9 @@ public class AgreementLogic {
                 mailboxSendRecordPolicy.setPolicyType(PolicyTypeEnum.AC.getKey());
 
                 mailboxSendRecordPolicies.add(mailboxSendRecordPolicy);
+
+                policyOrder.setIsSend(IsYesNoEnum.YES.getKey());
+                policyOrder.updateById();
             }
 
             mailboxSendRecord.insert();
@@ -546,6 +551,9 @@ public class AgreementLogic {
 
 
                 mailboxSendRecordPolicies.add(mailboxSendRecordPolicy);
+
+                policyOrder.setIsSend(IsYesNoEnum.YES.getKey());
+                policyOrder.updateById();
             }
 
             mailboxSendRecord.insert();
@@ -603,6 +611,9 @@ public class AgreementLogic {
 
 
                     mailboxSendRecordPolicies.add(mailboxSendRecordPolicy);
+
+                    policyOrder.setIsSend(IsYesNoEnum.YES.getKey());
+                    policyOrder.updateById();
                 }
 
                 mailboxSendRecord.insert();
@@ -794,4 +805,7 @@ public class AgreementLogic {
         }
 
     }
+
+    public void huizhi() {
+    }
 }

+ 22 - 11
mall-server-api/src/main/java/com/gree/mall/manager/utils/email/EmailUtilsNew.java

@@ -10,6 +10,10 @@ import javax.activation.DataHandler;
 import javax.activation.FileDataSource;
 import javax.mail.*;
 import javax.mail.internet.*;
+import javax.mail.search.AndTerm;
+import javax.mail.search.FromTerm;
+import javax.mail.search.SearchTerm;
+import javax.mail.search.SentDateTerm;
 
 
 import java.io.IOException;
@@ -20,7 +24,7 @@ import java.util.Properties;
 @Slf4j
 public class EmailUtilsNew {
 
-    private static final String ALIDM_SMTP_HOST = "smtpdm.aliyun.com";
+    private static final String ALIDM_SMTP_HOST = "smtp.exmail.qq.com";
     private static final int ALIDM_SMTP_PORT = 80;// 或80
 
 
@@ -139,7 +143,7 @@ public class EmailUtilsNew {
 
         Properties props = new Properties();
         props.setProperty("mail.store.protocol", "imap");
-        props.setProperty("mail.imap.host", "imap.qq.com");
+        props.setProperty("mail.imap.host", ALIDM_SMTP_HOST);
         props.setProperty("mail.imap.port", "993");
         props.setProperty("mail.imap.auth.login.disable", "true");
         props.setProperty("mail.imap.ssl.enable", "true");
@@ -150,7 +154,7 @@ public class EmailUtilsNew {
         IAM.put("name","李斌");
         IAM.put("version","1.0.0");
         IAM.put("vendor","myclient");
-        IAM.put("support-email","15920909481@163.com");
+        IAM.put("support-email","17607626121@163.com");
 
         Session session = Session.getInstance(props, new Authenticator() {
             public PasswordAuthentication getPasswordAuthentication() {
@@ -158,17 +162,24 @@ public class EmailUtilsNew {
                 return new PasswordAuthentication(user, password);
             }
         });
-        IMAPStore store = (IMAPStore)session.getStore("imap");
+        Store store = (IMAPStore)session.getStore("imap");
         // imap.qq.com
-        store.connect("imap.163.com", user, password);
-        store.id(IAM);
+        store.connect(ALIDM_SMTP_HOST, user, password);
+
+
         // 获得邮箱内的邮件夹Folder对象,以"只读"打开
-        Folder folder = store.getFolder("INBOX");
+        Folder inbox = store.getFolder("INBOX");
+
         //folder.open(Folder.READ_ONLY);
-        folder.open(Folder.READ_WRITE);
+        inbox.open(Folder.READ_WRITE);
+
+        SearchTerm sinceTerm = new SentDateTerm(SentDateTerm.GE, DateUtil.beginOfDay(new Date()));
+        SearchTerm sentDateTerm = new SentDateTerm(SentDateTerm.GE, DateUtil.beginOfDay(new Date()));
+
+        SearchTerm searchTerm = new AndTerm(sinceTerm,sentDateTerm);
 
         // 获得邮件夹Folder内的所有邮件Message对象
-        Message [] messages = folder.getMessages();
+        Message [] messages = inbox.search(searchTerm);
 
         int mailCounts = messages.length;
         for(int i = 0; i < mailCounts; i++) {
@@ -179,7 +190,7 @@ public class EmailUtilsNew {
             //今天接收的邮件
             if(receivedDate.getTime() > DateUtil.beginOfDay(new Date()).getTime() && from.indexOf(receEmail) > -1){
                 messages[i].setFlag(Flags.Flag.SEEN, true);
-                folder.close(false);
+                inbox.close(false);
                 store.close();
                 return true;
             }
@@ -195,7 +206,7 @@ public class EmailUtilsNew {
 //                messages[i].writeTo(System.out);
 //            }
         }
-        folder.close(false);
+        inbox.close(false);
         store.close();
         return false;
     }

+ 1 - 0
mall-server-api/src/main/java/com/gree/mall/manager/utils/excel/ExcelUtils.java

@@ -202,6 +202,7 @@ public class ExcelUtils {
             build.write(excelData.getRows(),writeSheet).finish();
             // 关闭流
             out.flush();
+            out.close();
         } catch (FileNotFoundException e) {
             throw new RuntimeException(e);
         } catch (IOException e) {