主题整合学期计划

This commit is contained in:
paidaxing444
2020-08-24 17:59:49 +08:00
parent 90b454d7af
commit fd6616a29a
10 changed files with 242 additions and 216 deletions

View File

@ -1,6 +1,16 @@
package com.ruoyi.project.benyi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
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.service.IByClassService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -28,31 +38,34 @@ import com.ruoyi.framework.web.page.TableDataInfo;
*/
@RestController
@RequestMapping("/benyi/themetermplan")
public class ByThemeTermplanController extends BaseController
{
public class ByThemeTermplanController extends BaseController {
@Autowired
private IByThemeTermplanService byThemeTermplanService;
@Autowired
private SchoolCommon schoolCommon;
@Autowired
private IByClassService byClassService;
@Autowired
private IByThemeTermplanitemService byThemeTermplanitemService;
/**
* 查询主题整合学期计划列表
*/
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:list')")
@GetMapping("/list")
public TableDataInfo list(ByThemeTermplan byThemeTermplan)
{
/**
* 查询主题整合学期计划列表
*/
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:list')")
@GetMapping("/list")
public TableDataInfo list(ByThemeTermplan byThemeTermplan) {
startPage();
List<ByThemeTermplan> list = byThemeTermplanService.selectByThemeTermplanList(byThemeTermplan);
return getDataTable(list);
}
/**
* 导出主题整合学期计划列表
*/
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:export')")
@Log(title = "主题整合学期计划", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ByThemeTermplan byThemeTermplan)
{
public AjaxResult export(ByThemeTermplan byThemeTermplan) {
List<ByThemeTermplan> list = byThemeTermplanService.selectByThemeTermplanList(byThemeTermplan);
ExcelUtil<ByThemeTermplan> util = new ExcelUtil<ByThemeTermplan>(ByThemeTermplan.class);
return util.exportExcel(list, "themetermplan");
@ -63,8 +76,7 @@ public class ByThemeTermplanController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(byThemeTermplanService.selectByThemeTermplanById(id));
}
@ -74,9 +86,41 @@ public class ByThemeTermplanController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:add')")
@Log(title = "主题整合学期计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByThemeTermplan byThemeTermplan)
{
return toAjax(byThemeTermplanService.insertByThemeTermplan(byThemeTermplan));
public AjaxResult add(@RequestBody ByThemeTermplan byThemeTermplan) {
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());
//月份加1
Calendar calendar = Calendar.getInstance();
calendar.setTime(byThemeTermplan.getStartmonth());
calendar.add(Calendar.MONTH, i);
byThemeTermplanitem.setMonth(calendar.getTime());
//创建时间
byThemeTermplanitem.setCreateTime(new Date());
//新增每月计划
byThemeTermplanitemService.insertByThemeTermplanitem(byThemeTermplanitem);
}
return toAjax(byThemeTermplanService.insertByThemeTermplan(byThemeTermplan));
} else {
return AjaxResult.error("当前用户非幼儿园,无法添加幼儿");
}
}
/**
@ -85,8 +129,7 @@ public class ByThemeTermplanController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:edit')")
@Log(title = "主题整合学期计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ByThemeTermplan byThemeTermplan)
{
public AjaxResult edit(@RequestBody ByThemeTermplan byThemeTermplan) {
return toAjax(byThemeTermplanService.updateByThemeTermplan(byThemeTermplan));
}
@ -96,8 +139,7 @@ public class ByThemeTermplanController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:themetermplan:remove')")
@Log(title = "主题整合学期计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(byThemeTermplanService.deleteByThemeTermplanByIds(ids));
}
}

View File

@ -43,15 +43,15 @@ public class ByThemeTermplan extends BaseEntity {
/**
* 月份
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "月份", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM")
@Excel(name = "月份", width = 30, dateFormat = "yyyy-MM")
private Date startmonth;
/**
* 结束月份
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束月份", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM")
@Excel(name = "结束月份", width = 30, dateFormat = "yyyy-MM")
private Date endmonth;
/**
@ -85,6 +85,12 @@ public class ByThemeTermplan extends BaseEntity {
@Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date sptime;
/**
* 审核意见
*/
@Excel(name = "审核意见")
private String shyj;
public void setId(String id) {
this.id = id;
}
@ -173,6 +179,14 @@ public class ByThemeTermplan extends BaseEntity {
return sptime;
}
public void setShyj(String shyj) {
this.shyj = shyj;
}
public String getShyj() {
return shyj;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -189,6 +203,7 @@ public class ByThemeTermplan extends BaseEntity {
.append("status", getStatus())
.append("spr", getSpr())
.append("sptime", getSptime())
.append("shyj", getShyj())
.toString();
}
}

View File

@ -28,6 +28,13 @@ public class ByThemeTermplanitem extends BaseEntity {
@Excel(name = "所属计划")
private String tpid;
/**
* 月份
*/
@JsonFormat(pattern = "yyyy-MM")
@Excel(name = "月份", width = 30, dateFormat = "yyyy-MM")
private Date month;
/**
* 主题内容
*/
@ -40,13 +47,6 @@ public class ByThemeTermplanitem extends BaseEntity {
@Excel(name = "创建人")
private Long createuserid;
/**
* $column.columnComment
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建人", width = 30, dateFormat = "yyyy-MM-dd")
private Date 创建时间;
/**
* 修改人
*/
@ -69,6 +69,14 @@ public class ByThemeTermplanitem extends BaseEntity {
return tpid;
}
public void setMonth(Date month) {
this.month = month;
}
public Date getMonth() {
return month;
}
public void setThemeconent(String themeconent) {
this.themeconent = themeconent;
}
@ -85,14 +93,6 @@ public class ByThemeTermplanitem extends BaseEntity {
return createuserid;
}
public void set创建时间(Date 创建时间) {
this.创建时间 = 创建时间;
}
public Date get创建时间() {
return 创建时间;
}
public void setUpdateuserid(Long updateuserid) {
this.updateuserid = updateuserid;
}
@ -106,12 +106,13 @@ public class ByThemeTermplanitem extends BaseEntity {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tpid", getTpid())
.append("month", getMonth())
.append("themeconent", getThemeconent())
.append("remark", getRemark())
.append("createuserid", getCreateuserid())
.append("创建时间", get创建时间())
.append("createTime", getCreateTime())
.append("updateuserid", getUpdateuserid())
.append("updateTime", getUpdateTime())
.toString();
}
}
}

View File

@ -14,10 +14,10 @@ public interface ByThemeTermplanMapper {
/**
* 查询主题整合学期计划
*
* @param id 主题整合学期计划ID
* @param id 主题整合学期计划IDdeleteByThemeTermplanByIds
* @return 主题整合学期计划
*/
public ByThemeTermplan selectByThemeTermplanById(Long id);
public ByThemeTermplan selectByThemeTermplanById(String id);
/**
* 查询主题整合学期计划列表
@ -49,7 +49,7 @@ public interface ByThemeTermplanMapper {
* @param id 主题整合学期计划ID
* @return 结果
*/
public int deleteByThemeTermplanById(Long id);
public int deleteByThemeTermplanById(String id);
/**
* 批量删除主题整合学期计划
@ -57,5 +57,5 @@ public interface ByThemeTermplanMapper {
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByThemeTermplanByIds(Long[] ids);
public int deleteByThemeTermplanByIds(String[] ids);
}

View File

@ -17,7 +17,7 @@ public interface IByThemeTermplanService {
* @param id 主题整合学期计划ID
* @return 主题整合学期计划
*/
public ByThemeTermplan selectByThemeTermplanById(Long id);
public ByThemeTermplan selectByThemeTermplanById(String id);
/**
* 查询主题整合学期计划列表
@ -49,7 +49,7 @@ public interface IByThemeTermplanService {
* @param ids 需要删除的主题整合学期计划ID
* @return 结果
*/
public int deleteByThemeTermplanByIds(Long[] ids);
public int deleteByThemeTermplanByIds(String[] ids);
/**
* 删除主题整合学期计划信息
@ -57,5 +57,5 @@ public interface IByThemeTermplanService {
* @param id 主题整合学期计划ID
* @return 结果
*/
public int deleteByThemeTermplanById(Long id);
public int deleteByThemeTermplanById(String id);
}

View File

@ -27,7 +27,7 @@ public class ByThemeTermplanServiceImpl implements IByThemeTermplanService {
* @return 主题整合学期计划
*/
@Override
public ByThemeTermplan selectByThemeTermplanById(Long id) {
public ByThemeTermplan selectByThemeTermplanById(String id) {
return byThemeTermplanMapper.selectByThemeTermplanById(id);
}
@ -72,7 +72,7 @@ public class ByThemeTermplanServiceImpl implements IByThemeTermplanService {
* @return 结果
*/
@Override
public int deleteByThemeTermplanByIds(Long[] ids) {
public int deleteByThemeTermplanByIds(String[] ids) {
return byThemeTermplanMapper.deleteByThemeTermplanByIds(ids);
}
@ -83,7 +83,7 @@ public class ByThemeTermplanServiceImpl implements IByThemeTermplanService {
* @return 结果
*/
@Override
public int deleteByThemeTermplanById(Long id) {
public int deleteByThemeTermplanById(String id) {
return byThemeTermplanMapper.deleteByThemeTermplanById(id);
}
}

View File

@ -109,8 +109,8 @@ public class SchoolCommon {
byClass.setZljs(sysUser.getUserId());
//新的返回byclassNew返回整条数据
ByClass byClassNew = byClassService.selectByClassByUserId(byClass);
System.out.println("--------------------"+ byClassNew);
if(byClassNew != null) {
System.out.println("--------------------" + byClassNew);
if (byClassNew != null) {
//如果实体byclassnew不为空,那么取出它的班级编号
return byClassNew.getBjbh();
} else {
@ -137,10 +137,10 @@ public class SchoolCommon {
//根据时间 生成学年学期
public String getCurrentXnXq(Date date) {
String year=String.format("%tY", date);
String year = String.format("%tY", date);
Integer iYear = Integer.parseInt(year);
System.out.println("当前年======:" + iYear);
String mon=String.format("%tm", date);
String mon = String.format("%tm", date);
Integer iMonth = Integer.parseInt(mon);
System.out.println("当前月======:" + iMonth);
String strNxNq = "";
@ -155,7 +155,7 @@ public class SchoolCommon {
}
public String getCurrentXn() {
return getCurrentXnXq().substring(0,9);
return getCurrentXnXq().substring(0, 9);
}
public String getCurrentYear() {
@ -173,7 +173,18 @@ public class SchoolCommon {
}
// 生成UUID
public String getUuid(){
return UUID.randomUUID().toString().replace("-","");
public String getUuid() {
return UUID.randomUUID().toString().replace("-", "");
}
//日期相减 获取月份
public Integer getDifMonth(Date startDate, Date endDate) {
Calendar start = Calendar.getInstance();
Calendar end = Calendar.getInstance();
start.setTime(startDate);
end.setTime(endDate);
int result = end.get(Calendar.MONTH) - start.get(Calendar.MONTH);
int month = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * 12;
return Math.abs(month + result);
}
}

View File

@ -18,10 +18,11 @@
<result property="status" column="status"/>
<result property="spr" column="spr"/>
<result property="sptime" column="sptime"/>
<result property="shyj" column="shyj"/>
</resultMap>
<sql id="selectByThemeTermplanVo">
select id, schoolid, classid, name, startmonth, endmonth, xnxq, remark, createuserid, create_time, status, spr, sptime from by_theme_termplan
select id, schoolid, classid, name, startmonth, endmonth, xnxq, remark, createuserid, create_time, status, spr, sptime, shyj from by_theme_termplan
</sql>
<select id="selectByThemeTermplanList" parameterType="ByThemeTermplan" resultMap="ByThemeTermplanResult">
@ -37,6 +38,7 @@
<if test="status != null and status != ''">and status = #{status}</if>
<if test="spr != null ">and spr = #{spr}</if>
<if test="sptime != null ">and sptime = #{sptime}</if>
<if test="shyj != null and shyj != ''">and shyj = #{shyj}</if>
</where>
</select>
@ -61,6 +63,7 @@
<if test="status != null and status != ''">status,</if>
<if test="spr != null ">spr,</if>
<if test="sptime != null ">sptime,</if>
<if test="shyj != null and shyj != ''">shyj,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
@ -76,6 +79,7 @@
<if test="status != null and status != ''">#{status},</if>
<if test="spr != null ">#{spr},</if>
<if test="sptime != null ">#{sptime},</if>
<if test="shyj != null and shyj != ''">#{shyj},</if>
</trim>
</insert>
@ -94,6 +98,7 @@
<if test="status != null and status != ''">status = #{status},</if>
<if test="spr != null ">spr = #{spr},</if>
<if test="sptime != null ">sptime = #{sptime},</if>
<if test="shyj != null and shyj != ''">shyj = #{shyj},</if>
</trim>
where id = #{id}
</update>

View File

@ -5,30 +5,31 @@
<mapper namespace="com.ruoyi.project.benyi.mapper.ByThemeTermplanitemMapper">
<resultMap type="ByThemeTermplanitem" id="ByThemeTermplanitemResult">
<result property="id" column="id"/>
<result property="tpid" column="tpid"/>
<result property="themeconent" column="themeconent"/>
<result property="remark" column="remark"/>
<result property="createuserid" column="createuserid"/>
<result property="创建时间" column="创建时间"/>
<result property="updateuserid" column="updateuserid"/>
<result property="updateTime" column="update_time"/>
<result property="id" column="id" />
<result property="tpid" column="tpid" />
<result property="month" column="month" />
<result property="themeconent" column="themeconent" />
<result property="remark" column="remark" />
<result property="createuserid" column="createuserid" />
<result property="createTime" column="create_time" />
<result property="updateuserid" column="updateuserid" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectByThemeTermplanitemVo">
select id, tpid, themeconent, remark, createuserid, 创建时间, updateuserid, update_time from by_theme_termplanitem
select id, tpid, month, themeconent, remark, createuserid, create_time, updateuserid, update_time from by_theme_termplanitem
</sql>
<select id="selectByThemeTermplanitemList" parameterType="ByThemeTermplanitem"
resultMap="ByThemeTermplanitemResult">
<select id="selectByThemeTermplanitemList" parameterType="ByThemeTermplanitem" resultMap="ByThemeTermplanitemResult">
<include refid="selectByThemeTermplanitemVo"/>
<where>
<if test="tpid != null and tpid != ''">and tpid = #{tpid}</if>
<if test="themeconent != null and themeconent != ''">and themeconent = #{themeconent}</if>
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
<if test="创建时间 != null ">and 创建时间 = #{创建时间}</if>
<if test="updateuserid != null ">and updateuserid = #{updateuserid}</if>
<if test="tpid != null and tpid != ''"> and tpid = #{tpid}</if>
<if test="month != null "> and month = #{month}</if>
<if test="themeconent != null and themeconent != ''"> and themeconent = #{themeconent}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="updateuserid != null "> and updateuserid = #{updateuserid}</if>
</where>
order by month
</select>
<select id="selectByThemeTermplanitemById" parameterType="Long" resultMap="ByThemeTermplanitemResult">
@ -40,19 +41,21 @@
insert into by_theme_termplanitem
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tpid != null and tpid != ''">tpid,</if>
<if test="month != null ">month,</if>
<if test="themeconent != null and themeconent != ''">themeconent,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="创建时间 != null ">创建时间,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateuserid != null ">updateuserid,</if>
<if test="updateTime != null ">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tpid != null and tpid != ''">#{tpid},</if>
<if test="month != null ">#{month},</if>
<if test="themeconent != null and themeconent != ''">#{themeconent},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="创建时间 != null ">#{创建时间},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateuserid != null ">#{updateuserid},</if>
<if test="updateTime != null ">#{updateTime},</if>
</trim>
@ -62,10 +65,11 @@
update by_theme_termplanitem
<trim prefix="SET" suffixOverrides=",">
<if test="tpid != null and tpid != ''">tpid = #{tpid},</if>
<if test="month != null ">month = #{month},</if>
<if test="themeconent != null and themeconent != ''">themeconent = #{themeconent},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="创建时间 != null ">创建时间 = #{创建时间},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateuserid != null ">updateuserid = #{updateuserid},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>