主题整合学期月计划

This commit is contained in:
paidaxing444
2020-08-25 16:02:51 +08:00
parent 8faf7c090a
commit ec500c38ef
8 changed files with 374 additions and 144 deletions

View File

@ -6,7 +6,12 @@ import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.benyi.domain.ByThemeTermplan;
import com.ruoyi.project.benyi.domain.ByThemeTermplanitem;
import com.ruoyi.project.benyi.service.IByThemeTermplanService;
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;
@ -39,6 +44,12 @@ public class ByThemeMonthplanController extends BaseController {
private IByThemeMonthplanService byThemeMonthplanService;
@Autowired
private SchoolCommon schoolCommon;
@Autowired
private IByClassService byClassService;
@Autowired
private IByThemeTermplanService byThemeTermplanService;
@Autowired
private IByThemeTermplanitemService byThemeTermplanitemService;
/**
* 查询主题整合月计划列表
@ -68,7 +79,7 @@ public class ByThemeMonthplanController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('benyi:thememonthplan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(byThemeMonthplanService.selectByThemeMonthplanById(id));
}
@ -79,28 +90,52 @@ public class ByThemeMonthplanController extends BaseController {
@Log(title = "主题整合月计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByThemeMonthplan byThemeMonthplan) {
String classId = schoolCommon.getClassId();
//首先判断当前账户是否为幼儿园账号
if (schoolCommon.isSchool()) {
if (schoolCommon.isSchool() && !schoolCommon.isStringEmpty(classId)) {
byThemeMonthplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
String dateTime = byThemeMonthplan.getMonth();
dateTime = dateTime .replace("Z", " UTC"); //2019-06-27T16:00:00.000 UTC
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");//转换时区格式
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM");
Date date = null;//将Z时间格式转换成Date类型格式或换成毫秒
try {
date = format1.parse(dateTime);
} catch (ParseException e) {
e.printStackTrace();
//根据当前月份 查找学期计划的主题
ByThemeTermplan byThemeTermplan = new ByThemeTermplan();
byThemeTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
byThemeTermplan.setClassid(classId);
byThemeTermplan.setStatus("1");
byThemeTermplan.setXnxq(byThemeMonthplan.getXnxq());
List<ByThemeTermplan> 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<ByThemeTermplanitem> listItem = byThemeTermplanitemService.selectByThemeTermplanitemList(byThemeTermplanitem);
if (listItem != null && listItem.size() > 0) {
for (int j = 0; j < list.size(); j++) {
String themeIds = listItem.get(j).getThemeconent();
if (!schoolCommon.isStringEmpty(themeIds)) {
strThemeIds = strThemeIds + themeIds;
}
}
}
}
} else {
return AjaxResult.error("当前班级未制定学期计划或学期计划未审批,无法创建月计划");
}
String time= format2.format(date);//2019-06
System.out.println(time);
byThemeMonthplan.setMonth(time);
byThemeMonthplan.setName(byThemeMonthplan.getName() + "-主题整合月计划(" + byThemeMonthplan.getMonth() + "");
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());
byThemeMonthplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合月计划");
return toAjax(byThemeMonthplanService.insertByThemeMonthplan(byThemeMonthplan));
} else {
return AjaxResult.error("当前用户非幼儿园,无法添加幼儿");
return AjaxResult.error("当前用户非幼儿园,无法创建月计划");
}
}
@ -120,7 +155,7 @@ public class ByThemeMonthplanController extends BaseController {
@PreAuthorize("@ss.hasPermi('benyi:thememonthplan:remove')")
@Log(title = "主题整合月计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(byThemeMonthplanService.deleteByThemeMonthplanByIds(ids));
}
}

View File

@ -1,5 +1,8 @@
package com.ruoyi.project.benyi.domain;
import java.util.Date;
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;
@ -9,7 +12,7 @@ import com.ruoyi.framework.web.domain.BaseEntity;
* 主题整合月计划对象 by_theme_monthplan
*
* @author tsbz
* @date 2020-08-17
* @date 2020-08-25
*/
public class ByThemeMonthplan extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -17,7 +20,7 @@ public class ByThemeMonthplan extends BaseEntity {
/**
* 编号
*/
private Long id;
private String id;
/**
* 计划名称
@ -25,6 +28,12 @@ public class ByThemeMonthplan extends BaseEntity {
@Excel(name = "计划名称")
private String name;
/**
* 所属学校
*/
@Excel(name = "所属学校")
private Long schoolid;
/**
* 所属班级
*/
@ -40,8 +49,9 @@ public class ByThemeMonthplan extends BaseEntity {
/**
* 计划月份
*/
@Excel(name = "计划月份")
private String month;
@JsonFormat(pattern = "yyyy-MM")
@Excel(name = "计划月份", width = 30, dateFormat = "yyyy-MM")
private Date month;
/**
* 本月主题
@ -55,6 +65,12 @@ public class ByThemeMonthplan extends BaseEntity {
@Excel(name = "本月自定义主题")
private String selfthemes;
/**
* 微型课程
*/
@Excel(name = "微型课程")
private String wxkc;
/**
* 家长支持
*/
@ -73,11 +89,36 @@ public class ByThemeMonthplan extends BaseEntity {
@Excel(name = "创建人")
private Long createuserid;
public void setId(Long id) {
/**
* 审批人
*/
@Excel(name = "审批人")
private Long spr;
/**
* 审批时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date sptime;
/**
* 审批意见
*/
@Excel(name = "审批意见")
private String spyj;
/**
* 当前状态
*/
@Excel(name = "当前状态")
private String status;
public void setId(String id) {
this.id = id;
}
public Long getId() {
public String getId() {
return id;
}
@ -89,6 +130,14 @@ public class ByThemeMonthplan extends BaseEntity {
return name;
}
public void setSchoolid(Long schoolid) {
this.schoolid = schoolid;
}
public Long getSchoolid() {
return schoolid;
}
public void setClassid(String classid) {
this.classid = classid;
}
@ -105,11 +154,11 @@ public class ByThemeMonthplan extends BaseEntity {
return xnxq;
}
public void setMonth(String month) {
public void setMonth(Date month) {
this.month = month;
}
public String getMonth() {
public Date getMonth() {
return month;
}
@ -129,6 +178,14 @@ public class ByThemeMonthplan extends BaseEntity {
return selfthemes;
}
public void setWxkc(String wxkc) {
this.wxkc = wxkc;
}
public String getWxkc() {
return wxkc;
}
public void setSupport(String support) {
this.support = support;
}
@ -153,20 +210,58 @@ public class ByThemeMonthplan extends BaseEntity {
return createuserid;
}
public void setSpr(Long spr) {
this.spr = spr;
}
public Long getSpr() {
return spr;
}
public void setSptime(Date sptime) {
this.sptime = sptime;
}
public Date getSptime() {
return sptime;
}
public void setSpyj(String spyj) {
this.spyj = spyj;
}
public String getSpyj() {
return spyj;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("schoolid", getSchoolid())
.append("classid", getClassid())
.append("xnxq", getXnxq())
.append("month", getMonth())
.append("themes", getThemes())
.append("selfthemes", getSelfthemes())
.append("wxkc", getWxkc())
.append("support", getSupport())
.append("remarks", getRemarks())
.append("createuserid", getCreateuserid())
.append("createTime", getCreateTime())
.append("spr", getSpr())
.append("sptime", getSptime())
.append("spyj", getSpyj())
.append("status", getStatus())
.toString();
}
}
}

View File

@ -8,7 +8,7 @@ import com.ruoyi.project.benyi.domain.ByThemeMonthplan;
* 主题整合月计划Mapper接口
*
* @author tsbz
* @date 2020-08-17
* @date 2020-08-25
*/
public interface ByThemeMonthplanMapper {
/**
@ -17,7 +17,7 @@ public interface ByThemeMonthplanMapper {
* @param id 主题整合月计划ID
* @return 主题整合月计划
*/
public ByThemeMonthplan selectByThemeMonthplanById(Long id);
public ByThemeMonthplan selectByThemeMonthplanById(String id);
/**
* 查询主题整合月计划列表
@ -49,7 +49,7 @@ public interface ByThemeMonthplanMapper {
* @param id 主题整合月计划ID
* @return 结果
*/
public int deleteByThemeMonthplanById(Long id);
public int deleteByThemeMonthplanById(String id);
/**
* 批量删除主题整合月计划
@ -57,5 +57,5 @@ public interface ByThemeMonthplanMapper {
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByThemeMonthplanByIds(Long[] ids);
}
public int deleteByThemeMonthplanByIds(String[] ids);
}

View File

@ -8,7 +8,7 @@ import com.ruoyi.project.benyi.domain.ByThemeMonthplan;
* 主题整合月计划Service接口
*
* @author tsbz
* @date 2020-08-17
* @date 2020-08-25
*/
public interface IByThemeMonthplanService {
/**
@ -17,7 +17,7 @@ public interface IByThemeMonthplanService {
* @param id 主题整合月计划ID
* @return 主题整合月计划
*/
public ByThemeMonthplan selectByThemeMonthplanById(Long id);
public ByThemeMonthplan selectByThemeMonthplanById(String id);
/**
* 查询主题整合月计划列表
@ -49,7 +49,7 @@ public interface IByThemeMonthplanService {
* @param ids 需要删除的主题整合月计划ID
* @return 结果
*/
public int deleteByThemeMonthplanByIds(Long[] ids);
public int deleteByThemeMonthplanByIds(String[] ids);
/**
* 删除主题整合月计划信息
@ -57,5 +57,5 @@ public interface IByThemeMonthplanService {
* @param id 主题整合月计划ID
* @return 结果
*/
public int deleteByThemeMonthplanById(Long id);
}
public int deleteByThemeMonthplanById(String id);
}

View File

@ -13,7 +13,7 @@ import com.ruoyi.project.benyi.service.IByThemeMonthplanService;
* 主题整合月计划Service业务层处理
*
* @author tsbz
* @date 2020-08-17
* @date 2020-08-25
*/
@Service
public class ByThemeMonthplanServiceImpl implements IByThemeMonthplanService {
@ -27,7 +27,7 @@ public class ByThemeMonthplanServiceImpl implements IByThemeMonthplanService {
* @return 主题整合月计划
*/
@Override
public ByThemeMonthplan selectByThemeMonthplanById(Long id) {
public ByThemeMonthplan selectByThemeMonthplanById(String id) {
return byThemeMonthplanMapper.selectByThemeMonthplanById(id);
}
@ -72,7 +72,7 @@ public class ByThemeMonthplanServiceImpl implements IByThemeMonthplanService {
* @return 结果
*/
@Override
public int deleteByThemeMonthplanByIds(Long[] ids) {
public int deleteByThemeMonthplanByIds(String[] ids) {
return byThemeMonthplanMapper.deleteByThemeMonthplanByIds(ids);
}
@ -83,7 +83,7 @@ public class ByThemeMonthplanServiceImpl implements IByThemeMonthplanService {
* @return 结果
*/
@Override
public int deleteByThemeMonthplanById(Long id) {
public int deleteByThemeMonthplanById(String id) {
return byThemeMonthplanMapper.deleteByThemeMonthplanById(id);
}
}
}

View File

@ -5,68 +5,94 @@
<mapper namespace="com.ruoyi.project.benyi.mapper.ByThemeMonthplanMapper">
<resultMap type="ByThemeMonthplan" id="ByThemeMonthplanResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="classid" column="classid"/>
<result property="xnxq" column="xnxq"/>
<result property="month" column="month"/>
<result property="themes" column="themes"/>
<result property="selfthemes" column="selfthemes"/>
<result property="support" column="support"/>
<result property="remarks" column="remarks"/>
<result property="createuserid" column="createuserid"/>
<result property="createTime" column="create_time"/>
<result property="id" column="id" />
<result property="name" column="name" />
<result property="schoolid" column="schoolid" />
<result property="classid" column="classid" />
<result property="xnxq" column="xnxq" />
<result property="month" column="month" />
<result property="themes" column="themes" />
<result property="selfthemes" column="selfthemes" />
<result property="wxkc" column="wxkc" />
<result property="support" column="support" />
<result property="remarks" column="remarks" />
<result property="createuserid" column="createuserid" />
<result property="createTime" column="create_time" />
<result property="spr" column="spr" />
<result property="sptime" column="sptime" />
<result property="spyj" column="spyj" />
<result property="status" column="status" />
</resultMap>
<sql id="selectByThemeMonthplanVo">
select id, name, classid, xnxq, month, themes, selfthemes, support, remarks, createuserid, create_time from by_theme_monthplan
select id, name, schoolid, classid, xnxq, month, themes, selfthemes, wxkc, support, remarks, createuserid, create_time, spr, sptime, spyj, status from by_theme_monthplan
</sql>
<select id="selectByThemeMonthplanList" parameterType="ByThemeMonthplan" resultMap="ByThemeMonthplanResult">
<include refid="selectByThemeMonthplanVo"/>
<where>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="classid != null and classid != ''">and classid = #{classid}</if>
<if test="xnxq != null and xnxq != ''">and xnxq = #{xnxq}</if>
<if test="month != null and month != ''">and month = #{month}</if>
<if test="themes != null and themes != ''">and themes = #{themes}</if>
<if test="selfthemes != null and selfthemes != ''">and selfthemes = #{selfthemes}</if>
<if test="support != null and support != ''">and support = #{support}</if>
<if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="schoolid != null "> and schoolid = #{schoolid}</if>
<if test="classid != null and classid != ''"> and classid = #{classid}</if>
<if test="xnxq != null and xnxq != ''"> and xnxq = #{xnxq}</if>
<if test="month != null "> and month = #{month}</if>
<if test="themes != null and themes != ''"> and themes = #{themes}</if>
<if test="selfthemes != null and selfthemes != ''"> and selfthemes = #{selfthemes}</if>
<if test="wxkc != null and wxkc != ''"> and wxkc = #{wxkc}</if>
<if test="support != null and support != ''"> and support = #{support}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="spr != null "> and spr = #{spr}</if>
<if test="sptime != null "> and sptime = #{sptime}</if>
<if test="spyj != null and spyj != ''"> and spyj = #{spyj}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectByThemeMonthplanById" parameterType="Long" resultMap="ByThemeMonthplanResult">
<select id="selectByThemeMonthplanById" parameterType="String" resultMap="ByThemeMonthplanResult">
<include refid="selectByThemeMonthplanVo"/>
where id = #{id}
</select>
<insert id="insertByThemeMonthplan" parameterType="ByThemeMonthplan" useGeneratedKeys="true" keyProperty="id">
<insert id="insertByThemeMonthplan" parameterType="ByThemeMonthplan">
insert into by_theme_monthplan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="schoolid != null ">schoolid,</if>
<if test="classid != null and classid != ''">classid,</if>
<if test="xnxq != null and xnxq != ''">xnxq,</if>
<if test="month != null and month != ''">month,</if>
<if test="month != null ">month,</if>
<if test="themes != null and themes != ''">themes,</if>
<if test="selfthemes != null and selfthemes != ''">selfthemes,</if>
<if test="wxkc != null and wxkc != ''">wxkc,</if>
<if test="support != null and support != ''">support,</if>
<if test="remarks != null and remarks != ''">remarks,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="createTime != null ">create_time,</if>
<if test="spr != null ">spr,</if>
<if test="sptime != null ">sptime,</if>
<if test="spyj != null and spyj != ''">spyj,</if>
<if test="status != null and status != ''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="schoolid != null ">#{schoolid},</if>
<if test="classid != null and classid != ''">#{classid},</if>
<if test="xnxq != null and xnxq != ''">#{xnxq},</if>
<if test="month != null and month != ''">#{month},</if>
<if test="month != null ">#{month},</if>
<if test="themes != null and themes != ''">#{themes},</if>
<if test="selfthemes != null and selfthemes != ''">#{selfthemes},</if>
<if test="wxkc != null and wxkc != ''">#{wxkc},</if>
<if test="support != null and support != ''">#{support},</if>
<if test="remarks != null and remarks != ''">#{remarks},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="spr != null ">#{spr},</if>
<if test="sptime != null ">#{sptime},</if>
<if test="spyj != null and spyj != ''">#{spyj},</if>
<if test="status != null and status != ''">#{status},</if>
</trim>
</insert>
@ -74,20 +100,26 @@
update by_theme_monthplan
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="schoolid != null ">schoolid = #{schoolid},</if>
<if test="classid != null and classid != ''">classid = #{classid},</if>
<if test="xnxq != null and xnxq != ''">xnxq = #{xnxq},</if>
<if test="month != null and month != ''">month = #{month},</if>
<if test="month != null ">month = #{month},</if>
<if test="themes != null and themes != ''">themes = #{themes},</if>
<if test="selfthemes != null and selfthemes != ''">selfthemes = #{selfthemes},</if>
<if test="wxkc != null and wxkc != ''">wxkc = #{wxkc},</if>
<if test="support != null and support != ''">support = #{support},</if>
<if test="remarks != null and remarks != ''">remarks = #{remarks},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="spr != null ">spr = #{spr},</if>
<if test="sptime != null ">sptime = #{sptime},</if>
<if test="spyj != null and spyj != ''">spyj = #{spyj},</if>
<if test="status != null and status != ''">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteByThemeMonthplanById" parameterType="Long">
<delete id="deleteByThemeMonthplanById" parameterType="String">
delete from by_theme_monthplan where id = #{id}
</delete>