Просмотр исходного кода

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

lyx 1 месяц назад
Родитель
Сommit
f85d4479de

+ 12 - 3
alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java

@@ -15,19 +15,28 @@ import java.util.List;
 public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
 
     @Select("select dyna1.* from (with dynamice as( " +
-            "select lud.id, lud.top_status, lud.top_time, lud.title, lud.phone_id phoneId, lud.context, lud.image_path, lud.address, lud.address_name, lud.address_context, lud.liulan_count, lud.dianzan_count, lud.type, lud.created_time, substring_index(lud.phone_id, '_', 1) flag, substring_index(lud.phone_id, '_', -1) phone, lud.draft , lud.address_province, lud.transfer_count from life_user_dynamics lud " +
+            "select lud.id, lud.top_status, lud.top_time, lud.title, lud.phone_id phoneId, " +
+            "lud.context, lud.image_path, lud.address, lud.address_name, lud.address_context, " +
+            "lud.liulan_count, lud.dianzan_count, lud.type, lud.created_time, substring_index(lud.phone_id, '_', 1) flag, " +
+            "substring_index(lud.phone_id, '_', -1) phone, lud.draft , lud.address_province, lud.transfer_count " +
+            "from life_user_dynamics lud " +
             "where lud.delete_flag = 0 and lud.enable_status = 0 and lud.draft = 0 and " +
-            "not exists (select 1 from life_user_violation luv where luv.delete_flag = 0 and luv.processing_status = 1 AND luv.dynamics_id = lud.id) order by lud.created_time desc) " +
+            "not exists (select 1 from life_user_violation luv where luv.delete_flag = 0 and luv.processing_status = 1 " +
+            "AND luv.dynamics_id = lud.id) order by lud.created_time desc) " +
             "select dynamice.*, info.store_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert " +
             "from dynamice " +
             "join store_user user on dynamice.phone = user.phone and user.delete_flag = 0 " +
+            "and user.status = 0 and user.logout_flag = 0 " +
             "join store_info info on info.id = user.store_id and info.delete_flag = 0 " +
+            "and info.store_status = 1 " +
             "left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0  " +
             "where dynamice.flag = 'store' " +
             "union " +
-            "select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert " +
+            "select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, " +
+            "IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert " +
             "from dynamice " +
             "join life_user user on dynamice.phone = user.user_phone and user.delete_flag = 0 " +
+            "and user.logout_flag = 0 " +
             "left join life_user_expert  lue on lue.user_id = user.id and lue.delete_flag = 0 " +
             "where dynamice.flag = 'user') dyna1 order by dyna1.top_status desc, dyna1.top_time desc, created_time desc")
     List<LifeUserDynamicsVo> getLifeUserDynamicsList();

+ 10 - 0
alien-second/src/main/java/shop/alien/second/service/impl/SecondTradeRecordServiceImpl.java

@@ -201,6 +201,16 @@ public class SecondTradeRecordServiceImpl extends ServiceImpl<SecondTradeRecordM
             // 交易信息
             SecondTradeRecord trade = secondTradeRecordMapper.selectById(tradeId);
 
+            // 判断商品是否正在交易中
+            if (type == 1) {
+                LambdaQueryWrapper<SecondTradeRecord> recordWrapper = new LambdaQueryWrapper<>();
+                recordWrapper.eq(SecondTradeRecord::getGoodsId, trade.getGoodsId());
+                recordWrapper.eq(SecondTradeRecord::getTradeStatus, 3);
+                if (secondTradeRecordMapper.selectCount(recordWrapper) > 0) {
+                    throw new BusinessException("该商品正在交易中");
+                }
+            }
+
             // 有定时任务: 超过交易时间还未确认的交易会自动取消并保存交易操作表  所以如果是已取消的交易  不需要进行这两步操作
             if (trade.getTradeStatus() != 6) {
                 // 修改交易状态

+ 37 - 30
alien-store/src/main/java/shop/alien/store/controller/AliController.java

@@ -1,13 +1,17 @@
 package shop.alien.store.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import shop.alien.entity.result.R;
+import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.StoreAliPayLog;
+import shop.alien.entity.store.StoreInfo;
+import shop.alien.entity.store.StoreUser;
 import shop.alien.store.service.AliService;
 import shop.alien.store.service.LifeUserService;
 import shop.alien.store.service.StoreInfoService;
@@ -22,6 +26,9 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @author ssk
@@ -73,36 +80,36 @@ public class AliController {
     @GetMapping("/getIdInfo")
     public R getIdInfo(@RequestParam("name") String name, @RequestParam("idCard") String idCard, @RequestParam("appType") Integer appType) {
         log.info("AliController.getIdInfo?name={}&idCard={}", name, idCard);
-//        int size = 0;
-//        if (appType == 0) {
-//            //根据身份查询未注销的用户
-//            size = lifeUserService
-//                    .list(new LambdaQueryWrapper<LifeUser>()
-//                            .eq(LifeUser::getIdCard, idCard)
-//                            .eq(LifeUser::getRealName, name)
-//                            .eq(LifeUser::getLogoutFlag, 0))
-//                    .size();
-//        } else {
-//            //根据身份查询已入住或审核中的商家
-//            List<StoreUser> storeUserList = storeUserService
-//                    .list(new LambdaQueryWrapper<StoreUser>()
-//                            .eq(StoreUser::getIdCard, idCard)
-//                            .eq(StoreUser::getName, name));
-//            List<Integer> storeIds = storeUserList.stream()
-//                    .map(StoreUser::getStoreId)
-//                    .filter(Objects::nonNull)
-//                    .collect(Collectors.toList());
-//            if (!storeIds.isEmpty()) {
-//                size = storeInfoService
-//                        .list(new LambdaQueryWrapper<StoreInfo>()
-//                                .in(StoreInfo::getId, storeIds)
-//                                .notIn(StoreInfo::getStoreApplicationStatus, 2))
-//                        .size();
-//            }
-//        }
-//        if (size > 0) {
-//            return R.fail("该身份证已实名认证过");
-//        }
+        int size = 0;
+        if (appType == 0) {
+            //根据身份查询未注销的用户
+            size = lifeUserService
+                    .list(new LambdaQueryWrapper<LifeUser>()
+                            .eq(LifeUser::getIdCard, idCard)
+                            .eq(LifeUser::getRealName, name)
+                            .eq(LifeUser::getLogoutFlag, 0))
+                    .size();
+        } else {
+            //根据身份查询已入住或审核中的商家
+            List<StoreUser> storeUserList = storeUserService
+                    .list(new LambdaQueryWrapper<StoreUser>()
+                            .eq(StoreUser::getIdCard, idCard)
+                            .eq(StoreUser::getName, name));
+            List<Integer> storeIds = storeUserList.stream()
+                    .map(StoreUser::getStoreId)
+                    .filter(Objects::nonNull)
+                    .collect(Collectors.toList());
+            if (!storeIds.isEmpty()) {
+                size = storeInfoService
+                        .list(new LambdaQueryWrapper<StoreInfo>()
+                                .in(StoreInfo::getId, storeIds)
+                                .notIn(StoreInfo::getStoreApplicationStatus, 2))
+                        .size();
+            }
+        }
+        if (size > 0) {
+            return R.fail("该身份证已实名认证过");
+        }
         if (aliPayConfig.getIdInfo(name, idCard)) {
             return R.success("身份验证成功");
         }

+ 3 - 2
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java

@@ -344,7 +344,7 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
     @Override
     public List<LifeDiscountCouponVo> getStoreUserCouponList(String storeId, UserLoginInfo userLoginInfo) {
         List<LifeDiscountCouponVo> lifeDiscountCouponVos = new ArrayList<>();
-        try{
+        try {
             LocalDateTime now = LocalDateTime.now();
             //根据店铺id查询该店铺的优惠券,状态是开启领取的券
             List<LifeDiscountCoupon> lifeDiscountCoupons = lifeDiscountCouponMapper.selectList(new LambdaQueryWrapper<LifeDiscountCoupon>().eq(LifeDiscountCoupon::getStoreId, storeId).eq(LifeDiscountCoupon::getGetStatus, "1") //还有库存
@@ -1085,6 +1085,7 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
         return lifeDiscountCouponMapper.selectPage(iPage, new LambdaQueryWrapper<LifeDiscountCoupon>()
                 .eq(LifeDiscountCoupon::getType, 3)
                 .like(!StringUtils.isEmpty(name), LifeDiscountCoupon::getName, name)
+                .orderByDesc(LifeDiscountCoupon::getCreatedTime)
                 .between(!StringUtils.isEmpty(createDate), LifeDiscountCoupon::getCreatedTime, createDate + " 00:00:00", createDate + " 23:59:59"));
     }
 
@@ -1128,7 +1129,7 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
     @Override
     public boolean issuePlatformCoupon(List<Integer> userIds, Integer couponId) {
         LifeDiscountCoupon lifeDiscountCoupon = this.getById(couponId);
-        if(lifeDiscountCoupon == null){
+        if (lifeDiscountCoupon == null) {
             //如果优惠券为空,则返回失败
             return false;
         }