Joburgess 5 роки тому
батько
коміт
62121d1b86

+ 4 - 3
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.ExecutorType;
 import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -125,7 +126,7 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 		StringBuffer sql=new StringBuffer();
 		Map<Y,Z> result=new HashMap();
 		try {
-			SqlSession sqlSession = sqlSessionFactory.openSession(true);
+			SqlSession sqlSession = sqlSessionFactory.openSession();
 			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());
@@ -170,7 +171,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(true).getConnection();
+			Connection connection = sqlSessionFactory.openSession(ExecutorType.BATCH).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()) {
@@ -234,7 +235,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(true).getConnection();
+			Connection connection = sqlSessionFactory.openSession(ExecutorType.BATCH).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();

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

@@ -71,7 +71,15 @@ public class ExamOrganizationRelationController extends BaseController {
     @ApiOperation("更新考级项目与合作单位关联信息")
     @PostMapping(value = "/updateExamOrganizationRelation")
     public HttpResponseResult updateExamOrganizationRelation(@RequestBody ExamOrganizationRelation examOrganizationRelation){
-        examOrganizationRelationService.updateExamOrganizationRelation(examOrganizationRelation);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(sysUser)){
+            return failed("请重新登录");
+        }
+        Employee employee = employeeService.get(sysUser.getId());
+        if(Objects.isNull(employee)){
+            return failed("用户异常");
+        }
+        examOrganizationRelationService.updateExamOrganizationRelation(examOrganizationRelation,employee.getOrganId());
         return succeed();
     }
 

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

@@ -49,7 +49,7 @@ public interface ExamOrganizationRelationService extends BaseService<Long, ExamO
      * @param examOrganizationRelation:
      * @return void
      */
-    void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation);
+    void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation, Integer selfOrganId);
 
     /**
      * @describe 发送考级报名链接

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

@@ -247,11 +247,21 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-	public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
+	public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation,Integer selfOrganId) {
 		if(Objects.isNull(examOrganizationRelation.getId())){
 			throw new BizException("参数错误");
 		}
-
+		ExamOrganizationRelation organizationRelation = examOrganizationRelationDao.get(examOrganizationRelation.getId());
+		if(Objects.isNull(organizationRelation)){
+			throw new BizException("参数错误");
+		}
+		ExamOrganStatisticsDto selfOrgan = examOrganizationRelationDao.getExamOrganizationRelation(organizationRelation.getExaminationBasicId().longValue(), selfOrganId);
+		if(Objects.isNull(selfOrgan)){
+			throw new BizException("操作异常");
+		}
+		if(selfOrgan.getIsAllowArrangeExam()==0){
+			examOrganizationRelation.setIsAllowArrangeExam(0);
+		}
 		examOrganizationRelationDao.update(examOrganizationRelation);
 	}