Search in sources :

Example 1 with Class

use of com.cas.sim.tis.entity.Class in project TeachingInSimulation by ScOrPiOzzy.

the class ClassList method reload.

private void reload(Integer pageIndex) {
    int pageSize = 10;
    PageInfo<Class> pageInfo = SpringUtil.getBean(ClassAction.class).findClasses(pageIndex + 1, pageSize);
    if (pageInfo == null) {
        pagination.setPageCount(0);
        table.setItems(null);
        table.build();
    } else {
        pagination.setPageCount((int) pageInfo.getPages());
        JSONArray array = new JSONArray();
        array.addAll(pageInfo.getList());
        table.setItems(array);
        table.build();
    }
}
Also used : ClassAction(com.cas.sim.tis.action.ClassAction) JSONArray(com.alibaba.fastjson.JSONArray) Class(com.cas.sim.tis.entity.Class)

Example 2 with Class

use of com.cas.sim.tis.entity.Class in project TeachingInSimulation by ScOrPiOzzy.

the class ClassList method modify.

private void modify(int id) {
    Class clazz = SpringUtil.getBean(ClassAction.class).findClass(id);
    Dialog<Class> dialog = new Dialog<>();
    dialog.setDialogPane(new ClassModifyDialog(clazz));
    dialog.setTitle(MsgUtil.getMessage("class.dialog.modify"));
    dialog.setPrefSize(635, 320);
    dialog.showAndWait().ifPresent(obj -> {
        if (obj == null) {
            return;
        }
        try {
            SpringUtil.getBean(ClassAction.class).modifyClass(obj);
            AlertUtil.showAlert(AlertType.INFORMATION, MsgUtil.getMessage("alert.information.data.update.success"));
            pagination.reload();
        } catch (Exception e) {
            e.printStackTrace();
            AlertUtil.showAlert(AlertType.ERROR, e.getMessage());
            LOG.error("修改Class对象失败,Class编号{}:{}", obj.getId(), e.getMessage());
        }
    });
}
Also used : ClassAction(com.cas.sim.tis.action.ClassAction) Dialog(com.cas.sim.tis.view.control.imp.dialog.Dialog) Class(com.cas.sim.tis.entity.Class) IOException(java.io.IOException)

Example 3 with Class

use of com.cas.sim.tis.entity.Class in project TeachingInSimulation by ScOrPiOzzy.

the class PreviewQuestionPaper method publish.

@FXML
private void publish() {
    // 判断当前是否有考核正在进行
    if (Session.get(Session.KEY_LIBRARY_PUBLISH_ID) != null) {
        AlertUtil.showAlert(AlertType.WARNING, MsgUtil.getMessage("alert.warning.examing"));
        return;
    }
    // 创建考核记录
    List<Class> classes = SpringUtil.getBean(ClassAction.class).findClassesByTeacher(Session.get(Session.KEY_LOGIN_ID));
    Dialog<Integer> dialog = new Dialog<>();
    dialog.setDialogPane(new ClassSelectDialog(classes));
    dialog.setTitle(MsgUtil.getMessage("class.dialog.select"));
    dialog.setPrefSize(652, 420);
    dialog.showAndWait().ifPresent(cid -> {
        if (cid == null) {
            return;
        }
        try {
            Integer publishId = SpringUtil.getBean(LibraryPublishAction.class).publishLibraryToClass(rid, cid);
            // 记录当前考核发布编号
            Session.set(Session.KEY_LIBRARY_PUBLISH_ID, publishId);
            // 添加考核进行时菜单
            PageController controller = SpringUtil.getBean(PageController.class);
            ILeftContent content = controller.getLeftMenu();
            if (content instanceof IPublish) {
                ((IPublish) content).publish(publishId);
            }
        } catch (Exception e) {
            e.printStackTrace();
            AlertUtil.showAlert(AlertType.ERROR, e.getMessage());
        }
    });
}
Also used : IPublish(com.cas.sim.tis.view.control.IPublish) ClassAction(com.cas.sim.tis.action.ClassAction) LibraryPublishAction(com.cas.sim.tis.action.LibraryPublishAction) PageController(com.cas.sim.tis.view.controller.PageController) ClassSelectDialog(com.cas.sim.tis.view.control.imp.classes.ClassSelectDialog) Dialog(com.cas.sim.tis.view.control.imp.dialog.Dialog) ClassSelectDialog(com.cas.sim.tis.view.control.imp.classes.ClassSelectDialog) Class(com.cas.sim.tis.entity.Class) ILeftContent(com.cas.sim.tis.view.control.ILeftContent) IOException(java.io.IOException) FXML(javafx.fxml.FXML)

Example 4 with Class

use of com.cas.sim.tis.entity.Class in project TeachingInSimulation by ScOrPiOzzy.

the class ClassServiceImpl method findClasses.

@Override
public PageInfo<Class> findClasses(int pageIndex, int pageSize) {
    ClassMapper classMapper = (ClassMapper) mapper;
    PageHelper.startPage(pageIndex, pageSize);
    List<Class> result = classMapper.findClasses();
    PageInfo<Class> page = new PageInfo<>(result);
    LOG.info("成功查找到{}条资源,当前页码{},每页{}条资源,共{}页", page.getTotal(), pageIndex, pageSize, page.getPages());
    return page;
}
Also used : ClassMapper(com.cas.sim.tis.mapper.ClassMapper) PageInfo(com.github.pagehelper.PageInfo) Class(com.cas.sim.tis.entity.Class)

Example 5 with Class

use of com.cas.sim.tis.entity.Class in project TeachingInSimulation by ScOrPiOzzy.

the class ClassAction method deleteClass.

public void deleteClass(int id) {
    ClassService service = getService();
    Class clazz = service.findById(id);
    clazz.setDel(1);
    clazz.setUpdater(Session.get(Session.KEY_LOGIN_ID));
    service.update(clazz);
}
Also used : ClassService(com.cas.sim.tis.services.ClassService) Class(com.cas.sim.tis.entity.Class)

Aggregations

Class (com.cas.sim.tis.entity.Class)5 ClassAction (com.cas.sim.tis.action.ClassAction)3 Dialog (com.cas.sim.tis.view.control.imp.dialog.Dialog)2 IOException (java.io.IOException)2 JSONArray (com.alibaba.fastjson.JSONArray)1 LibraryPublishAction (com.cas.sim.tis.action.LibraryPublishAction)1 ClassMapper (com.cas.sim.tis.mapper.ClassMapper)1 ClassService (com.cas.sim.tis.services.ClassService)1 ILeftContent (com.cas.sim.tis.view.control.ILeftContent)1 IPublish (com.cas.sim.tis.view.control.IPublish)1 ClassSelectDialog (com.cas.sim.tis.view.control.imp.classes.ClassSelectDialog)1 PageController (com.cas.sim.tis.view.controller.PageController)1 PageInfo (com.github.pagehelper.PageInfo)1 FXML (javafx.fxml.FXML)1