Przeglądaj źródła

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

FengChaoYu 5 miesięcy temu
rodzic
commit
a4f3c1ab01

+ 15 - 5
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/order/PayOrderLogic.java

@@ -235,30 +235,39 @@ public class PayOrderLogic {
 
             totalAmount = totalAmount.add(workerOrderBuy.getServicePrice());
 
+
             BigDecimal workerServiceProceAmount = workerOrderBuy.getServicePrice().multiply(Convert.toBigDecimal("0.006"));
 
 
             if (workerServiceProceAmount.doubleValue() > 0.01) {
-                workerProceAmount.add(workerServiceProceAmount.setScale(2, BigDecimal.ROUND_CEILING));
+                workerServiceProceAmount = workerServiceProceAmount.setScale(2, BigDecimal.ROUND_CEILING);
+                workerProceAmount =workerProceAmount.add(workerServiceProceAmount);
 
             }else {
-                workerProceAmount.add(Convert.toBigDecimal("0.01"));
+                workerServiceProceAmount = Convert.toBigDecimal("0.01");
+                workerProceAmount =workerProceAmount.add(workerServiceProceAmount);
             }
+
+            workerAmount = workerAmount.add(workerOrderBuy.getServicePrice()).subtract(workerServiceProceAmount);
         }
 
 
         if (workerOrderBuy.getOtherPrice() != null){
 
             totalAmount = totalAmount.add(workerOrderBuy.getOtherPrice());
+            workerAmount = workerAmount.add(workerOrderBuy.getServicePrice());
             BigDecimal workerOtherProceAmount = workerOrderBuy.getOtherPrice().multiply(Convert.toBigDecimal("0.006"));
 
 
             if (workerOtherProceAmount.doubleValue() > 0.01) {
-                workerProceAmount.add(workerOtherProceAmount.setScale(2, BigDecimal.ROUND_CEILING));
+                workerOtherProceAmount = workerOtherProceAmount.setScale(2, BigDecimal.ROUND_CEILING);
+                workerProceAmount =workerProceAmount.add(workerOtherProceAmount.setScale(2, BigDecimal.ROUND_CEILING));
 
             }else {
-                workerProceAmount.add(Convert.toBigDecimal("0.01"));
+                workerOtherProceAmount = Convert.toBigDecimal("0.01");
+                workerProceAmount =workerProceAmount.add(Convert.toBigDecimal("0.01"));
             }
+            workerAmount = workerAmount.add(workerOrderBuy.getServicePrice()).subtract(workerOtherProceAmount);
 
         }
 
@@ -279,7 +288,8 @@ public class PayOrderLogic {
         if (workerProceAmount.doubleValue() > 0.01) {
             workerOrderBuy.setWorkerProceAmount(workerProceAmount.setScale(2, BigDecimal.ROUND_CEILING));
         }else {
-            workerOrderBuy.setWorkerProceAmount(Convert.toBigDecimal("0.01"));
+            if (totalAmount.doubleValue() > 0)
+                workerOrderBuy.setWorkerProceAmount(Convert.toBigDecimal("0.01"));
         }
         workerOrderBuy.setWorkerProceAmount(workerProceAmount);
         workerOrderBuy.setCommissionAmount(workerProceAmount);

+ 88 - 76
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/user/UserLogic.java

@@ -112,6 +112,12 @@ public class UserLogic {
     @Resource
     SMSLogic smsLogic;
 
+    @Autowired
+    UserWaitPolicyService userWaitPolicyService;
+
+    @Autowired
+    UserWaitWorkerImgService userWaitWorkerImgService;
+
     /**
      * 微信小程序授权
      *
@@ -356,91 +362,97 @@ public class UserLogic {
                     websitUser.setWorkerNumber(userWait.getWorkerNumber());
                     websitUser.insert();
 
-                    //新意外增保险
-                    if (!StringUtil.isEmpty(userWait.getPolicyOrder())){
-                        WorkerPolicy workerPolicy = new WorkerPolicy();
-                        workerPolicy.setWorkerId(websitUser.getWorkerNumber());
-                        workerPolicy.setType("LINE");
-                        workerPolicy.setOrderId(userWait.getPolicyOrder());
-                        workerPolicy.setPolicyName(userWait.getPolicyName());
-                        workerPolicy.setCompany(userWait.getCompany());
-                        workerPolicy.setPolicyOrder(userWait.getPolicyOrder());
-                        workerPolicy.setPolicyType("AC");
-                        workerPolicy.setStartTime(userWait.getPolicyStartTime());
-                        workerPolicy.setEndTime(userWait.getPolicyEndTime());
-                        workerPolicy.setWebsitUserId(websitUser.getId());
-                        workerPolicy.setWebsitId(websitUser.getWebsitId());
-                        workerPolicy.setWebsitName(websitUser.getWebsitName());
-                        workerPolicy.setWorkerName(user.getNickName());
-
-                        if (new Date().after(userWait.getPolicyStartTime()) && new Date().before(userWait.getPolicyEndTime()))
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.BZZ.getKey());
-                        else if (new Date().after(userWait.getPolicyEndTime()))
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.YSX.getKey());
-                        else {
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.DSX.getKey());
+                    List<UserWaitPolicy> userWaitPolicies = userWaitPolicyService.lambdaQuery().eq(UserWaitPolicy::getUserWaitId, userWait.getId())
+                            .list();
+
+                    for (UserWaitPolicy userWaitPolicy : userWaitPolicies) {
+                        //新意外增保险
+                        if (userWaitPolicy.getPolicyType().equals("AC")){
+                            WorkerPolicy workerPolicy = new WorkerPolicy();
+                            workerPolicy.setWorkerId(websitUser.getWorkerNumber());
+                            workerPolicy.setType("LINE");
+                            workerPolicy.setOrderId(userWaitPolicy.getPolicyOrder());
+                            workerPolicy.setPolicyName(userWaitPolicy.getPolicyName());
+                            workerPolicy.setCompany(userWaitPolicy.getCompany());
+                            workerPolicy.setPolicyOrder(userWaitPolicy.getPolicyOrder());
+                            workerPolicy.setPolicyType("AC");
+                            workerPolicy.setStartTime(userWaitPolicy.getStartTime());
+                            workerPolicy.setEndTime(userWaitPolicy.getEndTime());
+                            workerPolicy.setWebsitUserId(websitUser.getId());
+                            workerPolicy.setWebsitId(websitUser.getWebsitId());
+                            workerPolicy.setWebsitName(websitUser.getWebsitName());
+                            workerPolicy.setWorkerName(user.getNickName());
+
+                            if (new Date().after(userWaitPolicy.getStartTime()) && new Date().before(userWaitPolicy.getEndTime()))
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.BZZ.getKey());
+                            else if (new Date().after(userWaitPolicy.getEndTime()))
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.YSX.getKey());
+                            else {
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.DSX.getKey());
+                            }
+                            workerPolicy.insert();
                         }
-                        workerPolicy.insert();
-                    }
 
 
-                    //新增雇主保险
-                    if (!StringUtil.isEmpty(userWait.getEmPolicyOrder())){
-                        WorkerPolicy workerPolicy = new WorkerPolicy();
-                        workerPolicy.setWorkerId(websitUser.getWorkerNumber());
-                        workerPolicy.setType("LINE");
-                        workerPolicy.setOrderId(userWait.getEmPolicyOrder());
-                        workerPolicy.setPolicyName(userWait.getEmPolicyName());
-                        workerPolicy.setCompany(userWait.getEmCompany());
-                        workerPolicy.setPolicyOrder(userWait.getEmPolicyOrder());
-                        workerPolicy.setPolicyType("EM");
-                        workerPolicy.setStartTime(userWait.getEmPolicyStartTime());
-                        workerPolicy.setEndTime(userWait.getEmPolicyEndTime());
-                        workerPolicy.setWebsitUserId(websitUser.getId());
-                        workerPolicy.setWebsitId(websitUser.getWebsitId());
-                        workerPolicy.setWebsitName(websitUser.getWebsitName());
-                        workerPolicy.setWorkerName(user.getNickName());
-
-                        if (new Date().after(workerPolicy.getStartTime()) && new Date().before(workerPolicy.getEndTime()))
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.BZZ.getKey());
-                        else if (new Date().after(workerPolicy.getEndTime()))
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.YSX.getKey());
-                        else {
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.DSX.getKey());
+                        //新增雇主保险
+                        if (userWaitPolicy.getPolicyType().equals("EM")){
+                            WorkerPolicy workerPolicy = new WorkerPolicy();
+                            workerPolicy.setWorkerId(websitUser.getWorkerNumber());
+                            workerPolicy.setType("LINE");
+                            workerPolicy.setOrderId(userWaitPolicy.getPolicyOrder());
+                            workerPolicy.setPolicyName(userWaitPolicy.getPolicyName());
+                            workerPolicy.setCompany(userWaitPolicy.getCompany());
+                            workerPolicy.setPolicyOrder(userWaitPolicy.getPolicyOrder());
+                            workerPolicy.setPolicyType("EM");
+                            workerPolicy.setStartTime(userWaitPolicy.getStartTime());
+                            workerPolicy.setEndTime(userWaitPolicy.getEndTime());
+                            workerPolicy.setWebsitUserId(websitUser.getId());
+                            workerPolicy.setWebsitId(websitUser.getWebsitId());
+                            workerPolicy.setWebsitName(websitUser.getWebsitName());
+                            workerPolicy.setWorkerName(user.getNickName());
+
+                            if (new Date().after(workerPolicy.getStartTime()) && new Date().before(workerPolicy.getEndTime()))
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.BZZ.getKey());
+                            else if (new Date().after(workerPolicy.getEndTime()))
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.YSX.getKey());
+                            else {
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.DSX.getKey());
+                            }
+
+                            workerPolicy.insert();
                         }
 
-                        workerPolicy.insert();
-                    }
-
 
-                    //新增工伤保险
-                    if (!StringUtil.isEmpty(userWait.getInPolicyOrder())){
-                        WorkerPolicy workerPolicy = new WorkerPolicy();
-                        workerPolicy.setWorkerId(websitUser.getWorkerNumber());
-                        workerPolicy.setType("LINE");
-                        workerPolicy.setOrderId(userWait.getInPolicyOrder());
-                        workerPolicy.setPolicyName(userWait.getInPolicyName());
-                        workerPolicy.setCompany(userWait.getInCompany());
-                        workerPolicy.setPolicyOrder(userWait.getInPolicyOrder());
-                        workerPolicy.setPolicyType("IN");
-                        workerPolicy.setStartTime(userWait.getInPolicyStartTime());
-                        workerPolicy.setEndTime(userWait.getInPolicyEndTime());
-                        workerPolicy.setWebsitUserId(websitUser.getId());
-                        workerPolicy.setWebsitId(websitUser.getWebsitId());
-                        workerPolicy.setWebsitName(websitUser.getWebsitName());
-                        workerPolicy.setWorkerName(user.getNickName());
-
-                        if (new Date().after(workerPolicy.getStartTime()) && new Date().before(workerPolicy.getEndTime()))
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.BZZ.getKey());
-                        else if (new Date().after(workerPolicy.getEndTime()))
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.YSX.getKey());
-                        else {
-                            workerPolicy.setStatus(PolicyOrderStutasEnum.DSX.getKey());
+                        //新增工伤保险
+                        if (userWaitPolicy.getPolicyType().equals("IN")){
+                            WorkerPolicy workerPolicy = new WorkerPolicy();
+                            workerPolicy.setWorkerId(websitUser.getWorkerNumber());
+                            workerPolicy.setType("LINE");
+                            workerPolicy.setOrderId(userWaitPolicy.getPolicyOrder());
+                            workerPolicy.setPolicyName(userWaitPolicy.getPolicyName());
+                            workerPolicy.setCompany(userWaitPolicy.getCompany());
+                            workerPolicy.setPolicyOrder(userWaitPolicy.getPolicyOrder());
+                            workerPolicy.setPolicyType("IN");
+                            workerPolicy.setStartTime(userWaitPolicy.getStartTime());
+                            workerPolicy.setEndTime(userWaitPolicy.getEndTime());
+                            workerPolicy.setWebsitUserId(websitUser.getId());
+                            workerPolicy.setWebsitId(websitUser.getWebsitId());
+                            workerPolicy.setWebsitName(websitUser.getWebsitName());
+                            workerPolicy.setWorkerName(user.getNickName());
+
+                            if (new Date().after(workerPolicy.getStartTime()) && new Date().before(workerPolicy.getEndTime()))
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.BZZ.getKey());
+                            else if (new Date().after(workerPolicy.getEndTime()))
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.YSX.getKey());
+                            else {
+                                workerPolicy.setStatus(PolicyOrderStutasEnum.DSX.getKey());
+                            }
+
+                            workerPolicy.insert();
                         }
-
-                        workerPolicy.insert();
                     }
 
+
                 }
             }
         }

+ 10 - 4
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/workorder/ChangeOrderLogic.java

@@ -467,20 +467,26 @@ public class ChangeOrderLogic {
 
         OrderInfo orderInfo = orderInfoService.getById(pgOrderBase.getSaleOrderId());
 
+        if (orderInfo == null)
+            return;
+
         List<OrderOldProduct> list = orderOldProductService.lambdaQuery().eq(OrderOldProduct::getOrderId, pgOrderBase.getSaleOrderId()).list();
 
+        if (CollectionUtils.isEmpty(list))
+            return;
+
         List<OrderOldProductItem> orderOldProductItems = orderOldProductItemService.lambdaQuery().eq(OrderOldProductItem::getOrderId, pgOrderBase.getSaleOrderId()).list();
 
         OldProductManagerAdd oldProductManagerAdd = new OldProductManagerAdd();
-        oldProductManagerAdd.setCompanyName(orderInfo.getCompanyName());
-        oldProductManagerAdd.setCompanyWechatId(orderInfo.getCompanyWechatId());
-        oldProductManagerAdd.setOrderId(orderInfo.getOrderId());
+        oldProductManagerAdd.setCompanyName(pgOrderBase.getCompanyWechatName());
+        oldProductManagerAdd.setCompanyWechatId(pgOrderBase.getCompanyWechatId());
+        oldProductManagerAdd.setOrderId(pgOrderBase.getSaleOrderId());
         oldProductManagerAdd.setPgOrderId(pgOrderBase.getId());
         oldProductManagerAdd.setStatus("IN");
         oldProductManagerAdd.setUserName(pgOrderBase.getUserName());
         oldProductManagerAdd.setUserPhone(pgOrderBase.getUserMobile());
         oldProductManagerAdd.setUserAddress(pgOrderBase.getAddress());
-        oldProductManagerAdd.setSaleType(orderInfo.getSaleType());
+        oldProductManagerAdd.setSaleType(pgOrderBase.getSaleType());
         oldProductManagerAdd.setOverTime(pgOrderBase.getOverTime());
         oldProductManagerAdd.setRemark(pgOrderBase.getRemark());
         oldProductManagerAdd.setProvince(pgOrderBase.getProvince());

+ 7 - 3
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/workorder/OrderBaseLogic.java

@@ -2,6 +2,7 @@ package com.gree.mall.miniapp.logic.workorder;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.db.sql.Order;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -59,7 +60,8 @@ public class OrderBaseLogic {
      */
     public CountOrderStatusBean countOrderStatus(String pgIncreOrderId, Boolean isYb, Boolean isWb) {
         CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
-        CountOrderStatusBean countOrderStatusBean = orderBaseCMapper.countOrderStatus(currentCompanyWechat.getUserId(), currentCompanyWechat.getUser().getWorkerNumber(), pgIncreOrderId, isYb, isWb, currentCompanyWechat.getCompanyWechatId());
+        CountOrderStatusBean countOrderStatusBean = orderBaseCMapper.countOrderStatus(currentCompanyWechat.getUserId(),
+                currentCompanyWechat.getUser().getWorkerNumber(), pgIncreOrderId, isYb, isWb, currentCompanyWechat.getCompanyWechatId());
         CountOrderStatusBean countOrderStatusBean2 = orderBaseCMapper.countPartsApply(currentCompanyWechat.getUserId());
         if (countOrderStatusBean2 != null) {
             countOrderStatusBean.setPing(countOrderStatusBean2.getPing());
@@ -267,10 +269,12 @@ public class OrderBaseLogic {
                 )
 
                 .and(CollectionUtils.isNotEmpty(orderStatusList) && !orderStatusList.contains("DCL") && !orderStatusList.contains("DJD"),item ->
-                        item.in(PgOrderBase::getOrderStatus,orderStatusList).eq(PgOrderBase::getIsMeet, finalIsMeet))
+                        item.in(PgOrderBase::getOrderStatus,orderStatusList))
 
                 .and(CollectionUtils.isNotEmpty(orderStatusList) && orderStatusList.contains("DCL"),item ->
-                        item.notIn(PgOrderBase::getOrderStatus,orderStatusList))
+                        item.and(item1 -> item1.notIn(PgOrderBase::getOrderStatus,orderStatusList))
+
+                )
 
                 .and(CollectionUtils.isNotEmpty(orderStatusList) && orderStatusList.contains("DJD"),item ->
                         item.in(PgOrderBase::getOrderStatus,orderStatusList)

+ 5 - 5
mall-miniapp-service/src/main/resources/mapper/workorder/OrderBaseCMapper.xml

@@ -5,12 +5,12 @@
     <select id="countOrderStatus" resultType="com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean">
          select
             count(DISTINCT if((is_import_excel = false and a.order_status='DJD') or (is_import_excel = true and a.is_meet = false) ,a.id,null)) 'djd',
-            count(DISTINCT if(a.order_status in ('FWZ','GCSZT','BFWG','DSM','YZP','XSBH','TJXSBH','ZBBH','FZXBH','WDBH')  and a.is_meet = true,a.id,null)) 'fwz',
+            count(DISTINCT if(a.order_status in ('FWZ','GCSZT','BFWG','DSM','YZP','XSBH','TJXSBH','ZBBH','FZXBH','WDBH'),a.id,null)) 'fwz',
             count(DISTINCT if(a.is_exception=1,a.id,null)) 'ycd',
             count(DISTINCT if(a.order_status='DQD',a.id,null)) 'dqd',
-            count(DISTINCT if(a.order_status in ('YWG','YJS','GCSZX','YWGO','WDWG') and a.is_meet = true,a.id,null)) 'ywg',
-            count(DISTINCT if(a.over_time between date(now()) and now(),a.id,null)) 'jrwg',
-            count(DISTINCT if(a.order_status in ('YWG','YJS','GCSZX','YWGO','WDWG'),a.id,null)) 'jbnwg',
+            count(DISTINCT if(a.order_status in ('YWG','YJS','GCSZX','YWGO','WDWG') ,a.id,null)) 'ywg',
+            count(DISTINCT if(a.over_time between CONCAT(CURDATE(), ' 00:00:00') and CONCAT(CURDATE(), ' 23:59:59'),a.id,null)) 'jrwg',
+            count(DISTINCT if(a.order_status in ('YWG','YJS','GCSZX','YWGO','WDWG') and a.over_time > CONCAT(DATE_SUB(CURDATE(), INTERVAL 6 MONTH) , ' 00:00:00') ,a.id,null)) 'jbnwg',
             count(DISTINCT if(a.order_status not in ('YWG','YJS','GCSZX','YWGO','WDWG','DQD'),a.id,null)) 'WWG',
             COUNT(DISTINCT a.id) AS 'all'
         from pg_order_base a
@@ -26,7 +26,7 @@
         and a.pg_incre_order_id = #{pgIncreOrderId}
     </if>
     and a.company_wechat_id = #{companyWechatId}
-    and a.create_time > date_sub(now(),INTERVAL 180 day)
+
     </select>
 
     <select id="countPartsApply" resultType="com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean">

+ 21 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/policy/UserWaitDetail.java

@@ -0,0 +1,21 @@
+package com.gree.mall.manager.bean.policy;
+
+import com.gree.mall.manager.plus.entity.UserWait;
+import com.gree.mall.manager.plus.entity.UserWaitPolicy;
+import com.gree.mall.manager.plus.entity.UserWaitWorkerImg;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel
+@Data
+public class UserWaitDetail extends UserWait {
+
+    @ApiModelProperty(value = "初始化师傅保险")
+    private List<UserWaitPolicy> userWaitPolicies;
+
+    @ApiModelProperty(value = "初始化师傅照片")
+    private List<UserWaitWorkerImg> userWaitWorkerImgs;
+}

+ 14 - 2
mall-server-api/src/main/java/com/gree/mall/manager/controller/member/MemberController.java

@@ -9,6 +9,7 @@ import com.gree.mall.manager.bean.listvo.UserCustomerVO;
 import com.gree.mall.manager.bean.listvo.UserVO;
 import com.gree.mall.manager.bean.listvo.workorder.UserWaitVO;
 import com.gree.mall.manager.bean.member.UserApplyBean;
+import com.gree.mall.manager.bean.policy.UserWaitDetail;
 import com.gree.mall.manager.bean.user.UserApplyWorkerBean;
 import com.gree.mall.manager.bean.user.UserDetail;
 import com.gree.mall.manager.bean.user.UserWxBean;
@@ -154,12 +155,23 @@ public class MemberController {
         return ResponseHelper.success();
     }
 
+
+    @PostMapping("/userWatit/detail")
+    @ApiOperation("修改师傅初始资料")
+    public ResponseHelper<UserWaitDetail> waitDetail(
+            @ApiParam(value = "userId", required = true) @RequestParam String id
+    ) {
+        UserWaitDetail userWaitDetail = userLogic.detailWait(id);
+        return ResponseHelper.success(userWaitDetail);
+    }
+
+
     @PostMapping("/userWatit/update")
     @ApiOperation("修改师傅初始资料")
     public ResponseHelper workerUpdate(
-            @RequestBody UserWait userWait
+            @RequestBody UserWaitDetail userWaitDetail
     ) {
-        userLogic.userWaitUpdate(userWait);
+        userLogic.userWaitUpdate(userWaitDetail);
         return ResponseHelper.success();
     }
 

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

@@ -3,11 +3,13 @@ package com.gree.mall.manager.controller.policy;
 import cn.hutool.core.lang.TypeReference;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.binarywang.wxpay.exception.WxPayException;
 import com.gree.mall.manager.annotation.ZfireList;
 import com.gree.mall.manager.bean.policy.*;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.policy.AgreementLogic;
+import com.gree.mall.manager.logic.websit.SettlementOrderLogic;
 import com.gree.mall.manager.plus.entity.Mailbox;
 import com.gree.mall.manager.plus.entity.MailboxSendRecord;
 import com.gree.mall.manager.plus.entity.MailboxSendRecordPolicy;
@@ -35,6 +37,9 @@ public class MailboxController {
     @Autowired
     private AgreementLogic agreementLogic;
 
+    @Autowired
+    SettlementOrderLogic settlementOrderLogic;
+
 
     @PostMapping("/detail")
     @ApiOperation("邮箱配置详情")
@@ -166,4 +171,11 @@ public class MailboxController {
         return ResponseHelper.success();
     }
 
+    @ApiOperation(value = "测试过期提醒")
+    @PostMapping("task8")
+    public ResponseHelper task8() throws IOException, MessagingException, WxPayException {
+        settlementOrderLogic.sync();
+        return ResponseHelper.success();
+    }
+
 }

+ 93 - 8
mall-server-api/src/main/java/com/gree/mall/manager/logic/user/UserLogic.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.listvo.User2VO;
@@ -14,6 +15,7 @@ import com.gree.mall.manager.bean.listvo.UserVO;
 import com.gree.mall.manager.bean.listvo.workorder.UserWaitVO;
 import com.gree.mall.manager.bean.member.MemberSortBean;
 import com.gree.mall.manager.bean.member.UserApplyBean;
+import com.gree.mall.manager.bean.policy.UserWaitDetail;
 import com.gree.mall.manager.bean.user.*;
 import com.gree.mall.manager.commonmapper.*;
 import com.gree.mall.manager.enums.ExamineStatusEnum;
@@ -50,6 +52,10 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -89,6 +95,8 @@ public class UserLogic {
     private final SettleDailyBankAccountService settleDailyBankAccountService;
     private final WebsitUserLogService websitUserLogService;
     private final WorkerTeamService workerTeamService;
+    private final UserWaitPolicyService userWaitPolicyService;
+    private final UserWaitWorkerImgService userWaitWorkerImgService;
 
 
     /**
@@ -233,6 +241,7 @@ public class UserLogic {
                 .remove();*/
 
         List<UserWait> userWaits = new ArrayList<>();
+        List<UserWaitPolicy> userWaitPolicies = new ArrayList<>();
         for (Object o : datas) {
             index++;
             String errPrefix = "第" + index + "行";
@@ -279,6 +288,7 @@ public class UserLogic {
             }
 
             UserWait userWait = new UserWait();
+            userWait.setId(IdWorker.getIdStr());
             userWait.setUserType(userTypeEnum.getKey());
             userWait.setMobile(mobile);
             userWait.setIdcard(idcard);
@@ -310,6 +320,17 @@ public class UserLogic {
                         throw new RemoteServiceException(userWait.getIdcard()+"导入师傅保险已过期");
                     userWait.setInPolicyName(in_policy_name);
                     userWait.setInPolicyOrder(in_policy_order);
+
+                    UserWaitPolicy userWaitPolicy = new UserWaitPolicy();
+
+                    userWaitPolicy.setUserWaitId(userWait.getId());
+                    userWaitPolicy.setCompany(in_company);
+                    userWaitPolicy.setPolicyName(in_policy_name);
+                    userWaitPolicy.setPolicyOrder(in_policy_order);
+                    userWaitPolicy.setStartTime(DateUtil.parse(in_policy_start_time, "yyyy-MM-dd"));
+                    userWaitPolicy.setEndTime(this.getEndOfDay(DateUtil.parse(in_policy_end_time, "yyyy-MM-dd")));
+
+                    userWaitPolicies.add(userWaitPolicy);
                 }
 
 
@@ -333,6 +354,19 @@ public class UserLogic {
                         throw new RemoteServiceException(userWait.getIdcard()+"导入师傅保险已过期");
                     userWait.setEmPolicyName(em_policy_name);
                     userWait.setEmPolicyOrder(em_policy_order);
+
+
+                    UserWaitPolicy userWaitPolicy = new UserWaitPolicy();
+
+                    userWaitPolicy.setUserWaitId(userWait.getId());
+                    userWaitPolicy.setCompany(em_company);
+                    userWaitPolicy.setPolicyName(em_policy_name);
+                    userWaitPolicy.setPolicyOrder(em_policy_order);
+                    userWaitPolicy.setStartTime(DateUtil.parse(em_policy_start_time, "yyyy-MM-dd"));
+                    userWaitPolicy.setEndTime(this.getEndOfDay(DateUtil.parse(em_policy_end_time, "yyyy-MM-dd")));
+
+                    userWaitPolicies.add(userWaitPolicy);
+
                 }
 
 
@@ -352,6 +386,18 @@ public class UserLogic {
 
                 userWait.setPolicyName(policy_name);
                 userWait.setPolicyOrder(policy_order);
+
+
+                UserWaitPolicy userWaitPolicy = new UserWaitPolicy();
+
+                userWaitPolicy.setUserWaitId(userWait.getId());
+                userWaitPolicy.setCompany(company);
+                userWaitPolicy.setPolicyName(policy_name);
+                userWaitPolicy.setPolicyOrder(policy_order);
+                userWaitPolicy.setStartTime(DateUtil.parse(policy_start_time, "yyyy-MM-dd"));
+                userWaitPolicy.setEndTime(this.getEndOfDay(DateUtil.parse(policy_end_time, "yyyy-MM-dd")));
+
+                userWaitPolicies.add(userWaitPolicy);
             }else {
                 throw new RemoteServiceException(userWait.getEmCompany()+"必须导入意外险");
             }
@@ -397,11 +443,21 @@ public class UserLogic {
             userWaits.add(userWait);
         }
         userWaitService.saveBatch(userWaits);
-
+        userWaitPolicyService.saveBatch(userWaitPolicies);
 
 
     }
-
+    /**
+     * 获取某天最小时间
+     * @param date 时间
+     * @return 获取某天最小时间
+     */
+    public  Date getEndOfDay(Date date) {
+        LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());;
+        LocalTime localTime = LocalTime.of(23, 59, 59);
+        LocalDateTime endOfDay = localDateTime.with(localTime);
+        return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant());
+    }
 
     /**
      * 师傅审核详情
@@ -1133,19 +1189,33 @@ public class UserLogic {
 
 
     @Transactional(rollbackFor = Exception.class)
-    public void userWaitUpdate(UserWait userWait) {
+    public void userWaitUpdate(UserWaitDetail userWaitDetail) {
         userService.lambdaUpdate()
-                .ne(User::getMobile,userWait.getMobile())
-                .eq(User::getWorkerNumber,userWait.getWorkerNumber())
+                .ne(User::getMobile,userWaitDetail.getMobile())
+                .eq(User::getWorkerNumber,userWaitDetail.getWorkerNumber())
                 .set(User::getType,"GENERAL")
                 .set(User::getWorkerNumber,null)
                 .update();
 
-        userWait.updateById();
+        userWaitDetail.updateById();
 
         userWaitService.lambdaUpdate()
-                .eq(UserWait::getWorkerNumber,userWait.getWorkerNumber())
-                .set(UserWait::getMobile,userWait.getMobile()).update();
+                .eq(UserWait::getWorkerNumber,userWaitDetail.getWorkerNumber())
+                .set(UserWait::getMobile,userWaitDetail.getMobile()).update();
+
+        userWaitWorkerImgService.lambdaUpdate().eq(UserWaitWorkerImg::getUserWaitId,userWaitDetail.getId()).remove();
+        userWaitPolicyService.lambdaUpdate().eq(UserWaitPolicy::getUserWaitId,userWaitDetail.getId()).remove();
+
+        for (UserWaitWorkerImg userWaitWorkerImg : userWaitDetail.getUserWaitWorkerImgs()) {
+            userWaitWorkerImg.setUserWaitId(userWaitDetail.getId());
+        }
+
+        for (UserWaitPolicy userWaitPolicy : userWaitDetail.getUserWaitPolicies()) {
+            userWaitPolicy.setUserWaitId(userWaitDetail.getId());
+        }
+
+        userWaitWorkerImgService.saveBatch(userWaitDetail.getUserWaitWorkerImgs());
+        userWaitPolicyService.saveBatch(userWaitDetail.getUserWaitPolicies());
     }
 
     public UserDetail getUserDetail(String userId) {
@@ -1163,4 +1233,19 @@ public class UserLogic {
 
         return websitUserLogService.lambdaQuery().eq(WebsitUserLog::getWebsitUserId,id).orderByDesc(WebsitUserLog::getCreateTime).list();
     }
+
+    public UserWaitDetail detailWait(String id) {
+        UserWait userWait = userWaitService.getById(id);
+
+        UserWaitDetail userWaitDetail = BeanUtil.toBean(userWait, UserWaitDetail.class);
+
+        List<UserWaitPolicy> userWaitPolicies = userWaitPolicyService.lambdaQuery().eq(UserWaitPolicy::getUserWaitId,userWait.getId()).list();
+
+        List<UserWaitWorkerImg> userWaitWorkerImgs = userWaitWorkerImgService.lambdaQuery().eq(UserWaitWorkerImg::getUserWaitId, userWait.getId()).list();
+
+        userWaitDetail.setUserWaitPolicies(userWaitPolicies);
+        userWaitDetail.setUserWaitWorkerImgs(userWaitWorkerImgs);
+
+        return userWaitDetail;
+    }
 }

+ 1 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseLogic.java

@@ -232,7 +232,7 @@ public class OrderBaseLogic {
         orderBase.setIsQdNotice(true);
         orderBase.setId(orderBaseId);
         orderBase.setIsImportExcel(orderBase.getIsImportExcel() != null?old.getIsImportExcel():false);
-        orderBase.setIsMeet(true);
+        orderBase.setIsMeet(orderAddBeanDTO.getIsMeet());
 
 
         //是否变更了师傅

+ 1 - 1
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -332,7 +332,7 @@
             and a.is_exception =1 and a.order_status NOT IN ('YWG','YWGO','YJS')
         </if>
         <if test="ex.orderStatus != null and ex.orderStatus.key =='DYY'.toString()">
-            and a.appointment_time is null and a.order_status in('DYY','DSHPG','DWDPG','DJD')
+            and a.appointment_time is null
         </if>
         <if test="ex.partsApplyStatus != null and ex.partsApplyStatus =='PJSQZ'.toString()">
             and a.id in(select order_base_id from websit_parts_apply where `status` = 'ING')

+ 2 - 1
mall-server-api/src/main/resources/mapper/workorder/OrderBaseCMapper.xml

@@ -20,6 +20,7 @@
         <if test="startTime != null and startTime != ''">
             and a.create_time between #{startTime} and #{endTime}
         </if>
+        and a.order_status != 'DYY'
         group by order_status_text
     union
         select
@@ -44,7 +45,7 @@
             'DYY' as 'orderStatus',
             '待预约' as 'orderStatusText'
         from pg_order_base a
-        where appointment_time is null and a.order_status in('DYY','DSHPG','DWDPG','DJD')
+        where appointment_time is null
         <include refid="orderBaseSqlWhere"></include>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}