From 10c28ce3d0b384584c77ce9111a66a0641250752 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 27 二月 2025 18:30:32 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformBooksServiceImpl.java |  104 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 95 insertions(+), 9 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 f4b6d33..f32e69e 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,23 +1,32 @@
 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.alibaba.fastjson.JSONObject;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
-import com.doumee.core.model.LoginUserInfo;
-import com.doumee.core.model.PageData;
-import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.dao.UserActionMapper;
+import com.doumee.service.business.third.model.LoginUserInfo;
+import com.doumee.service.business.third.model.PageData;
+import com.doumee.service.business.third.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.MemberMapper;
+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.business.model.Member;
+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.Notices;
+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;
@@ -29,7 +38,6 @@
 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;
@@ -37,6 +45,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;
@@ -51,6 +60,10 @@
 
     @Autowired
     private PlatformBooksMapper platformBooksMapper;
+    @Autowired
+    private UserActionMapper userActionMapper;
+    @Autowired
+    private PlatformJobMapper platformJobMapper;
 
     @Autowired
     private NoticesJoinMapper noticesJoinMapper;
@@ -66,6 +79,9 @@
 
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
+
+    @Autowired
+    private SystemUserMapper systemUserMapper;
 
     @Autowired
     private ApproveService approveService;
@@ -88,6 +104,9 @@
     @Autowired
     private EmayService emayService;
 
+    @Autowired
+    private WxNoticeConfigMapper wxNoticeConfigMapper;
+
     @Override
     public Integer create(PlatformBooks platformBooks) {
 
@@ -100,7 +119,32 @@
     public void deleteById(Integer id) {
         platformBooksMapper.deleteById(id);
     }
-
+    @Override
+    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+    public void deleteById(Integer id,LoginUserInfo user) {
+        PlatformBooks model =findById(id);
+        if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        Date date =new Date();
+        platformBooksMapper.update(null,new UpdateWrapper<PlatformBooks>().lambda()
+                .set(PlatformBooks::getIsdeleted,Constants.ONE)
+                .set(PlatformBooks::getEditDate,date)
+                .set(PlatformBooks::getEditor,user.getId())
+                .eq(PlatformBooks::getId,id));
+        platformJobMapper.update(null,new UpdateWrapper<PlatformJob>().lambda()
+                .set(PlatformJob::getIsdeleted,Constants.ONE)
+                .set(PlatformJob::getEditDate,new Date())
+                .set(PlatformJob::getEditor,user.getId())
+                .eq(PlatformJob::getBookId,id)
+                .eq(PlatformJob::getIsdeleted,Constants.ZERO));
+        String[] params = new String[3];
+        params[0] = user.getRealname();
+        params[1]=DateUtil.getPlusTime2(date);
+        params[2]=model.getContractNum()+"-銆愬徃鏈猴細"+model.getDriverName()+" "+model.getDriverPhone()+"銆�-銆愯溅鐗屽ソ锛� "+model.getPlateNum()+"銆�";
+        //璁板綍鍒犻櫎鏃ュ織
+        UserActionServiceImpl.saveUserActionBiz(user,id,Constants.UserActionType.PLATFROM_BOOK_DEL,userActionMapper,date,params, JSONObject.toJSONString(model));
+    }
     @Override
     public void delete(PlatformBooks platformBooks) {
         UpdateWrapper<PlatformBooks> deleteWrapper = new UpdateWrapper<>(platformBooks);
@@ -261,6 +305,9 @@
         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()+"]灞炰簬鍐呴儴杞﹁締锛屾棤娉曢绾�");
@@ -283,6 +330,22 @@
 
         //鍒涘缓瀹℃壒娴佷俊鎭�
         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())
+                .isNotNull(SystemUser::getOpenid)
+                .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();
     }
 
@@ -364,6 +427,20 @@
             approve.setCheckDate(model.getCancelTime());
             approveList.add(approve);
         }
+
+        Notices notices = noticesJoinMapper.selectOne(new QueryWrapper<Notices>().lambda()
+                .eq(Notices::getObjId,id)
+                .eq(Notices::getType,Constants.noticesObjectType.reason)
+                .eq(Notices::getUserId,memberId)
+                .eq(Notices::getSendacopy,Constants.ZERO)
+                .orderByDesc(Notices::getId).last(" limit 1 "));
+        if(Objects.nonNull(notices)){
+            if(Constants.equalsInteger(notices.getStatus(),Constants.ZERO)){
+                model.setInfo("寰呮垜澶勭悊");
+            }else{
+                model.setInfo(notices.getInfo());
+            }
+        }
         return model;
     }
 
@@ -373,7 +450,6 @@
     public void revoke(RevokeDTO revokeDTO, LoginUserInfo loginUserInfo){
         if(Objects.isNull(revokeDTO)
                 || Objects.isNull(revokeDTO.getId())
-                || StringUtils.isBlank(revokeDTO.getInfo())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -400,6 +476,16 @@
                 .eq(Approve::getObjId,revokeDTO.getId())
         );
 
+        noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
+                .set(Notices::getEditDate,new Date())
+                .set(Notices::getInfo,"鐗╂祦杞﹂绾︾敵璇峰彇娑�")
+                .set(Notices::getReaded,Constants.ONE)
+                .set(Notices::getParam2,Constants.TWO)
+                .set(Notices::getStatus,Constants.ONE)
+                .eq(Notices::getType,Constants.noticesObjectType.reason)
+                .eq(Notices::getObjId,model.getId())
+        );
+
         //鍙戦�佺煭淇¢�氱煡
         SmsEmailServiceImpl.sendPlatformBookSms(systemDictDataBiz,
                 emayService,smsEmailMapper,smsConfigMapper,platformBooksMapper,model.getId(),

--
Gitblit v1.9.3