|
@@ -58,29 +58,32 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询详情
|
|
* 查询详情
|
|
|
|
+ *
|
|
* @param id 详情ID
|
|
* @param id 详情ID
|
|
* @return TenantAlbum
|
|
* @return TenantAlbum
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public TenantAlbum detail(Long id) {
|
|
public TenantAlbum detail(Long id) {
|
|
-
|
|
|
|
|
|
+
|
|
return baseMapper.selectById(id);
|
|
return baseMapper.selectById(id);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分页查询
|
|
* 分页查询
|
|
- * @param page IPage<TenantAlbum>
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param page IPage<TenantAlbum>
|
|
* @param query TenantAlbumWrapper.TenantAlbumQuery
|
|
* @param query TenantAlbumWrapper.TenantAlbumQuery
|
|
* @return IPage<TenantAlbum>
|
|
* @return IPage<TenantAlbum>
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public IPage<TenantAlbumWrapper.TenantAlbum> selectPage(IPage<TenantAlbumWrapper.TenantAlbum> page, TenantAlbumWrapper.TenantAlbumQuery query) {
|
|
|
|
- List<TenantAlbumWrapper.TenantAlbum> albums = baseMapper.selectPage(page, query);
|
|
|
|
- return page.setRecords(albums);
|
|
|
|
|
|
+ public IPage<TenantAlbumWrapper.TenantAlbum> selectPage(IPage<TenantAlbumWrapper.TenantAlbum> page,
|
|
|
|
+ TenantAlbumWrapper.TenantAlbumQuery query) {
|
|
|
|
+ return page.setRecords(baseMapper.selectPage(page, query));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加
|
|
* 添加
|
|
|
|
+ *
|
|
* @param tenantAlbum TenantAlbumWrapper.TenantAlbum
|
|
* @param tenantAlbum TenantAlbumWrapper.TenantAlbum
|
|
* @return Boolean
|
|
* @return Boolean
|
|
*/
|
|
*/
|
|
@@ -93,13 +96,14 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
|
|
|
|
/**
|
|
/**
|
|
* 更新
|
|
* 更新
|
|
|
|
+ *
|
|
* @param tenantAlbum TenantAlbumWrapper.TenantAlbum
|
|
* @param tenantAlbum TenantAlbumWrapper.TenantAlbum
|
|
* @return Boolean
|
|
* @return Boolean
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Boolean update(TenantAlbumWrapper.TenantAlbum tenantAlbum){
|
|
|
|
|
|
+ public Boolean update(TenantAlbumWrapper.TenantAlbum tenantAlbum) {
|
|
|
|
|
|
- return this.updateById(JSON.parseObject(tenantAlbum.jsonString(), TenantAlbum.class));
|
|
|
|
|
|
+ return this.updateById(JSON.parseObject(tenantAlbum.jsonString(), TenantAlbum.class));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -116,7 +120,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
}
|
|
}
|
|
|
|
|
|
TenantAlbumWrapper.TenantAlbumBuy tenantAlbumBuy = JSON
|
|
TenantAlbumWrapper.TenantAlbumBuy tenantAlbumBuy = JSON
|
|
- .parseObject(JSON.toJSONString(orderGoodsInfo.getBizContent()), TenantAlbumWrapper.TenantAlbumBuy.class);
|
|
|
|
|
|
+ .parseObject(JSON.toJSONString(orderGoodsInfo.getBizContent()),
|
|
|
|
+ TenantAlbumWrapper.TenantAlbumBuy.class);
|
|
if (tenantAlbumBuy == null) {
|
|
if (tenantAlbumBuy == null) {
|
|
log.error("订单创建前检测,订单商品信息为空");
|
|
log.error("订单创建前检测,订单商品信息为空");
|
|
throw new BizException("订单商品信息为空");
|
|
throw new BizException("订单商品信息为空");
|
|
@@ -156,7 +161,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
}
|
|
}
|
|
TenantInfo tenantInfo = tenantInfoService.detail(student.getTenantId());
|
|
TenantInfo tenantInfo = tenantInfoService.detail(student.getTenantId());
|
|
if (tenantInfo == null || !tenantIdList.contains(tenantInfo.getId())) {
|
|
if (tenantInfo == null || !tenantIdList.contains(tenantInfo.getId())) {
|
|
- log.error("订单创建前检测,学生不在当前机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(), student.getTenantId());
|
|
|
|
|
|
+ log.error("订单创建前检测,学生不在当前机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(),
|
|
|
|
+ student.getTenantId());
|
|
throw new BizException("用户不在当前机构");
|
|
throw new BizException("用户不在当前机构");
|
|
}
|
|
}
|
|
price = tenantAlbum.getSalePrice();
|
|
price = tenantAlbum.getSalePrice();
|
|
@@ -174,7 +180,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
throw new BizException("用户信息未找到");
|
|
throw new BizException("用户信息未找到");
|
|
}
|
|
}
|
|
if (!tenantIdList.contains(tenantStaff.getTenantId())) {
|
|
if (!tenantIdList.contains(tenantStaff.getTenantId())) {
|
|
- log.error("订单创建前检测,专辑不在机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(), tenantStaff.getTenantId());
|
|
|
|
|
|
+ log.error("订单创建前检测,专辑不在机构下,userId={},tenantId={}", orderGoodsInfo.getUserId(),
|
|
|
|
+ tenantStaff.getTenantId());
|
|
throw new BizException("用户不在当前机构");
|
|
throw new BizException("用户不在当前机构");
|
|
}
|
|
}
|
|
price = tenantAlbum.getOriginalPrice();
|
|
price = tenantAlbum.getOriginalPrice();
|
|
@@ -184,7 +191,6 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
userOrderDetail.setGoodUrl(userOrderService.getGoodUrlByType(orderGoodsInfo.getGoodType()));
|
|
userOrderDetail.setGoodUrl(userOrderService.getGoodUrlByType(orderGoodsInfo.getGoodType()));
|
|
userOrderDetail.setBizId(tenantAlbum.getId());
|
|
userOrderDetail.setBizId(tenantAlbum.getId());
|
|
userOrderDetail.setGoodNum(orderGoodsInfo.getGoodNum());
|
|
userOrderDetail.setGoodNum(orderGoodsInfo.getGoodNum());
|
|
@@ -214,62 +220,43 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 新增机构专辑
|
|
|
|
- * @param album
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public Boolean insertTenantAlbum(TenantAlbumWrapper.TenantAlbumVo album) {
|
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- TenantInfo tenantInfo = tenantInfoService.lambdaQuery().eq(TenantInfo::getUserId, sysUser.getId())
|
|
|
|
- .last("limit 1").one();
|
|
|
|
- if (tenantInfo == null) {
|
|
|
|
- throw new BizException("非法请求");
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void insertTenantAlbum(Long tenantId, TenantAlbum tenantAlbum,
|
|
|
|
+ List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList) {
|
|
|
|
|
|
|
|
+ List<String> subjectTypeNames = musicSheetDataList.stream().map(next -> next.getSubjectType().name())
|
|
|
|
+ .distinct().collect(Collectors.toList());
|
|
|
|
+ tenantAlbum.setSubjectTypes(String.join(",", subjectTypeNames));
|
|
//给机构专辑赋值
|
|
//给机构专辑赋值
|
|
- TenantAlbum tenantAlbum = new TenantAlbum();
|
|
|
|
- tenantAlbum.setName(album.getName());
|
|
|
|
- tenantAlbum.setDescribe(album.getDescribe());
|
|
|
|
- tenantAlbum.setCoverImg(album.getCoverImg());
|
|
|
|
- tenantAlbum.setPurchaseCycle(album.getPurchaseCycle());
|
|
|
|
- tenantAlbum.setSalePrice(album.getSalePrice());
|
|
|
|
-
|
|
|
|
- add(tenantAlbum);
|
|
|
|
|
|
+ tenantAlbum.setStatus(true);
|
|
|
|
+ tenantAlbum.setDelFlag(false);
|
|
|
|
+ this.add(tenantAlbum);
|
|
|
|
+
|
|
//关联表赋值
|
|
//关联表赋值
|
|
TenantAlbumRef ref = new TenantAlbumRef();
|
|
TenantAlbumRef ref = new TenantAlbumRef();
|
|
ref.setTenantAlbumId(tenantAlbum.getId());
|
|
ref.setTenantAlbumId(tenantAlbum.getId());
|
|
- ref.setTenantId(album.getTenantId());
|
|
|
|
|
|
+ ref.setTenantId(tenantId);
|
|
tenantAlbumRefService.add(ref);
|
|
tenantAlbumRefService.add(ref);
|
|
- //曲目表赋值
|
|
|
|
- List<TenantAlbumWrapper.TenantAlbumVo.MusicSheetData> data = album.getMusicSheetData();
|
|
|
|
-
|
|
|
|
- List<TenantAlbumMusic> tenantAlbumMusics = album.getMusicSheetData().stream().map(next -> {
|
|
|
|
|
|
|
|
- AtomicInteger sort = new AtomicInteger(0);
|
|
|
|
|
|
+ //曲目表赋值
|
|
|
|
+ List<TenantAlbumMusic> tenantAlbumMusics = musicSheetDataList.stream().map(next -> {
|
|
|
|
+ AtomicInteger sort = new AtomicInteger(1);
|
|
return next.getMusicSheetIdList().stream().map(tenantAlbumMusic -> {
|
|
return next.getMusicSheetIdList().stream().map(tenantAlbumMusic -> {
|
|
-
|
|
|
|
TenantAlbumMusic tenantAlbumMusic1 = new TenantAlbumMusic();
|
|
TenantAlbumMusic tenantAlbumMusic1 = new TenantAlbumMusic();
|
|
//tenantAlbumMusic1.setId(tenantAlbumMusic);
|
|
//tenantAlbumMusic1.setId(tenantAlbumMusic);
|
|
|
|
+ tenantAlbumMusic1.setTenantId(tenantId);
|
|
tenantAlbumMusic1.setSubjectType(next.getSubjectType());
|
|
tenantAlbumMusic1.setSubjectType(next.getSubjectType());
|
|
- tenantAlbumMusic1.setTenantId(album.getTenantId());
|
|
|
|
- tenantAlbumMusic1.setMusicSheetId(tenantAlbumMusic);
|
|
|
|
- tenantAlbumMusic1.setDelFlag(true);
|
|
|
|
tenantAlbumMusic1.setTenantAlbumId(tenantAlbum.getId());
|
|
tenantAlbumMusic1.setTenantAlbumId(tenantAlbum.getId());
|
|
|
|
+ tenantAlbumMusic1.setMusicSheetId(tenantAlbumMusic);
|
|
tenantAlbumMusic1.setSortNumber(sort.getAndIncrement());
|
|
tenantAlbumMusic1.setSortNumber(sort.getAndIncrement());
|
|
|
|
+ tenantAlbumMusic1.setDelFlag(false);
|
|
return tenantAlbumMusic1;
|
|
return tenantAlbumMusic1;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
-
|
|
|
|
}).flatMap(Collection::stream).collect(Collectors.toList());
|
|
}).flatMap(Collection::stream).collect(Collectors.toList());
|
|
|
|
|
|
- if(!tenantAlbumMusics.isEmpty()){
|
|
|
|
- tenantAlbumMusicService.saveBatch(tenantAlbumMusics,100);
|
|
|
|
|
|
+ if (!tenantAlbumMusics.isEmpty()) {
|
|
|
|
+ tenantAlbumMusicService.saveBatch(tenantAlbumMusics, 100);
|
|
}
|
|
}
|
|
-
|
|
|
|
- return true;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|