diff --git a/ruoyi-ui/src/views/benyi/themeweekplan/table.vue b/ruoyi-ui/src/views/benyi/themeweekplan/table.vue index ab585495c..d1befe696 100644 --- a/ruoyi-ui/src/views/benyi/themeweekplan/table.vue +++ b/ruoyi-ui/src/views/benyi/themeweekplan/table.vue @@ -215,7 +215,7 @@ export default { //主题活动 getThemeActivityList(themeid) { listActivityByThemeId(themeid).then((response) => { - //console.log(response.rows); + console.log(response.rows); this.themeactivityOptions = response.rows; }); }, diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeTermplanController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeTermplanController.java index 25459b46a..8aa47e824 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeTermplanController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeTermplanController.java @@ -106,35 +106,50 @@ public class ByThemeTermplanController extends BaseController { String classId = schoolCommon.getClassId(); //首先判断当前账户是否为幼儿园账号 if (schoolCommon.isSchool() && !schoolCommon.isStringEmpty(classId)) { - int iCount = schoolCommon.getDifMonth(byThemeTermplan.getStartmonth(), byThemeTermplan.getEndmonth()); - System.out.println("月份差=" + iCount); - String uuid = schoolCommon.getUuid(); - byThemeTermplan.setId(uuid); - byThemeTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId()); - byThemeTermplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); - byThemeTermplan.setClassid(classId); - byThemeTermplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合学期计划"); - ByThemeTermplanitem byThemeTermplanitem = null; - for (int i = 0; i <= iCount; i++) { - byThemeTermplanitem = new ByThemeTermplanitem(); - byThemeTermplanitem.setTpid(uuid); - byThemeTermplanitem.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + ByThemeTermplan mybyThemeTermplan = new ByThemeTermplan(); + String xnxqNew = null; + List list = null; + xnxqNew = byThemeTermplan.getXnxq(); + mybyThemeTermplan.setXnxq(xnxqNew); + mybyThemeTermplan.setStartmonth(null); + mybyThemeTermplan.setEndmonth(null); + list = byThemeTermplanService.selectByThemeTermplanList(mybyThemeTermplan); + // 判断是否存在当前学期计划 + if (list != null && list.size() > 0) { + return AjaxResult.error("当前学年学期计划已经存在,无法创建学期计划"); + }else { + int iCount = schoolCommon.getDifMonth(byThemeTermplan.getStartmonth(), byThemeTermplan.getEndmonth()); + System.out.println("月份差=" + iCount); + String uuid = schoolCommon.getUuid(); + byThemeTermplan.setId(uuid); + byThemeTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId()); + byThemeTermplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + byThemeTermplan.setClassid(classId); + byThemeTermplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合学期计划"); + + + ByThemeTermplanitem byThemeTermplanitem = null; + for (int i = 0; i <= iCount; i++) { + byThemeTermplanitem = new ByThemeTermplanitem(); + byThemeTermplanitem.setTpid(uuid); + byThemeTermplanitem.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); // //月份加1 // Calendar calendar = Calendar.getInstance(); // calendar.setTime(byThemeTermplan.getStartmonth()); // calendar.add(Calendar.MONTH, i); - byThemeTermplanitem.setMonth(schoolCommon.DateAddMonths(i, byThemeTermplan.getStartmonth())); + byThemeTermplanitem.setMonth(schoolCommon.DateAddMonths(i, byThemeTermplan.getStartmonth())); - //创建时间 - byThemeTermplanitem.setCreateTime(new Date()); + //创建时间 + byThemeTermplanitem.setCreateTime(new Date()); - //新增每月计划 - byThemeTermplanitemService.insertByThemeTermplanitem(byThemeTermplanitem); + //新增每月计划 + byThemeTermplanitemService.insertByThemeTermplanitem(byThemeTermplanitem); + } + + return toAjax(byThemeTermplanService.insertByThemeTermplan(byThemeTermplan)); } - - return toAjax(byThemeTermplanService.insertByThemeTermplan(byThemeTermplan)); } else { return AjaxResult.error("当前用户非幼儿园教师,无法创建计划"); }