diff --git a/ruoyi-ui/src/views/benyi/schoolcharge/index.vue b/ruoyi-ui/src/views/benyi/schoolcharge/index.vue index 04d81855d..4c23be7b0 100644 --- a/ruoyi-ui/src/views/benyi/schoolcharge/index.vue +++ b/ruoyi-ui/src/views/benyi/schoolcharge/index.vue @@ -46,6 +46,8 @@ <el-table-column label="伙食费(小班)/天" align="center" prop="hsfX" /> <el-table-column label="保育费(托班)/月" align="center" prop="byfT" /> <el-table-column label="伙食费(托班)/天" align="center" prop="hsfT" /> + <el-table-column label="开始时间" align="center" prop="startTime" /> + <el-table-column label="截止时间" align="center" prop="endtime" /> <el-table-column label="操作" align="center" @@ -141,6 +143,18 @@ placeholder="请输入伙食费" /> </el-form-item> + <el-form-item label="起止时间" prop="startTime"> + <el-date-picker + clearable + class="my-date-picker" + v-model="form.startTime" + type="daterange" + value-format="yyyy-MM-dd" + range-separator="-" + start-placeholder="开始日期" + end-placeholder="结束日期" + ></el-date-picker> + </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitForm">确 定</el-button> @@ -191,7 +205,11 @@ export default { // 表单参数 form: {}, // 表单校验 - rules: {}, + rules: { + startTime: [ + { required: true, message: "起止时间不能为空", trigger: "blur" }, + ], + }, }; }, created() { @@ -227,6 +245,8 @@ export default { hsfT: undefined, createUserid: undefined, createTime: undefined, + startTime: undefined, + endtime: undefined, }; this.resetForm("form"); }, @@ -244,8 +264,16 @@ export default { this.title = "添加园所收费标准"; } else { const id = row.id || this.ids; + var myArray = new Array(2); getSchoolcharge(id).then((response) => { this.form = response.data; + //console.log(response.data); + if (response.data.endtime != null) { + myArray[0] = response.data.startTime; + myArray[1] = response.data.endtime; + this.form.startTime = myArray; + } + this.open = true; this.title = "设置园所收费标准"; }); @@ -255,6 +283,10 @@ export default { submitForm: function () { this.$refs["form"].validate((valid) => { if (valid) { + var v1 = this.form.startTime[0]; + var v2 = this.form.startTime[1]; + this.form.startTime = v1; + this.form.endtime = v2; if (this.form.id != undefined) { updateSchoolcharge(this.form).then((response) => { if (response.code === 200) { @@ -302,4 +334,8 @@ export default { margin: 0 auto; } } +.my-date-picker { + width: 100%; +} </style> + diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolchargeController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolchargeController.java index 6e696c4c4..56ab2a47c 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolchargeController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolchargeController.java @@ -51,14 +51,24 @@ public class BySchoolchargeController extends BaseController { @PreAuthorize("@ss.hasPermi('benyi:schoolcharge:list')") @GetMapping("/child/list") public TableDataInfo childlist(BySchoolcharge bySchoolcharge) { - startPage(); - List<BySchoolcharge> list = bySchoolchargeService.selectByChildchargeList(bySchoolcharge); - if (list != null && list.size() > 0) { - for (int i = 0; i < list.size(); i++) { - list.get(i).setZj(getZongji(list.get(i))); + System.out.println("month---" + bySchoolcharge.getMonth()); + bySchoolcharge.setMonthday(bySchoolcharge.getMonth() + "-15"); + List<BySchoolcharge> listScope = bySchoolchargeService.selectByChildchargeListByMonth(bySchoolcharge); + if (listScope != null && listScope.size() > 0) { + bySchoolcharge.setId(listScope.get(0).getId()); + startPage(); + List<BySchoolcharge> list = bySchoolchargeService.selectByChildchargeList(bySchoolcharge); + if (list != null && list.size() > 0) { + for (int i = 0; i < list.size(); i++) { + list.get(i).setZj(getZongji(list.get(i))); + } } + return getDataTable(list); + } else { + bySchoolcharge.setId(Long.valueOf(0)); + List<BySchoolcharge> list = bySchoolchargeService.selectByChildchargeList(bySchoolcharge); + return getDataTable(list); } - return getDataTable(list); } //根据每条幼儿统计数计算总费用 @@ -154,7 +164,23 @@ public class BySchoolchargeController extends BaseController { @Log(title = "园所收费标准", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody BySchoolcharge bySchoolcharge) { - return toAjax(bySchoolchargeService.updateBySchoolcharge(bySchoolcharge)); + int iCount = 0; + BySchoolcharge bySchoolchargeNew = bySchoolchargeService.selectBySchoolchargeById(bySchoolcharge.getId()); + if (bySchoolcharge.getStartTime().equals(bySchoolchargeNew.getStartTime())) { + if (bySchoolcharge.getEndtime().equals(bySchoolchargeNew.getEndtime())) { + iCount = iCount + bySchoolchargeService.updateBySchoolcharge(bySchoolcharge); + } else { + bySchoolchargeNew.setIsdel("1"); + iCount = iCount + bySchoolchargeService.updateBySchoolcharge(bySchoolchargeNew); + iCount = iCount + bySchoolchargeService.insertBySchoolcharge(bySchoolcharge); + } + } else { + bySchoolchargeNew.setIsdel("1"); + iCount = iCount + bySchoolchargeService.updateBySchoolcharge(bySchoolchargeNew); + iCount = iCount + bySchoolchargeService.insertBySchoolcharge(bySchoolcharge); + } + + return toAjax(iCount); } /** diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcharge.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcharge.java index 83eeb3f66..af208ea4f 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcharge.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolcharge.java @@ -1,11 +1,14 @@ package com.ruoyi.project.benyi.domain; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.project.system.domain.SysDept; 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_schoolcharge * @@ -80,10 +83,58 @@ public class BySchoolcharge extends BaseEntity { @Excel(name = "伙食费中班") private Double hsfZ; + /** + * 起止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date startTime; + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndtime() { + return endtime; + } + + public void setEndtime(Date endtime) { + this.endtime = endtime; + } + + /** + * 起止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date endtime; + + public String getIsdel() { + return isdel; + } + + public void setIsdel(String isdel) { + this.isdel = isdel; + } + + private String isdel; + private SysDept dept; // 幼儿考勤系统属性 private String month; + + public String getMonthday() { + return monthday; + } + + public void setMonthday(String monthday) { + this.monthday = monthday; + } + + private String monthday; private String name; private String classid; private Long days; @@ -256,6 +307,10 @@ public class BySchoolcharge extends BaseEntity { .append("bjtype", getBjtype()) .append("days", getDays()) .append("zj", getZj()) + .append("startTime",getStartTime()) + .append("endtime",getEndtime()) + .append("isdel",getIsdel()) + .append("monthday",getMonthday()) .toString(); } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolchargeMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolchargeMapper.java index 94d65d50b..22f9d0c6c 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolchargeMapper.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolchargeMapper.java @@ -35,6 +35,14 @@ public interface BySchoolchargeMapper { */ public List<BySchoolcharge> selectByChildchargeList(BySchoolcharge bySchoolcharge); + /** + * 查询幼儿收费列表 + * + * @param bySchoolcharge 收费标准 + * @return 幼儿收费集合 + */ + public List<BySchoolcharge> selectByChildchargeListByMonth(BySchoolcharge bySchoolcharge); + /** * 新增园所收费标准 * diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolchargeService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolchargeService.java index ba3d9654c..e2174534e 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolchargeService.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolchargeService.java @@ -35,6 +35,15 @@ public interface IBySchoolchargeService { */ public List<BySchoolcharge> selectByChildchargeList(BySchoolcharge bySchoolcharge); + /** + * 查询幼儿收费列表 + * + * @param bySchoolcharge 收费标准 + * @return 幼儿收费集合 + */ + public List<BySchoolcharge> selectByChildchargeListByMonth(BySchoolcharge bySchoolcharge); + + /** * 新增园所收费标准 * diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolchargeServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolchargeServiceImpl.java index 1245e9119..133e6d25f 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolchargeServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolchargeServiceImpl.java @@ -52,10 +52,22 @@ public class BySchoolchargeServiceImpl implements IBySchoolchargeService { */ @Override @DataScope(deptAlias = "b") - public List<BySchoolcharge> selectByChildchargeList(BySchoolcharge bySchoolcharge){ + public List<BySchoolcharge> selectByChildchargeList(BySchoolcharge bySchoolcharge) { return bySchoolchargeMapper.selectByChildchargeList(bySchoolcharge); } + /** + * 查询幼儿收费列表 + * + * @param bySchoolcharge 收费标准 + * @return 幼儿收费集合 + */ + @Override + @DataScope(deptAlias = "b") + public List<BySchoolcharge> selectByChildchargeListByMonth(BySchoolcharge bySchoolcharge) { + return bySchoolchargeMapper.selectByChildchargeListByMonth(bySchoolcharge); + } + /** * 新增园所收费标准 * diff --git a/ruoyi/src/main/resources/mybatis/benyi/BySchoolchargeMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/BySchoolchargeMapper.xml index 18f4df10d..a4c9f8992 100644 --- a/ruoyi/src/main/resources/mybatis/benyi/BySchoolchargeMapper.xml +++ b/ruoyi/src/main/resources/mybatis/benyi/BySchoolchargeMapper.xml @@ -17,7 +17,11 @@ <result property="hsfT" column="hsf_t"/> <result property="byfZ" column="byf_z"/> <result property="hsfZ" column="hsf_z"/> + <result property="startTime" column="start_time"/> + <result property="endtime" column="endtime"/> + <result property="isdel" column="isdel"/> <result property="month" column="month"/> + <result property="monthday" column="monthday"/> <result property="name" column="name"/> <result property="classid" column="classid"/> <result property="days" column="days"/> @@ -35,13 +39,13 @@ </resultMap> <sql id="selectBySchoolchargeVo"> - select a.id, a.dept_id, a.byf, a.hsf, a.create_userid, a.create_time,a.byf_x, a.hsf_x, a.byf_t, a.hsf_t, a.byf_z, a.hsf_z,b.dept_name from by_schoolcharge a + select a.id, a.dept_id, a.byf, a.hsf, a.create_userid, a.create_time,a.byf_x, a.hsf_x, a.byf_t, a.hsf_t, a.byf_z, a.hsf_z,a.start_time,a.endtime,a.isdel,b.dept_name from by_schoolcharge a right join sys_dept b on a.dept_id=b.dept_id </sql> <select id="selectBySchoolchargeList" parameterType="BySchoolcharge" resultMap="BySchoolchargeResult"> <include refid="selectBySchoolchargeVo"/> - where school_id is not null and del_flag=0 + where school_id is not null and del_flag=0 and isdel=0 <if test="byf != null ">and byf = #{byf}</if> <if test="hsf != null ">and hsf = #{hsf}</if> <if test="createUserid != null ">and create_userid = #{createUserid}</if> @@ -49,6 +53,19 @@ ${dataScope} </select> + <select id="selectByChildchargeListByMonth" parameterType="BySchoolcharge" resultMap="BySchoolchargeResult"> + <include refid="selectBySchoolchargeVo"/> + where school_id is not null and del_flag=0 + <if test="monthday != null and monthday != ''"><!-- 开始时间检索 --> + AND date_format(start_time,'%y%m%d') <= date_format(#{monthday},'%y%m%d') + </if> + <if test="monthday != null and monthday != ''"><!-- 结束时间检索 --> + AND date_format(endtime,'%y%m%d') >= date_format(#{monthday},'%y%m%d') + </if> + <!-- 数据范围过滤 --> + ${dataScope} + </select> + <select id="selectByChildchargeList" parameterType="BySchoolcharge" resultMap="BySchoolchargeResult"> select a.name,a.classid, c.bjtype, @@ -59,7 +76,7 @@ from by_child a left join by_class c on a.classid=c.bjbh left join by_schoolcharge b on a.schoolid=b.dept_id - where c.bjbh = #{classid} + where c.bjbh = #{classid} and b.id=#{id} <!-- 数据范围过滤 --> ${dataScope} </select> @@ -83,6 +100,9 @@ <if test="hsfT != null ">hsf_t,</if> <if test="byfZ != null and byfZ != ''">byf_z,</if> <if test="hsfZ != null ">hsf_z,</if> + <if test="startTime != null ">start_time,</if> + <if test="endtime != null ">endtime,</if> + <if test="isdel != null and isdel != ''">isdel,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="deptId != null ">#{deptId},</if> @@ -96,6 +116,9 @@ <if test="hsfT != null ">#{hsfT},</if> <if test="byfZ != null and byfZ != ''">#{byfZ},</if> <if test="hsfZ != null ">#{hsfZ},</if> + <if test="startTime != null ">#{startTime},</if> + <if test="endtime != null ">#{endtime},</if> + <if test="isdel != null and isdel != ''">#{isdel},</if> </trim> </insert> @@ -113,6 +136,9 @@ <if test="hsfT != null ">hsf_t = #{hsfT},</if> <if test="byfZ != null and byfZ != ''">byf_z = #{byfZ},</if> <if test="hsfZ != null ">hsf_z = #{hsfZ},</if> + <if test="startTime != null ">start_time = #{startTime},</if> + <if test="endtime != null ">endtime = #{endtime},</if> + <if test="isdel != null and isdel != ''">isdel = #{isdel},</if> </trim> where id = #{id} </update>