123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package cn.hmsoft.mr.control.cf;
- import java.io.IOException;
- import java.util.List;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import org.springframework.web.multipart.MultipartFile;
- import cn.hmsoft.application.web.Ajax;
- import cn.hmsoft.frame.constants.FrameThreadCallbackType;
- import cn.hmsoft.frame.constants.FrameThreadStatus;
- import cn.hmsoft.frame.control.FrameControl;
- import cn.hmsoft.frame.data.model.FrameDept;
- import cn.hmsoft.frame.data.model.FrameOptr;
- import cn.hmsoft.frame.data.model.FrameThread;
- import cn.hmsoft.frame.thread.FrameThreadHelper;
- import cn.hmsoft.helper.excel.ExcelReaderHelper;
- import cn.hmsoft.mr.constants.FrameResIdConst;
- import cn.hmsoft.mr.constants.MRConst;
- import cn.hmsoft.mr.data.dao.cf.CfAspectOptrDao;
- import cn.hmsoft.mr.service.cf.CfAspectOptrService;
- /**
- * 评审专业老师
- * @author zq
- *
- */
- @RestController
- public class CfAspectOptrControl extends FrameControl {
- @Autowired
- private CfAspectOptrService service;
- @Autowired
- private CfAspectOptrDao dao;
-
- /**
- * 专业评审老师
- * @param query : 查询条件
- * @param school_id: 学校ID
- */
- @RequestMapping("cf/aspect/optr/page.htm")
- public Ajax pageAspectOptr(String query, Integer start, Integer limit, String order, String type,
- Integer school_id, Integer batch_id, Integer aspect_id) {
- return new Ajax(this.dao.pageAspectOptr(start, limit, query, getQueryOrder(order, type),
- school_id, batch_id, aspect_id));
- }
-
- /**
- * 专业评审老师账号信息
- * @param query : 查询条件
- * @param school_id: 学校ID
- */
- @RequestMapping("cf/school/optr/page")
- public Ajax pageSchoolOptr(String query, Integer start, Integer limit, String order, String type,
- Integer school_id) {
- FrameDept org = this.dao.find(FrameDept.class, this.getFrameOptr().getOptr_dept());
- Integer dept_id = null;
- if (!org.getDept_type().equals(MRConst.OrgType.Admin.toString())) {
- dept_id = org.getDept_id();
- } else {
- return new Ajax();
- }
- return new Ajax(this.dao.pageSchoolOptr(start, limit, query, getQueryOrder(order, type),
- dept_id));
- }
-
- /**
- * @param ids
- * @param aspect_id
- */
- @RequestMapping("cf/aspect/optr/set.htm")
- public Ajax setAspectOptr(Integer[] ids, Integer school_id, Integer batch_id, Integer aspect_id) {
- this.authOptrRole(FrameResIdConst.RES_ASPECT_OPTR_SET);
- this.service.setAspectOptr(ids, school_id, batch_id, aspect_id, this.getFrameOptr());
- return new Ajax();
- }
-
- /**
- * @param file
- * @param batch_id
- * @throws IOException
- */
- @RequestMapping("cf/aspect/optr/upload.htm")
- public Ajax uploadAspectOptr(MultipartFile file, Integer school_id, Integer batch_id, String error_flag, String thread_flag) throws IOException {
- //this.authOptrRole(FrameResIdConst.RES_ASPECT_OPTR_UPLOAD);
- final FrameOptr optr = this.getFrameOptr();
- List<List<String>> array = ExcelReaderHelper.readSheet(file.getOriginalFilename(), file.getInputStream());
- FrameThread thread = FrameThreadHelper.createThread("考生导入线程", "数据需要进行处理", FrameThreadCallbackType.Swal,
- "数据处理完成", this.getFrameOptr());
- try {
- new Thread(() -> {
- this.service.uploadProcess(thread, school_id, batch_id, error_flag, array, file, optr);
- }).start();
- } catch (Exception e) {
- FrameThreadHelper.completeThread(thread, "出现错误:" + e.getMessage(), FrameThreadStatus.Error);
- }
- return new Ajax(thread);
- }
-
- }
|