From eb49564ab17c6695d8928d5a63a57c58b3cfd79c Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 11 十二月 2024 18:21:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java
index ad482b6..8a53ba9 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java
@@ -1,7 +1,5 @@
 package com.doumee.service.business.impl;
 
-import cn.emay.sdk.util.StringUtil;
-import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
@@ -10,13 +8,20 @@
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.DateUtil;
+import com.doumee.core.utils.SmsConstants;
 import com.doumee.core.utils.Utils;
+import com.doumee.core.wx.wxPlat.WxPlatConstants;
+import com.doumee.core.wx.wxPlat.WxPlatNotice;
 import com.doumee.dao.business.*;
+import com.doumee.dao.business.dao.SmsConfigMapper;
+import com.doumee.dao.business.dao.SmsEmailMapper;
 import com.doumee.dao.business.join.ApproveJoinMapper;
 import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.ApproveDataVO;
+
+import com.doumee.dao.system.SystemUserMapper;
 import com.doumee.dao.system.join.NoticesJoinMapper;
-import com.doumee.dao.web.reqeust.ConfirmTaskDTO;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.dao.web.reqeust.PlatformBooksApplyDTO;
 import com.doumee.dao.web.reqeust.PlatformBooksCheckNumDTO;
 import com.doumee.dao.web.reqeust.RevokeDTO;
@@ -26,8 +31,8 @@
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.doumee.service.business.third.EmayService;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.tomcat.util.bcel.Const;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -35,6 +40,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +72,9 @@
     private SystemDictDataBiz systemDictDataBiz;
 
     @Autowired
+    private SystemUserMapper systemUserMapper;
+
+    @Autowired
     private ApproveService approveService;
 
     @Autowired
@@ -77,6 +86,17 @@
     @Autowired
     private CarsMapper carsMapper;
 
+    @Autowired
+    private SmsConfigMapper smsConfigMapper;
+
+    @Autowired
+    private SmsEmailMapper smsEmailMapper;
+
+    @Autowired
+    private EmayService emayService;
+
+    @Autowired
+    private WxNoticeConfigMapper wxNoticeConfigMapper;
 
     @Override
     public Integer create(PlatformBooks platformBooks) {
@@ -251,11 +271,14 @@
         if(!Constants.equalsInteger(platformGroup.getIsdeleted(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"缁戝畾鏈堝彴缁勬暟鎹紓甯革紝璇疯仈绯荤鐞嗗憳");
         }
+        if(!Constants.checkCarNo(platformBooksApplyDTO.getCarCodeFront())){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"璇疯緭鍏ユ纭殑杞︾墝!");
+        };
         //鏌ヨ杞﹁締鏄惁涓鸿嚜鏈夎溅
         if(carsMapper.selectCount(new QueryWrapper<Cars>().lambda().eq(Cars::getIsdeleted,Constants.ZERO).eq(Cars::getCode,platformBooksApplyDTO.getCarCodeFront()))>Constants.ZERO){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+platformBooksApplyDTO.getCarCodeFront()+"]灞炰簬鍐呴儴杞﹁締锛屾棤娉曢绾�");
         };
-        ApproveTempl approveTempl = approveTemplMapper.selectById(platformReason.getId());
+        ApproveTempl approveTempl = approveTemplMapper.selectById(platformReason.getApproveTemplId());
         if(Objects.isNull(approveTempl)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈厤缃鎵规祦,璇疯仈绯荤鐞嗗憳");
         }
@@ -272,7 +295,22 @@
         platformBooksMapper.insert(platformBooks);
 
         //鍒涘缓瀹℃壒娴佷俊鎭�
-        approveService.createApproveForPlatfrom(platformReason.getApproveTemplId(),platformBooks.getId(),platformBooks.getDriverId());
+        approveService.createApproveForPlatfrom(approveTempl.getId(),platformBooks.getId(),platformBooks.getDriverId());
+        //鍙戦�佸叕浼楀彿閫氱煡 缁欐彁浜や汉
+        SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda()
+                .eq(SystemUser::getDeleted, Constants.ZERO)
+                .eq(SystemUser::getType, Constants.ZERO)
+                .eq(SystemUser::getMobile,platformBooks.getDriverPhone())
+                .last(" limit 1 "));
+
+        if(Objects.nonNull(driver)&&StringUtils.isNotBlank(driver.getOpenid())){
+            WxPlatNotice wxPlatNotice = new WxPlatNotice();
+            wxPlatNotice.sendPlatformBookTemplateNotice(systemDictDataBiz,
+                    wxNoticeConfigMapper,platformBooks,
+                    WxPlatConstants.platformBookContent.platformBookUpload,
+                    systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
+                    Arrays.asList(driver.getOpenid().split(",")),0);
+        }
         return platformBooks.getId();
     }
 
@@ -389,6 +427,15 @@
                 .eq(Approve::getObjType,Constants.approveObjectType.logisticsCarUse)
                 .eq(Approve::getObjId,revokeDTO.getId())
         );
+
+        //鍙戦�佺煭淇¢�氱煡
+        SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz,
+                emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,model.getId(),
+                        SmsConstants.platformBookContent.platformBookCancel,
+                null,null
+        );
+
+
     }
 
 

--
Gitblit v1.9.3