From 2f8da8cea8a978cc215ccee14feed1898ee6b151 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期五, 17 十月 2025 18:17:57 +0800
Subject: [PATCH] 发送小程序订单数量

---
 pt-errand/src/main/java/com/ruoyi/errand/service/impl/AppUserServiceImpl.java |   58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/pt-errand/src/main/java/com/ruoyi/errand/service/impl/AppUserServiceImpl.java b/pt-errand/src/main/java/com/ruoyi/errand/service/impl/AppUserServiceImpl.java
index 9cd135d..39fe4c8 100644
--- a/pt-errand/src/main/java/com/ruoyi/errand/service/impl/AppUserServiceImpl.java
+++ b/pt-errand/src/main/java/com/ruoyi/errand/service/impl/AppUserServiceImpl.java
@@ -123,11 +123,11 @@
     @Override
     public R<LoginVO> mobileLogin(MobileLoginDTO mobileLogin) {
         String code = redisService.getCacheObject(mobileLogin.getPhone());
-        if(!"999999".equals(mobileLogin.getCode())){
+//        if(!"999999".equals(mobileLogin.getCode())){
             if(null == code || !code.equals(mobileLogin.getCode())){
                 throw new ServiceException("验证码错误");
             }
-        }
+//        }
         //查看用户是否存在
         AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone())
                 .ne(AppUser::getStatus,AppUserStatusConstant.LOGOUT)
@@ -159,7 +159,13 @@
         loginVO.setFailureTime(TimeUnit.MILLISECONDS.toSeconds((long)jwt.get("exp")));
         loginVO.setPhone(appUser.getPhone());
         loginVO.setSkipPage(1);
-        loginVO.setIsCourier(appUser.getCourierId()!=null);
+        loginVO.setIsCourier(false);
+        if (appUser.getCourierId()!=null){
+            Courier courier = courierMapper.selectById(appUser.getCourierId());
+            if (courier!=null && courier.getDelFlag().equals(0) && courier.getStatus().equals(1)){
+                loginVO.setIsCourier(true);
+            }
+        }
         return R.ok(loginVO);
     }
 
@@ -207,7 +213,15 @@
         loginVO.setFailureTime(TimeUnit.MILLISECONDS.toSeconds((long)jwt.get("exp")));
         loginVO.setPhone(appUser.getPhone());
         loginVO.setSkipPage(1);
-        loginVO.setIsCourier(appUser.getCourierId()!=null);
+        loginVO.setIsCourier(false);
+        if (appUser.getCourierId()!=null){
+            Courier courier = courierMapper.selectById(appUser.getCourierId());
+            if (courier!=null && courier.getDelFlag().equals(0) && courier.getStatus().equals(1)){
+                loginVO.setIsCourier(true);
+            }
+        }
+
+
         return R.ok(loginVO);
     }
 
@@ -257,25 +271,43 @@
         loginVO.setFailureTime(TimeUnit.MILLISECONDS.toSeconds((long)jwt.get("exp")));
         loginVO.setPhone(appUser2.getPhone());
         loginVO.setSkipPage(1);
-        loginVO.setIsCourier(appUser2.getCourierId()!=null);
+
+        loginVO.setIsCourier(false);
+        if (appUser2.getCourierId()!=null){
+            Courier courier = courierMapper.selectById(appUser2.getCourierId());
+            if (courier!=null && courier.getDelFlag().equals(0) && courier.getStatus().equals(1)){
+                loginVO.setIsCourier(true);
+            }
+        }
         return loginVO;
 
     }
 
     @Override
-    public OrderPageVO getOrderPage(Integer communityId) {
+    public OrderPageVO getOrderPage(Integer communityId,String regionExtend) {
         AppUser appUser = (AppUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
         //更换绑定的小区
         if (communityId!=null&& !Objects.equals(appUser.getCommunityId(), communityId)){
             appUser.setCommunityId(communityId);
             this.updateById(appUser);
         }
+        if (regionExtend!=null&& !Objects.equals(appUser.getRegionExtend(), regionExtend)){
+            appUser.setRegionExtend(regionExtend);
+            this.updateById(appUser);
+        }
         List<OrderPageVO> orderPage = this.getBaseMapper().getOrderPage(appUser.getId());
         Community community = communityMapper.selectById(appUser.getCommunityId());
         String regionFullName = getRegionFullName(community.getRegionId());
-        orderPage.get(0).setRegionName(regionFullName);
-        orderPage.get(0).setRegionId(community.getRegionId());
-        return orderPage.get(0);
+        OrderPageVO orderPageVO = orderPage.get(0);
+        if (appUser.getEndTime()==null ){
+            orderPageVO.setVipId(null);
+        }
+        if (appUser.getEndTime()!=null&&appUser.getEndTime().isBefore(LocalDateTime.now())){
+            orderPageVO.setVipId(null);
+        }
+        orderPageVO.setRegionName(regionFullName);
+        orderPageVO.setRegionId(community.getRegionId());
+        return orderPageVO;
     }
     @Autowired
     private RegionMapper regionMapper;
@@ -304,7 +336,13 @@
     public AppUserInfoVO getMyInfo() {
         AppUser appUser = (AppUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
         AppUserInfoVO myInfo = this.getBaseMapper().getMyInfo(appUser.getId());
-
+        myInfo.setIsCourier(false);
+        if (myInfo.getCourierId()!=null){
+            Courier courier = courierMapper.selectById(myInfo.getCourierId());
+            if (courier!=null && courier.getDelFlag().equals(0) && courier.getStatus().equals(1)){
+                myInfo.setIsCourier(true);
+            }
+        }
         myInfo.setEndTimeStamp(myInfo.getEndTime() != null ?
                 myInfo.getEndTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() :
                 null);

--
Gitblit v1.7.1