From e875d1160de30da972083febd9b835812405c19e Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 8 Dec 2022 16:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=8E=A5=E5=8F=A3=E5=87=86?= =?UTF-8?q?=E5=A4=87=E6=8D=A2=E6=96=B0=EF=BC=9B=E9=A1=B9=E7=9B=AE=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Controller.java => CompanyController.java} | 4 ++- .../rtss/controller/org/OrgController.java | 29 +++++++++++++++++++ .../paper/PaperCompositionController.java | 7 +++-- .../controller/project/DeviceController.java | 8 ++--- .../rtss/services/org/IOrgService.java | 6 ++++ .../joylink/rtss/services/org/OrgService.java | 15 ++++++++++ 6 files changed, 61 insertions(+), 8 deletions(-) rename src/main/java/club/joylink/rtss/controller/{OrgController.java => CompanyController.java} (98%) create mode 100644 src/main/java/club/joylink/rtss/controller/org/OrgController.java diff --git a/src/main/java/club/joylink/rtss/controller/OrgController.java b/src/main/java/club/joylink/rtss/controller/CompanyController.java similarity index 98% rename from src/main/java/club/joylink/rtss/controller/OrgController.java rename to src/main/java/club/joylink/rtss/controller/CompanyController.java index 5b5817397..7467eaff1 100644 --- a/src/main/java/club/joylink/rtss/controller/OrgController.java +++ b/src/main/java/club/joylink/rtss/controller/CompanyController.java @@ -18,10 +18,12 @@ import java.util.List; /** * 组织成员管理接口 + * 这些接口逐渐废弃,新接口加在这里{@link club.joylink.rtss.controller.org.OrgController} */ @RestController @RequestMapping("/api/company") -public class OrgController { +@Deprecated(since = "2022.12.08", forRemoval = true) +public class CompanyController { @Autowired private IOrgUserService iOrgUserService; diff --git a/src/main/java/club/joylink/rtss/controller/org/OrgController.java b/src/main/java/club/joylink/rtss/controller/org/OrgController.java new file mode 100644 index 000000000..d3df41233 --- /dev/null +++ b/src/main/java/club/joylink/rtss/controller/org/OrgController.java @@ -0,0 +1,29 @@ +package club.joylink.rtss.controller.org; + +import club.joylink.rtss.services.org.IOrgService; +import club.joylink.rtss.vo.client.org.DepartmentVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 组织相关数据管理 + */ +@RestController +@RequestMapping("/api/org") +public class OrgController { + @Autowired + private IOrgService iOrgService; + + /** + * 列表查询该组织下的所有班级 + */ + @GetMapping("/{topOrgId}/cls/list") + public List listQueryCls(@PathVariable long topOrgId) { + return iOrgService.listQueryCls(topOrgId); + } +} diff --git a/src/main/java/club/joylink/rtss/controller/paper/PaperCompositionController.java b/src/main/java/club/joylink/rtss/controller/paper/PaperCompositionController.java index 3c7bb79eb..00a846009 100644 --- a/src/main/java/club/joylink/rtss/controller/paper/PaperCompositionController.java +++ b/src/main/java/club/joylink/rtss/controller/paper/PaperCompositionController.java @@ -6,6 +6,7 @@ import club.joylink.rtss.dao.ExamDefinitionDAO; import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.UserExamMapper; import club.joylink.rtss.dao.org.OrgProjectDao; +import club.joylink.rtss.dao.paper.PaperCompositionDAO; import club.joylink.rtss.dao.paper.PaperUserDAO; import club.joylink.rtss.entity.ExamDefinitionExample; import club.joylink.rtss.entity.UserExam; @@ -164,6 +165,8 @@ public class PaperCompositionController { UserExamMapper userExamMapper; @Autowired private PaperUserDAO paperUserDAO; + @Autowired + PaperCompositionDAO paperCompositionDAO; /** * 旧数据处理接口(用完删除) @@ -171,7 +174,7 @@ public class PaperCompositionController { @Transactional(rollbackFor = Exception.class) @PostMapping("/oldData/handle") public List oldDataHandle(@RequestAttribute AccountVO user) { - examDefinitionDAO.deleteByExample(null); + paperCompositionDAO.deleteByExample(null); paperUserDAO.deleteByExample(null); List msg = new ArrayList<>(); @@ -214,7 +217,7 @@ public class PaperCompositionController { paperCompositionWithRuleVo.setCreatorId(exam.getCreatorId()); paperCompositionWithRuleVo.setCreateTime(exam.getCreateTime()); paperCompositionWithRuleVo.setUpdateTime(null); - paperCompositionWithRuleVo.setState(PaperCompositionState.Locked); + paperCompositionWithRuleVo.setState(PaperCompositionState.Invalid); CreatePaperCompositionRspVo paperComposition = createPaperCompositionWithRuleForOrg(exam.getOrgId(), paperCompositionWithRuleVo, user); old_newExamIdMap.put(exam.getId(), paperComposition.getId()); }); diff --git a/src/main/java/club/joylink/rtss/controller/project/DeviceController.java b/src/main/java/club/joylink/rtss/controller/project/DeviceController.java index 7c6767217..21ee574b8 100644 --- a/src/main/java/club/joylink/rtss/controller/project/DeviceController.java +++ b/src/main/java/club/joylink/rtss/controller/project/DeviceController.java @@ -206,11 +206,9 @@ public class DeviceController { /** * 查询某个类型的所有设备 */ - @GetMapping("/{type}/all") - public List queryByType(@PathVariable ProjectDeviceType type, - @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) - LoginUserInfoVO userLoginInfo) { - return this.deviceService.queryByType(type, userLoginInfo.getProject()); + @GetMapping("/{project}/{type}/all") + public List queryByType(@PathVariable String project, @PathVariable ProjectDeviceType type) { + return this.deviceService.queryByType(type, project); } // diff --git a/src/main/java/club/joylink/rtss/services/org/IOrgService.java b/src/main/java/club/joylink/rtss/services/org/IOrgService.java index d67e101f2..eed5d6f44 100644 --- a/src/main/java/club/joylink/rtss/services/org/IOrgService.java +++ b/src/main/java/club/joylink/rtss/services/org/IOrgService.java @@ -91,4 +91,10 @@ public interface IOrgService { Org getTopOrgOfUser(long userId); Org findTopOrgOfUser(long userId); + + /** + * 查询该组织下的所有班级。 + * 目前组织结构仅有两级,非顶级的就是班级。 + */ + List listQueryCls(long topOrgId); } diff --git a/src/main/java/club/joylink/rtss/services/org/OrgService.java b/src/main/java/club/joylink/rtss/services/org/OrgService.java index 75e57b37a..39e5f08d5 100644 --- a/src/main/java/club/joylink/rtss/services/org/OrgService.java +++ b/src/main/java/club/joylink/rtss/services/org/OrgService.java @@ -380,6 +380,21 @@ public class OrgService implements IOrgService { } } + @Override + public List listQueryCls(long topOrgId) { + List clsList = findClsByTopOrgId(topOrgId); + return DepartmentVO.convert2VOList(clsList); + } + + /** + * 查询该顶级组织下的班级 + */ + private List findClsByTopOrgId(long topOrgId) { + OrgExample orgExample = new OrgExample(); + orgExample.createCriteria().andRootIdEqualTo(topOrgId).andParentIdIsNull(); + return orgDAO.selectByExample(orgExample); + } + /** * 创建非顶级组织 */