|
@@ -1,5 +1,6 @@
|
|
|
package com.qmth.exam.reserve.controller.admin;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.boot.core.fss.store.FileStore;
|
|
@@ -7,16 +8,20 @@ import com.qmth.exam.reserve.bean.Constants;
|
|
|
import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
|
|
|
import com.qmth.exam.reserve.bean.systemproperty.SystemPropertyBean;
|
|
|
import com.qmth.exam.reserve.controller.BaseController;
|
|
|
+import com.qmth.exam.reserve.entity.OrgEntity;
|
|
|
import com.qmth.exam.reserve.entity.SystemPropertyEntity;
|
|
|
import com.qmth.exam.reserve.service.ApplyTaskService;
|
|
|
+import com.qmth.exam.reserve.service.OrgService;
|
|
|
import com.qmth.exam.reserve.service.SystemPropertyService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
@RestController
|
|
@@ -33,22 +38,40 @@ public class SystemPropertyController extends BaseController {
|
|
|
@Autowired
|
|
|
private ApplyTaskService applyTaskService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrgService orgService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SystemPropertyService systemPropertyService;
|
|
|
|
|
|
@ApiOperation(value = "获取系统常用属性集合")
|
|
|
@PostMapping(value = "/properties")
|
|
|
- public SystemPropertyBean properties() {
|
|
|
+ public SystemPropertyBean properties(@ApiParam("学校ID") @RequestParam(required = false) Long orgId) {
|
|
|
SystemPropertyBean properties = new SystemPropertyBean();
|
|
|
properties.setFileUrlPrefix(fileStore.getServer());
|
|
|
|
|
|
- CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask();
|
|
|
+ OrgEntity org;
|
|
|
+ if (orgId != null) {
|
|
|
+ org = orgService.getById(orgId);
|
|
|
+ } else {
|
|
|
+ // 未明确指定学校,默认取一个学校
|
|
|
+ LambdaQueryWrapper<OrgEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.select(OrgEntity::getId, OrgEntity::getName);
|
|
|
+ wrapper.last("LIMIT 1");
|
|
|
+ org = orgService.getOne(wrapper);
|
|
|
+ }
|
|
|
+ if (org != null) {
|
|
|
+ properties.setOrgTitle(org.getName());
|
|
|
+ orgId = org.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(orgId);
|
|
|
if (curApplyTask != null) {
|
|
|
- properties.setOrgTitle(curApplyTask.getOrgName());
|
|
|
+ // 当前预约任务
|
|
|
properties.setTaskTitle(curApplyTask.getTaskName());
|
|
|
}
|
|
|
|
|
|
- SystemPropertyEntity systemProperty = systemPropertyService.findByPropKey(Constants.CATEGORY_LEVEL);
|
|
|
+ SystemPropertyEntity systemProperty = systemPropertyService.findByPropKey(orgId, Constants.CATEGORY_LEVEL);
|
|
|
if (systemProperty != null) {
|
|
|
properties.setCategoryLevels(systemProperty.getPropValue());
|
|
|
}
|