Browse Source

场景管理增加人口排序及使用人数字段

master
yanyan 3 years ago
parent
commit
e3fd5af91e
  1. 22
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/add.html
  2. 24
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/edit.html
  3. 5
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/manage.html
  4. 6
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneManageController.java
  5. 20
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneImportDataModel.java
  6. 149
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneManage.java
  7. 9
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneManageMapper.java
  8. 2
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneManageService.java
  9. 12
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneManageServiceImpl.java
  10. 23
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneManageMapper.xml

22
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/add.html

@ -7,40 +7,46 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manage-add"> <form class="form-horizontal m" id="form-manage-add">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">场景名称:</label> <label class="col-sm-3 control-label is-required">场景名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="name" class="form-control" type="text"> <input name="name" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">来源单位:</label> <label class="col-sm-3 control-label is-required">来源单位:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="sourceUnit" class="form-control" type="text"> <input name="sourceUnit" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">题目类型:</label> <label class="col-sm-3 control-label is-required">题目类型:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<!-- <select name="type" class="form-control m-b">--> <!-- <select name="type" class="form-control m-b">-->
<!-- <option value="1">文字型</option>--> <!-- <option value="1">文字型</option>-->
<!-- <option value="2">视频型</option>--> <!-- <option value="2">视频型</option>-->
<!-- <option value="3">图片型</option>--> <!-- <option value="3">图片型</option>-->
<!-- </select>--> <!-- </select>-->
<select name="type" class="form-control" th:with="type=${@dict.getType('scene_type')}"> <select name="type" class="form-control" th:with="type=${@dict.getType('scene_type')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option> th:value="${dict.dictValue}"></option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">是否公开:</label> <label class="col-sm-3 control-label is-required">是否公开:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="isOpen" class="form-control"> <select name="isOpen" class="form-control" required>
<option value="0">是</option> <option value="0">是</option>
<option value="1">否</option> <option value="1">否</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">入口排序:</label>
<div class="col-sm-8">
<input name="sort" class="form-control" type="text" required>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">演练背景:</label> <label class="col-sm-3 control-label">演练背景:</label>
<div class="col-sm-8"> <div class="col-sm-8">

24
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/edit.html

@ -34,18 +34,18 @@
<input name="sourceUnit" th:field="*{sourceUnit}" class="form-control" type="text"> <input name="sourceUnit" th:field="*{sourceUnit}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label">创建人:</label> <!-- <label class="col-sm-3 control-label">创建人:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="creator" th:field="*{creator}" class="form-control" type="text"> <!-- <input name="creator" th:field="*{creator}" class="form-control" type="text">-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label">创建时间:</label> <!-- <label class="col-sm-3 control-label">创建时间:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<input name="createTime" th:field="*{createTime}" class="form-control" type="text"> <!-- <input name="createTime" th:field="*{createTime}" class="form-control" type="text">-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">是否公开:</label> <label class="col-sm-3 control-label">是否公开:</label>
<div class="col-sm-8"> <div class="col-sm-8">

5
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/manage.html

@ -19,7 +19,10 @@
<input type="text" class="time-input" id="createTime" placeholder="年-月-日" <input type="text" class="time-input" id="createTime" placeholder="年-月-日"
name="createTime" data-format="yyyy-MM-dd HH:mm:ss" style="width: 200px;"/> name="createTime" data-format="yyyy-MM-dd HH:mm:ss" style="width: 200px;"/>
</li> </li>
<li>
<p>创建人:</p>
<input type="text" name="creator"/>
</li>
<li> <li>
<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> <a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a> <a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>

6
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneManageController.java

@ -2,7 +2,6 @@ package com.zdxt.knowledge.controller;
import com.zdxt.common.ZDResponse; import com.zdxt.common.ZDResponse;
import com.zdxt.common.controller.BaseController; import com.zdxt.common.controller.BaseController;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.TableDataInfo; import com.zdxt.common.util.TableDataInfo;
import com.zdxt.knowledge.domain.SceneImportDataModel; import com.zdxt.knowledge.domain.SceneImportDataModel;
import com.zdxt.knowledge.domain.SceneManage; import com.zdxt.knowledge.domain.SceneManage;
@ -20,7 +19,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
@ -114,8 +112,7 @@ public class SceneManageController extends BaseController {
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public ZDResponse remove(String ids) { public ZDResponse remove(String ids) {
return sceneManageService.deleteSceneManageByIds(ids) > 0 return sceneManageService.deleteSceneManageByIds(ids);
? ZDResponse.success() : ZDResponse.error("删除失败");
} }
/** /**
@ -149,6 +146,7 @@ public class SceneManageController extends BaseController {
dataModel.setType("文字"); dataModel.setType("文字");
dataModel.setSourceUnit("深圳消防"); dataModel.setSourceUnit("深圳消防");
dataModel.setIsOpen("是"); dataModel.setIsOpen("是");
dataModel.setSort(1);
dataModel.setSceneBackground("开展全员消防培训及演练活动,增强员工防火意识、提升火灾处理能力"); dataModel.setSceneBackground("开展全员消防培训及演练活动,增强员工防火意识、提升火灾处理能力");
dataModel.setDescribe("逐人过关熟悉掌握基本防火意识及注意事项;强化操练灭火器等消防装备器材的使用方法和操作"); dataModel.setDescribe("逐人过关熟悉掌握基本防火意识及注意事项;强化操练灭火器等消防装备器材的使用方法和操作");
return ExcelUtil.getExcelSimpleResponseEntity( return ExcelUtil.getExcelSimpleResponseEntity(

20
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneImportDataModel.java

@ -10,26 +10,38 @@ import lombok.Data;
@Data @Data
public class SceneImportDataModel { public class SceneImportDataModel {
/** 场景名称 */ /**
* 场景名称
*/
@ExcelProperty("场景名称") @ExcelProperty("场景名称")
@ColumnWidth(20) @ColumnWidth(20)
private String name; private String name;
/** 题目类型0:文字 1:图片 2:视频*/ /**
* 题目类型0:文字 1:图片 2:视频
*/
@ExcelProperty("题目类型(文字,图片,视频)") @ExcelProperty("题目类型(文字,图片,视频)")
@ColumnWidth(20) @ColumnWidth(20)
private String type; private String type;
/** 来源单位 */ /**
* 来源单位
*/
@ExcelProperty("来源单位") @ExcelProperty("来源单位")
@ColumnWidth(20) @ColumnWidth(20)
private String sourceUnit; private String sourceUnit;
/** 是否公开0是1否 */ /**
* 是否公开0是1否
*/
@ExcelProperty("是否公开") @ExcelProperty("是否公开")
@ColumnWidth(20) @ColumnWidth(20)
private String isOpen; private String isOpen;
@ExcelProperty("入口排序")
@ColumnWidth(20)
private Integer sort;
@ExcelProperty("演练背景") @ExcelProperty("演练背景")
@ColumnWidth(20) @ColumnWidth(20)
private String sceneBackground; private String sceneBackground;

149
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneManage.java

@ -16,152 +16,185 @@ import java.util.Map;
* @author ruoyi * @author ruoyi
* @date 2023-12-25 * @date 2023-12-25
*/ */
public class SceneManage implements Serializable public class SceneManage implements Serializable {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /**
* 主键
*/
private Long id; private Long id;
/** 场景名称 */ /**
* 场景名称
*/
@Excel(name = "场景名称") @Excel(name = "场景名称")
private String name; private String name;
/** 题目类型0:文字 1:图片 2:视频*/ /**
* 题目类型0:文字 1:图片 2:视频
*/
@Excel(name = "题目类型") @Excel(name = "题目类型")
private Integer type; private Integer type;
/** 二维码链接 */ /**
* 二维码链接
*/
@Excel(name = "二维码链接") @Excel(name = "二维码链接")
private String url; private String url;
/** 来源单位 */ /**
* 来源单位
*/
@Excel(name = "来源单位") @Excel(name = "来源单位")
private String sourceUnit; private String sourceUnit;
/** 是否公开0是1否 */ /**
* 是否公开0是1否
*/
@Excel(name = "是否公开0是1否") @Excel(name = "是否公开0是1否")
private Integer isOpen; private Integer isOpen;
/** 状态 1:上架中 2:上架 3:下架中 4:下架*/ /**
* 状态 1:上架中 2:上架 3:下架中 4:下架
*/
@Excel(name = "状态") @Excel(name = "状态")
private Integer status; private Integer status;
/** 是否删除0是1否 */ /**
* 是否删除0是1否
*/
@Excel(name = "是否删除0是1否") @Excel(name = "是否删除0是1否")
private Integer isDelete; private Integer isDelete;
/** 创建人 */ /**
* 创建人
*/
@Excel(name = "创建人") @Excel(name = "创建人")
private String creator; private String creator;
/**
* 演练背景
*/
@Excel(name = "演练背景") @Excel(name = "演练背景")
private String sceneBackground; private String sceneBackground;
/**
* 描述
*/
@Excel(name = "描述") @Excel(name = "描述")
private String describe; private String describe;
/** 创建时间 */ /**
* 排序
*/
@Excel(name = "排序")
private Integer sort;
/**
* 使用人数
*/
@Excel(name = "使用人数")
private Long useTotal;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
private Date createTimeEnd; private Date createTimeEnd;
/** 更新时间 */ /**
* 更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** 请求参数 */ /**
* 请求参数
*/
private Map<String, Object> params; private Map<String, Object> params;
public void setId(Long id) public void setId(Long id) {
{
this.id = id; this.id = id;
} }
public Long getId() public Long getId() {
{
return id; return id;
} }
public void setName(String name)
{ public void setName(String name) {
this.name = name; this.name = name;
} }
public String getName() public String getName() {
{
return name; return name;
} }
public void setType(Integer type)
{ public void setType(Integer type) {
this.type = type; this.type = type;
} }
public Integer getType() public Integer getType() {
{
return type; return type;
} }
public void setUrl(String url)
{ public void setUrl(String url) {
this.url = url; this.url = url;
} }
public String getUrl() public String getUrl() {
{
return url; return url;
} }
public void setSourceUnit(String sourceUnit)
{ public void setSourceUnit(String sourceUnit) {
this.sourceUnit = sourceUnit; this.sourceUnit = sourceUnit;
} }
public String getSourceUnit() public String getSourceUnit() {
{
return sourceUnit; return sourceUnit;
} }
public void setIsOpen(Integer isOpen)
{ public void setIsOpen(Integer isOpen) {
this.isOpen = isOpen; this.isOpen = isOpen;
} }
public Integer getIsOpen() public Integer getIsOpen() {
{
return isOpen; return isOpen;
} }
public void setStatus(Integer status)
{ public void setStatus(Integer status) {
this.status = status; this.status = status;
} }
public Integer getStatus() public Integer getStatus() {
{
return status; return status;
} }
public void setIsDelete(Integer isDelete)
{ public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete; this.isDelete = isDelete;
} }
public Integer getIsDelete() public Integer getIsDelete() {
{
return isDelete; return isDelete;
} }
public void setCreator(String creator)
{ public void setCreator(String creator) {
this.creator = creator; this.creator = creator;
} }
public String getCreator() public String getCreator() {
{
return creator; return creator;
} }
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public Date getUpdateTime() { public Date getUpdateTime() {
return updateTime; return updateTime;
} }
@ -217,4 +250,20 @@ public class SceneManage implements Serializable
public void setDescribe(String describe) { public void setDescribe(String describe) {
this.describe = describe; this.describe = describe;
} }
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Long getUseTotal() {
return useTotal;
}
public void setUseTotal(Long useTotal) {
this.useTotal = useTotal;
}
} }

9
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneManageMapper.java

@ -68,4 +68,13 @@ public interface SceneManageMapper
* @return 结果 * @return 结果
*/ */
public int deleteSceneManageByIds(String[] ids); public int deleteSceneManageByIds(String[] ids);
/**
* 批量查找【请填写功能名称】
*
* @param ids 需要查找的数据ID
* @return 结果
*/
public List<SceneManage> selectSceneManageByIds(String[] ids);
} }

2
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneManageService.java

@ -54,7 +54,7 @@ public interface ISceneManageService
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
public int deleteSceneManageByIds(String ids); public ZDResponse deleteSceneManageByIds(String ids);
/** /**
* 删除【请填写功能名称】信息 * 删除【请填写功能名称】信息

12
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneManageServiceImpl.java

@ -104,8 +104,16 @@ public class SceneManageServiceImpl implements ISceneManageService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSceneManageByIds(String ids) { public ZDResponse deleteSceneManageByIds(String ids) {
return sceneManageMapper.deleteSceneManageByIds(Convert.toStrArray(ids)); List<SceneManage> sceneManageList = sceneManageMapper.selectSceneManageByIds(Convert.toStrArray(ids));
if (CollectionUtils.isNotEmpty(sceneManageList)) {
long count = sceneManageList.stream().filter(item -> !Objects.equals(item.getStatus(), 4)).count();
if (count > 0) {
return ZDResponse.error("仅支持已下架的场景进行删除操作");
}
}
return sceneManageMapper.deleteSceneManageByIds(Convert.toStrArray(ids))> 0
? ZDResponse.success() : ZDResponse.error("删除失败");
} }
/** /**

23
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneManageMapper.xml

@ -17,10 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="sceneBackground" column="scene_background" /> <result property="sceneBackground" column="scene_background" />
<result property="describe" column="describe" /> <result property="describe" column="describe" />
<result property="sort" column="sort" />
<result property="useTotal" column="use_total" />
</resultMap> </resultMap>
<sql id="selectSceneManageVo"> <sql id="selectSceneManageVo">
select id, name, type, url, source_unit, is_open, status, is_delete, creator, create_time, scene_background, `describe` from scene_manage select id, name, type, url, source_unit, is_open, status, is_delete, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage
</sql> </sql>
<select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult"> <select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult">
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null ">create_time,</if> <if test="createTime != null ">create_time,</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background,</if> <if test="sceneBackground != null and sceneBackground != ''">scene_background,</if>
<if test="describe != null and describe != '' ">`describe`,</if> <if test="describe != null and describe != '' ">`describe`,</if>
<if test="sort != null and sort != '' ">`sort`,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null ">#{createTime},</if> <if test="createTime != null ">#{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">#{sceneBackground},</if> <if test="sceneBackground != null and sceneBackground != ''">#{sceneBackground},</if>
<if test="describe != null and describe != ''">#{describe},</if> <if test="describe != null and describe != ''">#{describe},</if>
<if test="sort != null and sort != ''">#{sort},</if>
</trim> </trim>
</insert> </insert>
@ -92,6 +96,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null ">create_time = #{createTime},</if> <if test="createTime != null ">create_time = #{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background = #{sceneBackground},</if> <if test="sceneBackground != null and sceneBackground != ''">scene_background = #{sceneBackground},</if>
<if test="describe != null and describe != ''">`describe` = #{describe},</if> <if test="describe != null and describe != ''">`describe` = #{describe},</if>
<if test="sort != null and sort != ''">`sort` = #{sort},</if>
<if test="useTotal != null and useTotal != ''">`use_total` = #{useTotal},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -107,11 +113,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</update> </update>
<select id="selectSceneManageByIds" parameterType="String" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/>
<where>
and is_delete = 1
and id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</where>
</select>
<insert id="batchInsertSceneManage"> <insert id="batchInsertSceneManage">
insert into scene_manage insert into scene_manage
(`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`) values (`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values
<foreach collection="sceneManageList" item="sceneObj" separator=","> <foreach collection="sceneManageList" item="sceneObj" separator=",">
(#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe}) (#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort})
</foreach> </foreach>
</insert> </insert>

Loading…
Cancel
Save