diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 2c0d2641f..c896188ae 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -17,6 +17,28 @@ + + + + + + @@ -27,13 +49,21 @@ import BarChart from "./dashboard/BarChart"; export default { name: "Index", + name: "calendar", components: { RaddarChart, PieChart, BarChart }, data() { - return {}; + return {calendarData: [ + { months: ['09', '11'],days: ['15'],things: '看电影' }, + { months: ['10', '11'], days: ['02'],things: '去公园野炊' }, + { months: ['11'], days: ['02'],things: '看星星' }, + { months: ['11'], days: ['02'],things: '看月亮' } + ], + value: new Date() + }; }, methods: {} }; diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java new file mode 100644 index 000000000..76d2a7070 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java @@ -0,0 +1,122 @@ +package com.ruoyi.project.benyi.controller; + +import java.util.Date; +import java.util.List; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.project.common.SchoolCommon; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.project.benyi.domain.BySchoolcalendar; +import com.ruoyi.project.benyi.service.IBySchoolcalendarService; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.page.TableDataInfo; + +/** + * 园历管理Controller + * + * @author tsbz + * @date 2020-04-20 + */ +@RestController +@RequestMapping("/benyi/schoolcalendar") +public class BySchoolcalendarController extends BaseController { + @Autowired + private IBySchoolcalendarService bySchoolcalendarService; + @Autowired + private SchoolCommon schoolCommon; + + /** + * 查询园历管理列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:list')") + @GetMapping("/list") + public TableDataInfo list(BySchoolcalendar bySchoolcalendar) { + startPage(); + List list = bySchoolcalendarService.selectBySchoolcalendarList(bySchoolcalendar); + return getDataTable(list); + } + + /** + * 导出园历管理列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:export')") + @Log(title = "园历管理", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(BySchoolcalendar bySchoolcalendar) { + List list = bySchoolcalendarService.selectBySchoolcalendarList(bySchoolcalendar); + ExcelUtil util = new ExcelUtil(BySchoolcalendar.class); + return util.exportExcel(list, "schoolcalendar"); + } + + /** + * 获取园历管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(bySchoolcalendarService.selectBySchoolcalendarById(id)); + } + + /** + * 新增园历管理 + */ + @PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:add')") + @Log(title = "园历管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BySchoolcalendar bySchoolcalendar) { + //首先判断 当前用户是否为学校 + if (schoolCommon.isSchool()) { + bySchoolcalendar.setCreatetime(new Date()); + String strXnxq = schoolCommon.getCurrentXnXq(bySchoolcalendar.getActivitytime()); + bySchoolcalendar.setXnxq(strXnxq); + bySchoolcalendar.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + bySchoolcalendar.setDeptid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId()); + return toAjax(bySchoolcalendarService.insertBySchoolcalendar(bySchoolcalendar)); + } else { + return AjaxResult.error("当前用户非幼儿园,无法创建园历"); + } + } + + /** + * 修改园历管理 + */ + @PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:edit')") + @Log(title = "园历管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BySchoolcalendar bySchoolcalendar) { + //首先判断 当前用户是否为学校 + if (schoolCommon.isSchool()) { + return toAjax(bySchoolcalendarService.updateBySchoolcalendar(bySchoolcalendar)); + } else { + return AjaxResult.error("当前用户非幼儿园,无法编辑园历"); + } + } + + /** + * 删除园历管理 + */ + @PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:remove')") + @Log(title = "园历管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + //首先判断 当前用户是否为学校 + if (schoolCommon.isSchool()) { + return toAjax(bySchoolcalendarService.deleteBySchoolcalendarByIds(ids)); + } else { + return AjaxResult.error("当前用户非幼儿园,无法删除园历"); + } + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcalendar.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcalendar.java new file mode 100644 index 000000000..2ee6f58f0 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcalendar.java @@ -0,0 +1,151 @@ +package com.ruoyi.project.benyi.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; +import com.ruoyi.framework.web.domain.BaseEntity; +import java.util.Date; + +/** + * 园历管理对象 by_schoolcalendar + * + * @author tsbz + * @date 2020-04-20 + */ +public class BySchoolcalendar extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 标识 */ + private Long id; + + /** 名称 */ + @Excel(name = "名称") + private String name; + + /** 活动类型 */ + @Excel(name = "活动类型") + private String type; + + /** 适用范围:大班、中班、小班、全园 */ + @Excel(name = "适用范围:大班、中班、小班、全园") + private String scope; + + /** 学年学期 */ + @Excel(name = "学年学期") + private String xnxq; + + /** 所属学校 */ + @Excel(name = "所属学校") + private Long deptid; + + /** 活动时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date activitytime; + + /** 创建人 */ + @Excel(name = "创建人") + private Long createuserid; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createtime; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setScope(String scope) + { + this.scope = scope; + } + + public String getScope() + { + return scope; + } + public void setXnxq(String xnxq) + { + this.xnxq = xnxq; + } + + public String getXnxq() + { + return xnxq; + } + public void setDeptid(Long deptid) + { + this.deptid = deptid; + } + + public Long getDeptid() + { + return deptid; + } + public void setActivitytime(Date activitytime) + { + this.activitytime = activitytime; + } + + public Date getActivitytime() + { + return activitytime; + } + public void setCreateuserid(Long createuserid) + { + this.createuserid = createuserid; + } + + public Long getCreateuserid() + { + return createuserid; + } + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getCreatetime() { + return createtime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .append("type", getType()) + .append("scope", getScope()) + .append("xnxq", getXnxq()) + .append("deptid", getDeptid()) + .append("activitytime", getActivitytime()) + .append("createuserid", getCreateuserid()) + .append("createtime", getCreatetime()) + .toString(); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolcalendarMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolcalendarMapper.java new file mode 100644 index 000000000..b40670df8 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolcalendarMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.mapper; + +import java.util.List; +import com.ruoyi.project.benyi.domain.BySchoolcalendar; + +/** + * 园历管理Mapper接口 + * + * @author tsbz + * @date 2020-04-20 + */ +public interface BySchoolcalendarMapper +{ + /** + * 查询园历管理 + * + * @param id 园历管理ID + * @return 园历管理 + */ + public BySchoolcalendar selectBySchoolcalendarById(Long id); + + /** + * 查询园历管理列表 + * + * @param bySchoolcalendar 园历管理 + * @return 园历管理集合 + */ + public List selectBySchoolcalendarList(BySchoolcalendar bySchoolcalendar); + + /** + * 新增园历管理 + * + * @param bySchoolcalendar 园历管理 + * @return 结果 + */ + public int insertBySchoolcalendar(BySchoolcalendar bySchoolcalendar); + + /** + * 修改园历管理 + * + * @param bySchoolcalendar 园历管理 + * @return 结果 + */ + public int updateBySchoolcalendar(BySchoolcalendar bySchoolcalendar); + + /** + * 删除园历管理 + * + * @param id 园历管理ID + * @return 结果 + */ + public int deleteBySchoolcalendarById(Long id); + + /** + * 批量删除园历管理 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteBySchoolcalendarByIds(Long[] ids); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolcalendarService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolcalendarService.java new file mode 100644 index 000000000..6eabedec7 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolcalendarService.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.service; + +import java.util.List; +import com.ruoyi.project.benyi.domain.BySchoolcalendar; + +/** + * 园历管理Service接口 + * + * @author tsbz + * @date 2020-04-20 + */ +public interface IBySchoolcalendarService +{ + /** + * 查询园历管理 + * + * @param id 园历管理ID + * @return 园历管理 + */ + public BySchoolcalendar selectBySchoolcalendarById(Long id); + + /** + * 查询园历管理列表 + * + * @param bySchoolcalendar 园历管理 + * @return 园历管理集合 + */ + public List selectBySchoolcalendarList(BySchoolcalendar bySchoolcalendar); + + /** + * 新增园历管理 + * + * @param bySchoolcalendar 园历管理 + * @return 结果 + */ + public int insertBySchoolcalendar(BySchoolcalendar bySchoolcalendar); + + /** + * 修改园历管理 + * + * @param bySchoolcalendar 园历管理 + * @return 结果 + */ + public int updateBySchoolcalendar(BySchoolcalendar bySchoolcalendar); + + /** + * 批量删除园历管理 + * + * @param ids 需要删除的园历管理ID + * @return 结果 + */ + public int deleteBySchoolcalendarByIds(Long[] ids); + + /** + * 删除园历管理信息 + * + * @param id 园历管理ID + * @return 结果 + */ + public int deleteBySchoolcalendarById(Long id); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolcalendarServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolcalendarServiceImpl.java new file mode 100644 index 000000000..ab1430817 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolcalendarServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.project.benyi.service.impl; + +import java.util.List; + +import com.ruoyi.framework.aspectj.lang.annotation.DataScope; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.project.benyi.mapper.BySchoolcalendarMapper; +import com.ruoyi.project.benyi.domain.BySchoolcalendar; +import com.ruoyi.project.benyi.service.IBySchoolcalendarService; + +/** + * 园历管理Service业务层处理 + * + * @author tsbz + * @date 2020-04-20 + */ +@Service +public class BySchoolcalendarServiceImpl implements IBySchoolcalendarService +{ + @Autowired + private BySchoolcalendarMapper bySchoolcalendarMapper; + + /** + * 查询园历管理 + * + * @param id 园历管理ID + * @return 园历管理 + */ + @Override + public BySchoolcalendar selectBySchoolcalendarById(Long id) + { + return bySchoolcalendarMapper.selectBySchoolcalendarById(id); + } + + /** + * 查询园历管理列表 + * + * @param bySchoolcalendar 园历管理 + * @return 园历管理 + */ + @Override + @DataScope(deptAlias = "d") + public List selectBySchoolcalendarList(BySchoolcalendar bySchoolcalendar) + { + return bySchoolcalendarMapper.selectBySchoolcalendarList(bySchoolcalendar); + } + + /** + * 新增园历管理 + * + * @param bySchoolcalendar 园历管理 + * @return 结果 + */ + @Override + public int insertBySchoolcalendar(BySchoolcalendar bySchoolcalendar) + { + return bySchoolcalendarMapper.insertBySchoolcalendar(bySchoolcalendar); + } + + /** + * 修改园历管理 + * + * @param bySchoolcalendar 园历管理 + * @return 结果 + */ + @Override + public int updateBySchoolcalendar(BySchoolcalendar bySchoolcalendar) + { + return bySchoolcalendarMapper.updateBySchoolcalendar(bySchoolcalendar); + } + + /** + * 批量删除园历管理 + * + * @param ids 需要删除的园历管理ID + * @return 结果 + */ + @Override + public int deleteBySchoolcalendarByIds(Long[] ids) + { + return bySchoolcalendarMapper.deleteBySchoolcalendarByIds(ids); + } + + /** + * 删除园历管理信息 + * + * @param id 园历管理ID + * @return 结果 + */ + @Override + public int deleteBySchoolcalendarById(Long id) + { + return bySchoolcalendarMapper.deleteBySchoolcalendarById(id); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/common/SchoolCommon.java b/ruoyi/src/main/java/com/ruoyi/project/common/SchoolCommon.java index 0a4d3241f..e039d8152 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/common/SchoolCommon.java +++ b/ruoyi/src/main/java/com/ruoyi/project/common/SchoolCommon.java @@ -6,10 +6,12 @@ import com.ruoyi.project.system.domain.BySchool; import com.ruoyi.project.system.domain.SysDept; import com.ruoyi.project.system.service.IBySchoolService; import com.ruoyi.project.system.service.ISysDeptService; +import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RestController; import java.util.Calendar; +import java.util.Date; import java.util.List; @RestController @@ -83,9 +85,28 @@ public class SchoolCommon { String strNxNq = ""; if (iMonth < 9) { - strNxNq = (iYear - 1) + "-" + iYear + "2"; + strNxNq = (iYear - 1) + "" + iYear + "2"; } else { - strNxNq = iYear + "-" + (iYear + 1) + "1"; + strNxNq = iYear + "" + (iYear + 1) + "1"; + } + return strNxNq; + + } + + //根据时间 生成学年学期 + public String getCurrentXnXq(Date date) { + String year=String.format("%tY", date); + Integer iYear = Integer.parseInt(year); + System.out.println("当前年======:" + iYear); + String mon=String.format("%tm", date); + Integer iMonth = Integer.parseInt(mon); + System.out.println("当前月======:" + iMonth); + String strNxNq = ""; + + if (iMonth < 9) { + strNxNq = (iYear - 1) + "" + iYear + "2"; + } else { + strNxNq = iYear + "" + (iYear + 1) + "1"; } return strNxNq; diff --git a/ruoyi/src/main/resources/mybatis/benyi/BySchoolcalendarMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/BySchoolcalendarMapper.xml new file mode 100644 index 000000000..51fee344c --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/benyi/BySchoolcalendarMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + select id, name, type, scope, xnxq, dept_id, activitytime, createuserid, createtime from by_schoolcalendar d + + + + + + + + insert into by_schoolcalendar + + name, + type, + scope, + xnxq, + dept_id, + activitytime, + createuserid, + createtime, + + + #{name}, + #{type}, + #{scope}, + #{xnxq}, + #{deptid}, + #{activitytime}, + #{createuserid}, + #{createtime}, + + + + + update by_schoolcalendar + + name = #{name}, + type = #{type}, + scope = #{scope}, + xnxq = #{xnxq}, + dept_id = #{deptid}, + activitytime = #{activitytime}, + createuserid = #{createuserid}, + createtime = #{createtime}, + + where id = #{id} + + + + delete from by_schoolcalendar where id = #{id} + + + + delete from by_schoolcalendar where id in + + #{id} + + + + \ No newline at end of file