Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java
#	mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java
#	mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
Joburgess 4 rokov pred
rodič
commit
cd80a7475d
40 zmenil súbory, kde vykonal 619 pridanie a 268 odobranie
  1. 2 0
      cms/src/main/java/com/ym/mec/cms/config/ResourceServerConfig.java
  2. 27 0
      cms/src/main/java/com/ym/mec/cms/controller/TaskController.java
  3. 6 0
      cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java
  4. 25 0
      cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java
  5. 6 0
      cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java
  6. 18 0
      cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java
  7. 18 2
      cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml
  8. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/LuckDrawPrizeDao.java
  9. 31 15
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderCourseSettingsDao.java
  10. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java
  11. 13 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfoDto.java
  12. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java
  13. 14 11
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java
  14. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderCourseSettings.java
  15. 0 22
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java
  16. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/LuckDrawQueryInfo.java
  17. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/LuckDrawPrizeService.java
  18. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java
  19. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/LuckDrawPrizeServiceImpl.java
  20. 107 69
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  21. 20 75
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  22. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  23. 19 24
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SporadicChargeInfoImpl.java
  24. 19 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  25. 5 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountServiceImpl.java
  26. 3 3
      mec-biz/src/main/resources/config/mybatis/LuckDrawCountMapper.xml
  27. 24 0
      mec-biz/src/main/resources/config/mybatis/LuckDrawGroupMapper.xml
  28. 17 13
      mec-biz/src/main/resources/config/mybatis/LuckDrawLogMapper.xml
  29. 23 6
      mec-biz/src/main/resources/config/mybatis/LuckDrawPrizeMapper.xml
  30. 18 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml
  31. 2 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml
  32. 12 0
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  33. 16 0
      mec-client-api/src/main/java/com/ym/mec/cms/task/CmsTaskRemoteService.java
  34. 19 0
      mec-client-api/src/main/java/com/ym/mec/cms/task/fallback/CmsTaskRemoteServiceFallback.java
  35. 29 3
      mec-student/src/main/java/com/ym/mec/student/controller/SporadicChargeInfoController.java
  36. 20 0
      mec-task/src/main/java/com/ym/mec/task/jobs/CmsUpdateStatusTask.java
  37. 2 2
      mec-task/src/main/resources/logback-spring.xml
  38. 26 0
      mec-web/src/main/java/com/ym/mec/web/controller/LuckDrawController.java
  39. 5 7
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java
  40. 3 2
      mec-web/src/main/java/com/ym/mec/web/controller/education/ActivityController.java

+ 2 - 0
cms/src/main/java/com/ym/mec/cms/config/ResourceServerConfig.java

@@ -25,6 +25,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
 		http.authorizeRequests()
+		.antMatchers("/task/**")
+		.hasIpAddress("0.0.0.0/0")
 				.antMatchers("/v2/api-docs", "/news/list", "/news/query", "/news/homeList")
 				.permitAll()
 				// 任何人不登录都可以获取的资源

+ 27 - 0
cms/src/main/java/com/ym/mec/cms/controller/TaskController.java

@@ -0,0 +1,27 @@
+package com.ym.mec.cms.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.cms.service.SysNewsInformationService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("task")
+@RestController
+@Api(tags = "资讯服务")
+public class TaskController extends BaseController {
+
+	@Autowired
+	private SysNewsInformationService sysNewsInformationService;
+
+	@ApiOperation(value = "查询奖品组列表")
+	@GetMapping("/updateStatus")
+	public void updateStatus(){
+		sysNewsInformationService.autoUpdateStatus();
+	}
+}

+ 6 - 0
cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java

@@ -25,4 +25,10 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	List<SysNewsInformation> queryHomePage(Map<String, Object> params);
 	
 	int queryHomeCount(Map<String, Object> params);
+	
+	/**
+	 * 查询需要更新状态的对象集合
+	 * @return
+	 */
+	List<SysNewsInformation> queryNeedUpdateStatusList();
 }

+ 25 - 0
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java

@@ -1,6 +1,9 @@
 package com.ym.mec.cms.dal.entity;
 
 import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 /**
@@ -46,6 +49,12 @@ public class SysNewsInformation {
 
 	@ApiModelProperty(value = "顺序号", required = true)
 	private Integer order;
+	
+	@ApiModelProperty(value = "上线时间", required = false)
+	private Date onlineTime;
+	
+	@ApiModelProperty(value = "下线时间", required = false)
+	private Date offlineTime;
 
 	/**  */
 	private java.util.Date createTime;
@@ -208,6 +217,22 @@ public class SysNewsInformation {
 		this.attribute2 = attribute2;
 	}
 
+	public Date getOnlineTime() {
+		return onlineTime;
+	}
+
+	public void setOnlineTime(Date onlineTime) {
+		this.onlineTime = onlineTime;
+	}
+
+	public Date getOfflineTime() {
+		return offlineTime;
+	}
+
+	public void setOfflineTime(Date offlineTime) {
+		this.offlineTime = offlineTime;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 6 - 0
cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java

@@ -32,4 +32,10 @@ public interface SysNewsInformationService extends BaseService<Long, SysNewsInfo
 	 * @return
 	 */
 	Map<String, PageInfo<SysNewsInformation>> getHomeList(SysUser user, NewsInformationQueryInfo queryInfo);
+	
+	/**
+	 * 自动更新状态
+	 * @return
+	 */
+	boolean autoUpdateStatus();
 }

+ 18 - 0
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -150,4 +150,22 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		return pageInfo;
 	}
 
+	@Override
+	public boolean autoUpdateStatus() {
+		List<SysNewsInformation> list = sysNewsInformationDao.queryNeedUpdateStatusList();
+		if(list != null && list.size() > 0){
+			Date now = new Date();
+			for(SysNewsInformation news : list){
+				if(news.getStatus() == NewsStatusEnum.SHOW){
+					news.setStatus(NewsStatusEnum.HIDDEN);
+				}else{
+					news.setStatus(NewsStatusEnum.SHOW);
+				}
+				news.setUpdateTime(now);
+				sysNewsInformationDao.update(news);
+			}
+		}
+		return true;
+	}
+
 }

+ 18 - 2
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -14,6 +14,8 @@
 		<result column="video_cover_image_" property="videoCoverImage" />
 		<result column="link_url_" property="linkUrl"/>
 		<result column="type_" property="type"/>
+		<result column="online_time_" property="onlineTime"/>
+		<result column="offline_time_" property="offlineTime"/>
 		<result column="sub_type_" property="subType"/>
 		<result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
 		<result column="create_time_" property="createTime" />
@@ -73,8 +75,8 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_)
-		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2})
+		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_)
+		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -105,6 +107,12 @@
 			<if test="type != null">
 				type_ = #{type},
 			</if>
+			<if test="onlineTime != null">
+				online_time_ = #{onlineTime},
+			</if>
+			<if test="offlineTime != null">
+				offline_time_ = #{offlineTime},
+			</if>
 			<if test="subType != null">
 				sub_type_ = #{subType},
 			</if>
@@ -236,4 +244,12 @@
 			</choose>
 		</if>
 	</select>
+	
+	<select id="queryNeedUpdateStatusList" resultMap="SysNewsInformation" >
+		SELECT * FROM sys_news_information WHERE del_flag_ = 0 and (
+		(online_time_ is not null and now() between online_time_ and offline_time_ and status_ = 0) 
+		or (offline_time_ is not null and offline_time_ &lt;= now() and status_ = 1)
+		or (online_time_ is not null and online_time_ &gt;= now() and status_ = 1)
+		)
+	</select>
 </mapper>

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/LuckDrawPrizeDao.java

@@ -20,4 +20,11 @@ public interface LuckDrawPrizeDao extends BaseDAO<Integer, LuckDrawPrize> {
 	 * @return
 	 */
 	LuckDrawPrize getLock(Integer id);
+	
+	/**
+	 * 批量新增
+	 * @param luckDrawPrizeList
+	 * @return
+	 */
+	int batchInsert(List<LuckDrawPrize> luckDrawPrizeList);
 }

+ 31 - 15
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderCourseSettingsDao.java

@@ -8,22 +8,38 @@ import java.util.List;
 
 public interface MusicGroupPaymentCalenderCourseSettingsDao extends BaseDAO<Integer, MusicGroupPaymentCalenderCourseSettings> {
 
-    /**
-     * @describe 获取指定缴费日历的课程价格设置
-     * @author Joburgess
-     * @date 2020.10.27
-     * @param calenderId:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings>
-     */
-    List<MusicGroupPaymentCalenderCourseSettings> getWithPaymentCalender(@Param("calenderId") Long calenderId);
+	/**
+	 * @param calenderId:
+	 * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings>
+	 * @describe 获取指定缴费日历的课程价格设置
+	 * @author Joburgess
+	 * @date 2020.10.27
+	 */
+	List<MusicGroupPaymentCalenderCourseSettings> getWithPaymentCalender(@Param("calenderId") Long calenderId);
 
 	int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
 
-    /**
-     * 获取乐团的缴费课程
-     *
-     * @param musicGroupId
-     * @return
-     */
-    List<MusicGroupPaymentCalenderCourseSettings> getMusicGroupRegCalenderCourseSettings(@Param("musicGroupId") String musicGroupId);
+	/**
+	 * 获取乐团的缴费课程
+	 *
+	 * @param musicGroupId
+	 * @return
+	 */
+	List<MusicGroupPaymentCalenderCourseSettings> getMusicGroupRegCalenderCourseSettings(@Param("musicGroupId") String musicGroupId);
+
+	/**
+	 * 获取乐团的缴费课程
+	 *
+	 * @param ids
+	 * @return
+	 */
+	List<MusicGroupPaymentCalenderCourseSettings> getCalenderCourseSettings(@Param("ids") List<Integer> ids);
+
+	/**
+	 * 批量新增
+	 * @param musicGroupPaymentCalenderCourseSettingsList
+	 * @return
+	 */
+	int batchInsert(List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList);
+
 }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -325,4 +325,20 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      */
     List<OrderStatisDto> doubleEleven2020Statis(@Param("organs") List<Organization> organs);
 
+    /**
+     * 获取用户某种类型订单成功的数量
+     *
+     * @param userId
+     * @param type
+     * @return
+     */
+    int getUserOrderNumByType(@Param("userId") Integer userId, @Param("orderType") OrderTypeEnum orderType);
+
+
+    /**
+     * 根据ids获取商品
+     * @param ids
+     * @return
+     */
+    List<UserGoodsDto> getUserGoods(@Param("ids") String ids);
 }

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfoDto.java

@@ -1,8 +1,10 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
+import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
 import java.util.Map;
@@ -27,6 +29,9 @@ public class MusicGroupSubjectGoodsAndInfoDto {
     //其他商品(教材、琴谱)
     private List<Goods> otherGoods;
 
+    @ApiModelProperty(value = "课程组成形态",required = false)
+    private List<MusicGroupPaymentCalenderCourseSettings> courseSettings;
+
     public Map getCourseScheduleInfo() {
         return CourseScheduleInfo;
     }
@@ -66,4 +71,12 @@ public class MusicGroupSubjectGoodsAndInfoDto {
     public void setStudentGoods(List<Goods> studentGoods) {
         this.studentGoods = studentGoods;
     }
+
+    public List<MusicGroupPaymentCalenderCourseSettings> getCourseSettings() {
+        return courseSettings;
+    }
+
+    public void setCourseSettings(List<MusicGroupPaymentCalenderCourseSettings> courseSettings) {
+        this.courseSettings = courseSettings;
+    }
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java

@@ -29,6 +29,8 @@ public class RegisterPayDto {
     @ApiModelProperty(value = "可选课程的key",required = false)
     private List<String> courseKeys;
 
+    @ApiModelProperty(value = "新的乐团课程形态",required = false)
+    private List<Integer> newCourse;
 
     public Integer getRegisterId() {
         return registerId;
@@ -93,4 +95,12 @@ public class RegisterPayDto {
     public void setCourseKeys(List<String> courseKeys) {
         this.courseKeys = courseKeys;
     }
+
+    public List<Integer> getNewCourse() {
+        return newCourse;
+    }
+
+    public void setNewCourse(List<Integer> newCourse) {
+        this.newCourse = newCourse;
+    }
 }

+ 14 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -100,10 +100,13 @@ public class MusicGroupPaymentCalender {
 
 	private String studentIds;
 
+	private List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
+
 	private String batchNo;
-	
+
 	private List<MusicGroupPaymentCalenderCourseSettings> MusicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
 
+
 	public Integer getPaymentType() {
 		return paymentType;
 	}
@@ -136,14 +139,6 @@ public class MusicGroupPaymentCalender {
 		this.paymentValidEndDate = paymentValidEndDate;
 	}
 
-	public String getStudentIds() {
-		return studentIds;
-	}
-
-	public void setStudentIds(String studentIds) {
-		this.studentIds = studentIds;
-	}
-
 	public void setId(Long id) {
 		this.id = id;
 	}
@@ -256,12 +251,20 @@ public class MusicGroupPaymentCalender {
 		this.payUserType = payUserType;
 	}
 
+	public String getStudentIds() {
+		return studentIds;
+	}
+
+	public void setStudentIds(String studentIds) {
+		this.studentIds = studentIds;
+	}
+
 	public List<MusicGroupPaymentCalenderCourseSettings> getMusicGroupPaymentCalenderCourseSettingsList() {
-		return MusicGroupPaymentCalenderCourseSettingsList;
+		return musicGroupPaymentCalenderCourseSettingsList;
 	}
 
 	public void setMusicGroupPaymentCalenderCourseSettingsList(List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
-		MusicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderCourseSettingsList;
+		this.musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderCourseSettingsList;
 	}
 
 	public String getBatchNo() {

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderCourseSettings.java

@@ -13,7 +13,7 @@ public class MusicGroupPaymentCalenderCourseSettings {
 	private Integer id;
 	
 	/**  */
-	private Integer musicGroupPaymentCalenderId;
+	private Long musicGroupPaymentCalenderId;
 	
 	/** 课程类型 */
 	private CourseSchedule.CourseScheduleType courseType;
@@ -47,11 +47,11 @@ public class MusicGroupPaymentCalenderCourseSettings {
 		return this.id;
 	}
 			
-	public void setMusicGroupPaymentCalenderId(Integer musicGroupPaymentCalenderId){
+	public void setMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId){
 		this.musicGroupPaymentCalenderId = musicGroupPaymentCalenderId;
 	}
 	
-	public Integer getMusicGroupPaymentCalenderId(){
+	public Long getMusicGroupPaymentCalenderId(){
 		return this.musicGroupPaymentCalenderId;
 	}
 			

+ 0 - 22
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java

@@ -53,12 +53,6 @@ public class MusicGroupPaymentCalenderDetail {
 	/**  */
 	private java.util.Date deadlinePaymentDate;
 
-	/**  */
-	private java.util.Date startPaymentDateMgpc;
-
-	/**  */
-	private java.util.Date deadlinePaymentDateMgpc;
-
 	@ApiModelProperty(value = "订单编号",required = true)
 	private Long paymentOrderId;
 
@@ -70,22 +64,6 @@ public class MusicGroupPaymentCalenderDetail {
 
 	private Integer useInCourse;
 
-	public Date getStartPaymentDateMgpc() {
-		return startPaymentDateMgpc;
-	}
-
-	public void setStartPaymentDateMgpc(Date startPaymentDateMgpc) {
-		this.startPaymentDateMgpc = startPaymentDateMgpc;
-	}
-
-	public Date getDeadlinePaymentDateMgpc() {
-		return deadlinePaymentDateMgpc;
-	}
-
-	public void setDeadlinePaymentDateMgpc(Date deadlinePaymentDateMgpc) {
-		this.deadlinePaymentDateMgpc = deadlinePaymentDateMgpc;
-	}
-
 	private SysUser sysUser = new SysUser();
 
 	public YesOrNoEnum getOpenFlag() {

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/LuckDrawQueryInfo.java

@@ -17,6 +17,8 @@ public class LuckDrawQueryInfo extends QueryInfo {
 	private Date endDate;
 
 	private Integer groupId;
+	
+	private Integer organId;
 
 	public String getName() {
 		return name;
@@ -65,4 +67,12 @@ public class LuckDrawQueryInfo extends QueryInfo {
 	public void setGroupId(Integer groupId) {
 		this.groupId = groupId;
 	}
+
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/LuckDrawPrizeService.java

@@ -1,9 +1,18 @@
 package com.ym.mec.biz.service;
 
+import java.util.List;
+
 import com.ym.mec.biz.dal.entity.LuckDrawPrize;
 import com.ym.mec.common.service.BaseService;
 
 public interface LuckDrawPrizeService extends BaseService<Integer, LuckDrawPrize> {
+	
+	/**
+	 * 批量新增
+	 * @param luckDrawPrizeList
+	 * @return
+	 */
+	boolean batchInsert(List<LuckDrawPrize> luckDrawPrizeList);
 
 	/**
 	 * 抽奖

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -9,10 +9,10 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 
 	/**
 	 * 创建缴费信息
-	 * @param musicGroupPaymentCalenderList
+	 * @param musicGroupPaymentCalenderDto
 	 * @return
 	 */
-	boolean create(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList);
+	boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender);
 	
 	/**
 	 * 更新缴费信息

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LuckDrawPrizeServiceImpl.java

@@ -50,6 +50,14 @@ public class LuckDrawPrizeServiceImpl extends BaseServiceImpl<Integer, LuckDrawP
 	}
 
 	@Override
+	public boolean batchInsert(List<LuckDrawPrize> luckDrawPrizeList) {
+		if (luckDrawPrizeList != null && luckDrawPrizeList.size() > 0) {
+			luckDrawPrizeDao.batchInsert(luckDrawPrizeList);
+		}
+		return true;
+	}
+
+	@Override
 	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
 	public LuckDrawPrize draw(final Long userId, int group) {
 		final LuckDrawGroup luckDrawGroup = luckDrawGroupService.get(group);

+ 107 - 69
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -77,12 +77,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean create(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList) {
-		if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0){
-			throw new BizException("请重新创建缴费记录");
-		}
+	public boolean create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
 		
-		String musicGroupId = musicGroupPaymentCalenderList.get(0).getMusicGroupId();
+		String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
 
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
 		
@@ -94,85 +91,102 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		Map<Integer, String> pushUserMap = new HashMap<Integer, String>();
 		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
+		
 
-		for(MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList){
-			musicGroupPaymentCalender.setCreateTime(date);
-			musicGroupPaymentCalender.setUpdateTime(date);
-			if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null) {
-				musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
+		musicGroupPaymentCalender.setCreateTime(date);
+		musicGroupPaymentCalender.setUpdateTime(date);
+		
+		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null) {
+			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
+		}
+		int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
+				musicGroupPaymentCalender.getPaymentValidEndDate(), null);
+		if (count > 0) {
+			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
+		}
+		
+		//获取设置的课程
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
+		if(musicGroupPaymentCalenderCourseSettingsList == null){
+			musicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
+		}
+		
+		//查询默认课程费用
+		Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
+		Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
+		
+		//当前缴费的课程费用
+		Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
+		
+		BigDecimal totalPrice = new BigDecimal(0);
+		//相同类型的课程如果修改了课程费用,需要走审批
+		for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
+			if(defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0){
+				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
 			}
-			int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
-					musicGroupPaymentCalender.getPaymentValidEndDate(), null);
-			if (count > 0) {
-				throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
+			totalPrice.add(entry.getValue());
+		}
+		
+		if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
+			if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
+				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
+			} else if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
+				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
+			} else {
+				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
 			}
 			
-			//查询默认课程费用
-			Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
-			Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
-			
-			//当前缴费的课程费用
-			Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList().stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
-			
-			BigDecimal totalPrice = new BigDecimal(0);
-			//相同类型的课程如果修改了课程费用,需要走审批
-			for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
-				if(defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0){
-					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
-				}
-				totalPrice.add(entry.getValue());
+			//如果是报名,需要修改乐团状态
+			if (musicGroupPaymentCalender.getPaymentType() == 1) {
+				musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
+				musicGroup.setUpdateTime(date);
+				musicGroupDao.update(musicGroup);
 			}
+		}
+
+		musicGroupPaymentCalender.setExpectNum(0);
+		if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
+			String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
+			musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
 			
-			if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
-				if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
-					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
-				} else if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
-					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
-				} else {
-					musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
-				}
-				
-				//如果是报名,需要修改乐团状态
-				if (musicGroupPaymentCalender.getPaymentType() == 1) {
-					musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
-					musicGroup.setUpdateTime(date);
-					musicGroupDao.update(musicGroup);
+			if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
+				for(String studentId : sutdentIdList){
+					pushUserMap.put(Integer.parseInt(studentId), studentId);
 				}
 			}
-
-			musicGroupPaymentCalender.setExpectNum(0);
-			if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
-				String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
-				musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
-				
-				if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
-					for(String studentId : sutdentIdList){
-						pushUserMap.put(Integer.parseInt(studentId), studentId);
-					}
-				}
+			
+			//创建缴费明细
+			for(String studentId : sutdentIdList){
+				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
+				musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+				musicGroupPaymentCalenderDetail.setCreateTime(date);
+				musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
+				musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
+				musicGroupPaymentCalenderDetail.setUpdateTime(date);
+				musicGroupPaymentCalenderDetail.setUserId(Integer.parseInt(studentId));
+				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
+				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
 				
-				//创建缴费明细
-				for(String studentId : sutdentIdList){
-					musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
-					musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-					musicGroupPaymentCalenderDetail.setCreateTime(date);
-					musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
-					musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
-					musicGroupPaymentCalenderDetail.setUpdateTime(date);
-					musicGroupPaymentCalenderDetail.setUserId(Integer.parseInt(studentId));
-					
-					musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
-				}
+				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
 			}
 		}
+		
+		Long musicGroupPaymentCalenderId = musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
+		
+		for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
+			musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
+			musicGroupPaymentCalenderCourseSettings.setCreateTime(date);
+			musicGroupPaymentCalenderCourseSettings.setUpdateTime(date);
+		}
+		
+		if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
+			musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingsList);
+		}
 
 		if (musicGroupPaymentCalenderDetailList.size() > 0) {
 			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
 		}
 		
-		if(musicGroupPaymentCalenderList.size() > 0){
-			musicGroupPaymentCalenderDao.batchInsert(musicGroupPaymentCalenderList);
-		}
 		
 		// 发送续费通知
 		if (pushUserMap.size() > 0) {
@@ -189,6 +203,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public int update(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+		
+		MusicGroupPaymentCalender orginMusicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalender.getId());
+		if(orginMusicGroupPaymentCalender == null){
+			throw new BizException("查询不到缴费记录");
+		}
+		//只有“拒绝”才能修改
+		if(orginMusicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.REJECT){
+			throw new BizException("缴费记录只有被“审核拒绝”才能修改");
+		}
+		
 		String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
 
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
@@ -209,12 +233,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
 		}
 		
+		//获取设置的课程
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
+		if(musicGroupPaymentCalenderCourseSettingsList == null){
+			musicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
+		}
+		
 		//查询默认课程费用
 		Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
 		Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
 		
 		//当前缴费的课程费用
-		Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList().stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
+		Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
 		
 		BigDecimal totalPrice = new BigDecimal(0);
 		//相同类型的课程如果修改了课程费用,需要走审批
@@ -268,6 +298,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
 				musicGroupPaymentCalenderDetail.setUpdateTime(date);
 				musicGroupPaymentCalenderDetail.setUserId(Integer.parseInt(studentId));
+				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
+				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
 				
 				musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
 			}
@@ -279,6 +311,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
 		}
 		
+		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+		
+		if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
+			musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingsList);
+		}
+		
 		// 发送续费通知
 		if (pushUserMap.size() > 0) {
 			String configValue = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);

+ 20 - 75
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -14,6 +14,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -26,34 +28,6 @@ import com.alibaba.fastjson.TypeReference;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.ChargeTypeDao;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.CooperationOrganDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentEntitiesDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
-import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectGoodsGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.CourseFormDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleTeachersDto;
@@ -64,33 +38,7 @@ import com.ym.mec.biz.dal.dto.SporadicPayDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectRegisterDto;
 import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
-import com.ym.mec.biz.dal.entity.ApprovalStatus;
-import com.ym.mec.biz.dal.entity.ChargeType;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
-import com.ym.mec.biz.dal.entity.MusicGroupQuit;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
@@ -251,6 +199,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private ImFeignService imFeignService;
     @Autowired
     private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
+    @Autowired
+    private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -394,28 +344,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("订单金额异常");
         }
         if (chargeInfo.getMaxNum() != null) {
-            //重试避免人数过多频繁冲突
-            boolean flag = false;
-            int max = 100, min = 1;
-            int ran2 = (int) (Math.random() * (max - min) + min);
-            for (int i = 1; i <= 100; i++) {
-                if (i == ran2) {
-                    Thread.sleep(500);
-                }
-                chargeInfo = sporadicChargeInfoDao.get(sporadicPayDto.getSporadicId());
-                if (chargeInfo.getMaxNum() != null && chargeInfo.getMaxNum() <= chargeInfo.getPaidNum()) {
-                    throw new BizException("活动人数暂时已满,请稍后再试");
-                }
-                chargeInfo.setPaidNum(chargeInfo.getPaidNum() + 1);
-                chargeInfo.setUpdateTime(new Date());
-                int update = sporadicChargeInfoDao.update(chargeInfo);
-                if (update > 0) {
-                    flag = true;
-                    break;
-                }
+            if(chargeInfo.getMaxNum() <= chargeInfo.getPaidNum()){
+                throw new Exception("活动人数暂时已满,请稍后再试");
             }
-            if (!flag) {
-                throw new BizException("活动火爆,请稍后再试"+ran2);
+            chargeInfo.setPaidNum(chargeInfo.getPaidNum() + 1);
+            chargeInfo.setUpdateTime(new Date());
+            int update = sporadicChargeInfoDao.update(chargeInfo);
+            if (update <= 0) {
+                throw new BizException("活动火爆,请稍后再试");
             }
         }
 
@@ -637,6 +573,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             }
         }
 
+        //新课程形态
+        List<MusicGroupPaymentCalenderCourseSettings> newCourses = new ArrayList<>();
+        if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
+            newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
+            for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
+                orderAmount = orderAmount.add(calenderCourseSetting.getCourseCurrentPrice());
+            }
+        }
+
         if (amount.compareTo(orderAmount) != 0) {
             throw new BizException("商品价格不符");
         }

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -6,8 +6,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
-import com.ym.mec.biz.dal.dao.ChargeTypeSubjectMapperDao;
-import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.MusicGroupGoodsAndDiscountDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
@@ -15,8 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dto.MusicGroupRegRespDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
@@ -58,6 +55,8 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     private GoodsDao goodsDao;
     @Autowired
     private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
+    @Autowired
+    private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 
     @Override
     public BaseDAO<Integer, MusicGroupSubjectPlan> getDAO() {
@@ -94,7 +93,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
 
         //新的课程形态10.27
-
+        List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(musicGroupId);
 
 
         //乐团计划及收费信息
@@ -118,6 +117,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         MusicGroupSubjectGoodsAndInfoDto musicGroupSubjectGoodsAndInfo = new MusicGroupSubjectGoodsAndInfoDto();
         musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectPlan(musicOneSubjectClassPlan);
         musicGroupSubjectGoodsAndInfo.setCourseScheduleInfo(courseForm);
+        musicGroupSubjectGoodsAndInfo.setCourseSettings(courseSettings);
         musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectGoodsGroupList(goodsGroups);
         musicGroupSubjectGoodsAndInfo.setOtherGoods(otherGoods);
         return musicGroupSubjectGoodsAndInfo;

+ 19 - 24
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SporadicChargeInfoImpl.java

@@ -4,10 +4,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.SporadicChargeInfoQueryInfo;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
@@ -53,6 +50,8 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
     private DegreeRegistrationService degreeRegistrationService;
     @Autowired
     private ContractService contractService;
+    @Autowired
+    private LuckDrawCountService luckDrawCountService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -85,7 +84,17 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
 
             //福袋活动,增加课程余额
             if (info.getChargeType().getCode() == 6 || info.getChargeType().getCode() == 12) {
-                sysUserCashAccountService.appendCourseBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.SPORADIC, "双11活动");
+                //第二单起每买一单增加一次抽奖机会
+                int num = studentPaymentOrderDao.getUserOrderNumByType(userId, OrderTypeEnum.DOUBLE_ELEVEN2020);
+                if (num > 1) {
+                    if (!luckDrawCountService.updateTimes(userId.longValue(), 1)) {
+                        throw new BizException("给用户增加抽奖次数失败");
+                    }
+                }
+                boolean appendCourseBalance = sysUserCashAccountService.appendCourseBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.SPORADIC, "双11活动");
+                if (!appendCourseBalance) {
+                    throw new BizException("增加用户课程余额失败");
+                }
             } else if (info.getChargeType().getCode() == 9) { //零星收费账户充值
                 sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getActualAmount(), PlatformCashAccountDetailTypeEnum.RECHARGE, "零星收费账户充值", studentPaymentOrder.getTransNo());
             } else if (info.getOrganId().equals(42) && info.getChargeType().equals(SporadicChargeTypeEnum.LEVEL)) {
@@ -140,25 +149,11 @@ public class SporadicChargeInfoImpl extends BaseServiceImpl<Integer, SporadicCha
         }
         if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             if (info.getMaxNum() != null && info.getPaidNum() > 0) {
-                //重试避免人数过多频繁冲突
-                boolean flag = false;
-                int max = 100, min = 1;
-                int ran2 = (int) (Math.random() * (max - min) + min);
-                for (int i = 1; i <= 100; i++) {
-                    if (i == ran2) {
-                        Thread.sleep(ran2);
-                    }
-                    info = sporadicChargeInfoDao.get(info.getId());
-                    info.setPaidNum(info.getPaidNum() - 1);
-                    info.setUpdateTime(new Date());
-                    int update = sporadicChargeInfoDao.update(info);
-                    if (update > 0) {
-                        flag = true;
-                        break;
-                    }
-                }
-                if (!flag) {
-                    throw new BizException("活动火爆,请稍后再试");
+                info.setPaidNum(info.getPaidNum() - 1);
+                info.setUpdateTime(new Date());
+                int update = sporadicChargeInfoDao.update(info);
+                if (update <= 0) {
+                    throw new BizException("人数更新失败,请重试");
                 }
             }
             if (info.getOrganId().equals(42) && info.getChargeType().equals(SporadicChargeTypeEnum.LEVEL)) {

+ 19 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -66,6 +66,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
     @Autowired
     private MusicGroupQuitDao musicGroupQuitDao;
+    @Autowired
+    private SubjectChangeDao subjectChangeDao;
 
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -213,7 +215,23 @@ public class StudentManageServiceImpl implements StudentManageService {
         //获取学员报名时所选乐器
         if (musicGroups.size() > 0) {
             for (StudentManageBaseInfoOfMusicGroupDto e : musicGroups) {
-                e.setUserGoodsDtos(studentPaymentOrderDao.findGoodsIds(e.getMusicGroupId(), e.getUserId()));
+                List<UserGoodsDto> userGoods = new ArrayList<>();
+                SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(e.getUserId(), e.getMusicGroupId());
+                if (studentLastChange != null) {
+                    String goodsIds = "";
+                    if (studentLastChange.getChangeMusical() != null) {
+                        goodsIds += studentLastChange.getChangeMusical();
+                    }
+                    if (studentLastChange.getChangeAccessories() != null) {
+                        goodsIds += StringUtils.isNotBlank(goodsIds) ? "," + studentLastChange.getChangeAccessories() : studentLastChange.getChangeAccessories();
+                    }
+                    if (StringUtils.isNotBlank(goodsIds)) {
+                        userGoods = studentPaymentOrderDao.getUserGoods(goodsIds);
+                    }
+                } else {
+                    userGoods = studentPaymentOrderDao.findGoodsIds(e.getMusicGroupId(), e.getUserId());
+                }
+                e.setUserGoodsDtos(userGoods);
             }
         }
         List<MusicGroupQuit> userMusicQuits = musicGroupQuitDao.getUserMusicQuit(userId);

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountServiceImpl.java

@@ -235,12 +235,16 @@ public class SysUserCashAccountServiceImpl extends BaseServiceImpl<Integer, SysU
         sysUserCashAccountDao.update(cashAccount);
 
         if (decimal.compareTo(BigDecimal.ZERO) != 0) {
+           String comment = description;
             SysUser sysUser = sysUserFeignService.queryUserInfo();
+            if(sysUser != null && sysUser.getId()!=null){
+                comment +=  "-" + sysUser.getId();
+            }
             SysUserCoursesAccountDetail sysUserCoursesAccountDetail = new SysUserCoursesAccountDetail();
             sysUserCoursesAccountDetail.setUserId(userId);
             sysUserCoursesAccountDetail.setAmount(decimal);
             sysUserCoursesAccountDetail.setBalance(balance);
-            sysUserCoursesAccountDetail.setComment(description + "-" + sysUser.getId());
+            sysUserCoursesAccountDetail.setComment(comment);
             sysUserCoursesAccountDetail.setStatus(DealStatusEnum.SUCCESS);
             sysUserCoursesAccountDetail.setType(type);
             sysUserCoursesAccountDetail.setUpdateTime(date);

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/LuckDrawCountMapper.xml

@@ -5,7 +5,7 @@
     <id column="user_id_" property="userId" jdbcType="BIGINT" />
     <result column="used_count_" property="usedCount" jdbcType="INTEGER" />
     <result column="available_count_" property="availableCount" jdbcType="INTEGER" />
-    <result column="available_amount_" property="availableAmount.cent" jdbcType="BIGINT" />
+    <result column="available_amount_" property="availableAmount" jdbcType="BIGINT" />
     <result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
   </resultMap>
   <sql id="Base_Column_List" >
@@ -38,7 +38,7 @@
   <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawCount" >
     insert into luck_draw_count (user_id_, used_count_, available_count_, available_amount_,
       modify_on_)
-    values (#{userId,jdbcType=BIGINT}, #{usedCount,jdbcType=INTEGER}, #{availableCount,jdbcType=INTEGER}, #{availableAmount.cent,jdbcType=BIGINT}, 
+    values (#{userId,jdbcType=BIGINT}, #{usedCount,jdbcType=INTEGER}, #{availableCount,jdbcType=INTEGER}, #{availableAmount,jdbcType=BIGINT},
       #{modifyOn,jdbcType=TIMESTAMP})
   </insert>
   
@@ -52,7 +52,7 @@
         available_count_ = #{availableCount,jdbcType=INTEGER},
       </if>
       <if test="availableAmount != null" >
-        available_amount_ = #{availableAmount.cent,jdbcType=BIGINT},
+        available_amount_ = #{availableAmount,jdbcType=BIGINT},
       </if>
       <if test="modifyOn != null" >
         modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},

+ 24 - 0
mec-biz/src/main/resources/config/mybatis/LuckDrawGroupMapper.xml

@@ -22,6 +22,10 @@
     where id_ = #{id,jdbcType=INTEGER}
   </select>
   
+  <select id="findAll" resultMap="BaseResultMap" parameterType="map" >
+    select * from luck_draw_group
+  </select>
+  
   <delete id="delete" parameterType="java.lang.Integer" >
     delete from luck_draw_group
     where id_ = #{id,jdbcType=INTEGER}
@@ -60,4 +64,24 @@
     </set>
     where id_ = #{id,jdbcType=INTEGER}
   </update>
+
+	<select id="queryCount" parameterType="map" resultType="int">
+		select count(*) from luck_draw_group
+		<where>
+			<if test="search != null">
+				and name_ like concat('%',#{search},'%')
+			</if>
+		</where>
+	</select>
+
+	<select id="queryPage" parameterType="map" resultMap="BaseResultMap">
+		select * from luck_draw_group
+		<where>
+			<if test="search != null">
+				and name_ like concat('%',#{search},'%')
+			</if>
+		</where>
+		order by create_on_ desc
+		<include refid="global.limit" />
+	</select>
 </mapper>

+ 17 - 13
mec-biz/src/main/resources/config/mybatis/LuckDrawLogMapper.xml

@@ -12,8 +12,9 @@
 	</resultMap>
 	
 	<resultMap id="BaseResultMapExt" type="com.ym.mec.biz.dal.entity.LuckDrawLog" extends="BaseResultMap">
-		<result column="nickname_" property="user.nickname" jdbcType="VARCHAR" />
-		<result column="mobile_no_" property="user.mobileNo" jdbcType="VARCHAR" />
+		<result column="username_" property="user.username" jdbcType="VARCHAR" />
+		<result column="phone_" property="user.phone" jdbcType="VARCHAR" />
+		<result column="organ_name_" property="user.organName" jdbcType="VARCHAR" />
 	</resultMap>
 
 	<sql id="Base_Column_List">
@@ -29,10 +30,10 @@
 				and l.user_id_ = #{userId}
 			</if>
 			<if test="name != null">
-				and d.name_ like '%' #{name} '%'
+				and d.name_ like concat('%',#{name},'%')
 			</if>
 			<if test="rewardType != null">
-				and d.reward_type_ like '%' #{rewardType} '%'
+				and d.reward_type_ like concat('%',#{rewardType},'%')
 			</if>
 			<if test="groupId != null">
 				and l.group_id_ = #{groupId}
@@ -43,6 +44,9 @@
 			<if test="endDate != null">
 				and l.create_on_ &lt;= #{endDate}
 			</if>
+			<if test="organId != null">
+				and u.organ_id_ = #{organId}
+			</if>
 		</where>
 	</sql>
 
@@ -89,20 +93,20 @@
 		where id_ = #{id,jdbcType=BIGINT}
 	</update>
 
-	<select id="findCount" parameterType="map" resultType="int">
-		select count(*)
-		from (luck_draw_log l left join luck_draw_prize d on
-		l.prize_id_ = d.id_) left join sys_user u on u.id_=l.user_id_
+	<select id="queryCount" parameterType="map" resultType="int">
+		select count(*) from luck_draw_log l 
+		left join luck_draw_prize d on l.prize_id_ = d.id_ 
+		left join sys_user u on u.id_=l.user_id_
 		<include refid="queryCondition" />
 	</select>
 
 	<select id="queryPage" parameterType="map" resultMap="BaseResultMapExt">
-		select
-		<include refid="Base_Column_List" />,nickname_,mobile_no_
-		from (luck_draw_log l left join luck_draw_prize d on
-		l.prize_id_ = d.id_) left join sys_user u on u.id_=l.user_id_
+		select <include refid="Base_Column_List" />,u.username_,u.phone_,o.name_ organ_name_ from luck_draw_log l 
+		left join luck_draw_prize d on l.prize_id_ = d.id_ 
+		left join sys_user u on u.id_=l.user_id_
+		left join organization o on o.id_ = u.organ_id_
 		<include refid="queryCondition" />
-		<include refid="global.orderby" />
+		order by l.create_on_ desc
 		<include refid="global.limit" />
 	</select>
 </mapper>

+ 23 - 6
mec-biz/src/main/resources/config/mybatis/LuckDrawPrizeMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.ym.mec.biz.dal.dao.LuckDrawDao">
+<mapper namespace="com.ym.mec.biz.dal.dao.LuckDrawPrizeDao">
 	<resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.LuckDrawPrize">
 		<id column="id_" property="id" jdbcType="INTEGER" />
 		<result column="name_" property="name" jdbcType="VARCHAR" />
@@ -24,10 +24,13 @@
 				and id_ = #{id}
 			</if>
 			<if test="name != null">
-				and name_ like '%' #{name} '%'
+				and name_ like concat('%',#{name},'%')
 			</if>
 			<if test="rewardType != null">
-				and reward_type_ like '%' #{rewardType} '%'
+				and reward_type_ like concat('%',#{rewardType},'%')
+			</if>
+			<if test="groupId != null">
+				and group_id_ = #{groupId}
 			</if>
 		</where>
 	</sql>
@@ -51,7 +54,8 @@
 		where id_ = #{id,jdbcType=INTEGER}
 	</delete>
 
-	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawPrize">
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawPrize" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
 		insert into luck_draw_prize (id_, name_, chances_,
 		stock_, enabled_, reward_type_, memo_, group_id_, create_on_,
 		modify_on_)
@@ -61,6 +65,19 @@
 		#{modifyOn,jdbcType=TIMESTAMP})
 	</insert>
 
+	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
+		insert into luck_draw_prize (id_, name_, chances_,
+		stock_, enabled_, reward_type_, memo_, group_id_, create_on_,
+		modify_on_) values 
+		<foreach collection="list" item="item" separator=",">
+		(#{item.id,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
+		#{item.chances,jdbcType=DOUBLE}, #{item.stock,jdbcType=INTEGER}, 
+		#{item.enabled,jdbcType=BIT},#{item.rewardType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+		#{item.memo,jdbcType=VARCHAR}, #{item.groupId,jdbcType=INTEGER}, now(), now())
+		</foreach>
+	</insert>
+
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.LuckDrawPrize">
 		update luck_draw_prize
 		<set>
@@ -95,7 +112,7 @@
 		where id_ = #{id,jdbcType=INTEGER}
 	</update>
 
-	<select id="findCount" parameterType="map" resultType="int">
+	<select id="queryCount" parameterType="map" resultType="int">
 		select count(*) from luck_draw_prize
 		<include refid="queryCondition" />
 	</select>
@@ -103,7 +120,7 @@
 	<select id="queryPage" parameterType="map" resultMap="BaseResultMap">
 		select * from luck_draw_prize
 		<include refid="queryCondition" />
-		<include refid="global.orderby" />
+		order by create_on_ desc
 		<include refid="global.limit" />
 	</select>
 

+ 18 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml

@@ -33,12 +33,22 @@
 	<insert id="insert"
 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO music_group_payment_calender_course_settings
 		(id_,music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,course_current_price_,is_student_optional_,create_time_,update_time_)
 		VALUES(#{id},#{musicGroupPaymentCalenderId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseTotalMinuties},#{unitPrice},#{courseOriginalPrice},#{courseCurrentPrice},#{isStudentOptional},#{createTime},#{updateTime})
 	</insert>
+	
+	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
+		INSERT INTO music_group_payment_calender_course_settings
+		(id_,music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,course_current_price_,is_student_optional_,create_time_,update_time_)
+		VALUES
+		<foreach collection="list" item="item" separator=",">
+		(#{item.id},#{item.musicGroupPaymentCalenderId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.courseTotalMinuties},#{item.unitPrice},#{item.courseOriginalPrice},#{item.courseCurrentPrice},#{item.isStudentOptional},#{item.createTime},#{item.updateTime})
+		</foreach>
+	</insert>
 
 	<!-- 根据主键查询一条记录 -->
 	<update id="update"
@@ -107,4 +117,11 @@
 		WHERE mgpc.music_group_id_ = #{musicGroupId}
 		AND mgpc.payment_type_ = 1
 	</select>
+
+    <select id="getCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">
+		SELECT * FROM music_group_organization_course_settings WHERE id_ IN
+		<foreach collection="ids" item="id" open="(" close=")" separator=",">
+			#{id}
+		</foreach>
+	</select>
 </mapper>

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -55,7 +55,8 @@
 		#{userStatus},#{payTime},#{updateTime},#{createTime},#{startPaymentDate},#{deadlinePaymentDate},#{paymentOrderId},#{useInCourse})
 	</insert>
 
-    <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail">
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
         INSERT INTO music_group_payment_calender_detail
 		(id_,music_group_payment_calender_id_,user_id_,expect_amount_,actual_amount_,
 		payment_status_,user_status_,pay_time_,update_time_,create_time_,start_payment_date_,deadline_payment_date_,payment_order_id_,use_in_course_)

+ 12 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -384,6 +384,10 @@
           AND spo.user_id_ = #{userId}
     </select>
 
+    <select id="getUserGoods" resultMap="userGoodsDto">
+        SELECT id_ goods_id_, name_ goods_name_ FROM goods WHERE FIND_IN_SET(id_,#{ids})
+    </select>
+
     <select id="findOrdersByStatus" resultMap="StudentPaymentOrder">
         SELECT *
         FROM student_payment_order
@@ -736,4 +740,12 @@
         </foreach>
         GROUP BY spo.organ_id_
     </select>
+
+    <select id="getUserOrderNumByType" resultType="int">
+        SELECT COUNT(*)
+        FROM student_payment_order
+        WHERE user_id_ = #{userId}
+          AND status_ = 'SUCCESS'
+          AND type_ = #{orderType}
+    </select>
 </mapper>

+ 16 - 0
mec-client-api/src/main/java/com/ym/mec/cms/task/CmsTaskRemoteService.java

@@ -0,0 +1,16 @@
+package com.ym.mec.cms.task;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import com.ym.mec.cms.task.fallback.CmsTaskRemoteServiceFallback;
+import com.ym.mec.common.config.FeignConfiguration;
+
+@FeignClient(name = "cms-server", contextId = "CmsTaskRemoteService", configuration = { FeignConfiguration.class }, fallback = CmsTaskRemoteServiceFallback.class)
+public interface CmsTaskRemoteService {
+
+	@GetMapping(value = "task/updateStatus")
+	// 自动更新状态
+	public void updateStatusTask();
+
+}

+ 19 - 0
mec-client-api/src/main/java/com/ym/mec/cms/task/fallback/CmsTaskRemoteServiceFallback.java

@@ -0,0 +1,19 @@
+package com.ym.mec.cms.task.fallback;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import com.ym.mec.cms.task.CmsTaskRemoteService;
+
+@Component
+public class CmsTaskRemoteServiceFallback implements CmsTaskRemoteService {
+
+	private final static Logger logger = LoggerFactory.getLogger(CmsTaskRemoteServiceFallback.class);
+
+	@Override
+	public void updateStatusTask() {
+		logger.info("更新状态的服务调用失败");
+	}
+
+}

+ 29 - 3
mec-student/src/main/java/com/ym/mec/student/controller/SporadicChargeInfoController.java

@@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.Map;
 
 @RequestMapping("sporadicChargeInfo")
@@ -40,7 +42,7 @@ public class SporadicChargeInfoController extends BaseController {
     @ApiOperation(value = "单查询")
     @GetMapping("/get")
     public Object get(Integer id, Integer userId) {
-        return succeed(sporadicChargeInfoService.findDetail(id,userId));
+        return succeed(sporadicChargeInfoService.findDetail(id, userId));
     }
 
 
@@ -68,6 +70,31 @@ public class SporadicChargeInfoController extends BaseController {
                 return failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
         }
+        SporadicChargeInfo info = sporadicChargeInfoService.get(sporadicPayDto.getSporadicId());
+
+        if (info.getMaxNum() != null) {
+            String msg = "";
+            for (int i = 1; i <= 100; i++) {
+                try {
+                    Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
+                    if (payMap.containsKey("tradeState")) {
+                        return failed(HttpStatus.CREATED, "恭喜您,支付成功!");
+                    }
+                    return succeed(payMap);
+                } catch (Exception e) {
+                    msg = e.getMessage();
+                    if (e instanceof BizException) {
+                        int max = 100, min = 1;
+                        int times = (int) (Math.random() * (max - min) + min);
+                        Thread.sleep(times);
+                        continue;
+                    }
+                    break;
+                }
+            }
+            return failed(msg);
+        }
+
         Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
         if (payMap.containsKey("tradeState")) {
             return failed(HttpStatus.CREATED, "恭喜您,支付成功!");
@@ -93,10 +120,9 @@ public class SporadicChargeInfoController extends BaseController {
             return failed("参数不合法");
         }
         SporadicChargeInfo chargeInfo = sporadicChargeInfoService.findByOrganIdAndType(organId, type);
-        if(chargeInfo == null){
+        if (chargeInfo == null) {
             return failed("分部活动不存在");
         }
         return succeed(chargeInfo);
     }
-
 }

+ 20 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/CmsUpdateStatusTask.java

@@ -0,0 +1,20 @@
+package com.ym.mec.task.jobs;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.cms.task.CmsTaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+
+@Service
+public class CmsUpdateStatusTask extends BaseTask {
+
+	@Autowired
+	private CmsTaskRemoteService cmsTaskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		cmsTaskRemoteService.updateStatusTask();
+	}
+}

+ 2 - 2
mec-task/src/main/resources/logback-spring.xml

@@ -27,11 +27,11 @@
 		</encoder>
 	</appender>
 
-	<logger name="com.ym.mec" level="INFO" />
+	<logger name="com.ym.mec" level="debug" />
 
 	<!--开发环境:打印控制台 -->
 	<springProfile name="dev">
-		<root level="INFO">
+		<root level="info">
 			<appender-ref ref="stdout" />
 			<appender-ref ref="file" />
 		</root>

+ 26 - 0
mec-web/src/main/java/com/ym/mec/web/controller/LuckDrawController.java

@@ -3,7 +3,11 @@ package com.ym.mec.web.controller;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
+import java.math.BigDecimal;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
@@ -20,7 +24,9 @@ import com.ym.mec.biz.service.LuckDrawGroupService;
 import com.ym.mec.biz.service.LuckDrawLogService;
 import com.ym.mec.biz.service.LuckDrawPrizeService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.util.collection.MapUtil;
 
 @Api(tags = "抽奖")
 @RestController
@@ -36,6 +42,16 @@ public class LuckDrawController extends BaseController {
 	private LuckDrawLogService luckDrawLogService;
 	
 	@ApiOperation(value = "查询奖品组列表")
+	@GetMapping(value = "luckDrawGroup/findAll", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('luckDrawGroup/list')")
+	public Object luckDrawGroupFindAll(QueryInfo queryInfo) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+		
+		return succeed(luckDrawGroupService.findAll(params));
+	}
+	
+	@ApiOperation(value = "查询所有奖品组")
 	@GetMapping(value = "luckDrawGroup/list", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@PreAuthorize("@pcs.hasPermissions('luckDrawGroup/list')")
 	public Object luckDrawGroupList(QueryInfo queryInfo) {
@@ -71,6 +87,13 @@ public class LuckDrawController extends BaseController {
 		return succeed(luckDrawPrizeService.queryPage(queryInfo));
 	}
 
+	@ApiOperation(value = "批量新增抽奖奖品")
+	@PostMapping(value = "luckDrawPrize/batchAdd", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('luckDrawPrize/batchAdd')")
+	public Object batchAdd(@RequestBody List<LuckDrawPrize> luckDrawPrizeList) {
+		return luckDrawPrizeService.batchInsert(luckDrawPrizeList) ? succeed() : failed();
+	}
+
 	@ApiOperation(value = "新增抽奖奖品")
 	@PostMapping(value = "luckDrawPrize/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@PreAuthorize("@pcs.hasPermissions('luckDrawPrize/add')")
@@ -90,6 +113,9 @@ public class LuckDrawController extends BaseController {
 		oriGoods.setEnabled(luckDrawPrize.getEnabled());
 		oriGoods.setName(luckDrawPrize.getName());
 		oriGoods.setStock(luckDrawPrize.getStock());
+		oriGoods.setRewardType(luckDrawPrize.getRewardType());
+		oriGoods.setGroupId(luckDrawPrize.getGroupId());
+		oriGoods.setMemo(luckDrawPrize.getMemo());
 		Date date = new Date();
 		oriGoods.setModifyOn(date);
 		return luckDrawPrizeService.update(oriGoods) > 0 ? succeed() : failed();

+ 5 - 7
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -1,7 +1,5 @@
 package com.ym.mec.web.controller;
 
-import java.util.List;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
@@ -37,8 +35,8 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @ApiOperation(value = "新增乐团缴费日历")
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
-    public Object add(@RequestBody List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList) {
-        musicGroupPaymentCalenderService.create(musicGroupPaymentCalenderList);
+    public Object add(@RequestBody MusicGroupPaymentCalender musicGroupPaymentCalender) {
+        musicGroupPaymentCalenderService.create(musicGroupPaymentCalender);
         return succeed();
     }
 
@@ -51,9 +49,9 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     }
 
     @ApiOperation(value = "修改乐团缴费时间")
-    @PostMapping("/updateStartTime")
-    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/updateStartTime')")
-    public Object updateStartTime(MusicGroupPaymentCalender paymentCalender) {
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/update')")
+    public Object update(MusicGroupPaymentCalender paymentCalender) {
         musicGroupPaymentCalenderService.update(paymentCalender);
         return succeed();
     }

+ 3 - 2
mec-web/src/main/java/com/ym/mec/web/controller/education/ActivityController.java

@@ -66,9 +66,10 @@ public class ActivityController extends BaseController {
             totalNum += order.getNums();
             totalMoney = totalMoney.add(order.getMoney());
             if (order.getEstimatedNums() <= 0) {
-                order.setEstimatedNums(1);
+                order.setScale(new BigDecimal(order.getNums()).multiply(new BigDecimal(100)).divide(new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP));
+            }else {
+                order.setScale(new BigDecimal(order.getNums()).multiply(new BigDecimal(100)).divide(new BigDecimal(order.getEstimatedNums()), 2, BigDecimal.ROUND_HALF_UP));
             }
-            order.setScale(new BigDecimal(order.getNums()).multiply(new BigDecimal(100)).divide(new BigDecimal(order.getEstimatedNums()), 2, BigDecimal.ROUND_HALF_UP));
         }
         orders.sort(Comparator.comparing(OrderStatisDto::getMoney).reversed());