Explorar o código

Merge remote-tracking branch 'origin/master'

周箭河 %!s(int64=5) %!d(string=hai) anos
pai
achega
8c6ad0820c

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

@@ -197,4 +197,11 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @return
      */
     List<StudentRegistration> queryStudentByMusicGroupId(String musicGroupId);
+
+    /**
+     * 统计乐团不同声部报名人数
+     * @param musicGroupId
+     * @return
+     */
+    List<Map<Long, Long>> countApplyNum(String musicGroupId);
 }

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/ContractService.java

@@ -64,17 +64,17 @@ public interface ContractService {
 	 * 传递商品协议
 	 * @param userId
 	 * @param musicGroupId
-	 * @param musicGroupSubjectGoodsGroupIds
+	 * @param goodsIds
 	 * @return
 	 */
-	boolean transferGoodsContract(Integer userId, String musicGroupId, String musicGroupSubjectGoodsGroupIds);
+	boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds);
 
 	/**
 	 * 查询商品协议
 	 * @param userId
 	 * @param musicGroupId
-	 * @param musicGroupSubjectGoodsGroupIds
+	 * @param goodsIds
 	 * @return
 	 */
-	String queryGoodsContract(Integer userId, String musicGroupId, String musicGroupSubjectGoodsGroupIds);
+	String queryGoodsContract(Integer userId, String musicGroupId, String goodsIds);
 }

+ 16 - 25
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -22,7 +22,6 @@ import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.Subject;
@@ -70,7 +69,7 @@ public class ContractServiceImpl implements ContractService {
 
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-	
+
 	@Autowired
 	private MusicGroupSubjectGoodsGroupService musicGroupSubjectGoodsGroupService;
 
@@ -85,7 +84,7 @@ public class ContractServiceImpl implements ContractService {
 
 	@Autowired
 	private StoragePlugin storagePlugin;
-	
+
 	@Autowired
 	private GoodsService goodsService;
 
@@ -130,10 +129,10 @@ public class ContractServiceImpl implements ContractService {
 
 		if (sysUserTsign == null) {
 			SysUser user = sysUserFeignService.queryUserById(userId);
-			if(user == null){
+			if (user == null) {
 				throw new BizException("用户信息查询失败");
 			}
-			sysUserTsign = register(userId,user.getRealName(),user.getIdCardNo(),user.getPhone());
+			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
 		}
 
 		// 合成freemarker
@@ -218,10 +217,10 @@ public class ContractServiceImpl implements ContractService {
 
 		if (sysUserTsign == null) {
 			SysUser user = sysUserFeignService.queryUserById(userId);
-			if(user == null){
+			if (user == null) {
 				throw new BizException("用户信息查询失败");
 			}
-			sysUserTsign = register(userId,user.getRealName(),user.getIdCardNo(),user.getPhone());
+			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
 		}
 
 		// 合成freemarker
@@ -361,10 +360,10 @@ public class ContractServiceImpl implements ContractService {
 
 		if (sysUserTsign == null) {
 			SysUser user = sysUserFeignService.queryUserById(userId);
-			if(user == null){
+			if (user == null) {
 				throw new BizException("用户信息查询失败");
 			}
-			sysUserTsign = register(userId,user.getRealName(),user.getIdCardNo(),user.getPhone());
+			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
 		}
 
 		// 合成freemarker
@@ -477,15 +476,15 @@ public class ContractServiceImpl implements ContractService {
 	}
 
 	@Override
-	public boolean transferGoodsContract(Integer userId, String musicGroupId, String musicGroupSubjectGoodsGroupIds) {
+	public boolean transferGoodsContract(Integer userId, String musicGroupId, String goodsIds) {
 		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 
 		if (sysUserTsign == null) {
 			SysUser user = sysUserFeignService.queryUserById(userId);
-			if(user == null){
+			if (user == null) {
 				throw new BizException("用户信息查询失败");
 			}
-			sysUserTsign = register(userId,user.getRealName(),user.getIdCardNo(),user.getPhone());
+			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
 		}
 
 		// 合成freemarker
@@ -512,12 +511,8 @@ public class ContractServiceImpl implements ContractService {
 		studentInfo.setSubject(subject);
 
 		params.put("studentInfo", studentInfo);
-		
-		List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroupList = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(musicGroupSubjectGoodsGroupIds);
-		
-		String goodIdList = musicGroupSubjectGoodsGroupList.stream().map(t -> t.getGoodsIdList()).collect(Collectors.joining(","));
-		
-		List<Goods> goodsList = goodsService.findGoodsByIds(goodIdList);
+
+		List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
 		params.put("goodsList", goodsList);
 
 		MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
@@ -558,7 +553,7 @@ public class ContractServiceImpl implements ContractService {
 	}
 
 	@Override
-	public String queryGoodsContract(Integer userId, String musicGroupId, String musicGroupSubjectGoodsGroupIds) {
+	public String queryGoodsContract(Integer userId, String musicGroupId, String goodsIds) {
 
 		// 合成freemarker
 		String srcPdfPath = contractBaseDir + "/goods/" + userId + ".pdf";
@@ -584,12 +579,8 @@ public class ContractServiceImpl implements ContractService {
 		studentInfo.setSubject(subject);
 
 		params.put("studentInfo", studentInfo);
-		
-		List<MusicGroupSubjectGoodsGroup> musicGroupSubjectGoodsGroupList = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(musicGroupSubjectGoodsGroupIds);
-		
-		String goodIdList = musicGroupSubjectGoodsGroupList.stream().map(t -> t.getGoodsIdList()).collect(Collectors.joining(","));
-		
-		List<Goods> goodsList = goodsService.findGoodsByIds(goodIdList);
+
+		List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
 		params.put("goodsList", goodsList);
 
 		MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, subjectId);

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -107,12 +107,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             throw new Exception("学员信息不存在");
         }
         //当前专业报名人数减一
-        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,studentRegistration.getActualSubjectId(),-1);
+//        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,studentRegistration.getActualSubjectId(),-1);
         //批量调剂(未缴费学员)
-        int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
+//        int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
         //修改专业已报名人数
-        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
-        return i;
+//        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
+        return studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
     }
 
     @Override

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

@@ -62,11 +62,14 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject>  imple
     @Override
     public List<SubjectApplyDetailDto> findSubApplyDetail(String musicGroupId) {
         List<SubjectApplyDetailDto> subApplyDetail = subjectDao.findSubApplyDetail(musicGroupId);
-        List<Map<Integer, Long>> payNums = studentRegistrationDao.countPayNum(musicGroupId);
-        Map<Integer, Long> payNumMap = MapUtil.convertMybatisMap(payNums);
+        //统计当前乐团不同声部的报名人数
+        Map<Long,Long> applyNum = MapUtil.convertMybatisMap(studentRegistrationDao.countApplyNum(musicGroupId));
+        Map<Integer, Long> payNumMap = MapUtil.convertMybatisMap(studentRegistrationDao.countPayNum(musicGroupId));
         subApplyDetail.forEach(detail ->{
             Long num = payNumMap.get(detail.getSubjectId());
             detail.setPayNum(num == null?0:num.intValue());
+            num = applyNum.get(detail.getSubjectId().longValue());
+            detail.setApplyStudentNum(num == null?0:num.intValue());
         });
         return subApplyDetail;
     }

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

@@ -604,10 +604,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 					}
 
 					if(Objects.isNull(teacherOnlineSalary)){
-						teacherOnlineSalary=teacherDefaultVipGroupSalary.getOnlineClassesSalary();
-						if(Objects.isNull(teacherOnlineSalary)){
+						if(Objects.isNull(teacherDefaultVipGroupSalary)){
 							throw new BizException("请设置教师课酬");
 						}
+						teacherOnlineSalary=teacherDefaultVipGroupSalary.getOnlineClassesSalary();
 						teacherOnlineSalary=teacherOnlineSalary.multiply(classTimeDuty);
 					}
 					results.put("onlineTeacherSalary",teacherOnlineSalary);
@@ -631,10 +631,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 						teacherOfflineSalary=((VipGroupApplyBaseInfoDto) vipGroup).getOfflineTeacherSalary();
 					}
 					if(Objects.isNull(teacherOfflineSalary)){
-						teacherOfflineSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
-						if(Objects.isNull(teacherOfflineSalary)){
+						if(Objects.isNull(teacherDefaultVipGroupSalary)){
 							throw new BizException("请设置教师课酬");
 						}
+						teacherOfflineSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
 						teacherOfflineSalary=teacherOfflineSalary.multiply(classTimeDuty);
 					}
 					results.put("offlineTeacherSalary",teacherOfflineSalary);
@@ -723,7 +723,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			Map payMap = payService.getPayMap(
 					vipGroup.getTotalPrice(),
 					byStudentVipGroup.getOrderNo(),
-					"https://dyme.utools.club/api-student/studentOrder/notify",
+					"http://mstudev.dayaedu.com/api-student/studentOrder/notify",
 					"http://mstudev.dayaedu.com/#/paymentResult",
 					"vip课购买",
 					vipGroup.getName());

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

@@ -115,7 +115,7 @@
     </update>
 
     <select id="findStudentsByOrganId" resultMap="studentManageListDto">
-        SELECT sr.user_id_,su.real_name_,su.gender_,sr.parents_name_,sr.parents_phone_
+        SELECT sr.user_id_,su.username_ real_name_,su.gender_,sr.parents_name_,sr.parents_phone_
         FROM student_registration sr
         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
         WHERE sr.user_id_ IN (

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -414,6 +414,11 @@
             #{userId}
         </foreach>
     </select>
+    <select id="countApplyNum" resultType="java.util.Map">
+        SELECT sr.actual_subject_id_ 'key',COUNT(DISTINCT sr.user_id_) 'value' FROM student_registration sr
+        WHERE sr.music_group_id_ = #{musicGroupId}
+        GROUP BY actual_subject_id_
+    </select>
 
     <!-- 批量开启缴费 -->
     <update id="batchOpenPay">

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

@@ -109,7 +109,7 @@
         <result column="not_part_class_num_" property="notPartClassNum"/>
     </resultMap>
     <select id="findSubApplyDetail" resultMap="subApplyDetail">
-        SELECT mgsp.subject_id_,s.name_,mgsp.expected_student_num_,mgsp.apply_student_num_
+        SELECT mgsp.subject_id_,s.name_,mgsp.expected_student_num_
         FROM music_group_subject_plan mgsp
         LEFT JOIN `subject` s ON mgsp.subject_id_ = s.id_
         WHERE mgsp.music_group_id_ = #{musicGroupId} AND s.del_flag_ = 0

+ 40 - 0
mec-im/src/main/java/com/ym/controller/HereWhiteController.java

@@ -0,0 +1,40 @@
+package com.ym.controller;
+
+import com.ym.mec.common.controller.BaseController;
+import com.ym.service.HereWhiteService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/hereWhite")
+public class HereWhiteController  extends BaseController {
+
+    @Autowired
+    private HereWhiteService hereWhiteService;
+
+    /**
+     * 创建白板,默认全部采用零时白板
+     * @param name 白板名称
+     * @param userNum 白板人数上限,0不限制
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "create", method = RequestMethod.POST)
+    public Object userAdd(String name,Integer userNum) throws Exception {
+        return hereWhiteService.create(name, userNum);
+    }
+
+    /**
+     * 获取特定白板 room Token
+     * @param courseScheduleId
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "join", method = RequestMethod.POST)
+    public Object join(Integer courseScheduleId) throws Exception {
+        return succeed(hereWhiteService.join(courseScheduleId));
+    }
+
+}

+ 11 - 0
mec-im/src/main/java/com/ym/dao/HereWhiteDao.java

@@ -0,0 +1,11 @@
+package com.ym.dao;
+
+import com.ym.pojo.HereWhite;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface HereWhiteDao extends JpaRepository<HereWhite, Long> {
+
+    HereWhite findById(Integer id);
+}

+ 34 - 0
mec-im/src/main/java/com/ym/pojo/HereWhite.java

@@ -0,0 +1,34 @@
+package com.ym.pojo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by weiqinxiao on 2019/2/28.
+ */
+@Entity
+@Table(name = "rongyun_here_white")
+public class HereWhite implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Getter @Setter
+    private Integer id;
+
+    private @Getter @Setter String name;
+    private @Getter @Setter int limit;
+    private @Getter @Setter int teamId;
+    private @Getter @Setter int adminId;
+    private @Getter @Setter String mode;
+    private @Getter @Setter String template;
+    private @Getter @Setter String region;
+    private @Getter @Setter String uuid;
+    private @Getter @Setter String roomToken;
+    private @Getter @Setter Date updatedAt;
+    private @Getter @Setter Date createdAt;
+}

+ 23 - 0
mec-im/src/main/java/com/ym/service/HereWhiteService.java

@@ -0,0 +1,23 @@
+package com.ym.service;
+
+import com.ym.pojo.HereWhite;
+
+import java.io.IOException;
+
+public interface HereWhiteService {
+
+    /**
+     * 创建白板
+     * @param name
+     * @param userNum
+     * @return
+     */
+    String create(String name,Integer userNum) throws Exception;
+
+    /**
+     * 获取特定白板 room Token
+     * @param courseScheduleId
+     * @return
+     */
+    HereWhite join(Integer courseScheduleId) throws Exception;
+}

+ 46 - 0
mec-im/src/main/java/com/ym/service/Impl/HereWhiteServiceImpl.java

@@ -0,0 +1,46 @@
+package com.ym.service.Impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ym.dao.HereWhiteDao;
+import com.ym.mec.util.http.HttpUtil;
+import com.ym.pojo.HereWhite;
+import com.ym.service.HereWhiteService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class HereWhiteServiceImpl implements HereWhiteService {
+
+    @Value("${cn.rongcloud.hereWhite.url}")
+    private String hereWhiteUrl;
+    @Value("${cn.rongcloud.hereWhite.token}")
+    private String hereWhiteToken;
+
+    @Autowired
+    private HereWhiteDao hereWhiteDao;
+
+    @Override
+    public String create(String name, Integer userNum) throws Exception {
+        JSONObject json = new JSONObject();
+        json.put("name",name);
+        json.put("limit",userNum);
+        json.put("mode","transitory");
+        String url = "/room?token=" + hereWhiteToken;
+        return requestParam(json,url);
+    }
+
+    private String requestParam(JSONObject json,String url) throws Exception {
+        Map<String, String> headers = new HashMap<>(1);
+        headers.put("Content-Type","application/json");
+        return HttpUtil.postForHttps(hereWhiteUrl + url, json.toJSONString(), headers);
+    }
+
+    @Override
+    public HereWhite join(Integer courseScheduleId) throws Exception {
+        return hereWhiteDao.findById(courseScheduleId);
+    }
+}

+ 3 - 0
mec-im/src/main/resources/application.yml

@@ -89,6 +89,9 @@ cn:
       host: http://api-cn.ronghub.com
     whiteboard:
       host: https://sealclass.rongcloud.cn/ewb
+    hereWhite:
+      url: https://cloudcapiv4.herewhite.com
+      token: WHITEcGFydG5lcl9pZD1EUzdrQ3JOenJnRU1Hc1ZnelV5T1czOFl3ZlJuTUF5MjMyMmkmc2lnPTUwMjEwNDVjNzY3Mzc1YjEyZDEzYWY4MDM4M2Q5MTA0YTJhNGQwYjM6YWRtaW5JZD00ODkmcm9sZT1taW5pJmV4cGlyZV90aW1lPTE2MDI0MDIzMDUmYWs9RFM3a0NyTnpyZ0VNR3NWZ3pVeU9XMzhZd2ZSbk1BeTIzMjJpJmNyZWF0ZV90aW1lPTE1NzA4NDUzNTMmbm9uY2U9MTU3MDg0NTM1Mjc1MzAw
     web:
       enableCors: true
     room:

+ 2 - 2
mec-student/src/main/java/com/ym/mec/student/controller/ContractsController.java

@@ -36,12 +36,12 @@ public class ContractsController extends BaseController {
 
 	@ApiOperation("查询商品协议")
 	@GetMapping(value = "queryGoodsContract")
-	public Object queryGoodsContract(String musicGroupId, String musicGroupSubjectGoodsGroupIds) {
+	public Object queryGoodsContract(String musicGroupId, String goodsIds) {
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {
 			return failed("获取用户信息失败");
 		}
-		return succeed(contractService.queryGoodsContract(sysUser.getId(), musicGroupId, musicGroupSubjectGoodsGroupIds));
+		return succeed(contractService.queryGoodsContract(sysUser.getId(), musicGroupId, goodsIds));
 	}
 
 	@ApiOperation("查询乐团课程协议")

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -240,7 +240,7 @@ public class MusicGroupController extends BaseController {
         Map payMap = payService.getPayMap(
                 orderAmount,
                 orderNo,
-                "https://dyme.utools.club/api-student/studentOrder/notify",
+                "http://mstudev.dayaedu.com/api-student/studentOrder/notify",
                 "http://mstudev.dayaedu.com/#/paymentResult",
                 "测试订单",
                 "测试订单");