|
|
@@ -95,6 +95,16 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
@Value("${jwt.expiration-time}")
|
|
|
private String effectiveTime;
|
|
|
|
|
|
+ /** 点餐订单未完成:待支付、已支付未完结 */
|
|
|
+ private static final List<Integer> PENDING_DINING_ORDER_STATUSES = Arrays.asList(0, 1);
|
|
|
+
|
|
|
+ /** 预订订单未完成:待支付、待使用、退款中、商家预订 */
|
|
|
+ private static final List<Integer> PENDING_RESERVATION_ORDER_STATUSES = Arrays.asList(0, 1, 6, 8);
|
|
|
+
|
|
|
+ private final StoreOrderMapper storeOrderMapper;
|
|
|
+
|
|
|
+ private final UserReservationOrderMapper userReservationOrderMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 设定初始化默认密码
|
|
|
*/
|
|
|
@@ -979,25 +989,47 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
if (storeUser != null) {
|
|
|
storeMap.put("status", storeUser.getStatus().toString());
|
|
|
if (null != storeUser.getStoreId()) {
|
|
|
- StoreInfo storeInfo = storeInfoMapper.selectById(storeUser.getStoreId());
|
|
|
- //vaule为0代表有商铺未注销
|
|
|
+ // value为0代表有商铺未注销
|
|
|
storeMap.put("accountStore", "0");
|
|
|
+ fillPendingOrderVerification(storeMap, storeUser.getStoreId());
|
|
|
} else {
|
|
|
- //vaule为1代表绑定店铺已注销
|
|
|
+ // value为1代表绑定店铺已注销
|
|
|
storeMap.put("accountStore", "1");
|
|
|
+ storeMap.put("accountDiningOrder", "1");
|
|
|
+ storeMap.put("accountReservationOrder", "1");
|
|
|
}
|
|
|
//钱包功能暂未完成此效验默认状态都是1通过
|
|
|
if (storeUser.getMoney() != null && storeUser.getMoney() > 0) {
|
|
|
- //vaule为0代表有未体现的现金
|
|
|
+ // value为0代表有未体现的现金
|
|
|
storeMap.put("accountMoney", "0");
|
|
|
} else {
|
|
|
- //vaule为1代表没有未体现的现金
|
|
|
+ // value为1代表没有未体现的现金
|
|
|
storeMap.put("accountMoney", "1");
|
|
|
}
|
|
|
}
|
|
|
return storeMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 注销校验:店铺是否存在未结束的点餐/预订订单。
|
|
|
+ * value 为 0 表示存在未完成订单,1 表示通过。
|
|
|
+ */
|
|
|
+ private void fillPendingOrderVerification(Map<String, String> storeMap, Integer storeId) {
|
|
|
+ long pendingDiningCount = storeOrderMapper.selectCount(new LambdaQueryWrapper<StoreOrder>()
|
|
|
+ .eq(StoreOrder::getStoreId, storeId)
|
|
|
+ .in(StoreOrder::getOrderStatus, PENDING_DINING_ORDER_STATUSES)
|
|
|
+ .eq(StoreOrder::getDeleteFlag, 0));
|
|
|
+ storeMap.put("accountDiningOrder", pendingDiningCount > 0 ? "0" : "1");
|
|
|
+ storeMap.put("accountDiningOrderCount", String.valueOf(pendingDiningCount));
|
|
|
+
|
|
|
+ long pendingReservationCount = userReservationOrderMapper.selectCount(new LambdaQueryWrapper<UserReservationOrder>()
|
|
|
+ .eq(UserReservationOrder::getStoreId, storeId)
|
|
|
+ .in(UserReservationOrder::getOrderStatus, PENDING_RESERVATION_ORDER_STATUSES)
|
|
|
+ .eq(UserReservationOrder::getDeleteFlag, 0));
|
|
|
+ storeMap.put("accountReservationOrder", pendingReservationCount > 0 ? "0" : "1");
|
|
|
+ storeMap.put("accountReservationOrderCount", String.valueOf(pendingReservationCount));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @param phone
|