Browse Source

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

zouxuan 5 years ago
parent
commit
80504c7dc7

+ 6 - 4
edu-common/src/main/java/com/keao/edu/common/service/impl/BaseServiceImpl.java

@@ -14,6 +14,7 @@ import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.BaseService;
 import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
@@ -35,7 +36,7 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 	public abstract BaseDAO<PK, T> getDAO();
 
 	@Autowired
-	private SqlSessionFactory sqlSessionFactory;
+	protected SqlSessionFactory sqlSessionFactory;
 
 	/**
 	 * 通过主键id加载对象
@@ -124,7 +125,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 		StringBuffer sql=new StringBuffer();
 		Map<Y,Z> result=new HashMap();
 		try {
-			Connection connection = sqlSessionFactory.openSession().getConnection();
+			SqlSession sqlSession = sqlSessionFactory.openSession(true);
+			Connection connection = sqlSession.getConnection();
 			sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE ").append(columnKey).append(" IN (").append(StringUtils.join(ids, ",")).append(")");
 			PreparedStatement ps = connection.prepareStatement(sql.toString());
 			ResultSet resultSet = ps.executeQuery();
@@ -168,7 +170,7 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 		StringBuffer sql=new StringBuffer();
 		Map<Y,Z> result = new HashMap();
 		try {
-			Connection connection = sqlSessionFactory.openSession().getConnection();
+			Connection connection = sqlSessionFactory.openSession(true).getConnection();
 			sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE ");
 			boolean resultFlag = false;
 			for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
@@ -232,7 +234,7 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 		StringBuffer sql=new StringBuffer();
 		Map<String, String> result=new HashMap();
 		try {
-			Connection connection = sqlSessionFactory.openSession().getConnection();
+			Connection connection = sqlSessionFactory.openSession(true).getConnection();
 			sql.append("SELECT ").append(columnKey).append(",").append(columnValue).append(" FROM ").append(tableName).append(" WHERE ").append(columnKey).append(" IN (").append(StringUtils.join(ids, ",")).append(")");
 			PreparedStatement ps = connection.prepareStatement(sql.toString());
 			ResultSet resultSet = ps.executeQuery();

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

@@ -92,14 +92,14 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			params.put("offset", pageInfo.getOffset());
 			dataList = examOrganizationRelationDao.queryExamOrgans(params);
 			List<Integer> organIds = dataList.stream().map(ExamOrganizationRelation::getOrganId).collect(Collectors.toList());
-			List<ExamOrganizationRelation> countInfos = examOrganizationRelationDao.countExamOrganStudentAndPayment(queryInfo.getExamId(), organIds);
-			Map<Integer, ExamOrganizationRelation> organCountInfoMap = countInfos.stream().collect(Collectors.toMap(ExamOrganizationRelation::getOrganId, e -> e));
+//			List<ExamOrganizationRelation> countInfos = examOrganizationRelationDao.countExamOrganStudentAndPayment(queryInfo.getExamId(), organIds);
+//			Map<Integer, ExamOrganizationRelation> organCountInfoMap = countInfos.stream().collect(Collectors.toMap(ExamOrganizationRelation::getOrganId, e -> e));
 			for (ExamOrganizationRelationExtraDto examOrganizationRelation : dataList) {
-				ExamOrganizationRelation countInfo = organCountInfoMap.get(examOrganizationRelation.getOrganId());
-				if(Objects.nonNull(countInfo)){
-					examOrganizationRelation.setTotalRegistrationStudentNum(countInfo.getTotalRegistrationStudentNum());
-					examOrganizationRelation.setTotalPaymentAmount(countInfo.getTotalPaymentAmount());
-				}
+//				ExamOrganizationRelation countInfo = organCountInfoMap.get(examOrganizationRelation.getOrganId());
+//				if(Objects.nonNull(countInfo)){
+//					examOrganizationRelation.setTotalRegistrationStudentNum(countInfo.getTotalRegistrationStudentNum());
+//					examOrganizationRelation.setTotalPaymentAmount(countInfo.getTotalPaymentAmount());
+//				}
 				if(examOrganizationRelation.getOrganId().equals(queryInfo.getOrganId())){
 					examOrganizationRelation.setSelfOrgan(1);
 				}

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

@@ -203,8 +203,8 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
                 if (CollectionUtils.isEmpty(examOrganizationRelations)) {
                     continue;
                 }
-                Integer totalRegistrationStudentNum = examOrganizationRelations.stream().mapToInt(ExamOrganizationRelation::getTotalRegistrationStudentNum).sum();
-                BigDecimal totalPaymentAmount = examOrganizationRelations.stream().map(ExamOrganizationRelation::getTotalPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+                Integer totalRegistrationStudentNum = examOrganizationRelations.stream().mapToInt(ExamOrganizationRelation::getSelfRegistrationStudentNum).sum();
+                BigDecimal totalPaymentAmount = examOrganizationRelations.stream().map(ExamOrganizationRelation::getSelfPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                 examinationBasicDto.setTotalRegistrationStudentNum(totalRegistrationStudentNum);
                 examinationBasicDto.setTotalPaymentAmount(totalPaymentAmount);
             }
@@ -254,6 +254,17 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
         if(ExamStatusEnum.CLOSE.equals(existsExam.getStatus())){
             throw new BizException("考级项目已关闭");
         }
+
+        if(ExamModeEnum.ONLINE.equals(examinationBasic.getExamMode())){
+            examinationBasic.setExamLocationIdList(null);
+        }
+
+        if(StringUtils.isNotBlank(examinationBasic.getExamLocationIdList())){
+            List<Integer> organIds = Arrays.stream(examinationBasic.getExamLocationIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+            Map<Integer, String> organNameMap = this.getMap("exam_location", "id_", "name_", organIds, Integer.class, String.class);
+            examinationBasic.setExamLocationNameList(StringUtils.join(organNameMap.values(),","));
+        }
+
         if(Objects.nonNull(examinationBasic.getEnrollStartTime())
                 &&examinationBasic.getEnrollStartTime().compareTo(existsExam.getEnrollStartTime())!=0){
             if(ExamStatusEnum.EXAM_ING.equals(existsExam.getStatus())||