From e83d4754cbd936aabde97c4aaf130aad4062f715 Mon Sep 17 00:00:00 2001
From: sk1551 <15175617877@163.com>
Date: Sat, 30 Jan 2021 15:12:56 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=8F=AD=E7=A6=81=E6=AD=A2=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=A4=87=E8=AF=BE&=E5=AD=A6=E6=A0=A1=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E6=88=AA=E8=87=B3=E6=97=A5=E6=9C=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-ui/src/views/system/school/index.vue | 1 +
.../controller/ByMathTermplanController.java | 46 ++++---
.../ByThemeMonthplanController.java | 77 ++++++-----
.../controller/ByThemeTermplanController.java | 74 +++++-----
.../controller/ByThemeWeekplanController.java | 128 +++++++++---------
.../ruoyi/project/system/domain/BySchool.java | 2 +
6 files changed, 176 insertions(+), 152 deletions(-)
diff --git a/ruoyi-ui/src/views/system/school/index.vue b/ruoyi-ui/src/views/system/school/index.vue
index 48c69c02b..f031516af 100644
--- a/ruoyi-ui/src/views/system/school/index.vue
+++ b/ruoyi-ui/src/views/system/school/index.vue
@@ -116,6 +116,7 @@
+
list = byThemeTermplanService.selectByThemeTermplanList(byThemeTermplan);
- String strThemeIds = "";
- if (list != null && list.size() > 0) {
- for (int i = 0; i < list.size(); i++) {
- String themeId = list.get(i).getId();
- ByThemeTermplanitem byThemeTermplanitem = new ByThemeTermplanitem();
- byThemeTermplanitem.setTpid(themeId);
- byThemeTermplanitem.setMonth(byThemeMonthplan.getMonth());
- List listItem = byThemeTermplanitemService.selectByThemeTermplanitemList(byThemeTermplanitem);
- if (listItem != null && listItem.size() > 0) {
- for (int j = 0; j < listItem.size(); j++) {
- String themeIds = listItem.get(j).getThemeconent();
- if (!schoolCommon.isStringEmpty(themeIds)) {
- strThemeIds = strThemeIds + themeIds;
+ // 判断当前班级是否为托班
+ String bjtypeNew = byClassService.selectByClassById(classId).getBjtype();
+ if (bjtypeNew.equals("1")) {
+ return AjaxResult.error("当前班级为托班,无法创建计划");
+ }else {
+ //根据当前月份 查找学期计划的主题
+ ByThemeTermplan byThemeTermplan = new ByThemeTermplan();
+ byThemeTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
+ byThemeTermplan.setClassid(classId);
+ byThemeTermplan.setStatus("2");
+ byThemeTermplan.setXnxq(byThemeMonthplan.getXnxq());
+ List list = byThemeTermplanService.selectByThemeTermplanList(byThemeTermplan);
+ String strThemeIds = "";
+ if (list != null && list.size() > 0) {
+ for (int i = 0; i < list.size(); i++) {
+ String themeId = list.get(i).getId();
+ ByThemeTermplanitem byThemeTermplanitem = new ByThemeTermplanitem();
+ byThemeTermplanitem.setTpid(themeId);
+ byThemeTermplanitem.setMonth(byThemeMonthplan.getMonth());
+ List listItem = byThemeTermplanitemService.selectByThemeTermplanitemList(byThemeTermplanitem);
+ if (listItem != null && listItem.size() > 0) {
+ for (int j = 0; j < listItem.size(); j++) {
+ String themeIds = listItem.get(j).getThemeconent();
+ if (!schoolCommon.isStringEmpty(themeIds)) {
+ strThemeIds = strThemeIds + themeIds;
+ }
}
}
}
+ } else {
+ return AjaxResult.error("当前班级未制定学期计划或学期计划未审批,无法创建月计划");
}
- } else {
- return AjaxResult.error("当前班级未制定学期计划或学期计划未审批,无法创建月计划");
- }
- if (schoolCommon.isStringEmpty(strThemeIds)) {
- return AjaxResult.error("当前班级制定的学期计划未设置月份主题,无法创建月计划");
- }
+ if (schoolCommon.isStringEmpty(strThemeIds)) {
+ return AjaxResult.error("当前班级制定的学期计划未设置月份主题,无法创建月计划");
+ }
- String uuid = schoolCommon.getUuid();
- byThemeMonthplan.setId(uuid);
- byThemeMonthplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
- byThemeMonthplan.setClassid(classId);
- byThemeMonthplan.setThemes(strThemeIds);//主题id
- byThemeMonthplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
- byThemeMonthplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合月计划" + "(" + sdf.format(byThemeMonthplan.getMonth()) + ")");
- return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan));
+ String uuid = schoolCommon.getUuid();
+ byThemeMonthplan.setId(uuid);
+ byThemeMonthplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
+ byThemeMonthplan.setClassid(classId);
+ byThemeMonthplan.setThemes(strThemeIds);//主题id
+ byThemeMonthplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+ byThemeMonthplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合月计划" + "(" + sdf.format(byThemeMonthplan.getMonth()) + ")");
+ return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan));
+ }
} else {
return AjaxResult.error("当前用户非幼儿园教师,无法创建月计划");
}
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 8e58703f2..435958507 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
@@ -10,6 +10,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.benyi.domain.ByThemeTermplanitem;
import com.ruoyi.project.benyi.service.IByThemeTermplanitemService;
import com.ruoyi.project.common.SchoolCommon;
+import com.ruoyi.project.system.domain.ByClass;
import com.ruoyi.project.system.service.IByClassService;
import com.ruoyi.project.system.service.ISysUserService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -106,51 +107,56 @@ public class ByThemeTermplanController extends BaseController {
String classId = schoolCommon.getClassId();
//首先判断当前账户是否为幼儿园账号
if (schoolCommon.isSchool() && !schoolCommon.isStringEmpty(classId)) {
-
- ByThemeTermplan mybyThemeTermplan = new ByThemeTermplan();
- String xnxqNew = null;
- List list = null;
- xnxqNew = byThemeTermplan.getXnxq();
- mybyThemeTermplan.setXnxq(xnxqNew);
- mybyThemeTermplan.setClassid(classId);
- mybyThemeTermplan.setStartmonth(null);
- mybyThemeTermplan.setEndmonth(null);
- list = byThemeTermplanService.selectByThemeTermplanList(mybyThemeTermplan);
- System.out.println(list + "学期列表");
- // 判断是否存在当前学期计划
- if (list != null && list.size() > 0) {
- return AjaxResult.error("当前学年学期计划已经存在,无法创建学期计划");
+ // 判断当前班级是否为托班
+ String bjtypeNew = byClassService.selectByClassById(classId).getBjtype();
+ if (bjtypeNew.equals("1")) {
+ 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() + "-主题整合学期计划");
+ ByThemeTermplan mybyThemeTermplan = new ByThemeTermplan();
+ String xnxqNew = null;
+ List list = null;
+ xnxqNew = byThemeTermplan.getXnxq();
+ mybyThemeTermplan.setXnxq(xnxqNew);
+ mybyThemeTermplan.setClassid(classId);
+ mybyThemeTermplan.setStartmonth(null);
+ mybyThemeTermplan.setEndmonth(null);
+ list = byThemeTermplanService.selectByThemeTermplanList(mybyThemeTermplan);
+ System.out.println(list + "学期列表");
+ // 判断是否存在当前学期计划
+ 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());
+ 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("当前用户非幼儿园教师,无法创建计划");
diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeWeekplanController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeWeekplanController.java
index f6fb7147f..9bc74d794 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeWeekplanController.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByThemeWeekplanController.java
@@ -115,74 +115,78 @@ public class ByThemeWeekplanController extends BaseController {
String classId = schoolCommon.getClassId();
//首先判断当前账户是否为幼儿园账号
if (schoolCommon.isSchool() && !schoolCommon.isStringEmpty(classId)) {
+ // 判断当前班级是否为托班
+ String bjtypeNew = byClassService.selectByClassById(classId).getBjtype();
+ if (bjtypeNew.equals("1")) {
+ return AjaxResult.error("当前班级为托班,无法创建计划");
+ }else {
+ //判断当前班级是否创建月计划
+ ByThemeMonthplan byThemeMonthplan = new ByThemeMonthplan();
+ byThemeMonthplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
+ byThemeMonthplan.setClassid(classId);
+ byThemeMonthplan.setXnxq(byThemeWeekplan.getXnxq());
+ byThemeMonthplan.setMonth(byThemeWeekplan.getMonth());
+ byThemeMonthplan.setStatus("2");
+ List list = byThemeMonthplanService.selectByThemeMonthplanList(byThemeMonthplan);
+ int iCount = 0;
+ if (list != null && list.size() > 0) {
+ //循环月计划,查找周详情
+ for (int i = 0; i < list.size(); i++) {
+ String mpid = list.get(i).getId();
+ ByThemeMonthplanitem byThemeMonthplanitem = new ByThemeMonthplanitem();
+ byThemeMonthplanitem.setMpid(mpid);
+ byThemeMonthplanitem.setZc(byThemeWeekplan.getZc());
- //判断当前班级是否创建月计划
- ByThemeMonthplan byThemeMonthplan = new ByThemeMonthplan();
- byThemeMonthplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
- byThemeMonthplan.setClassid(classId);
- byThemeMonthplan.setXnxq(byThemeWeekplan.getXnxq());
- byThemeMonthplan.setMonth(byThemeWeekplan.getMonth());
- byThemeMonthplan.setStatus("2");
- List list = byThemeMonthplanService.selectByThemeMonthplanList(byThemeMonthplan);
- int iCount = 0;
- if (list != null && list.size() > 0) {
- //循环月计划,查找周详情
- for (int i = 0; i < list.size(); i++) {
- String mpid = list.get(i).getId();
- ByThemeMonthplanitem byThemeMonthplanitem = new ByThemeMonthplanitem();
- byThemeMonthplanitem.setMpid(mpid);
- byThemeMonthplanitem.setZc(byThemeWeekplan.getZc());
-
- List listItem = byThemeonthplanitemService.selectByThemeMonthplanitemList(byThemeMonthplanitem);
- for (int j = 0; j < listItem.size(); j++) {
- iCount = iCount + (j + 1);
- }
- }
- } else {
- return AjaxResult.error("当前班级未制定月计划或月计划未审批,无法创建周计划");
- }
-
- if (iCount <= 0) {
- return AjaxResult.error("当前班级未设置月份明细计划,无法创建周计划");
- }
-
- String uuid = schoolCommon.getUuid();
- byThemeWeekplan.setId(uuid);
- byThemeWeekplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合周计划" + "(第" + byThemeWeekplan.getZc() + "周)");
- byThemeWeekplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
- byThemeWeekplan.setClassid(classId);
- byThemeWeekplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
-
- if (list != null && list.size() > 0) {
- //循环月计划,查找周详情
- for (int i = 0; i < list.size(); i++) {
- String mpid = list.get(i).getId();
- ByThemeMonthplanitem byThemeMonthplanitem = new ByThemeMonthplanitem();
- byThemeMonthplanitem.setMpid(mpid);
- byThemeMonthplanitem.setZc(byThemeWeekplan.getZc());
-
- List listItem = byThemeonthplanitemService.selectByThemeMonthplanitemList(byThemeMonthplanitem);
- for (int j = 0; j < listItem.size(); j++) {
- SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
- Date dtStart = listItem.get(j).getStarttime();
- Date dtEnd = listItem.get(j).getEndtime();
- long day = (dtEnd.getTime() - dtStart.getTime()) / (24 * 60 * 60 * 1000) + 1;
- System.out.println("day=" + day);
- ByThemeWeekplanitem byThemeWeekplanitem = null;
- for (int g = 0; g < day; g++) {
- byThemeWeekplanitem = new ByThemeWeekplanitem();
- byThemeWeekplanitem.setDaytime(schoolCommon.DateAddDays(g, listItem.get(j).getStarttime()));
- byThemeWeekplanitem.setZhou(Long.valueOf(schoolCommon.dateToWeek(byThemeWeekplanitem.getDaytime())));
- byThemeWeekplanitem.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
- byThemeWeekplanitem.setWpid(uuid);
- byThemeWeekplanitemService.insertByThemeWeekplanitem(byThemeWeekplanitem);
+ List listItem = byThemeonthplanitemService.selectByThemeMonthplanitemList(byThemeMonthplanitem);
+ for (int j = 0; j < listItem.size(); j++) {
+ iCount = iCount + (j + 1);
}
+ }
+ } else {
+ return AjaxResult.error("当前班级未制定月计划或月计划未审批,无法创建周计划");
+ }
+ if (iCount <= 0) {
+ return AjaxResult.error("当前班级未设置月份明细计划,无法创建周计划");
+ }
+
+ String uuid = schoolCommon.getUuid();
+ byThemeWeekplan.setId(uuid);
+ byThemeWeekplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合周计划" + "(第" + byThemeWeekplan.getZc() + "周)");
+ byThemeWeekplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
+ byThemeWeekplan.setClassid(classId);
+ byThemeWeekplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
+
+ if (list != null && list.size() > 0) {
+ //循环月计划,查找周详情
+ for (int i = 0; i < list.size(); i++) {
+ String mpid = list.get(i).getId();
+ ByThemeMonthplanitem byThemeMonthplanitem = new ByThemeMonthplanitem();
+ byThemeMonthplanitem.setMpid(mpid);
+ byThemeMonthplanitem.setZc(byThemeWeekplan.getZc());
+
+ List listItem = byThemeonthplanitemService.selectByThemeMonthplanitemList(byThemeMonthplanitem);
+ for (int j = 0; j < listItem.size(); j++) {
+ SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
+ Date dtStart = listItem.get(j).getStarttime();
+ Date dtEnd = listItem.get(j).getEndtime();
+ long day = (dtEnd.getTime() - dtStart.getTime()) / (24 * 60 * 60 * 1000) + 1;
+ System.out.println("day=" + day);
+ ByThemeWeekplanitem byThemeWeekplanitem = null;
+ for (int g = 0; g < day; g++) {
+ byThemeWeekplanitem = new ByThemeWeekplanitem();
+ byThemeWeekplanitem.setDaytime(schoolCommon.DateAddDays(g, listItem.get(j).getStarttime()));
+ byThemeWeekplanitem.setZhou(Long.valueOf(schoolCommon.dateToWeek(byThemeWeekplanitem.getDaytime())));
+ byThemeWeekplanitem.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
+ byThemeWeekplanitem.setWpid(uuid);
+ byThemeWeekplanitemService.insertByThemeWeekplanitem(byThemeWeekplanitem);
+ }
+
+ }
}
}
+ return toAjax(byThemeWeekplanService.insertByThemeWeekplan(byThemeWeekplan));
}
-
- return toAjax(byThemeWeekplanService.insertByThemeWeekplan(byThemeWeekplan));
} else {
return AjaxResult.error("当前用户非幼儿园教师,无法创建周计划");
}
diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java b/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java
index 1047a6923..ab60ff004 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/system/domain/BySchool.java
@@ -1,5 +1,6 @@
package com.ruoyi.project.system.domain;
+import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
@@ -130,6 +131,7 @@ public class BySchool extends BaseEntity
/** 开通截至日期 */
@Excel(name = "开通截至日期", width = 30, dateFormat = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd")
private Date openDeadline;
/** 当前学年 */