|
|
@@ -25,6 +25,7 @@ import shop.alien.config.properties.RiskControlProperties;
|
|
|
import shop.alien.entity.second.LifeUserLog;
|
|
|
import shop.alien.entity.second.SecondGoods;
|
|
|
import shop.alien.entity.second.SecondRiskControlRecord;
|
|
|
+import shop.alien.entity.second.SecondTradeRecord;
|
|
|
import shop.alien.entity.second.enums.SecondGoodsStatusEnum;
|
|
|
import shop.alien.entity.store.*;
|
|
|
import shop.alien.entity.store.dto.LifeFansFollowOutcome;
|
|
|
@@ -35,6 +36,7 @@ import shop.alien.mapper.*;
|
|
|
import shop.alien.mapper.second.LifeUserLogMapper;
|
|
|
import shop.alien.mapper.second.SecondGoodsMapper;
|
|
|
import shop.alien.mapper.second.SecondRiskControlRecordMapper;
|
|
|
+import shop.alien.mapper.second.SecondTradeRecordMapper;
|
|
|
import shop.alien.mapper.second.SecondUserCreditMapper;
|
|
|
import shop.alien.util.common.constant.LawyerStatusEnum;
|
|
|
import shop.alien.store.config.BaseRedisService;
|
|
|
@@ -79,10 +81,15 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
|
|
|
private static final List<Integer> PENDING_RESERVATION_ORDER_STATUSES =
|
|
|
Arrays.asList(0, 1, 8);
|
|
|
|
|
|
+ /** 二手交易:待确认 / 待交易 */
|
|
|
+ private static final List<Integer> PENDING_SECOND_TRADE_STATUSES = Arrays.asList(1, 3);
|
|
|
+
|
|
|
private static final String CANCEL_MSG_PENDING_RESERVATION =
|
|
|
"您有待消费的商家预订,请完成消费或取消预订后再申请注销。";
|
|
|
private static final String CANCEL_MSG_LISTED_SECOND_GOODS =
|
|
|
"您有上架的二手商品,请确认下架后再申请注销。";
|
|
|
+ private static final String CANCEL_MSG_PENDING_SECOND_TRADE =
|
|
|
+ "您有待确认或待交易的二手订单,请完成交易或取消后再申请注销。";
|
|
|
private static final String CANCEL_MSG_CONSULT_IN_PROGRESS =
|
|
|
"您有进行中的法律咨询,请与律师确认服务完结后再申请注销。";
|
|
|
private static final String CANCEL_MSG_UNPAID_CONSULT_FEE =
|
|
|
@@ -145,6 +152,8 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
|
|
|
|
|
|
private final SecondGoodsMapper secondGoodsMapper;
|
|
|
|
|
|
+ private final SecondTradeRecordMapper secondTradeRecordMapper;
|
|
|
+
|
|
|
private final LawyerConsultationOrderMapper lawyerConsultationOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -564,7 +573,7 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 注销前业务校验:商家预订、二手上架、咨询进行中、咨询费用未结清。
|
|
|
+ * 注销前业务校验:商家预订、二手上架、二手待确认/待交易、咨询进行中、咨询费用未结清。
|
|
|
* 单项不满足返回对应提示;多项不满足返回汇总提示。
|
|
|
*/
|
|
|
private void validateCancelAccountBlockers(Integer userId) {
|
|
|
@@ -586,6 +595,16 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
|
|
|
blockers.add(CANCEL_MSG_LISTED_SECOND_GOODS);
|
|
|
}
|
|
|
|
|
|
+ long pendingSecondTradeCount = secondTradeRecordMapper.selectCount(
|
|
|
+ new LambdaQueryWrapper<SecondTradeRecord>()
|
|
|
+ .in(SecondTradeRecord::getTradeStatus, PENDING_SECOND_TRADE_STATUSES)
|
|
|
+ .and(w -> w.eq(SecondTradeRecord::getBuyerId, userId)
|
|
|
+ .or()
|
|
|
+ .eq(SecondTradeRecord::getSellerId, userId)));
|
|
|
+ if (pendingSecondTradeCount > 0) {
|
|
|
+ blockers.add(CANCEL_MSG_PENDING_SECOND_TRADE);
|
|
|
+ }
|
|
|
+
|
|
|
long inProgressConsultCount = lawyerConsultationOrderMapper.selectCount(
|
|
|
new LambdaQueryWrapper<LawyerConsultationOrder>()
|
|
|
.eq(LawyerConsultationOrder::getClientUserId, userId)
|