Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 năm trước cách đây
mục cha
commit
9c0cc2a565

+ 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/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;
     }

+ 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: