Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

Joburgess před 5 roky
rodič
revize
77fc363c76

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRepairDao.java

@@ -2,14 +2,18 @@ package com.ym.mec.biz.dal.dao;
 
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentRepair;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface StudentRepairDao extends com.ym.mec.common.dal.BaseDAO<Integer, StudentRepair> {
      /**
       * 获取学生列表
+      *
       * @param params
       * @return
       */
@@ -17,8 +21,16 @@ public interface StudentRepairDao extends com.ym.mec.common.dal.BaseDAO<Integer,
 
      /**
       * 获取学生总数
+      *
       * @param params
       * @return
       */
      Integer getStudentsCount(Map<String, Object> params);
+
+     /**
+      * 获取学生乐团列表
+      * @param userIds
+      * @return
+      */
+     List<MusicGroup> getUserMusicGroup(@Param("userIds") Set<Integer> userIds);
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRepair.java

@@ -16,6 +16,12 @@ public class StudentRepair {
     */
     private Integer organId;
 
+
+    /**
+    * 分部id
+    */
+    private String organName;
+
     /**
     * 学生id
     */
@@ -116,6 +122,14 @@ public class StudentRepair {
     */
     private Date updateTime;
 
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
     public Integer getRepairStatus() {
         return repairStatus;
     }

+ 16 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -5,6 +5,9 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.StudentRepairDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.entity.Group;
+import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
@@ -29,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRepair> implements StudentRepairService {
@@ -63,7 +67,17 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = studentRepairDao.getStudents(params);
-
+            Set<Integer> userIds = dataList.stream().map(BasicUserDto::getUserId).collect(Collectors.toSet());
+            List<MusicGroup> musicGroups = studentRepairDao.getUserMusicGroup(userIds);
+            Map<Integer, List<MusicGroup>> userMusicGroup = musicGroups.stream().collect(Collectors.groupingBy(MusicGroup::getRepairUserId));
+            for (BasicUserDto basicUserDto : dataList) {
+                if (!userMusicGroup.containsKey(basicUserDto.getUserId())) {
+                    continue;
+                }
+                MusicGroup musicGroup = userMusicGroup.get(basicUserDto.getUserId()).get(0);
+                basicUserDto.setMusicGroupId(musicGroup.getId());
+                basicUserDto.setMusicGroupName(musicGroup.getName());
+            }
         }
         pageInfo.setRows(dataList);
         return pageInfo;
@@ -149,7 +163,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             throw new BizException("用户信息获取失败");
         }
         StudentRepair studentRepair = studentRepairDao.get(id);
-        if(studentRepair == null){
+        if (studentRepair == null) {
             throw new BizException("维修信息不存在");
         }
         studentRepair.setRepairStatus(1);

+ 16 - 2
mec-biz/src/main/resources/config/mybatis/StudentRepairMapper.xml

@@ -5,6 +5,7 @@
         <result column="id_" jdbcType="INTEGER" property="id"/>
         <result column="trans_no_" jdbcType="VARCHAR" property="transNo"/>
         <result column="organ_id_" jdbcType="INTEGER" property="organId"/>
+        <result column="name_" jdbcType="INTEGER" property="organName"/>
         <result column="student_id_" jdbcType="INTEGER" property="studentId"/>
         <result column="student_name_" jdbcType="VARCHAR" property="studentName"/>
         <result column="student_school_" jdbcType="VARCHAR" property="studentSchool"/>
@@ -157,14 +158,16 @@
     </select>
 
     <select id="queryPage" resultMap="StudentRepair">
-        SELECT * FROM student_repair sr
+        SELECT sr.*,o.name_ FROM student_repair sr
+        LEFT JOIN organization o ON o.id_ = sr.organ_id_
         <include refid="queryPageSql"/>
         <include refid="global.limit"/>
     </select>
     <sql id="queryPageSql">
         <where>
             <if test="search != null and search != ''">
-                AND (sr.trans_no_ LIKE CONCAT('%',#{search},'%') OR sr.student_id_ = #{search} OR sr.student_name_ LIKE CONCAT('%',#{search},'%'))
+                AND (sr.trans_no_ LIKE CONCAT('%',#{search},'%') OR sr.student_id_ = #{search} OR sr.student_name_ LIKE
+                CONCAT('%',#{search},'%'))
             </if>
             <if test="employeeId != null">
                 AND sr.employee_id_ = #{employeeId}
@@ -196,4 +199,15 @@
         SELECT COUNT(id_) FROM student_repair sr
         <include refid="queryPageSql"/>
     </select>
+
+    <select id="getUserMusicGroup" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.MusicGroup">
+        SELECT mg.id_,mg.name_,sr.user_id_ repair_user_id_ FROM music_group mg
+        LEFT JOIN student_registration sr on sr.music_group_id_ = mg.id_
+        WHERE sr.user_id_ IN
+        <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
+            #{userId}
+        </foreach>
+        AND mg.status_='PROGRESS'
+        ORDER BY id_ DESC
+    </select>
 </mapper>

+ 13 - 4
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

@@ -8,12 +8,11 @@ import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
 import com.ym.mec.biz.service.StudentRepairService;
+import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
-import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -21,8 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
-import java.util.List;
 import java.util.Objects;
 
 @RequestMapping("eduRepair")
@@ -37,6 +34,8 @@ public class EduRepairController extends BaseController {
     private EmployeeDao employeeDao;
     @Autowired
     private StudentRepairService studentRepairService;
+    @Autowired
+    private SubjectService subjectService;
 
     @ApiOperation("获取学生列表")
     @GetMapping(value = "/getStudents")
@@ -78,5 +77,15 @@ public class EduRepairController extends BaseController {
         return succeed(studentRepairService.queryPage(queryInfo));
     }
 
+    @ApiOperation("获取乐器种类")
+    @GetMapping(value = "/findSubSubjects")
+    public HttpResponseResult findSubSubjects() {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        return succeed(subjectService.findSubSubjects(1));
+    }
+
 
 }