Переглянути джерело

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

yonge 5 роки тому
батько
коміт
9a9e12e120

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

@@ -8,7 +8,6 @@ import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.user.dto.ExamOrganizationRelationExtraDto;
 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;
@@ -18,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 /**
@@ -56,7 +56,15 @@ public class ExamOrganizationRelationController extends BaseController {
     @ApiOperation("添加合作单位")
     @PostMapping(value = "/addExamOrganizations")
     public HttpResponseResult addExamOrganizations(@RequestBody List<ExamOrganizationRelation> organizationRelations){
-        examOrganizationRelationService.addExamOrganizations(organizationRelations);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(sysUser)){
+            return failed("请重新登录");
+        }
+        Employee employee = employeeService.get(sysUser.getId());
+        if(Objects.isNull(employee)){
+            return failed("用户异常");
+        }
+        examOrganizationRelationService.addExamOrganizations(organizationRelations,employee.getOrganId());
         return succeed();
     }
 
@@ -74,6 +82,13 @@ public class ExamOrganizationRelationController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation("删除")
+    @PostMapping(value = "/del")
+    public HttpResponseResult del(Long id){
+        examOrganizationRelationService.delete(id);
+        return succeed();
+    }
+
     @ApiOperation("获取本单位项目信息")
     @GetMapping(value = "/getExamOrganStatistics")
     public HttpResponseResult getExamOrganStatistics(Long examId){
@@ -93,7 +108,7 @@ public class ExamOrganizationRelationController extends BaseController {
 
     @ApiOperation("获取未关联到考级项目的合作单位")
     @GetMapping(value = "/queryUnRelatedOrgans")
-    public HttpResponseResult<PageInfo<Organization>> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo){
+    public HttpResponseResult<Map<String, Object>> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(Objects.isNull(sysUser)){
             return failed("请重新登录");

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

@@ -9,6 +9,7 @@ import com.keao.edu.user.entity.Organization;
 import com.keao.edu.user.page.ExamOrganizationRelationQueryInfo;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ExamOrganizationRelationService extends BaseService<Long, ExamOrganizationRelation> {
 
@@ -39,7 +40,7 @@ public interface ExamOrganizationRelationService extends BaseService<Long, ExamO
      * @param orgainIdsStr:
      * @return void
      */
-    void addExamOrganizations(List<ExamOrganizationRelation> organizationRelations);
+    void addExamOrganizations(List<ExamOrganizationRelation> organizationRelations, Integer selfOrganId);
 
     /**
      * @describe 更新考级项目与合作单位关联信息
@@ -76,6 +77,6 @@ public interface ExamOrganizationRelationService extends BaseService<Long, ExamO
      * @param queryInfo:
      * @return org.springframework.data.domain.Page<com.keao.edu.user.entity.Organization>
      */
-    PageInfo<Organization> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo);
+    Map<String, Object> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo);
 
 }

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

@@ -168,7 +168,7 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void addExamOrganizations(List<ExamOrganizationRelation> organizationRelations) {
+	public void addExamOrganizations(List<ExamOrganizationRelation> organizationRelations, Integer selfOrganId) {
 		if(CollectionUtils.isEmpty(organizationRelations)){
 			throw new BizException("请指定考级项目");
 		}
@@ -183,6 +183,11 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			throw new BizException("当前状态暂不可添加合作单位");
 		}
 
+		ExamOrganStatisticsDto examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examinationBasic.getId(), selfOrganId);
+		if(Objects.isNull(examOrganizationRelation)){
+			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()){
@@ -215,6 +220,10 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 				throw new BizException("参数错误");
 			}
 
+			if(examOrganizationRelation.getIsAllowArrangeExam()==0){
+				og.setIsAllowArrangeExam(0);
+			}
+
 			og.setTenantId(TenantContextHolder.getTenantId());
 			og.setExaminationBasicId(examinationBasic.getId().intValue());
 
@@ -319,8 +328,8 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			days.add(today.toString());
 		}
 		for (String day : days) {
-			dayTransAmount.put(day, BigDecimal.valueOf(Math.random()*100));
-			dayPaymentAmount.put(day, BigDecimal.valueOf(Math.random()*100));
+			dayTransAmount.put(day, BigDecimal.valueOf((long) (Math.random()*100),2));
+			dayPaymentAmount.put(day, BigDecimal.valueOf((long) (Math.random()*100),2));
 		}
 		examOrganStatistics.setDayTransAmount(dayTransAmount);
 		examOrganStatistics.setDayPaymentAmount(dayPaymentAmount);
@@ -329,7 +338,7 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	}
 
 	@Override
-	public PageInfo<Organization> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo) {
+	public Map<String, Object> queryUnRelatedOrgans(ExamOrganizationRelationQueryInfo queryInfo) {
 		PageInfo<Organization> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<String, Object>();
 		MapUtil.populateMap(params, queryInfo);
@@ -344,7 +353,15 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 			params.put("offset", pageInfo.getOffset());
 			dataList = examOrganizationRelationDao.queryUnRelatedOrgans(params);
 		}
+		ExamOrganStatisticsDto examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(queryInfo.getExamId().longValue(), queryInfo.getOrganId());
 		pageInfo.setRows(dataList);
-		return pageInfo;
+		Map<String, Object> result=new HashMap<>();
+		result.put("pageInfo", pageInfo);
+		if(Objects.nonNull(examOrganizationRelation)){
+			result.put("isAllowArrangeExam",examOrganizationRelation.getIsAllowArrangeExam());
+		}else{
+			result.put("isAllowArrangeExam",0);
+		}
+		return result;
 	}
 }

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

@@ -73,7 +73,7 @@
 		SELECT COUNT(*) FROM exam_lifecycle_log
 	</select>
 
-    <select id="findWithExam" resultType="com.keao.edu.user.entity.ExamLifecycleLog">
+    <select id="findWithExam" resultMap="ExamLifecycleLog">
 		SELECT * FROM exam_lifecycle_log WHERE examination_basic_id_=#{examId} ORDER BY id_ DESC
 	</select>
 </mapper>