新客立减返回修改
This commit is contained in:
@@ -19,6 +19,7 @@ import com.czg.market.entity.MkShopConsumeDiscountRecord;
|
|||||||
import com.czg.market.service.MkShopConsumeDiscountRecordService;
|
import com.czg.market.service.MkShopConsumeDiscountRecordService;
|
||||||
import com.czg.service.market.mapper.MkShopConsumeDiscountRecordMapper;
|
import com.czg.service.market.mapper.MkShopConsumeDiscountRecordMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.auth.v1alpha1.Ca;
|
import org.apache.dubbo.auth.v1alpha1.Ca;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -33,6 +34,7 @@ import java.util.Random;
|
|||||||
* @author zs
|
* @author zs
|
||||||
* @since 2025-09-17
|
* @since 2025-09-17
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopConsumeDiscountRecordMapper, MkShopConsumeDiscountRecord> implements MkShopConsumeDiscountRecordService {
|
public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopConsumeDiscountRecordMapper, MkShopConsumeDiscountRecord> implements MkShopConsumeDiscountRecordService {
|
||||||
@Resource
|
@Resource
|
||||||
@@ -116,14 +118,17 @@ public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopCo
|
|||||||
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE));
|
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE));
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new ApiNotPrintException("新客立减仅新用户可用");
|
// throw new ApiNotPrintException("新客立减仅新用户可用");
|
||||||
|
log.info("新客立减仅限新用户使用");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
MkConsumeDiscountVO consumeDiscountVO = canUse(shopId, userId);
|
MkConsumeDiscountVO consumeDiscountVO = canUse(shopId, userId);
|
||||||
|
|
||||||
DateTime now = DateUtil.date();
|
DateTime now = DateUtil.date();
|
||||||
|
|
||||||
if (!now.isAfterOrEquals(DateUtil.date(consumeDiscountVO.getStartTime())) || !now.isBeforeOrEquals(DateUtil.date(consumeDiscountVO.getEndTime()))) {
|
if (!now.isAfterOrEquals(DateUtil.date(consumeDiscountVO.getStartTime())) || !now.isBeforeOrEquals(DateUtil.date(consumeDiscountVO.getEndTime()))) {
|
||||||
throw new ApiNotPrintException("此时间段未开启新客立减");
|
log.info("此时间段未开启新客立减");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
MkShopConsumeDiscountRecord shopConsumeDiscountRecord = new MkShopConsumeDiscountRecord();
|
MkShopConsumeDiscountRecord shopConsumeDiscountRecord = new MkShopConsumeDiscountRecord();
|
||||||
shopConsumeDiscountRecord.setShopId(shopId);
|
shopConsumeDiscountRecord.setShopId(shopId);
|
||||||
|
|||||||
Reference in New Issue
Block a user