Browse Source

报表计算

xiatian 6 years ago
parent
commit
e7b7236428

+ 16 - 1
examcloud-core-reports-api-provider/src/main/java/cn/com/qmth/examcloud/core/reports/api/provider/ProjectCloudServiceProvider.java

@@ -9,8 +9,10 @@ import org.springframework.web.bind.annotation.RestController;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.reports.api.ProjectCloudService;
 import cn.com.qmth.examcloud.core.reports.api.request.GetProjectInfoBeanReq;
+import cn.com.qmth.examcloud.core.reports.api.request.UpdateProjectCourseOrgCountReq;
 import cn.com.qmth.examcloud.core.reports.api.request.UpdateProjectStatusReq;
 import cn.com.qmth.examcloud.core.reports.api.response.GetProjectInfoBeanResp;
+import cn.com.qmth.examcloud.core.reports.api.response.UpdateProjectCourseOrgCountResp;
 import cn.com.qmth.examcloud.core.reports.api.response.UpdateProjectStatusResp;
 import cn.com.qmth.examcloud.core.reports.service.ProjectService;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
@@ -41,11 +43,24 @@ public class ProjectCloudServiceProvider extends ControllerSupport implements Pr
 		return new UpdateProjectStatusResp();
 	}
 
+	@ApiOperation(value = "获取项目信息")
+    @PostMapping("/getProjectBean")
 	@Override
-	public GetProjectInfoBeanResp getProjectBean(GetProjectInfoBeanReq req) {
+	public GetProjectInfoBeanResp getProjectBean(@RequestBody GetProjectInfoBeanReq req) {
 		GetProjectInfoBeanResp res=new GetProjectInfoBeanResp();
 		res.setBean(projectService.getProjectInfoBean(req));
 		return res;
 	}
 
+	@ApiOperation(value = "更新项目中心、课程数量")
+    @PostMapping("/updateCourseOrgCount")
+	@Override
+	public UpdateProjectCourseOrgCountResp updateProjectCourseOrgCount(@RequestBody UpdateProjectCourseOrgCountReq req) {
+		if(req.getProjectId()==null) {
+			throw new StatusException("1000011", "projectId不能为空");
+		}
+		projectService.updateProjectCourseOrgCount(req);
+		return new UpdateProjectCourseOrgCountResp();
+	}
+
 }

+ 4 - 0
examcloud-core-reports-dao/src/main/java/cn/com/qmth/examcloud/core/reports/dao/ProjectRepo.java

@@ -14,4 +14,8 @@ public interface ProjectRepo extends JpaRepository<ProjectEntity, Long>,
 	@Modifying
 	@Query(value = "update ec_r_project set enable = ?3 where id in(?1) and root_org_id=?2 ", nativeQuery = true)
 	int updateEnable(List<Long> ids, Long rootOrgId, Boolean enable);
+	@Modifying
+	@Query(value = "update ec_r_project set course_count = ?2,org_count=?3 where id =?1 ", nativeQuery = true)
+	int updateProjectCourseOrgCount(Long id, Integer courseCount, Integer orgCount);
+	
 }

+ 2 - 0
examcloud-core-reports-service/src/main/java/cn/com/qmth/examcloud/core/reports/service/ProjectService.java

@@ -3,6 +3,7 @@ package cn.com.qmth.examcloud.core.reports.service;
 import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
 import cn.com.qmth.examcloud.core.reports.api.bean.ProjectInfoBean;
 import cn.com.qmth.examcloud.core.reports.api.request.GetProjectInfoBeanReq;
+import cn.com.qmth.examcloud.core.reports.api.request.UpdateProjectCourseOrgCountReq;
 import cn.com.qmth.examcloud.core.reports.api.request.UpdateProjectStatusReq;
 import cn.com.qmth.examcloud.core.reports.base.bean.AddProjectReq;
 import cn.com.qmth.examcloud.core.reports.base.bean.ProjectBean;
@@ -22,4 +23,5 @@ public interface ProjectService {
 	public ProjectInfoBean getProjectInfoBean(GetProjectInfoBeanReq req);
 	public void updateScore(UpdateProjectScoreReq req,Long rootOrgId);
 	public ProjectEntity findProjectById(Long projectId);
+	public void updateProjectCourseOrgCount(UpdateProjectCourseOrgCountReq req);
 }

+ 6 - 0
examcloud-core-reports-service/src/main/java/cn/com/qmth/examcloud/core/reports/service/impl/ProjectServiceImpl.java

@@ -27,6 +27,7 @@ import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.reports.api.bean.ProjectInfoBean;
 import cn.com.qmth.examcloud.core.reports.api.request.GetProjectInfoBeanReq;
+import cn.com.qmth.examcloud.core.reports.api.request.UpdateProjectCourseOrgCountReq;
 import cn.com.qmth.examcloud.core.reports.api.request.UpdateProjectStatusReq;
 import cn.com.qmth.examcloud.core.reports.base.bean.AddProjectReq;
 import cn.com.qmth.examcloud.core.reports.base.bean.ProjectBean;
@@ -278,4 +279,9 @@ public class ProjectServiceImpl implements ProjectService {
 		ProjectEntity pe = GlobalHelper.getEntity(projectRepo, projectId, ProjectEntity.class);
 		return pe;
 	}
+
+	@Override
+	public void updateProjectCourseOrgCount(UpdateProjectCourseOrgCountReq req) {
+		projectRepo.updateProjectCourseOrgCount(req.getProjectId(), req.getCourseCount(), req.getOrgCount());
+	}
 }