|
@@ -220,7 +220,7 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
|
tenantAlbumRefService.getByAlbumId(tenantAlbum.getId());
|
|
|
if (CollectionUtils.isEmpty(refList)) {
|
|
|
log.error("订单创建前检测,专辑不在机构下,bizId={}", orderGoodsInfo.getBizId());
|
|
|
- throw new BizException("用户不在当前机构");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
|
|
|
// 机构ID集合
|
|
@@ -241,39 +241,39 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
|
Student student = studentService.getById(orderGoodsInfo.getUserId());
|
|
|
if (student == null) {
|
|
|
log.error("订单创建前检测,学生不存在,userId={}", orderGoodsInfo.getUserId());
|
|
|
- throw new BizException("用户信息未找到");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
TenantInfo tenantInfo = tenantInfoService.detail(student.getTenantId());
|
|
|
if (tenantInfo == null || !tenantIdList.contains(tenantInfo.getId())) {
|
|
|
log.error("订单创建前检测,学生不在当前机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(), student.getTenantId());
|
|
|
- throw new BizException("用户不在当前机构");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
if (orderGoodsInfo.getTenantGroupAlbumId() == null) {
|
|
|
log.error("订单创建前检测,学生购买机构专辑,机构小组专辑ID为空,userId={}", orderGoodsInfo.getUserId());
|
|
|
- throw new BizException("机构小组专辑ID为空");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
// 判断机构小组专辑ID是否能购买,专辑ID和当前机构专辑ID是否对应
|
|
|
TenantGroupAlbum tenantGroupAlbum = tenantGroupAlbumService.getById(orderGoodsInfo.getTenantGroupAlbumId());
|
|
|
if (tenantGroupAlbum == null || tenantGroupAlbum.getDelFlag() || !tenantGroupAlbum.getStatus()) {
|
|
|
log.error("订单创建前检测,学生购买机构专辑,机构小组专辑不存在,userId={},tenantGroupAlbumId={}", orderGoodsInfo.getUserId(), orderGoodsInfo.getTenantGroupAlbumId());
|
|
|
- throw new BizException("小组专辑不存在");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
|
|
|
// 判断学生是否在小组
|
|
|
if (orderGoodsInfo.getTenantGroupAlbumId().equals(student.getTenantGroupId())) {
|
|
|
log.error("订单创建前检测,学生购买机构专辑,学生不在小组,userId={},tenantGroupAlbumId={}", orderGoodsInfo.getUserId(), orderGoodsInfo.getTenantGroupAlbumId());
|
|
|
- throw new BizException("学生不在小组");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
if (!tenantGroupAlbum.getTenantAlbumId().equals(orderGoodsInfo.getBizId())) {
|
|
|
log.error("订单创建前检测,学生购买机构专辑,机构小组专辑ID和当前机构专辑ID不对应,userId={},tenantGroupAlbumId={},bizId={}", orderGoodsInfo.getUserId(), orderGoodsInfo.getTenantGroupAlbumId(), orderGoodsInfo.getBizId());
|
|
|
- throw new BizException("小组专辑和当前购买专辑不对应");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
// 判断购买次数
|
|
|
if (tenantGroupAlbum.getBuyTimesFlag()) {
|
|
|
List<Long> studentTenantAlbumNum = userOrderDao.getStudentTenantAlbumNum(student.getUserId(), Lists.newArrayList(tenantGroupAlbum.getId()));
|
|
|
if (CollectionUtils.isNotEmpty(studentTenantAlbumNum) && studentTenantAlbumNum.size() >= tenantGroupAlbum.getBuyTimes()) {
|
|
|
log.error("订单创建前检测,学生购买机构专辑,机构小组专辑购买次数超过限制,userId={},tenantGroupAlbumId={},buyTimes={}", orderGoodsInfo.getUserId(), orderGoodsInfo.getTenantGroupAlbumId(), tenantGroupAlbum.getBuyTimes());
|
|
|
- throw new BizException("购买次数超过限制");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -298,31 +298,31 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
|
}
|
|
|
if (!tenantIdList.contains(tenantStaff.getTenantId())) {
|
|
|
log.error("订单创建前检测,专辑不在机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(), tenantStaff.getTenantId());
|
|
|
- throw new BizException("用户不在当前机构");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
// 根据周期判断能不能购买当前周期的专辑
|
|
|
if (StringUtil.isEmpty(tenantAlbum.getPurchaseTypes())) {
|
|
|
log.error("订单创建前检测,机构购买机构专辑,专辑周期为空,userId={},bizId={}", orderGoodsInfo.getUserId(), orderGoodsInfo.getBizId());
|
|
|
- throw new BizException("专辑不支持当前周期");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
List<String> purchaseTypes = Arrays.asList(tenantAlbum.getPurchaseTypes().split(","));
|
|
|
if (!purchaseTypes.contains(tenantAlbumContent.getPurchaseType())) {
|
|
|
log.error("订单创建前检测,机构购买机构专辑,专辑周期不支持,userId={},bizId={},purchaseType={}", orderGoodsInfo.getUserId(),
|
|
|
orderGoodsInfo.getBizId(), tenantAlbumContent.getPurchaseType());
|
|
|
- throw new BizException("专辑不支持当前周期");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
List<TenantAlbumWrapper.TenantAlbumPurchaseJson> tenantAlbumPurchaseJsons = JSON
|
|
|
.parseArray(tenantAlbum.getPurchaseJson(), TenantAlbumWrapper.TenantAlbumPurchaseJson.class);
|
|
|
if (CollectionUtils.isEmpty(tenantAlbumPurchaseJsons)) {
|
|
|
log.error("订单创建前检测,机构购买机构专辑,专辑周期不支持,userId={},bizId={},purchaseType={}", orderGoodsInfo.getUserId(),
|
|
|
orderGoodsInfo.getBizId(), tenantAlbumContent.getPurchaseType());
|
|
|
- throw new BizException("专辑不支持当前周期");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
Optional<TenantAlbumWrapper.TenantAlbumPurchaseJson> first = tenantAlbumPurchaseJsons.stream().filter(o -> o.getType().equals(tenantAlbumContent.getPurchaseType())).findFirst();
|
|
|
if (!first.isPresent()) {
|
|
|
log.error("订单创建前检测,机构购买机构专辑,专辑周期不支持,userId={},bizId={},purchaseType={}", orderGoodsInfo.getUserId(),
|
|
|
orderGoodsInfo.getBizId(), tenantAlbumContent.getPurchaseType());
|
|
|
- throw new BizException("专辑不支持当前周期");
|
|
|
+ throw new BizException("该专辑已不可购买");
|
|
|
}
|
|
|
TenantAlbumWrapper.TenantAlbumPurchaseJson tenantAlbumPurchaseJson = first.get();
|
|
|
|