Joburgess 5 år sedan
förälder
incheckning
f91705478c
17 ändrade filer med 182 tillägg och 9 borttagningar
  1. 7 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamOrganizationRelationController.java
  2. 12 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSongController.java
  3. 9 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectController.java
  4. 2 2
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectSongController.java
  5. 12 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamOrganizationRelationDao.java
  6. 9 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSongDao.java
  7. 10 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSubjectDao.java
  8. 12 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamOrganizationRelationService.java
  9. 12 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamSongService.java
  10. 11 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamSubjectService.java
  11. 22 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java
  12. 10 4
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSongServiceImpl.java
  13. 5 0
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSubjectServiceImpl.java
  14. 1 1
      edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ShortUrlServiceImpl.java
  15. 33 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamOrganizationRelationMapper.xml
  16. 3 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml
  17. 12 0
      edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSubjectMapper.xml

+ 7 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamOrganizationRelationController.java

@@ -8,6 +8,7 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.user.dao.EmployeeDao;
 import com.keao.edu.user.entity.Employee;
 import com.keao.edu.user.entity.ExamOrganizationRelation;
+import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.page.ExamOrganizationRelationQueryInfo;
 import com.keao.edu.user.service.EmployeeService;
 import com.keao.edu.user.service.ExamOrganizationRelationService;
@@ -65,4 +66,10 @@ public class ExamOrganizationRelationController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("获取未关联到考级项目的合作单位")
+    @GetMapping(value = "/queryUnRelatedOrgans")
+    public HttpResponseResult<PageInfo<Organization>> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo){
+        return succeed(examOrganizationRelationService.queryUnRelatedOrgans(queryInfo));
+    }
+
 }

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSongController.java

@@ -2,6 +2,7 @@ package com.keao.edu.user.controller;
 
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
+import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.tenant.TenantContextHolder;
@@ -12,10 +13,12 @@ import com.keao.edu.user.service.TenantInfoService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @Author Joburgess
@@ -45,6 +48,9 @@ public class ExamSongController extends BaseController {
     @ApiOperation("新增曲库")
     @PostMapping(value = "/add")
     public HttpResponseResult add(ExamSong examSong) {
+        if(StringUtils.isBlank(examSong.getSubjectList())){
+            throw new BizException("请选择专业");
+        }
         examSong.setTenantId(TenantContextHolder.getTenantId().toString());
         examSongService.insert(examSong);
         return succeed();
@@ -63,4 +69,10 @@ public class ExamSongController extends BaseController {
     public HttpResponseResult add(Integer id) {
         return succeed(examSongService.delete(id));
     }
+
+    @ApiOperation("根据专业获取曲目")
+    @GetMapping(value = "/getWithSubject")
+    public HttpResponseResult<List<ExamSong>> getWithSubject(Integer subjectId){
+        return succeed(examSongService.getWithSubject(subjectId));
+    }
 }

+ 9 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectController.java

@@ -2,6 +2,7 @@ package com.keao.edu.user.controller;
 
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
+import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.dto.ExamSubjectDto;
 import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.entity.Subject;
@@ -9,6 +10,7 @@ import com.keao.edu.user.service.ExamSubjectService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -16,7 +18,7 @@ import java.util.List;
 
 @RestController
 @RequestMapping("examSubject")
-@Api(tags = "考级专业服务")
+@Api(tags = "考级内容服务")
 public class ExamSubjectController extends BaseController {
 
     @Autowired
@@ -28,4 +30,10 @@ public class ExamSubjectController extends BaseController {
     public HttpResponseResult<List<ExamSubjectDto>> getExamSubjects(Integer ExamId) {
         return succeed(examSubjectService.getExamSubjects(ExamId));
     }
+
+    @ApiOperation("获取与考级项目无关的专业")
+    @GetMapping(value = "/getUnRelatedWithExamSubjects")
+    public HttpResponseResult<List<Subject>> getUnRelatedWithExamSubjects(Integer examId){
+        return succeed(examSubjectService.getUnRelatedWithExamSubjects(Integer.valueOf(TenantContextHolder.getTenantId().toString()), examId));
+    }
 }

+ 2 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamSubjectSongController.java

@@ -50,7 +50,7 @@ public class ExamSubjectSongController extends BaseController {
         return succeed();
     }
 
-    @ApiOperation("获取考级专业相应级别列表")
+    @ApiOperation("获取考级专业相应级别列表-报名")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "examinationBasicId", value = "项目id", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "examSubjectId", value = "考试项目专业id", required = true, dataType = "Integer")})
@@ -59,7 +59,7 @@ public class ExamSubjectSongController extends BaseController {
         return succeed(examSubjectSongService.getExamSubjectLevels(examinationBasicId, examSubjectId));
     }
 
-    @ApiOperation("获取考级专业相应级别的曲目")
+    @ApiOperation("获取考级专业相应级别的曲目-报名")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "examinationBasicId", value = "项目id", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "examSubjectId", value = "考试项目专业id", required = true, dataType = "Integer"),

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamOrganizationRelationDao.java

@@ -3,10 +3,12 @@ package com.keao.edu.user.dao;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.user.dto.ExamOrganRegistDto;
 import com.keao.edu.user.entity.ExamOrganizationRelation;
+import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.enums.YesOrNoEnum;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 public interface ExamOrganizationRelationDao extends BaseDAO<Long, ExamOrganizationRelation> {
@@ -79,4 +81,14 @@ public interface ExamOrganizationRelationDao extends BaseDAO<Long, ExamOrganizat
      * @return
      */
     Integer findByOrganId(@Param("organId") Integer organId);
+
+    /**
+     * @describe 获取未关联到考级项目的合作单位
+     * @author Joburgess
+     * @date 2020.07.03
+     * @param params:
+     * @return java.util.List<com.keao.edu.user.entity.Organization>
+     */
+    List<Organization> queryUnRelatedOrgans(Map<String, Object> params);
+    int countUnRelatedOrgans(Map<String, Object> params);
 }

+ 9 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSongDao.java

@@ -16,4 +16,13 @@ public interface ExamSongDao extends BaseDAO<Integer, ExamSong> {
      */
     List<ExamSong> getExamSongs(@Param("ids") String ids);
 
+    /**
+     * @describe 根据专业获取曲目
+     * @author Joburgess
+     * @date 2020.07.03
+     * @param subjectId:
+     * @return java.util.List<com.keao.edu.user.entity.ExamSong>
+     */
+    List<ExamSong> getWithSubject(@Param("subjectId") Integer subjectId);
+
 }

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamSubjectDao.java

@@ -29,5 +29,15 @@ public interface ExamSubjectDao extends BaseDAO<Long, ExamSubject> {
      */
     List<ExamSubjectDto> getSubjectWithExamId(@Param("examId") Integer examId);
 
+    /**
+     * @describe 获取与考级项目无关的专业
+     * @author Joburgess
+     * @date 2020.07.03
+     * @param tenantId:
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.entity.Subject>
+     */
+    List<Subject> getUnRelatedWithExamSubjects(@Param("tenantId") Integer tenantId,
+                                               @Param("examId") Integer examId);
 
 }

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamOrganizationRelationService.java

@@ -3,7 +3,10 @@ package com.keao.edu.user.service;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.entity.ExamOrganizationRelation;
+import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.page.ExamOrganizationRelationQueryInfo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Page;
 
 public interface ExamOrganizationRelationService extends BaseService<Long, ExamOrganizationRelation> {
 
@@ -35,4 +38,13 @@ public interface ExamOrganizationRelationService extends BaseService<Long, ExamO
      */
     void sendUrl(Integer examId, String organIds);
 
+    /**
+     * @describe 获取未关联到考级项目的合作单位
+     * @author Joburgess
+     * @date 2020.07.03
+     * @param queryInfo:
+     * @return org.springframework.data.domain.Page<com.keao.edu.user.entity.Organization>
+     */
+    PageInfo<Organization> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo);
+
 }

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamSongService.java

@@ -2,7 +2,19 @@ package com.keao.edu.user.service;
 
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.entity.ExamSong;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ExamSongService extends BaseService<Integer, ExamSong> {
 
+    /**
+     * @describe 根据专业获取曲目
+     * @author Joburgess
+     * @date 2020.07.03
+     * @param subjectId:
+     * @return java.util.List<com.keao.edu.user.entity.ExamSong>
+     */
+    List<ExamSong> getWithSubject(Integer subjectId);
+
 }

+ 11 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamSubjectService.java

@@ -5,6 +5,7 @@ import com.keao.edu.common.service.BaseService;
 import com.keao.edu.user.dto.ExamSubjectDto;
 import com.keao.edu.user.entity.ExamSubject;
 import com.keao.edu.user.entity.Subject;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,4 +18,14 @@ public interface ExamSubjectService extends BaseService<Long, ExamSubject> {
      * @return
      */
     List<ExamSubjectDto> getExamSubjects(Integer ExamId);
+
+    /**
+     * @describe 获取与考级项目无关的专业
+     * @author Joburgess
+     * @date 2020.07.03
+     * @param tenantId:
+     * @param examId:
+     * @return java.util.List<com.keao.edu.user.entity.Subject>
+     */
+    List<Subject> getUnRelatedWithExamSubjects(Integer tenantId,Integer examId);
 }

+ 22 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -30,6 +30,7 @@ import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
@@ -156,7 +157,7 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			if(YesOrNoEnum.YES.equals(examOrgan.getSendUrlFlag())){
 				continue;
 			}
-			String registrationUrl = baseUrl + "organId=" + examOrgan.getOrganId();
+			String registrationUrl = baseUrl + "examId=" + examOrgan.getExaminationBasicId();
 			String registShortUrl = shortUrlService.createShortUrl(registrationUrl);
 
 			examOrgan.setUrl(registShortUrl);
@@ -178,4 +179,24 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			examinationBasicDao.update(examinationBasic);
 		}
 	}
+
+	@Override
+	public PageInfo<Organization> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo) {
+		PageInfo<Organization> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<Integer> nextLevelOrganIds = organizationService.getChildOrganIds(queryInfo.getOrganId(), true);
+		params.put("organIds", nextLevelOrganIds);
+
+		List<Organization> dataList = new ArrayList<>();
+		int count = examOrganizationRelationDao.countUnRelatedOrgans(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = examOrganizationRelationDao.queryUnRelatedOrgans(params);
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
 }

+ 10 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSongServiceImpl.java

@@ -1,6 +1,7 @@
 package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
@@ -12,10 +13,7 @@ import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> implements ExamSongService {
@@ -44,4 +42,12 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    public List<ExamSong> getWithSubject(Integer subjectId) {
+	    if(Objects.isNull(subjectId)){
+	        throw new BizException("请选择专业");
+        }
+        return examSongDao.getWithSubject(subjectId);
+    }
 }

+ 5 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSubjectServiceImpl.java

@@ -27,4 +27,9 @@ public class ExamSubjectServiceImpl extends BaseServiceImpl<Long, ExamSubject> i
     public List<ExamSubjectDto> getExamSubjects(Integer ExamId) {
 		return examSubjectDao.getSubjectWithExamId(ExamId);
     }
+
+	@Override
+	public List<Subject> getUnRelatedWithExamSubjects(Integer tenantId, Integer examId) {
+		return examSubjectDao.getUnRelatedWithExamSubjects(tenantId, examId);
+	}
 }

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ShortUrlServiceImpl.java

@@ -37,7 +37,7 @@ public class ShortUrlServiceImpl extends BaseServiceImpl<Long, ShortUrl> impleme
 		SysConfig baseUrlConfig = sysConfigService.findByParamName(SysConfigService.BASE_API_URL);
 
 		StringBuffer returnUrl=new StringBuffer(baseUrlConfig.getParanValue());
-		returnUrl.append(":8000/api-user/su/");
+		returnUrl.append("/api-user/su/");
 		returnUrl.append(shortUrl.getId());
 
 		return returnUrl.toString();

+ 33 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamOrganizationRelationMapper.xml

@@ -225,7 +225,40 @@
 		</if>
 		GROUP BY o.id_
 	</select>
+
     <select id="findByOrganId" resultType="java.lang.Integer">
 		SELECT COUNT(DISTINCT id_) FROM exam_organization_relation WHERE organ_id_ = #{organId}
 	</select>
+
+	<sql id="queryUnRelatedOrgansCondition">
+		<where>
+			o.tenant_id_ = #{tenantId}
+			<if test="organIds!=null">
+				o.id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
+			AND NOT EXISTS ( SELECT organ_id_ FROM exam_organization_relation WHERE examination_basic_id_ = #{examId} AND organ_id_ = o.id_ )
+		</where>
+	</sql>
+
+    <select id="queryUnRelatedOrgans" resultMap="com.keao.edu.user.dao.OrganizationDao.Organization">
+		SELECT
+			*
+		FROM
+			organization o
+		<include refid="queryUnRelatedOrgansCondition"/>
+		ORDER BY o.id_
+		<include refid="global.limit"/>
+    </select>
+
+	<select id="countUnRelatedOrgans" resultType="int">
+		SELECT
+			COUNT(o.id_)
+		FROM
+			organization o
+		<include refid="queryUnRelatedOrgansCondition"/>
+    </select>
+
 </mapper>

+ 3 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml

@@ -109,4 +109,7 @@
     <select id="getExamSongs" resultMap="ExamSong">
 		SELECT * FROM exam_song WHERE FIND_IN_SET(id_,#{ids})
 	</select>
+	<select id="getWithSubject" resultMap="ExamSong">
+		SELECT * FROM exam_song WHERE FIND_IN_SET(#{subjectId}, subject_list_)
+	</select>
 </mapper>

+ 12 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSubjectMapper.xml

@@ -84,4 +84,16 @@
 		SELECT es.id_ exam_subject_id_ ,s.* FROM exam_subject es
 		LEFT JOIN subject s on es.subject_id_ = s.id_ WHERE examination_basic_id_ = #{examId}
 	</select>
+
+    <select id="getUnRelatedWithExamSubjects" resultMap="com.keao.edu.user.dao.SubjectDao.Subject">
+		SELECT
+			*
+		FROM
+			`subject` s
+		WHERE
+			s.parent_subject_id_ != 0
+			AND s.del_flag_ = 0
+			AND s.tenant_id_ = #{tenantId}
+			AND NOT EXISTS (SELECT subject_id_ FROM exam_subject WHERE examination_basic_id_=#{examId} AND subject_id_=s.id_)
+    </select>
 </mapper>