Jelajahi Sumber

机构专辑提交

haonan 2 tahun lalu
induk
melakukan
bfe62babef

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TenantAlbum.java

@@ -43,6 +43,11 @@ public class TenantAlbum implements Serializable {
 	@TableField(value = "music_num_")
     private Integer musicNum;
 
+    @ApiModelProperty("原价")
+    @TableField(value = "cost_price_")
+    private BigDecimal costPrice;
+
+
     @ApiModelProperty("平台价格") 
 	@TableField(value = "original_price_")
     private BigDecimal originalPrice;

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/SubjectTypeEnum.java

@@ -21,7 +21,7 @@ public enum SubjectTypeEnum implements BaseEnum<String, SubjectTypeEnum> {
     private String msg;
 
     SubjectTypeEnum(String msg) {
-        this.code = code;
+        code = this.name();
         this.msg = msg;
     }
 

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TenantAlbumService.java

@@ -56,7 +56,7 @@ public interface TenantAlbumService extends IService<TenantAlbum>  {
      */
     void orderSuccess(UserOrderDetailVo userOrderDetailVo);
 
-    Boolean insertTenantAlbum(TenantAlbumWrapper.TenantAlbum album);
+    Boolean insertTenantAlbum(TenantAlbumWrapper.TenantAlbumVo album);
 
 
     /**

+ 4 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumServiceImpl.java

@@ -220,7 +220,8 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
      * @return
      */
     @Override
-    public Boolean insertTenantAlbum(TenantAlbumWrapper.TenantAlbum album) {
+    @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();
@@ -236,16 +237,14 @@ public class TenantAlbumServiceImpl extends ServiceImpl<TenantAlbumMapper, Tenan
         tenantAlbum.setPurchaseCycle(album.getPurchaseCycle());
         tenantAlbum.setSalePrice(album.getSalePrice());
 
-        //tenantAlbumService.addTenantAlbum(tenantAlbum);
         add(tenantAlbum);
         //关联表赋值
-        //tenantAlbumService.addTenantId(album.getTenantId());
         TenantAlbumRef ref = new TenantAlbumRef();
-        ref.setTenantAlbumId(album.getId());
+        ref.setTenantAlbumId(tenantAlbum.getId());
         ref.setTenantId(album.getTenantId());
         tenantAlbumRefService.add(ref);
         //曲目表赋值
-        List<TenantAlbumWrapper.TenantAlbum.MusicSheetData> data = album.getMusicSheetData();
+        List<TenantAlbumWrapper.TenantAlbumVo.MusicSheetData> data = album.getMusicSheetData();
 
         List<TenantAlbumMusic> tenantAlbumMusics = album.getMusicSheetData().stream().map(next -> {
 

+ 58 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumWrapper.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.biz.dal.wrapper;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
 import io.swagger.annotations.ApiModel;
@@ -18,6 +19,8 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * 机构专辑
  * 2023-07-21 17:32:49
@@ -101,6 +104,9 @@ public class TenantAlbumWrapper {
         @ApiModelProperty("机构价格")
         private BigDecimal salePrice;
 
+        @ApiModelProperty("原价")
+        private BigDecimal costPrice;
+
         @ApiModelProperty("购买周期")
         private Integer purchaseCycle;
 
@@ -189,4 +195,55 @@ public class TenantAlbumWrapper {
         @ApiModelProperty(value = "采购机构", hidden = true)
         private Long tenantId;
 
-    }}
+    }
+
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel(" 机构专辑新增")
+    public static class TenantAlbumVo {
+        @ApiModelProperty("机构ID")
+        private Long tenantId;
+
+        @ApiModelProperty("专辑名称")
+        @NotNull
+        private String name;
+
+        @ApiModelProperty("机构名称")
+        private String tenantName;
+
+        @ApiModelProperty("专辑介绍")
+        @NotNull
+        private String describe;
+
+        @ApiModelProperty("专辑封面")
+        @NotNull
+        private String coverImg;
+
+        @ApiModelProperty("曲目声部分类(多个,分隔)")
+        private String subjectTypes;
+
+        @ApiModelProperty("曲目相关信息")
+        private List<MusicSheetData> musicSheetData = new ArrayList<>();
+
+        @ApiModelProperty("机构价格")
+        private BigDecimal salePrice;
+
+        @ApiModelProperty("原价")
+        private BigDecimal costPrice;
+
+        @ApiModelProperty("购买周期")
+        private Integer purchaseCycle;
+
+
+        @Data
+        public static class MusicSheetData {
+            private SubjectTypeEnum subjectType;
+
+            private List<Long> musicSheetIdList = new ArrayList<>();
+        }
+    }
+
+}

+ 2 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantAlbumMapper.xml

@@ -19,12 +19,13 @@
         , t.del_flag_ AS delFlag
         , t.update_time_ AS updateTime
         , t.create_time_ AS createTime
+        , t.cost_price_ AS costPrice
         </sql> 
     
     <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper$TenantAlbum">
 		SELECT         
         	<include refid="baseColumns" />
-        i.name_ AS tenantName
+        , i.name_ AS tenantName
 		FROM tenant_album t
         LEFT JOIN tenant_album_ref r on  t.id_ = r.tenant_album_id_
         left join tenant_info i on r.tenant_id_ = i.id_