ソースを参照

Merge remote-tracking branch 'origin/master'

周箭河 5 年 前
コミット
1a7f053aa7

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -58,7 +58,7 @@ public class MusicGroupController extends BaseController {
         return succeed(musicGroupService.queryPage(queryInfo));
         return succeed(musicGroupService.queryPage(queryInfo));
     }
     }
 
 
-    @ApiOperation(value = "建团申请,提交声部设置")
+    @ApiOperation(value = "建团申请-->】新增、修改提交声部设置")
     @PostMapping("/subSet")
     @PostMapping("/subSet")
     public Object subSet(List<SubSettingUtilEntity> subSettingUtilEntitys){
     public Object subSet(List<SubSettingUtilEntity> subSettingUtilEntitys){
         musicGroupService.subSetting(subSettingUtilEntitys);
         musicGroupService.subSetting(subSettingUtilEntitys);
@@ -66,7 +66,7 @@ public class MusicGroupController extends BaseController {
     }
     }
 
 
     @ApiOperation(value = "建团申请,根据乐团编号获取已有声部设置")
     @ApiOperation(value = "建团申请,根据乐团编号获取已有声部设置")
-    @PostMapping("/subSet")
+    @PostMapping("/getSubSet")
     public Object getSubSetting(@RequestBody Integer musicGroupId){
     public Object getSubSetting(@RequestBody Integer musicGroupId){
         return succeed(musicGroupService.getSubSetting(musicGroupId));
         return succeed(musicGroupService.getSubSetting(musicGroupId));
     }
     }

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dao/MusicGroupSubjectGoodsGroupDao.java

@@ -14,4 +14,12 @@ public interface MusicGroupSubjectGoodsGroupDao extends BaseDAO<Long, MusicGroup
      * @return
      * @return
      */
      */
     int batchInsert(@Param("mappers") List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroups);
     int batchInsert(@Param("mappers") List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroups);
+
+    /**
+     * 获取建团申请,声部设置已确认数据
+     * @param musicGroupId
+     * @param subId
+     * @return
+     */
+    List<MusicGroupSubjectGoodsGroup> findGoodsGroup(@Param("musicGroupId") Integer musicGroupId, @Param("subId") String subId);
 }
 }

+ 10 - 1
mec-web/src/main/java/com/ym/mec/web/dal/dao/MusicGroupSubjectPlanDao.java

@@ -2,8 +2,17 @@ package com.ym.mec.web.dal.dao;
 
 
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.web.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.web.dal.entity.MusicGroupSubjectPlan;
+import com.ym.mec.web.dal.utilEntity.SubSetViewUtilEntity;
+
+import java.util.List;
 
 
 public interface MusicGroupSubjectPlanDao extends BaseDAO<Integer, MusicGroupSubjectPlan> {
 public interface MusicGroupSubjectPlanDao extends BaseDAO<Integer, MusicGroupSubjectPlan> {
 
 
-	
+
+    /**
+     * 根据乐团编号,获取乐团下所有科目,以及预计招生人数
+     * @param musicGroupId
+     * @return
+     */
+    List<SubSetViewUtilEntity> findSubByGroupId(Integer musicGroupId);
 }
 }

+ 14 - 1
mec-web/src/main/java/com/ym/mec/web/dal/entity/MusicGroupSubjectGoodsGroup.java

@@ -4,6 +4,8 @@ import com.ym.mec.web.dal.enums.GoodsType;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 
+import java.util.List;
+
 /**
 /**
  * 对应数据库表(music_group_subject_goods_group):
  * 对应数据库表(music_group_subject_goods_group):
  */
  */
@@ -31,6 +33,9 @@ public class MusicGroupSubjectGoodsGroup {
 	/** 商品列表(用逗号,分开) */
 	/** 商品列表(用逗号,分开) */
 	@ApiModelProperty(value = "商品列表(用逗号,分开)",required = false)
 	@ApiModelProperty(value = "商品列表(用逗号,分开)",required = false)
 	private String goodsIdList;
 	private String goodsIdList;
+
+	@ApiModelProperty(value = "商品名称列表",required = false)
+	private List<String> goodsName;
 	
 	
 	/**  */
 	/**  */
 	private java.util.Date createTime;
 	private java.util.Date createTime;
@@ -41,7 +46,15 @@ public class MusicGroupSubjectGoodsGroup {
 	/** 打包价格 */
 	/** 打包价格 */
 	@ApiModelProperty(value = "打包价格",required = false)
 	@ApiModelProperty(value = "打包价格",required = false)
 	private long price;
 	private long price;
-	
+
+	public List<String> getGoodsName() {
+		return goodsName;
+	}
+
+	public void setGoodsName(List<String> goodsName) {
+		this.goodsName = goodsName;
+	}
+
 	public void setId(Long id){
 	public void setId(Long id){
 		this.id = id;
 		this.id = id;
 	}
 	}

+ 13 - 1
mec-web/src/main/java/com/ym/mec/web/dal/entity/MusicGroupSubjectPlan.java

@@ -19,6 +19,10 @@ public class MusicGroupSubjectPlan {
 	/** 科目编号 */
 	/** 科目编号 */
 	@ApiModelProperty(value = "科目编号",required = false)
 	@ApiModelProperty(value = "科目编号",required = false)
 	private Integer subjectId;
 	private Integer subjectId;
+
+	/** 科目编号 */
+	@ApiModelProperty(value = "科目名称",required = false)
+	private String subName;
 	
 	
 	/** 预计学生数 */
 	/** 预计学生数 */
 	@ApiModelProperty(value = "预计学生数",required = false)
 	@ApiModelProperty(value = "预计学生数",required = false)
@@ -45,7 +49,15 @@ public class MusicGroupSubjectPlan {
 	
 	
 	/**  */
 	/**  */
 	private java.util.Date updateTime;
 	private java.util.Date updateTime;
-	
+
+	public String getSubName() {
+		return subName;
+	}
+
+	public void setSubName(String subName) {
+		this.subName = subName;
+	}
+
 	public void setId(Integer id){
 	public void setId(Integer id){
 		this.id = id;
 		this.id = id;
 	}
 	}

+ 64 - 0
mec-web/src/main/java/com/ym/mec/web/dal/utilEntity/SubSetViewUtilEntity.java

@@ -0,0 +1,64 @@
+package com.ym.mec.web.dal.utilEntity;
+
+import com.ym.mec.web.dal.entity.MusicGroupSubjectGoodsGroup;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+public class SubSetViewUtilEntity {
+
+    @ApiModelProperty(value = "乐团科目规划表编号",required = false)
+    private Integer planId;
+
+    @ApiModelProperty(value = "科目编号",required = false)
+    private String subId;
+
+    @ApiModelProperty(value = "科目名称",required = false)
+    private String subName;
+
+    @ApiModelProperty(value = "计划招生人数",required = false)
+    private Integer expectedStudentNum;
+
+    @ApiModelProperty(value = "乐器分组列表,包含乐器、辅件、教材",required = false)
+    private List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroups;
+
+    public Integer getPlanId() {
+        return planId;
+    }
+
+    public void setPlanId(Integer planId) {
+        this.planId = planId;
+    }
+
+    public String getSubId() {
+        return subId;
+    }
+
+    public void setSubId(String subId) {
+        this.subId = subId;
+    }
+
+    public String getSubName() {
+        return subName;
+    }
+
+    public void setSubName(String subName) {
+        this.subName = subName;
+    }
+
+    public Integer getExpectedStudentNum() {
+        return expectedStudentNum;
+    }
+
+    public void setExpectedStudentNum(Integer expectedStudentNum) {
+        this.expectedStudentNum = expectedStudentNum;
+    }
+
+    public List<MusicGroupSubjectGoodsGroup> getMusicGroupSubjectGoodsGroups() {
+        return musicGroupSubjectGoodsGroups;
+    }
+
+    public void setMusicGroupSubjectGoodsGroups(List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroups) {
+        this.musicGroupSubjectGoodsGroups = musicGroupSubjectGoodsGroups;
+    }
+}

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/dal/utilEntity/SubSettingUtilEntity.java

@@ -8,6 +8,9 @@ import java.util.List;
 //建团申请,声部设置实体类
 //建团申请,声部设置实体类
 public class SubSettingUtilEntity {
 public class SubSettingUtilEntity {
 
 
+    @ApiModelProperty(value = "乐团科目规划表编号",required = false)
+    private Integer planId;
+
     @ApiModelProperty(value = "乐团编号",required = false)
     @ApiModelProperty(value = "乐团编号",required = false)
     private Integer musicGroupId;
     private Integer musicGroupId;
 
 
@@ -20,6 +23,14 @@ public class SubSettingUtilEntity {
     @ApiModelProperty(value = "当前声部商品打包列表",required = false)
     @ApiModelProperty(value = "当前声部商品打包列表",required = false)
     private List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroups;
     private List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroups;
 
 
+    public Integer getPlanId() {
+        return planId;
+    }
+
+    public void setPlanId(Integer planId) {
+        this.planId = planId;
+    }
+
     public Integer getMusicGroupId() {
     public Integer getMusicGroupId() {
         return musicGroupId;
         return musicGroupId;
     }
     }

+ 2 - 1
mec-web/src/main/java/com/ym/mec/web/service/MusicGroupService.java

@@ -2,6 +2,7 @@ package com.ym.mec.web.service;
 
 
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.web.dal.entity.MusicGroup;
 import com.ym.mec.web.dal.entity.MusicGroup;
+import com.ym.mec.web.dal.utilEntity.SubSetViewUtilEntity;
 import com.ym.mec.web.dal.utilEntity.SubSettingUtilEntity;
 import com.ym.mec.web.dal.utilEntity.SubSettingUtilEntity;
 
 
 import java.util.List;
 import java.util.List;
@@ -19,5 +20,5 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
      * @param musicGroupId
      * @param musicGroupId
      * @return
      * @return
      */
      */
-    String getSubSetting(Integer musicGroupId);
+    List<SubSetViewUtilEntity> getSubSetting(Integer musicGroupId);
 }
 }

+ 28 - 7
mec-web/src/main/java/com/ym/mec/web/service/impl/MusicGroupServiceImpl.java

@@ -6,6 +6,7 @@ import com.ym.mec.web.dal.dao.SubjectDao;
 import com.ym.mec.web.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.web.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.web.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.web.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.web.dal.entity.Subject;
 import com.ym.mec.web.dal.entity.Subject;
+import com.ym.mec.web.dal.utilEntity.SubSetViewUtilEntity;
 import com.ym.mec.web.dal.utilEntity.SubSettingUtilEntity;
 import com.ym.mec.web.dal.utilEntity.SubSettingUtilEntity;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
 import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
@@ -19,7 +20,9 @@ import com.ym.mec.web.service.MusicGroupService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 @Service
 @Service
 public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup>  implements MusicGroupService {
 public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup>  implements MusicGroupService {
@@ -46,23 +49,41 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup>
 		Date date = new Date();
 		Date date = new Date();
 		for (SubSettingUtilEntity e:subSettingUtilEntitys) {
 		for (SubSettingUtilEntity e:subSettingUtilEntitys) {
 			subject = subjectDao.get(e.getSubId());
 			subject = subjectDao.get(e.getSubId());
-			//保存乐团科目规划
+			//保存、修改乐团科目规划
 			if(subject != null){
 			if(subject != null){
 				musicGroupSubjectPlan = new MusicGroupSubjectPlan();
 				musicGroupSubjectPlan = new MusicGroupSubjectPlan();
 				musicGroupSubjectPlan.setMusicGroupId(e.getMusicGroupId());
 				musicGroupSubjectPlan.setMusicGroupId(e.getMusicGroupId());
 				musicGroupSubjectPlan.setSubjectId(e.getSubId());
 				musicGroupSubjectPlan.setSubjectId(e.getSubId());
 				musicGroupSubjectPlan.setExpectedStudentNum(e.getExpectedStudentNum());
 				musicGroupSubjectPlan.setExpectedStudentNum(e.getExpectedStudentNum());
-				musicGroupSubjectPlan.setCreateTime(date);
 				musicGroupSubjectPlan.setUpdateTime(date);
 				musicGroupSubjectPlan.setUpdateTime(date);
-				musicGroupSubjectPlanDao.insert(musicGroupSubjectPlan);
-				//保存乐团科目乐器范围,以及打包商品
-				musicGroupSubjectGoodsGroupDao.batchInsert(e.getMusicGroupSubjectGoodsGroups());
+				if(e.getPlanId() != null){
+					musicGroupSubjectPlan.setId(e.getPlanId());
+					musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
+				}else {
+					musicGroupSubjectPlan.setCreateTime(date);
+					musicGroupSubjectPlanDao.insert(musicGroupSubjectPlan);
+				}
+				//保存、修改乐团科目乐器范围,以及打包商品
+				for (MusicGroupSubjectGoodsGroup m:e.getMusicGroupSubjectGoodsGroups()) {
+					if(m.getId() == null){
+						musicGroupSubjectGoodsGroupDao.insert(m);
+					}else {
+						m.setUpdateTime(date);
+						musicGroupSubjectGoodsGroupDao.update(m);
+					}
+				}
 			}
 			}
 		}
 		}
 	}
 	}
 
 
 	@Override
 	@Override
-	public String getSubSetting(Integer musicGroupId) {
-		return null;
+	public List<SubSetViewUtilEntity> getSubSetting(Integer musicGroupId) {
+		//获取已选择的声部
+		List<SubSetViewUtilEntity> subSetViewUtilEntities = musicGroupSubjectPlanDao.findSubByGroupId(musicGroupId);
+		//获取已选的商品组
+		for (SubSetViewUtilEntity subSetViewUtilEntity:subSetViewUtilEntities) {
+			subSetViewUtilEntity.setMusicGroupSubjectGoodsGroups(musicGroupSubjectGoodsGroupDao.findGoodsGroup(musicGroupId,subSetViewUtilEntity.getSubId()));
+		}
+		return subSetViewUtilEntities;
 	}
 	}
 }
 }

+ 14 - 7
mec-web/src/main/resources/config/mybatis/MusicGroupSubjectGoodsGroupMapper.xml

@@ -36,7 +36,7 @@
 			AS ID FROM DUAL </selectKey> -->
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO music_group_subject_goods_group
 		INSERT INTO music_group_subject_goods_group
 		(id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_)
 		(id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_)
-		VALUES(#{id},#{name},#{type},#{musicGroupId},#{subjectId},#{goodsIdList},#{createTime},#{updateTime},#{price})
+		VALUES(#{id},#{name},#{type},#{musicGroupId},#{subjectId},#{goodsIdList},NOW(),NOW(),#{price})
 	</insert>
 	</insert>
 
 
     <insert id="batchInsert" parameterType="java.util.List">
     <insert id="batchInsert" parameterType="java.util.List">
@@ -60,9 +60,6 @@
 			<if test="goodsIdList != null">
 			<if test="goodsIdList != null">
 				goods_id_list_ = #{goodsIdList},
 				goods_id_list_ = #{goodsIdList},
 			</if>
 			</if>
-			<if test="id != null">
-				id_ = #{id},
-			</if>
 			<if test="updateTime != null">
 			<if test="updateTime != null">
 				update_time_ = #{updateTime},
 				update_time_ = #{updateTime},
 			</if>
 			</if>
@@ -75,9 +72,6 @@
 			<if test="name != null">
 			<if test="name != null">
 				name_ = #{name},
 				name_ = #{name},
 			</if>
 			</if>
-			<if test="createTime != null">
-				create_time_ = #{createTime},
-			</if>
 		</set>
 		</set>
 		WHERE id_ = #{id}
 		WHERE id_ = #{id}
 	</update>
 	</update>
@@ -100,4 +94,17 @@
 		SELECT COUNT(*) FROM
 		SELECT COUNT(*) FROM
 		music_group_subject_goods_group
 		music_group_subject_goods_group
 	</select>
 	</select>
+
+	<resultMap type="com.ym.mec.web.dal.entity.MusicGroupSubjectGoodsGroup" id="findGoodsGroupMap">
+		<result column="name_" property="name" />
+		<result column="type_" property="type" />
+		<result column="price_" property="price" />
+		<result column="id_" property="id" />
+		<collection property="goodsName" column="goods_name_" ofType="java.lang.String" javaType="java.util.List"/>
+	</resultMap>
+    <select id="findGoodsGroup" resultMap="findGoodsGroupMap">
+		SELECT mgs.name_,mgs.type_,mgs.price_,g.name_ goods_name_,mgs.id_ FROM music_group_subject_goods_group mgs
+		LEFT JOIN goods g ON g.id_ IN (mgs.goods_id_list_)
+		WHERE mgs.music_group_id_ = #{musicGroupId} AND mgs.subject_id_ = #{subId}
+	</select>
 </mapper>
 </mapper>

+ 13 - 0
mec-web/src/main/resources/config/mybatis/MusicGroupSubjectPlanMapper.xml

@@ -89,4 +89,17 @@
     <select id="queryCount" resultType="int">
     <select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM music_group_subject_plan
 		SELECT COUNT(*) FROM music_group_subject_plan
 	</select>
 	</select>
+
+    <resultMap type="com.ym.mec.web.dal.utilEntity.SubSetViewUtilEntity" id="findSubByGroupIdMap">
+        <result column="plan_id_" property="planId" />
+        <result column="sub_id_" property="subId" />
+        <result column="sub_name_" property="subName" />
+        <result column="expected_student_num_" property="expectedStudentNum" />
+    </resultMap>
+    <select id="findSubByGroupId" resultMap="findSubByGroupIdMap">
+        SELECT mgsp.id_ plan_id_,mgsp.expected_student_num_,s.name_ sub_name_,s.id_ sub_id_
+        FROM music_group_subject_plan mgsp
+        LEFT JOIN `subject` s ON mgsp.subject_id_ = s.id_
+        WHERE mgsp.music_group_id_ = #{musicGroupId}
+    </select>
 </mapper>
 </mapper>