Browse Source

场景管理顺序上移,字段修改

master
yanyan 3 years ago
parent
commit
0e2d399bca
  1. 137
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/add.html
  2. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/bind.html
  3. 102
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/detail.html
  4. 129
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/edit.html
  5. 24
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/view.html
  6. 6
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/add.html
  7. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/detail.html
  8. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/edit.html
  9. 34
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/manage.html
  10. 24
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneManageController.java
  11. 32
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneQuestionController.java
  12. 21
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneImportDataModel.java
  13. 41
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneManage.java
  14. 45
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneQuestion.java
  15. 31
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneManageMapper.java
  16. 12
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneQuestionMapper.java
  17. 20
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneManageService.java
  18. 12
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/ISceneQuestionService.java
  19. 50
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneManageServiceImpl.java
  20. 22
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneQuestionServiceImpl.java
  21. 55
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneManageMapper.xml
  22. 40
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneQuestionMapper.xml

137
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/add.html

@ -6,16 +6,16 @@
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" enctype="multipart/form-data" id="form-question-add" type="text/template">
<form class="form-horizontal m" enctype="multipart/form-data" id="form-question-add" type="text/template">
<input name="parentId" type="text" hidden>
<div class="form-group" id="textTitle" hidden>
<label class="col-sm-3 control-label">题目:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group" id="fileTitle" hidden>
<label class="col-sm-3 control-label">题目:</label>
<!-- <div class="form-group" id="textTitle" hidden>-->
<!-- <label class="col-sm-3 control-label">题目:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="name" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label is-required">题目:</label>
<div id="fileIn" class="col-sm-8">
<div class="file-loading">
<input id="fileInput" name="file" type="file" multiple>
@ -23,7 +23,52 @@
</div>
</div>
<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">
<input class="form-control" type="text" name="answer" id="answer" placeholder="多选以逗号分隔" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">选项:</label>
<div class="col-sm-8">
<table id="tab11" style="display: none">
<tbody>
<tr>
<td height="30" align="center"><input type="text" name="NO" size="2" value="1"
style="text-align: center;" disabled/></td>
<td width="30" align="center"><input type="text" name="identify" value="A"
style="width: 30px; text-align: center;"/></td>
<td align="center"><input type="text" name="qContent" style="width: 100%;"/></td>
<td><input type="button" id="Button1" onClick="deltr(this)" value="删行"></td>
</tr>
</tbody>
</table>
<input type="button" id="btn_addtr" value="增行">
<table id="dynamicTable" width="500" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td height="30" align="center" bgcolor="#CCCCCC">ID</td>
<td width="30" align="center" bgcolor="#CCCCCC">标识</td>
<td align="center" bgcolor="#CCCCCC">内容</td>
<td width="30" align="center" bgcolor="#CCCCCC">操作</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td height="30" align="center"><input type="text" name="NO" size="2" value="1"
style="text-align: center;" disabled/></td>
<td width="30" align="center"><input type="text" name="identify" value="A"
style="width: 30px; text-align: center;"/></td>
<td align="center"><input type="text" name="qContent" style="width: 100%;"/></td>
<td><input type="button" id="Button2" onClick="deltr(this)" value="删行"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">状态:</label>
<div class="col-sm-8">
<select name="status" class="form-control">
<option value="0">有效</option>
@ -53,16 +98,16 @@
focusCleanup: true
});
$(function() {
$(function () {
// 渲染文件要素信息
renderVersionAtt();
})
if (type === 0) {
$("#textTitle").show();
} else {
$("#fileTitle").show();
}
// if (type === 0) {
// $("#textTitle").show();
// } else {
// $("#fileTitle").show();
// }
function submitHandler() {
if ($.validate.form()) {
@ -85,7 +130,7 @@
/** 上传附件 */
function uploadFiles() {
var filePreview = { fileList: null, previewRespDTOS: null }
var filePreview = {fileList: null, previewRespDTOS: null}
initFile("fileInput", prefix + "/add", filePreview);
}
@ -116,13 +161,25 @@
formData = decodeURIComponent(formData, true);
var arr = formData.split("&");
var data = {};
for (var i=0; i<arr.length; i++) {
for (var i = 0; i < arr.length; i++) {
var item = arr[i].split('=');
var value = item[1].replace("+", " ");
data[item[0]] = value;
}
var parentId = [[${parentId}]];
data.parentId = parentId;
//选项
var optionList = new Array();
var j = 0;
$('input[name="identify"]').each(function () {
if (j !== 0) {
let option = {}
option.identify = $(this).val();
option.content = $(this).parent().next().children().val();
optionList.push(option);
}
j++;
});
data.option = JSON.stringify(optionList);
data.parentId = [[${parentId}]];
return data;
},
// showBrowse: false,
@ -190,6 +247,46 @@
$.modal.close();
parent.$.table.refresh();
}
/** 动态表格 */
$(function () {
var show_count = 8; //要显示的条数
var count = 1; //递增的开始值,这里是你的ID
$("#btn_addtr").click(function () {
var length = $("#dynamicTable tbody tr").length;
//alert(length);
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件
{
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行
changeIndex();//更新行号
}
});
});
function changeIndex() {
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
var i = 1;
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr
// console.log(i)
$(this).find("input[name='NO']").val(i);//更新行号
$(this).find("input[name='identify']").val(c[i]);//更新标号
i++;
});
}
function deltr(opp) {
var length = $("#dynamicTable tbody tr").length;
//alert(length);
if (length <= 1) {
alert("至少保留一行");
} else {
$(opp).parent().parent().remove();//移除当前行
changeIndex();
}
}
</script>
</body>
</html>

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/bind.html

@ -7,7 +7,7 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-question-bind" th:object="${sceneQuestion}">
<h2 th:text="*{name}" style="margin-bottom: 30px;"></h2>
<input name="id" th:field="*{id}" type="hidden">
<input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group">
<div class="col-sm-6">
<input name="answer" class="form-control" type="text" placeholder="A...">

102
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/detail.html

@ -12,14 +12,14 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-question-detail" th:object="${sceneQuestion}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group" id="textTitle" hidden>
<label class="col-sm-3 control-label">题目:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group" id="fileTitle" hidden>
<input name="guid" th:field="*{guid}" type="hidden">
<!-- <div class="form-group" id="textTitle" hidden>-->
<!-- <label class="col-sm-3 control-label">题目:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="name" th:field="*{name}" class="form-control" type="text" readonly>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">题目:</label>
<div id="fileIn" class="col-sm-8" readonly>
<div class="file-loading">
@ -32,6 +32,29 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">答案:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="answer" id="answer" th:field="*{answer}" disabled required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">选项:</label>
<div class="col-sm-8">
<table id="dynamicTable" width="500" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td height="30" align="center" bgcolor="#CCCCCC">ID</td>
<td width="30" align="center" bgcolor="#CCCCCC">标识</td>
<td align="center" bgcolor="#CCCCCC">内容</td>
<td></td>
</tr>
</thead>
<tbody id="answerTrFlag">
</tbody>
</table>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
@ -71,11 +94,11 @@
var prefix = ctx + "project/question";
var sceneObj = [[${sceneQuestion}]];
if (sceneObj.name == null || sceneObj.name === "") {
$("#fileTitle").show();
} else {
$("#textTitle").show();
}
// if (sceneObj.name == null || sceneObj.name === "") {
// $("#fileTitle").show();
// } else {
// $("#textTitle").show();
// }
$(function () {
// 渲染文件要素信息
@ -87,7 +110,7 @@
/** 渲染附件信息 */
function renderVersionAtt() {
var key = $("[name='id']").val();
var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) {
@ -235,6 +258,57 @@
// $.modal.closeLoading();
// $.modal.msgReload(result.message, modal_status.SUCCESS);
}
/** 动态表格 */
$(function () {
var sceneQuestion = [[${sceneQuestion}]]
var answers = JSON.parse(sceneQuestion.option);
var html;
for (var i=0; i<answers.length; i++) {
var answer = answers[i];
html += '<tr>';
html += '<td height="30" align="center"><input type="text" name="NO" size="2" value="'+(i+1)+'" style="text-align: center;" disabled /></td>';
html += '<td width="30" align="center"><input type="text" name="identify" value="'+answer.identify+'" style="width: 30px; text-align: center;" disabled/></td>';
html += '<td align="center"><input type="text" name="qContent" value="'+answer.content+'" style="width: 100%;" disabled/></td>';
html += '</tr>';
}
$("#answerTrFlag").html(html);
var show_count = 8; //要显示的条数
var count = 1; //递增的开始值,这里是你的ID
$("#btn_addtr").click(function () {
var length = $("#dynamicTable tbody tr").length;
//alert(length);
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件
{
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行
changeIndex();//更新行号
}
});
});
function changeIndex() {
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
var i = 1;
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr
// console.log(i)
$(this).find("input[name='NO']").val(i);//更新行号
$(this).find("input[name='code']").val(c[i]);//更新标号
i++;
});
}
function deltr(opp) {
var length = $("#dynamicTable tbody tr").length;
//alert(length);
if (length <= 1) {
alert("至少保留一行");
} else {
$(opp).parent().parent().remove();//移除当前行
changeIndex();
}
}
</script>
</body>
</html>

129
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/edit.html

@ -7,14 +7,14 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-question-edit" th:object="${sceneQuestion}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group" id="textTitle" hidden>
<label class="col-sm-3 control-label">题目名称:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group" id="fileTitle" hidden>
<input name="guid" th:field="*{guid}" type="hidden">
<!-- <div class="form-group" id="textTitle" hidden>-->
<!-- <label class="col-sm-3 control-label">题目名称:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="name" th:field="*{name}" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group" id="fileTitle">
<label class="col-sm-3 control-label">题目:</label>
<div id="fileIn" class="col-sm-8">
<div class="file-loading">
@ -27,6 +27,47 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">答案:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="answer" id="answer" th:field="*{answer}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">选项:</label>
<div class="col-sm-8">
<table id="tab11" style="display: none">
<tbody>
<tr>
<td height="30" align="center"><input type="text" name="NO" size="2" value="1" style="text-align: center;" disabled /></td>
<td width="30" align="center"><input type="text" name="identify" value="A" style="width: 30px; text-align: center;"/></td>
<td align="center"><input type="text" name="qContent" style="width: 100%;" /></td>
<td><input type="button" id="Button1" onClick="deltr(this)" value="删行"></td>
</tr>
</tbody>
</table>
<input type="button" id="btn_addtr" value="增行">
<table id="dynamicTable" width="500" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td height="30" align="center" bgcolor="#CCCCCC">ID</td>
<td width="30" align="center" bgcolor="#CCCCCC">标识</td>
<td align="center" bgcolor="#CCCCCC">内容</td>
<td width="30" align="center" bgcolor="#CCCCCC">操作</td>
<td></td>
</tr>
</thead>
<tbody id="answerTrFlag">
<tr>
<td height="30" align="center"><input type="text" name="NO" size="2" value="1" style="text-align: center;" disabled /></td>
<td width="30" align="center"><input type="text" name="identify" value="A" style="width: 30px; text-align: center;"/></td>
<td align="center"><input type="text" name="qContent" style="width: 100%;" /></td>
<td><input type="button" id="Button2" onClick="deltr(this)" value="删行"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
@ -61,13 +102,13 @@
})
if (type === 0) {
$("#textTitle").show();
//$("#textTitle").show();
} else if (type === 1) {
$("#fileWarn").html("提示:请导入图片格式文件!");
$("#fileTitle").show();
//$("#fileTitle").show();
} else if (type === 2) {
$("#fileWarn").html("提示:请导入视频格式文件!");
$("#fileTitle").show();
//$("#fileTitle").show();
}
function submitHandler() {
@ -81,7 +122,7 @@
/** 渲染附件信息 */
function renderVersionAtt() {
var key = $("[name='id']").val();
var key = $("[name='guid']").val();
$.getJSON(prefix + "/queryFiles/" + key, function (result) {
if (result.data != null) {
@ -157,6 +198,19 @@
var value = item[1].replace("+", " ");
data[item[0]] = value;
}
//选项
var optionList = new Array();
var j = 0;
$('input[name="identify"]').each(function () {
if (j !== 0) {
let option = {}
option.identify = $(this).val();
option.content = $(this).parent().next().children().val();
optionList.push(option);
}
j++;
});
data.option = JSON.stringify(optionList);
return data;
},
// showBrowse: false,
@ -229,6 +283,57 @@
// $.modal.closeLoading();
// $.modal.msgReload(result.message, modal_status.SUCCESS);
}
/** 动态表格 */
$(function () {
var sceneQuestion = [[${sceneQuestion}]]
var answers = JSON.parse(sceneQuestion.option);
var html;
for (var i=0; i<answers.length; i++) {
var answer = answers[i];
html += '<tr>';
html += '<td height="30" align="center"><input type="text" name="NO" size="2" value="'+(i+1)+'" style="text-align: center;" disabled/></td>';
html += '<td width="30" align="center"><input type="text" name="identify" value="'+answer.identify+'" style="width: 30px; text-align: center;"/></td>';
html += '<td align="center"><input type="text" name="qContent" value="'+answer.content+'" style="width: 100%;"/></td>';
html += '</tr>';
}
$("#answerTrFlag").html(html);
var show_count = 8; //要显示的条数
var count = 1; //递增的开始值,这里是你的ID
$("#btn_addtr").click(function () {
var length = $("#dynamicTable tbody tr").length;
//alert(length);
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件
{
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行
changeIndex();//更新行号
}
});
});
function changeIndex() {
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
var i = 1;
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr
// console.log(i)
$(this).find("input[name='NO']").val(i);//更新行号
$(this).find("input[name='identify']").val(c[i]);//更新标号
i++;
});
}
function deltr(opp) {
var length = $("#dynamicTable tbody tr").length;
//alert(length);
if (length <= 1) {
alert("至少保留一行");
} else {
$(opp).parent().parent().remove();//移除当前行
changeIndex();
}
}
</script>
</body>
</html>

24
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/view.html

@ -59,19 +59,19 @@
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
detailUrl: prefix + "/detail/{guid}",
modalName: "场景题目",
columns: [{
checkbox: true
},
{
field: 'id',
field: 'code',
title: '题目序号'
},
{
field: 'name',
title: '题目名称'
},
// {
// field: 'name',
// title: '题目类型'
// },
{
field: 'roleIdStr',
title: '角色',
@ -99,11 +99,11 @@
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\',800,450)"><i class="fa fa-eye"></i>查看</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bind(\'' + row.id + '\',800,450)"><i class="fa fa-eject"></i>绑定</a>');
actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bindNew(\'' + row.id + '\',800,450)"><i class="fa fa-eject"></i>绑定新</a>');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.guid + '\')"><i class="fa fa-remove"></i>删除</a>');
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.guid + '\',800,450)"><i class="fa fa-eye"></i>查看</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bind(\'' + row.guid + '\',800,450)"><i class="fa fa-eject"></i>绑定</a>');
actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bindNew(\'' + row.guid + '\',800,450)"><i class="fa fa-eject"></i>绑定新</a>');
return actions.join('');
}
}]
@ -116,7 +116,7 @@
}
function add() {
$.modal.open("查看场景题目", ctx + "project/question/add/" + parentId, 800, 450);
$.modal.open("新增场景题目", ctx + "project/question/add/" + parentId, 800, 450);
}
function bind(id, width, height) {

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

@ -41,12 +41,6 @@
</select>
</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">
<label class="col-sm-3 control-label">演练背景:</label>
<div class="col-sm-8">

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/scene/detail.html

@ -6,7 +6,7 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manage-detail" th:object="${sceneManage}">
<input name="id" th:field="*{id}" type="hidden">
<input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">场景名称:</label>
<div class="col-sm-8">

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

@ -6,7 +6,7 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manage-edit" th:object="${sceneManage}">
<input name="id" th:field="*{id}" type="hidden">
<input name="guid" th:field="*{guid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">场景名称:</label>
<div class="col-sm-8">

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

@ -70,7 +70,7 @@
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
detailUrl: prefix + "/detail/{id}",
detailUrl: prefix + "/detail/{guid}",
exportUrl: prefix + "/export",
importUrl: prefix + "/importData",
importTemplateUrl: prefix + "/importTemplate",
@ -87,7 +87,12 @@
checkbox: true
},
{
field: 'id',
field: 'guid',
title: '主键',
visible: false
},
{
field: 'code',
title: '场景序号'
},
{
@ -144,10 +149,11 @@
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i> 删除</a>');
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detailFull(\'' + row.id + '\')"><i class="fa fa-eye"></i>查看</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="question(\'' + row.id + '\',\'' + row.name + '\')"><i class="fa fa-eject"></i>题目</a>');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.guid + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.guid + '\')"><i class="fa fa-remove"></i> 删除</a>');
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detailFull(\'' + row.guid + '\')"><i class="fa fa-eye"></i>查看</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="question(\'' + row.guid + '\',\'' + row.name + '\')"><i class="fa fa-eject"></i>题目</a>');
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sort(\'' + row.guid + '\')"><i class="fa fa-eject"></i>上移</a>');
return actions.join('');
}
}]
@ -173,10 +179,10 @@
table.set();
var url = "/404.html";
if ($.common.isNotEmpty(id)) {
url = table.options.detailUrl.replace("{id}", id);
url = table.options.detailUrl.replace("{guid}", id);
} else {
var row = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
url = table.options.detailUrl.replace("{id}", row);
url = table.options.detailUrl.replace("{guid}", row);
}
$.modal.openFull("场景详情", url);
}
@ -186,6 +192,18 @@
$.modal.openFull("场景名称 >>" + name, ctx + "project/question/view/" + id);
}
function sort(id) {
$.get(ctx + "scene/manage/sort/" + id, null, function (res) {
if (res.success) {
//
$.table.refresh();
$.modal.alertSuccess(res.message);
} else {
$.modal.alertWarning(res.message);
}
});
}
</script>
</body>
<script id="importTpl" type="text/template">

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

@ -58,9 +58,9 @@ public class SceneManageController extends BaseController {
* 查看详情
*/
@RequiresPermissions("project:manage:detail")
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Long id, ModelMap mmap) {
SceneManage sceneManage = sceneManageService.selectSceneManageById(id);
@GetMapping("/detail/{guid}")
public String detail(@PathVariable("guid") String guid, ModelMap mmap) {
SceneManage sceneManage = sceneManageService.selectSceneManageById(guid);
mmap.put("sceneManage", sceneManage);
return prefix + "/detail";
}
@ -87,9 +87,9 @@ public class SceneManageController extends BaseController {
/**
* 修改
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
SceneManage sceneManage = sceneManageService.selectSceneManageById(id);
@GetMapping("/edit/{guid}")
public String edit(@PathVariable("guid") String guid, ModelMap mmap) {
SceneManage sceneManage = sceneManageService.selectSceneManageById(guid);
mmap.put("sceneManage", sceneManage);
return prefix + "/edit";
}
@ -115,6 +115,16 @@ public class SceneManageController extends BaseController {
return sceneManageService.deleteSceneManageByIds(ids);
}
/**
* 排序上移
*/
@GetMapping("/sort/{guid}")
@ResponseBody
public ZDResponse sort(@PathVariable("guid") String guid) {
return sceneManageService.sort(guid);
}
/**
* 导出记录
*/
@ -143,7 +153,7 @@ public class SceneManageController extends BaseController {
public ResponseEntity<Resource> exampleImportRecord() {
SceneImportDataModel dataModel = new SceneImportDataModel();
dataModel.setName("消防演练");
dataModel.setType("文字");
dataModel.setType("图片");
dataModel.setSourceUnit("深圳消防");
dataModel.setIsOpen("是");
dataModel.setSceneBackground("开展全员消防培训及演练活动,增强员工防火意识、提升火灾处理能力");

32
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/controller/SceneQuestionController.java

@ -43,7 +43,7 @@ public class SceneQuestionController extends BaseController {
@RequiresPermissions("project:question:view")
@GetMapping("/view/{parentId}")
public String question(@PathVariable("parentId") Long parentId, ModelMap mmap) {
public String question(@PathVariable("parentId") String parentId, ModelMap mmap) {
mmap.put("parentId", parentId);
return prefix + "/view";
}
@ -61,21 +61,21 @@ public class SceneQuestionController extends BaseController {
}
@RequiresPermissions("project:question:detail")
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Long id, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id);
@GetMapping("/detail/{guid}")
public String detail(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
mmap.put("sceneQuestion", sceneQuestion);
mmap.put("roles", roleApi.getRolesAll());
return prefix + "/detail";
}
@RequiresPermissions("project:question:bind")
@GetMapping("/bind/{id}")
public String bind(@PathVariable("id") Long id, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id);
@GetMapping("/bind/{guid}")
public String bind(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(new SceneQuestion());
if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().filter(item -> !Objects.equals(item.getId(), id)).collect(Collectors.toList());
list = list.stream().filter(item -> !Objects.equals(item.getGuid(), guid)).collect(Collectors.toList());
}
mmap.put("sceneQuestion", sceneQuestion);
mmap.put("list", list);
@ -83,12 +83,12 @@ public class SceneQuestionController extends BaseController {
}
@RequiresPermissions("project:question:bind")
@GetMapping("/bindNew/{id}")
public String bindNew(@PathVariable("id") Long id, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id);
@GetMapping("/bindNew/{guid}")
public String bindNew(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(new SceneQuestion());
if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().filter(item -> !Objects.equals(item.getId(), id)).collect(Collectors.toList());
list = list.stream().filter(item -> !Objects.equals(item.getGuid(), guid)).collect(Collectors.toList());
}
mmap.put("sceneQuestion", sceneQuestion);
mmap.put("list", list);
@ -112,7 +112,7 @@ public class SceneQuestionController extends BaseController {
* 新增场景题目
*/
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
public String add(@PathVariable("parentId") String parentId, ModelMap mmap) {
SceneManage sceneManage = sceneManageMapper.selectSceneManageById(parentId);
mmap.put("parentId", parentId);
mmap.put("type", sceneManage.getType());
@ -134,9 +134,9 @@ public class SceneQuestionController extends BaseController {
/**
* 修改场景题目
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id);
@GetMapping("/edit/{guid}")
public String edit(@PathVariable("guid") String guid, ModelMap mmap) {
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(guid);
SceneManage sceneManage = sceneManageMapper.selectSceneManageById(sceneQuestion.getParentId());
mmap.put("sceneQuestion", sceneQuestion);
mmap.put("roles", roleApi.getRolesAll());

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

@ -16,9 +16,9 @@ public class SceneImportDataModel {
private String name;
/**
* 题目类型0:文字 1:图片 2:视频
* 题目类型 1:图片 2:视频
*/
@ExcelProperty("题目类型(文字,图片,视频)")
@ExcelProperty("题目类型(图片,视频)")
@ColumnWidth(20)
private String type;
@ -36,14 +36,16 @@ public class SceneImportDataModel {
@ColumnWidth(20)
private String isOpen;
@ExcelProperty("入口排序")
@ColumnWidth(20)
private Integer sort;
/**
* 演练背景
*/
@ExcelProperty("演练背景")
@ColumnWidth(20)
private String sceneBackground;
/**
* 描述
*/
@ExcelProperty("描述")
@ColumnWidth(20)
private String describe;
@ -95,11 +97,4 @@ public class SceneImportDataModel {
public void setDescribe(String describe) {
this.describe = describe;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
}

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

@ -22,7 +22,12 @@ public class SceneManage implements Serializable {
/**
* 主键
*/
private Long id;
private String guid;
/**
* 序号
*/
private Long code;
/**
* 场景名称
@ -60,12 +65,6 @@ public class SceneManage implements Serializable {
@Excel(name = "状态")
private Integer status;
/**
* 是否删除0是1否
*/
@Excel(name = "是否删除0是1否")
private Integer isDelete;
/**
* 创建人
*/
@ -115,12 +114,20 @@ public class SceneManage implements Serializable {
*/
private Map<String, Object> params;
public void setId(Long id) {
this.id = id;
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public Long getCode() {
return code;
}
public Long getId() {
return id;
public void setCode(Long code) {
this.code = code;
}
public void setName(String name) {
@ -171,14 +178,6 @@ public class SceneManage implements Serializable {
return status;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Integer getIsDelete() {
return isDelete;
}
public void setCreator(String creator) {
this.creator = creator;
}
@ -214,14 +213,14 @@ public class SceneManage implements Serializable {
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("guid", getGuid())
.append("code", getCode())
.append("name", getName())
.append("type", getType())
.append("url", getUrl())
.append("sourceUnit", getSourceUnit())
.append("isOpen", getIsOpen())
.append("status", getStatus())
.append("isDelete", getIsDelete())
.append("creator", getCreator())
.append("createTime", getCreateTime())
.toString();

45
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/domain/SceneQuestion.java

@ -21,7 +21,12 @@ public class SceneQuestion implements Serializable {
/**
* 主键
*/
private Long id;
private String guid;
/**
* 序号
*/
private Long code;
/**
* 题目名称
@ -33,7 +38,7 @@ public class SceneQuestion implements Serializable {
* 分组
*/
@Excel(name = "场景id")
private Long parentId;
private String parentId;
/**
* 角色
@ -77,6 +82,10 @@ public class SceneQuestion implements Serializable {
*/
private String answer;
/**
* 答案
*/
private String option;
/**
* 下一个答案
@ -88,12 +97,20 @@ public class SceneQuestion implements Serializable {
*/
private Map<String, Object> params;
public void setId(Long id) {
this.id = id;
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public Long getCode() {
return code;
}
public Long getId() {
return id;
public void setCode(Long code) {
this.code = code;
}
public void setName(String name) {
@ -131,11 +148,13 @@ public class SceneQuestion implements Serializable {
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("guid", getGuid())
.append("code", getCode())
.append("name", getName())
.append("roleId", getRoleId())
.append("parentId", getParentId())
.append("status", getStatus())
.append("option", getOption())
.append("answer", getAnswer())
.append("nextQuestionId", getNextQuestionId())
.append("creator", getCreator())
@ -177,11 +196,11 @@ public class SceneQuestion implements Serializable {
this.createTimeEnd = createTimeEnd;
}
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}
@ -208,4 +227,12 @@ public class SceneQuestion implements Serializable {
public void setNextQuestionId(Long nextQuestionId) {
this.nextQuestionId = nextQuestionId;
}
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
}

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

@ -16,10 +16,10 @@ public interface SceneManageMapper
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public SceneManage selectSceneManageById(Long id);
public SceneManage selectSceneManageById(String guid);
/**
* 查询【请填写功能名称】列表
@ -56,25 +56,40 @@ public interface SceneManageMapper
/**
* 删除【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @param guid 【请填写功能名称】ID
* @return 结果
*/
public int deleteSceneManageById(Long id);
public int deleteSceneManageById(String guid);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的数据ID
* @param guids 需要删除的数据ID
* @return 结果
*/
public int deleteSceneManageByIds(String[] ids);
public int deleteSceneManageByIds(String[] guids);
/**
* 批量查找【请填写功能名称】
*
* @param ids 需要查找的数据ID
* @param guids 需要查找的数据ID
* @return 结果
*/
public List<SceneManage> selectSceneManageByIds(String[] ids);
public List<SceneManage> selectSceneManageByIds(String[] guids);
/**
* 获取排序【请填写功能名称】
*
* @return 结果
*/
public int selectMinSort();
/**
* 获取排序【请填写功能名称】
*
* @return 结果
*/
public SceneManage selectLastSort(Integer sort);
}

12
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/mapper/SceneQuestionMapper.java

@ -15,10 +15,10 @@ public interface SceneQuestionMapper
/**
* 查询场景题目
*
* @param id 场景题目ID
* @param guid 场景题目ID
* @return 场景题目
*/
public SceneQuestion selectSceneQuestionById(Long id);
public SceneQuestion selectSceneQuestionById(String guid);
/**
* 查询场景题目列表
@ -47,18 +47,18 @@ public interface SceneQuestionMapper
/**
* 删除场景题目
*
* @param id 场景题目ID
* @param guid 场景题目ID
* @return 结果
*/
public int deleteSceneQuestionById(Long id);
public int deleteSceneQuestionById(String guid);
/**
* 批量删除场景题目
*
* @param ids 需要删除的数据ID
* @param guids 需要删除的数据ID
* @return 结果
*/
public int deleteSceneQuestionByIds(String[] ids);
public int deleteSceneQuestionByIds(String[] guids);
/**
* 绑定场景题目

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

@ -19,10 +19,10 @@ public interface ISceneManageService
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
public SceneManage selectSceneManageById(Long id);
public SceneManage selectSceneManageById(String guid);
/**
* 查询【请填写功能名称】列表
@ -51,18 +51,26 @@ public interface ISceneManageService
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的数据ID
* @param guids 需要删除的数据ID
* @return 结果
*/
public ZDResponse deleteSceneManageByIds(String ids);
public ZDResponse deleteSceneManageByIds(String guids);
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】ID
* @param guid 【请填写功能名称】ID
* @return 结果
*/
public int deleteSceneManageById(Long id);
public int deleteSceneManageById(String guid);
/**
* 排序上移【请填写功能名称】
*
* @param guid 需要删除的数据ID
* @return 结果
*/
public ZDResponse sort(String guid);
/**
* 导入【请填写功能名称】信息

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

@ -17,10 +17,10 @@ public interface ISceneQuestionService
/**
* 查询场景题目
*
* @param id 场景题目ID
* @param guid 场景题目ID
* @return 场景题目
*/
public SceneQuestion selectSceneQuestionById(Long id);
public SceneQuestion selectSceneQuestionById(String guid);
/**
* 查询场景题目列表
@ -49,18 +49,18 @@ public interface ISceneQuestionService
/**
* 批量删除场景题目
*
* @param ids 需要删除的数据ID
* @param guids 需要删除的数据ID
* @return 结果
*/
public int deleteSceneQuestionByIds(String ids);
public int deleteSceneQuestionByIds(String guids);
/**
* 删除场景题目信息
*
* @param id 场景题目ID
* @param guid 场景题目ID
* @return 结果
*/
public int deleteSceneQuestionById(Long id);
public int deleteSceneQuestionById(String guid);
/**
* 绑定场景题目信息

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

@ -8,6 +8,7 @@ import com.zdxt.auth.feign.UserApi;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.knowledge.domain.SceneImportDataModel;
import com.zdxt.knowledge.domain.SceneManage;
import com.zdxt.knowledge.mapper.SceneManageMapper;
@ -25,6 +26,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -47,12 +49,12 @@ public class SceneManageServiceImpl implements ISceneManageService {
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】ID
* @param guid 【请填写功能名称】ID
* @return 【请填写功能名称】
*/
@Override
public SceneManage selectSceneManageById(Long id) {
return sceneManageMapper.selectSceneManageById(id);
public SceneManage selectSceneManageById(String guid) {
return sceneManageMapper.selectSceneManageById(guid);
}
/**
@ -82,6 +84,9 @@ public class SceneManageServiceImpl implements ISceneManageService {
sceneManage.setCreator(userBean.getUserName());
sceneManage.setCreateTime(DateUtils.getNowDate());
}
int i = sceneManageMapper.selectMinSort();
sceneManage.setSort(i + 1);
sceneManage.setGuid(StringUtils.getUUID());
return sceneManageMapper.insertSceneManage(sceneManage);
}
@ -100,31 +105,50 @@ public class SceneManageServiceImpl implements ISceneManageService {
/**
* 删除【请填写功能名称】对象
*
* @param ids 需要删除的数据ID
* @param guids 需要删除的数据ID
* @return 结果
*/
@Override
public ZDResponse deleteSceneManageByIds(String ids) {
List<SceneManage> sceneManageList = sceneManageMapper.selectSceneManageByIds(Convert.toStrArray(ids));
public ZDResponse deleteSceneManageByIds(String guids) {
List<SceneManage> sceneManageList = sceneManageMapper.selectSceneManageByIds(Convert.toStrArray(guids));
if (CollectionUtils.isNotEmpty(sceneManageList)) {
long count = sceneManageList.stream().filter(item -> !Objects.equals(item.getStatus(), 4)).count();
if (count > 0) {
return ZDResponse.error("仅支持已下架的场景进行删除操作");
return ZDResponse.error("仅支持已下架的场景进行删除操作");
}
}
return sceneManageMapper.deleteSceneManageByIds(Convert.toStrArray(ids))> 0
return sceneManageMapper.deleteSceneManageByIds(Convert.toStrArray(guids)) > 0
? ZDResponse.success() : ZDResponse.error("删除失败");
}
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】ID
* @param guid 【请填写功能名称】ID
* @return 结果
*/
@Override
public int deleteSceneManageById(Long id) {
return sceneManageMapper.deleteSceneManageById(id);
public int deleteSceneManageById(String guid) {
return sceneManageMapper.deleteSceneManageById(guid);
}
@Override
public ZDResponse sort(String guid) {
SceneManage sceneManage = sceneManageMapper.selectSceneManageById(guid);
if (Objects.isNull(sceneManage)) {
return ZDResponse.error("未找到改场景相关数据");
}
SceneManage lastSceneManage = sceneManageMapper.selectLastSort(sceneManage.getSort());
if (Objects.isNull(lastSceneManage)) {
return ZDResponse.error("上移达到最大限制");
}
Integer lastSceneManageSort = lastSceneManage.getSort();
lastSceneManage.setSort(sceneManage.getSort());
sceneManageMapper.updateSceneManage(lastSceneManage);
sceneManage.setSort(lastSceneManageSort);
sceneManageMapper.updateSceneManage(sceneManage);
return ZDResponse.success("上移成功");
}
@Override
@ -140,6 +164,7 @@ public class SceneManageServiceImpl implements ISceneManageService {
.collect(Collectors.toMap(DictDataBean::getDictLabel, DictDataBean::getDictValue));
if (CollectionUtils.isNotEmpty(dataModelList)) {
AtomicInteger sort = new AtomicInteger(sceneManageMapper.selectMinSort());
List<SceneManage> sceneManageList = dataModelList.stream()
.filter(Objects::nonNull).peek(item -> {
String type = sceneTypeMap.get(item.getType());
@ -150,6 +175,9 @@ public class SceneManageServiceImpl implements ISceneManageService {
UserBean userBean = userApi.getCurrentUser();
SceneManage sceneManage = new SceneManage();
BeanUtils.copyProperties(item, sceneManage);
sort.addAndGet(1);
sceneManage.setSort(sort.get());
sceneManage.setGuid(StringUtils.getUUID());
sceneManage.setIsOpen(Integer.valueOf(item.getIsOpen()));
sceneManage.setType(Integer.valueOf(item.getType()));
sceneManage.setCreator(userBean.getUserName());

22
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneQuestionServiceImpl.java

@ -11,6 +11,7 @@ import com.zdxt.auth.feign.UserApi;
import com.zdxt.auth.feign.ZdxtFileCommonApi;
import com.zdxt.common.util.Convert;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.common.zdxtFile.AttFileRespDTO;
import com.zdxt.common.zdxtFile.FilePreviewUtilBean;
import com.zdxt.common.zdxtFile.ZdxtFileCommon;
@ -50,12 +51,12 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
/**
* 查询场景题目
*
* @param id 场景题目ID
* @param guid 场景题目ID
* @return 场景题目
*/
@Override
public SceneQuestion selectSceneQuestionById(Long id) {
return sceneQuestionMapper.selectSceneQuestionById(id);
public SceneQuestion selectSceneQuestionById(String guid) {
return sceneQuestionMapper.selectSceneQuestionById(guid);
}
/**
@ -100,11 +101,12 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
sceneQuestion.setCreator(userBean.getUserName());
sceneQuestion.setCreateTime(DateUtils.getNowDate());
}
sceneQuestion.setGuid(StringUtils.getUUID());
int result = sceneQuestionMapper.insertSceneQuestion(sceneQuestion);
// 上传文件,并在附件表中添加记录
if (result > 0 && ObjectUtil.isNotEmpty(files)) {
for (MultipartFile file : files) {
zdxtFileCommonApi.insertZdxtFile(file, sceneQuestion.getId() + "", fileUploadApi.upload(file));
zdxtFileCommonApi.insertZdxtFile(file, sceneQuestion.getGuid() + "", fileUploadApi.upload(file));
}
}
return result;
@ -125,23 +127,23 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
/**
* 删除场景题目对象
*
* @param ids 需要删除的数据ID
* @param guids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSceneQuestionByIds(String ids) {
return sceneQuestionMapper.deleteSceneQuestionByIds(Convert.toStrArray(ids));
public int deleteSceneQuestionByIds(String guids) {
return sceneQuestionMapper.deleteSceneQuestionByIds(Convert.toStrArray(guids));
}
/**
* 删除场景题目信息
*
* @param id 场景题目ID
* @param guid 场景题目ID
* @return 结果
*/
@Override
public int deleteSceneQuestionById(Long id) {
return sceneQuestionMapper.deleteSceneQuestionById(id);
public int deleteSceneQuestionById(String guid) {
return sceneQuestionMapper.deleteSceneQuestionById(guid);
}
@Override

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

@ -5,14 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zdxt.knowledge.mapper.SceneManageMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneManage" id="SceneManageResult">
<result property="id" column="id" />
<result property="guid" column="guid" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="url" column="url" />
<result property="sourceUnit" column="source_unit" />
<result property="isOpen" column="is_open" />
<result property="status" column="status" />
<result property="isDelete" column="is_delete" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="sceneBackground" column="scene_background" />
@ -22,13 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSceneManageVo">
select id, name, type, url, source_unit, is_open, status, is_delete, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage
select guid, code, name, type, url, source_unit, is_open, status, creator, create_time, scene_background, `describe`, sort, use_total from scene_manage
</sql>
<select id="selectSceneManageList" parameterType="com.zdxt.knowledge.domain.SceneManage" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/>
<where>
and is_delete = 1
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="url != null and url != ''"> and url = #{url}</if>
@ -43,23 +42,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and create_time <![CDATA[<=]]> #{createTimeEnd}
</if>
</where>
order by sort ASC
</select>
<select id="selectSceneManageById" parameterType="Long" resultMap="SceneManageResult">
<select id="selectSceneManageById" parameterType="String" resultMap="SceneManageResult">
<include refid="selectSceneManageVo"/>
where id = #{id}
where guid = #{guid}
</select>
<insert id="insertSceneManage" parameterType="SceneManage" useGeneratedKeys="true" keyProperty="id">
<insert id="insertSceneManage" parameterType="SceneManage" >
insert into scene_manage
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">guid,</if>
<if test="name != null and name != ''">name,</if>
<if test="type != null ">type,</if>
<if test="url != null and url != ''">url,</if>
<if test="sourceUnit != null and sourceUnit != ''">source_unit,</if>
<if test="isOpen != null ">is_open,</if>
<if test="status != null ">status,</if>
<if test="isDelete != null ">is_delete,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background,</if>
@ -67,13 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sort != null and sort != '' ">`sort`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null and guid != ''">#{guid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="type != null ">#{type},</if>
<if test="url != null and url != ''">#{url},</if>
<if test="sourceUnit != null and sourceUnit != ''">#{sourceUnit},</if>
<if test="isOpen != null ">#{isOpen},</if>
<if test="status != null ">#{status},</if>
<if test="isDelete != null ">#{isDelete},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">#{sceneBackground},</if>
@ -91,47 +91,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sourceUnit != null and sourceUnit != ''">source_unit = #{sourceUnit},</if>
<if test="isOpen != null ">is_open = #{isOpen},</if>
<if test="status != null ">status = #{status},</if>
<if test="isDelete != null ">is_delete = #{isDelete},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="sceneBackground != null and sceneBackground != ''">scene_background = #{sceneBackground},</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>
where id = #{id}
where guid = #{guid}
</update>
<delete id="deleteSceneManageById" parameterType="Long">
delete from scene_manage where id = #{id}
<delete id="deleteSceneManageById" parameterType="String">
delete from scene_manage where guid = #{guid}
</delete>
<update id="deleteSceneManageByIds" parameterType="String">
update scene_manage set is_delete = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
<delete id="deleteSceneManageByIds" parameterType="String">
delete from scene_manage where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</update>
</delete>
<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}
and guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</where>
</select>
<insert id="batchInsertSceneManage">
insert into scene_manage
(`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values
(`guid`,`name`, `type`, source_unit, is_open, creator, create_time,scene_background, `describe`, `sort`) values
<foreach collection="sceneManageList" item="sceneObj" separator=",">
(#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort})
(#{sceneObj.guid},#{sceneObj.name},#{sceneObj.type},#{sceneObj.sourceUnit},#{sceneObj.isOpen},#{sceneObj.creator},#{sceneObj.createTime},#{sceneObj.sceneBackground},#{sceneObj.describe},#{sceneObj.sort})
</foreach>
</insert>
<select id="selectMinSort" resultType="INTEGER">
select MAX(sort) as sort from scene_manage
</select>
<select id="selectLastSort" parameterType="INTEGER" resultMap="SceneManageResult">
SELECT guid, sort FROM scene_manage WHERE sort = (SELECT MAX(sort) FROM scene_manage where sort &lt; #{sort});
</select>
<!-- <delete id="deleteSceneManageByIds" parameterType="String">-->
<!-- delete from scene_manage where id in -->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->

40
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/resources/mapper/SceneQuestionMapper.xml

@ -5,12 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zdxt.knowledge.mapper.SceneQuestionMapper">
<resultMap type="com.zdxt.knowledge.domain.SceneQuestion" id="SceneQuestionResult">
<result property="id" column="id" />
<result property="guid" column="guid" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="parentId" column="parent_id" />
<result property="roleId" column="role_id" />
<result property="status" column="status" />
<result property="creator" column="creator" />
<result property="option" column="option" />
<result property="answer" column="answer" />
<result property="nextQuestionId" column="next_question_id" />
<result property="createTime" column="create_time" />
@ -18,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSceneQuestionVo">
select id, name, parent_id, role_id, status, creator, create_time, answer, next_question_id, update_time from scene_question
select guid, code, name, parent_id, role_id, status, creator, create_time, answer, `option`, next_question_id, update_time from scene_question
</sql>
<select id="selectSceneQuestionList" parameterType="SceneQuestion" resultMap="SceneQuestionResult">
@ -36,31 +38,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and create_time <![CDATA[<=]]> #{createTimeEnd}
</if>
</where>
order by create_time desc
</select>
<select id="selectSceneQuestionById" parameterType="Long" resultMap="SceneQuestionResult">
<select id="selectSceneQuestionById" parameterType="String" resultMap="SceneQuestionResult">
<include refid="selectSceneQuestionVo"/>
where id = #{id}
where guid = #{guid}
</select>
<insert id="insertSceneQuestion" parameterType="SceneQuestion" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<insert id="insertSceneQuestion" parameterType="SceneQuestion">
insert into scene_question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="guid != null ">guid,</if>
<if test="name != null and name != ''">`name`,</if>
<if test="parentId != null and parentId != ''">parent_id,</if>
<if test="roleId != null and roleId != ''">role_id,</if>
<if test="status != null ">status,</if>
<if test="option != null and option != ''">`option`,</if>
<if test="answer != null and answer != ''">answer,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateTime != null ">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="guid != null ">#{guid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="roleId != null and roleId != ''">#{roleId},</if>
<if test="status != null ">#{status},</if>
<if test="option != null and option != ''">#{option},</if>
<if test="answer != null and creator != ''">#{answer},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateTime != null ">#{updateTime},</if>
@ -74,21 +81,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
<if test="roleId != null and roleId != ''">role_id = #{roleId},</if>
<if test="status != null ">status = #{status},</if>
<if test="option != null and option != ''">`option` = #{option},</if>
<if test="answer != null and answer != ''">answer = #{answer},</if>
<if test="creator != null and creator != ''">creator = #{creator},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where id = #{id}
where guid = #{guid}
</update>
<delete id="deleteSceneQuestionById" parameterType="Long">
delete from scene_question where id = #{id}
<delete id="deleteSceneQuestionById" parameterType="String">
delete from scene_question where guid = #{guid}
</delete>
<delete id="deleteSceneQuestionByIds" parameterType="String">
delete from scene_question where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
delete from scene_question where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
@ -98,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="answer != null and answer != ''">answer = #{answer},</if>
<if test="nextQuestionId != null and nextQuestionId != ''">next_question_id = #{nextQuestionId},</if>
</trim>
where id = #{id}
where guid = #{guid}
</update>
</mapper>
Loading…
Cancel
Save