Преглед на файлове

Merge branch 'master' of http://git.dayaedu.com/yonge/edu-saas

zouxuan преди 5 години
родител
ревизия
a406c3e566

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

@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -54,8 +55,8 @@ public class ExamOrganizationRelationController extends BaseController {
 
     @ApiOperation("添加合作单位")
     @PostMapping(value = "/addExamOrganizations")
-    public HttpResponseResult addExamOrganizations(Long examId, String organIds){
-        examOrganizationRelationService.addExamOrganizations(examId, organIds);
+    public HttpResponseResult addExamOrganizations(@RequestBody List<ExamOrganizationRelation> organizationRelations){
+        examOrganizationRelationService.addExamOrganizations(organizationRelations);
         return succeed();
     }
 

+ 0 - 22
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamSongQueryInfo.java

@@ -12,12 +12,6 @@ public class ExamSongQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "级别")
     private Integer level;
 
-    @ApiModelProperty(value = "曲目名")
-    private String songName;
-
-    @ApiModelProperty(value = "作者名")
-    private String songAuthor;
-
     @ApiModelProperty(value = "曲目类别")
     private SongTypeEnum type;
 
@@ -37,22 +31,6 @@ public class ExamSongQueryInfo extends QueryInfo {
         this.subjectList = subjectList;
     }
 
-    public String getSongName() {
-        return songName;
-    }
-
-    public void setSongName(String songName) {
-        this.songName = songName;
-    }
-
-    public String getSongAuthor() {
-        return songAuthor;
-    }
-
-    public void setSongAuthor(String songAuthor) {
-        this.songAuthor = songAuthor;
-    }
-
     public SongTypeEnum getType() {
         return type;
     }

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

@@ -7,6 +7,8 @@ import com.keao.edu.user.entity.ExamOrganizationRelation;
 import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.page.ExamOrganizationRelationQueryInfo;
 
+import java.util.List;
+
 public interface ExamOrganizationRelationService extends BaseService<Long, ExamOrganizationRelation> {
 
     /**
@@ -29,6 +31,16 @@ public interface ExamOrganizationRelationService extends BaseService<Long, ExamO
     void addExamOrganizations(Long examId, String orgainIdsStr);
 
     /**
+     * @describe 添加单位
+     * @author Joburgess
+     * @date 2020.07.07
+     * @param examId:
+     * @param orgainIdsStr:
+     * @return void
+     */
+    void addExamOrganizations(List<ExamOrganizationRelation> organizationRelations);
+
+    /**
      * @describe 更新考级项目与合作单位关联信息
      * @author Joburgess
      * @date 2020.06.18

+ 66 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -173,6 +173,72 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void addExamOrganizations(List<ExamOrganizationRelation> organizationRelations) {
+		if(CollectionUtils.isEmpty(organizationRelations)){
+			throw new BizException("请指定考级项目");
+		}
+		if(Objects.isNull(organizationRelations.get(0).getExaminationBasicId())){
+			throw new BizException("请指定考级项目");
+		}
+		ExaminationBasic examinationBasic = examinationBasicDao.get(organizationRelations.get(0).getExaminationBasicId().longValue());
+		if(Objects.isNull(examinationBasic)){
+			throw new BizException("考级项目不存在");
+		}
+		if(!EDIT_ABLE_EXAM_STATUS.contains(examinationBasic.getStatus())){
+			throw new BizException("当前状态暂不可添加合作单位");
+		}
+
+		Set<Integer> organIdsWithExam = examOrganizationRelationDao.getOrganIdsWithExam(examinationBasic.getId().intValue());
+		List<Integer> organIds = organizationRelations.stream().filter(e->Objects.nonNull(e.getOrganId())).map(ExamOrganizationRelation::getOrganId).collect(Collectors.toList());
+		if(organIds.size()!=organizationRelations.size()){
+			throw new BizException("参数错误");
+		}
+		List<Organization> organs = organizationDao.getOrgans(organIds);
+		if(organs.size()!=organIds.size()){
+			throw new BizException("合作单位信息错误");
+		}
+
+		SysConfig baseUrlConfig = sysConfigService.findByParamName(SysConfigService.BASE_API_URL);
+		String baseUrl="";
+		if(Objects.nonNull(baseUrlConfig)){
+			baseUrl=baseUrlConfig.getParanValue();
+		}
+		baseUrl = baseUrl+"/#/signUp?";
+
+		Map<Integer, Organization> idOrganMap = organs.stream().collect(Collectors.toMap(Organization::getId, o -> o));
+		for (ExamOrganizationRelation og : organizationRelations) {
+			if(organIdsWithExam.contains(og.getOrganId())){
+				throw new BizException("合作单位冲突");
+			}
+			if(Objects.isNull(og.getIsAllowArrangeExam())){
+				throw new BizException("参数错误");
+			}
+			if(Objects.isNull(og.getSettlementType())){
+				throw new BizException("参数错误");
+			}
+			if(Objects.isNull(og.getShareProfitAmount())){
+				throw new BizException("参数错误");
+			}
+
+			og.setTenantId(TenantContextHolder.getTenantId());
+			og.setExaminationBasicId(examinationBasic.getId().intValue());
+
+			og.setSendUrlFlag(0);
+			og.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());
+			og.setTotalPaymentAmount(BigDecimal.ZERO);
+			og.setTotalTransAmount(BigDecimal.ZERO);
+			og.setSelfRegistrationStudentNum(BigDecimal.ZERO.intValue());
+			og.setSelfPaymentAmount(BigDecimal.ZERO);
+			String registrationUrl = baseUrl + "examId=" + examinationBasic.getId() + "&organId=" + og.getOrganId();
+			String registShortUrl = shortUrlService.createShortUrl(registrationUrl);
+			og.setUrl(registShortUrl);
+			organizationRelations.add(og);
+		}
+		examOrganizationRelationDao.batchInsert(organizationRelations);
+	}
+
+	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
 		if(Objects.isNull(examOrganizationRelation.getId())){

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

@@ -218,7 +218,7 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
         if(Objects.isNull(existsExam)){
             throw new BizException("考级项目不存在");
         }
-        if(ExamStatusEnum.SETTING.equals(existsExam.getStatus())){
+        if(!ExamStatusEnum.SETTING.equals(existsExam.getStatus())){
             throw new BizException("无法修改");
         }
         if(ExamStatusEnum.RESULT_CONFIRM.equals(existsExam.getStatus())){

+ 2 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -387,7 +387,8 @@
 		FROM
 			exam_registration er
 		WHERE
-			er.examination_basic_id_ = #{examId}
+			er.status_ NOT IN ('CANCEL')
+			AND er.examination_basic_id_ = #{examId}
 			<if test="organIds!=null">
 				AND er.organ_id_ IN
 				<foreach collection="organIds" item="organId" separator="," open="(" close=")">

+ 1 - 4
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml

@@ -82,9 +82,6 @@
 			<if test="subjectList!=null">
 				AND FIND_IN_SET(#{subjectList}, es.subject_list_)
 			</if>
-			<if test="songAuthor!=null">
-				AND es.song_author_ LIKE CONCAT(#{songAuthor}, '%')
-			</if>
 			<if test="level!=null">
 				AND FIND_IN_SET(#{level},level_list_)
 			</if>
@@ -95,7 +92,7 @@
 				AND es.song_name_ LIKE CONCAT(#{songName}, '%')
 			</if>
 			<if test="search!=null">
-				AND (es.id_=#{search} OR es.song_name_ LIKE CONCAT('%', #{search}, '%'))
+				AND (es.id_=#{search} OR es.song_name_ LIKE CONCAT(#{search}, '%') OR es.song_author_ LIKE CONCAT(#{search}, '%'))
 			</if>
 		</where>
 	</sql>