feat:查看当前用户是否有正在进行购买的动作
This commit is contained in:
1 parent
1ec66470e8
commit
c0161c424f
1 file changed
+11
-1
+11
-1
@@ -29,7 +29,9 @@ import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuJoinVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardAuthMapper;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import com.bsd.pjcloud.hard.mapper.HardDoorFlowMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.*;
|
||||
@@ -200,6 +202,14 @@ public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, Har
|
||||
if (!userCredit) {
|
||||
throw new RuntimeException("用户信誉不足,请联系管理员");
|
||||
}
|
||||
// 查看当前用户是否有正在进行购买的动作
|
||||
Long isHaveFlowCount = baseMapper.selectCount(new LambdaQueryWrapper<HardDoorFlowEntity>()
|
||||
.eq(HardDoorFlowEntity::getUserId, dto.getUserId())
|
||||
.eq(HardDoorFlowEntity::getIsOpen, YesNoEnum.NO.getCode())
|
||||
.eq(HardDoorFlowEntity::getBizType, HardDoorFlowBizEnum.PAY_OPEN.getType())
|
||||
.between(HardDoorFlowEntity::getCreateTime, LocalDateTime.now().minus(1, ChronoUnit.HOURS), LocalDateTime.now())
|
||||
);
|
||||
if (isHaveFlowCount > 0) throw new RuntimeException("正在购买中请勿重复操作,请稍后再试");
|
||||
// 查询货柜是否配置spu信息
|
||||
List<HardSpuJoinVo> spuList = hardSpuJoinService.getSpuList(hardDoorDetail.getId(), dto.getCabinetNo());
|
||||
if (ObjectUtil.isEmpty(spuList) || spuList.isEmpty()) throw new RuntimeException("货柜商品信息为空,请上架");
|
||||
|
||||
Reference in new issue
Block a user