组织接口准备换新;项目设备查询接口修改

This commit is contained in:
joylink_zhangsai 2022-12-08 16:12:58 +08:00
parent be68845591
commit e875d1160d
6 changed files with 61 additions and 8 deletions

View File

@ -18,10 +18,12 @@ import java.util.List;
/** /**
* 组织成员管理接口 * 组织成员管理接口
* 这些接口逐渐废弃新接口加在这里{@link club.joylink.rtss.controller.org.OrgController}
*/ */
@RestController @RestController
@RequestMapping("/api/company") @RequestMapping("/api/company")
public class OrgController { @Deprecated(since = "2022.12.08", forRemoval = true)
public class CompanyController {
@Autowired @Autowired
private IOrgUserService iOrgUserService; private IOrgUserService iOrgUserService;

View File

@ -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<DepartmentVO> listQueryCls(@PathVariable long topOrgId) {
return iOrgService.listQueryCls(topOrgId);
}
}

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.dao.ExamDefinitionDAO;
import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.UserExamMapper; import club.joylink.rtss.dao.UserExamMapper;
import club.joylink.rtss.dao.org.OrgProjectDao; 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.dao.paper.PaperUserDAO;
import club.joylink.rtss.entity.ExamDefinitionExample; import club.joylink.rtss.entity.ExamDefinitionExample;
import club.joylink.rtss.entity.UserExam; import club.joylink.rtss.entity.UserExam;
@ -164,6 +165,8 @@ public class PaperCompositionController {
UserExamMapper userExamMapper; UserExamMapper userExamMapper;
@Autowired @Autowired
private PaperUserDAO paperUserDAO; private PaperUserDAO paperUserDAO;
@Autowired
PaperCompositionDAO paperCompositionDAO;
/** /**
* 旧数据处理接口用完删除 * 旧数据处理接口用完删除
@ -171,7 +174,7 @@ public class PaperCompositionController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@PostMapping("/oldData/handle") @PostMapping("/oldData/handle")
public List<String> oldDataHandle(@RequestAttribute AccountVO user) { public List<String> oldDataHandle(@RequestAttribute AccountVO user) {
examDefinitionDAO.deleteByExample(null); paperCompositionDAO.deleteByExample(null);
paperUserDAO.deleteByExample(null); paperUserDAO.deleteByExample(null);
List<String> msg = new ArrayList<>(); List<String> msg = new ArrayList<>();
@ -214,7 +217,7 @@ public class PaperCompositionController {
paperCompositionWithRuleVo.setCreatorId(exam.getCreatorId()); paperCompositionWithRuleVo.setCreatorId(exam.getCreatorId());
paperCompositionWithRuleVo.setCreateTime(exam.getCreateTime()); paperCompositionWithRuleVo.setCreateTime(exam.getCreateTime());
paperCompositionWithRuleVo.setUpdateTime(null); paperCompositionWithRuleVo.setUpdateTime(null);
paperCompositionWithRuleVo.setState(PaperCompositionState.Locked); paperCompositionWithRuleVo.setState(PaperCompositionState.Invalid);
CreatePaperCompositionRspVo paperComposition = createPaperCompositionWithRuleForOrg(exam.getOrgId(), paperCompositionWithRuleVo, user); CreatePaperCompositionRspVo paperComposition = createPaperCompositionWithRuleForOrg(exam.getOrgId(), paperCompositionWithRuleVo, user);
old_newExamIdMap.put(exam.getId(), paperComposition.getId()); old_newExamIdMap.put(exam.getId(), paperComposition.getId());
}); });

View File

@ -206,11 +206,9 @@ public class DeviceController {
/** /**
* 查询某个类型的所有设备 * 查询某个类型的所有设备
*/ */
@GetMapping("/{type}/all") @GetMapping("/{project}/{type}/all")
public List<ProjectDeviceVO> queryByType(@PathVariable ProjectDeviceType type, public List<ProjectDeviceVO> queryByType(@PathVariable String project, @PathVariable ProjectDeviceType type) {
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) return this.deviceService.queryByType(type, project);
LoginUserInfoVO userLoginInfo) {
return this.deviceService.queryByType(type, userLoginInfo.getProject());
} }
// //

View File

@ -91,4 +91,10 @@ public interface IOrgService {
Org getTopOrgOfUser(long userId); Org getTopOrgOfUser(long userId);
Org findTopOrgOfUser(long userId); Org findTopOrgOfUser(long userId);
/**
* 查询该组织下的所有班级
* 目前组织结构仅有两级非顶级的就是班级
*/
List<DepartmentVO> listQueryCls(long topOrgId);
} }

View File

@ -380,6 +380,21 @@ public class OrgService implements IOrgService {
} }
} }
@Override
public List<DepartmentVO> listQueryCls(long topOrgId) {
List<Org> clsList = findClsByTopOrgId(topOrgId);
return DepartmentVO.convert2VOList(clsList);
}
/**
* 查询该顶级组织下的班级
*/
private List<Org> findClsByTopOrgId(long topOrgId) {
OrgExample orgExample = new OrgExample();
orgExample.createCriteria().andRootIdEqualTo(topOrgId).andParentIdIsNull();
return orgDAO.selectByExample(orgExample);
}
/** /**
* 创建非顶级组织 * 创建非顶级组织
*/ */