Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 6 months ago
parent
commit
0b9e93086f
  1. 41
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOrderServiceImpl.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysAttachMapper.java
  3. 20
      ruoyi-admin/src/main/resources/mapper/system/SysAttachMapper.xml
  4. 23
      ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOrder/aftersalesOrder.html
  5. 5
      ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOrder/sendOrders.html
  6. 3
      ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOrder/uploadReport.html
  7. 146
      ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html

41
ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOrderServiceImpl.java

@ -8,6 +8,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysAttach; import com.ruoyi.system.domain.SysAttach;
import com.ruoyi.system.mapper.SysAttachMapper;
import com.ruoyi.system.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachFileService;
import com.ruoyi.system.service.ISysAttachService; import com.ruoyi.system.service.ISysAttachService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +17,7 @@ import com.ruoyi.aftersales.mapper.AftersalesOrderMapper;
import com.ruoyi.aftersales.domain.AftersalesOrder; import com.ruoyi.aftersales.domain.AftersalesOrder;
import com.ruoyi.aftersales.service.IAftersalesOrderService; import com.ruoyi.aftersales.service.IAftersalesOrderService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 售后单Service业务层处理 * 售后单Service业务层处理
@ -35,6 +37,10 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService
@Autowired @Autowired
private ISysAttachFileService attachFileService; private ISysAttachFileService attachFileService;
@Autowired
private SysAttachMapper sysAttachMapper;
/** /**
* 查询售后单 * 查询售后单
* *
@ -96,6 +102,7 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService
* @param aftersalesOrder 售后单 * @param aftersalesOrder 售后单
* @return 结果 * @return 结果
*/ */
@Transactional
@Override @Override
public int updateAftersalesOrder(AftersalesOrder aftersalesOrder) public int updateAftersalesOrder(AftersalesOrder aftersalesOrder)
{ {
@ -104,17 +111,33 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService
aftersalesOrder.setUpdateTime(DateUtils.getNowDate()); aftersalesOrder.setUpdateTime(DateUtils.getNowDate());
Long aftersalesOrderId = aftersalesOrder.getAftersalesOrderId(); Long aftersalesOrderId = aftersalesOrder.getAftersalesOrderId();
String fileIdStr = aftersalesOrder.getFileIdStr(); String fileIdStr = aftersalesOrder.getFileIdStr();
Long attachId = null;
if (StringUtils.isNotEmpty(fileIdStr)){ if (StringUtils.isNotEmpty(fileIdStr)){
//保存文件附件关联 SysAttach tempSysAttach = new SysAttach();
SysAttach sysAttach = new SysAttach(); tempSysAttach.setSourceType("aftersalesOrder");
sysAttach.setCreateBy(ShiroUtils.getLoginName()); tempSysAttach.setSourceSubType("photo");
sysAttach.setCreateTime(new Date()); tempSysAttach.setRelId(aftersalesOrderId);
sysAttach.setSourceType("aftersalesOrder"); List<SysAttach> sysAttaches = attachService.selectSysAttachList(tempSysAttach);
sysAttach.setSourceSubType("photo"); if (StringUtils.isEmpty(sysAttaches)){
sysAttach.setRelId(aftersalesOrderId); // 保存新的文件附件关联
attachService.insertSysAttach(sysAttach); SysAttach newSysAttach = new SysAttach();
newSysAttach.setCreateBy(loginName);
newSysAttach.setCreateTime(new Date());
newSysAttach.setSourceType("aftersalesOrder");
newSysAttach.setSourceSubType("photo");
newSysAttach.setRelId(aftersalesOrderId);
attachService.insertSysAttach(newSysAttach);
// 假设insert后可以通过某种方式(如返回值)获取到新生成的ID,这里需要根据实际情况调整
attachId = newSysAttach.getId(); // 确保这里能正确获取到ID
}else {
// 更新已存在的附件信息
SysAttach sysAttachToUpdate = sysAttaches.get(0); // 假设只有一条记录,或按需处理多条
sysAttachToUpdate.setUpdateBy(loginName);
sysAttachToUpdate.setUpdateTime(new Date());
attachService.updateSysAttach(sysAttachToUpdate); // 假定有一个通用的更新方法
attachId = sysAttachToUpdate.getId();
}
//更新附件与文件关联 //更新附件与文件关联
Long attachId = sysAttach.getId();
List<String> fileIdList = Arrays.asList(fileIdStr.split(",")); List<String> fileIdList = Arrays.asList(fileIdStr.split(","));
attachFileService.updateAttachIdByIdList(attachId,fileIdList); attachFileService.updateAttachIdByIdList(attachId,fileIdList);
} }

13
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysAttachMapper.java

@ -20,6 +20,10 @@ public interface SysAttachMapper
*/ */
public SysAttach selectSysAttachById(Long id); public SysAttach selectSysAttachById(Long id);
/** /**
* 查询附件业务关联列表 * 查询附件业务关联列表
* *
@ -44,6 +48,15 @@ public interface SysAttachMapper
*/ */
public int updateSysAttach(SysAttach sysAttach); public int updateSysAttach(SysAttach sysAttach);
/**
* 根据多个条件修改附件业务关联
*
* @param sysAttach 附件业务关联
* @return 结果
*/
public int updateSysAttachByIdAndSourceType(SysAttach sysAttach);
/** /**
* 删除附件业务关联 * 删除附件业务关联
* *

20
ruoyi-admin/src/main/resources/mapper/system/SysAttachMapper.xml

@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertSysAttach" parameterType="SysAttach" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSysAttach" parameterType="SysAttach" useGeneratedKeys="true" keyProperty="id">
insert into sys_attach insert into sys_attach
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -77,6 +78,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<update id="updateSysAttachByIdAndSourceType" parameterType="SysAttach" >
update sys_attach
<trim prefix="SET" suffixOverrides=",">
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="relId != null ">rel_id = #{relId},</if>
<if test="sourceType != null and sourceType != ''">source_type = #{sourceType},</if>
<if test="sourceSubType != null and sourceSubType != ''">source_sub_type = #{sourceSubType},</if>
</trim>
where rel_id = #{relId}
and source_type = #{sourceType}
and source_sub_type = #{sourceSubType}
</update>
<delete id="deleteSysAttachById" parameterType="Long"> <delete id="deleteSysAttachById" parameterType="Long">
delete from sys_attach where id = #{id} delete from sys_attach where id = #{id}
</delete> </delete>

23
ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOrder/aftersalesOrder.html

@ -47,21 +47,6 @@
</div> </div>
</form> </form>
</div> </div>
<!-- <div class="btn-group-sm" id="toolbar" role="group">-->
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="aftersales:aftersalesOrder:add">-->
<!-- <i class="fa fa-plus"></i> 添加-->
<!-- </a>-->
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="aftersales:aftersalesOrder:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
<!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="aftersales:aftersalesOrder:remove">-->
<!-- <i class="fa fa-remove"></i> 删除-->
<!-- </a>-->
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="aftersales:aftersalesOrder:export">-->
<!-- <i class="fa fa-download"></i> 导出-->
<!-- </a>-->
<!-- </div>-->
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
</div> </div>
@ -71,8 +56,6 @@
<script th:inline="javascript"> <script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:edit')}]]; var editFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:edit')}]];
var removeFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:remove')}]]; var removeFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:remove')}]];
var cancelFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:restore')}]];
var sendOrdersFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:sendOrders')}]]; var sendOrdersFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:sendOrders')}]];
var uploadReportFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:uploadReport')}]]; var uploadReportFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:uploadReport')}]];
var detailFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:detail')}]]; var detailFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:detail')}]];
@ -201,26 +184,20 @@
// 示例逻辑: // 示例逻辑:
// 1. 确认用户操作 // 1. 确认用户操作
if (confirm('确认要派单吗?')) {
var url = ctx + 'aftersales/aftersalesOrder/sendOrders/'+aftersalesOrderId; var url = ctx + 'aftersales/aftersalesOrder/sendOrders/'+aftersalesOrderId;
console.log(url); console.log(url);
$.modal.open("派单",url); $.modal.open("派单",url);
} }
}
/*上传报告*/ /*上传报告*/
function uploadReport(aftersalesOrderId) { function uploadReport(aftersalesOrderId) {
// 在这里编写派单操作的逻辑,使用传入的aftersalesOrderId参数 // 在这里编写派单操作的逻辑,使用传入的aftersalesOrderId参数
// 示例逻辑: // 示例逻辑:
// 1. 确认用户操作 // 1. 确认用户操作
if (confirm('确认要上传报告吗?')) {
var url = ctx + 'aftersales/aftersalesOrder/uploadReport/'+aftersalesOrderId; var url = ctx + 'aftersales/aftersalesOrder/uploadReport/'+aftersalesOrderId;
console.log(url);
$.modal.open("上传报告",url); $.modal.open("上传报告",url);
} }
}
</script> </script>
</body> </body>

5
ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOrder/sendOrders.html

@ -66,13 +66,14 @@
<input name="remark" th:field="*{remark}" class="form-control" type="text"> <input name="remark" th:field="*{remark}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="container">
<div class="form-row"> <div class="row">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<h3 class="mb-4">选择设备</h3> <h3 class="mb-4">选择设备</h3>
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
</div> </div>
</div> </div>
</div>
<div class="form-group"> <div class="form-group">
<h3 class="mb-4">派单</h3> <h3 class="mb-4">派单</h3>
<label class="col-sm-3 control-label">售后员:</label> <label class="col-sm-3 control-label">售后员:</label>

3
ruoyi-admin/src/main/resources/templates/aftersales/aftersalesOrder/uploadReport.html

@ -69,7 +69,8 @@
</div> </div>
</div> </div>
<div class="form-row"> <div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<h3 class="mb-4">选择设备</h3> <h3 class="mb-4">选择设备</h3>
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>

146
ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('新增售后客诉通知单')" /> <th:block th:include="include :: header('新增售后客诉通知单')" />
<th:block th:include="include :: summernote-css" />
<link th:href="@{/ajax/libs/element-ui/element-ui.css}" rel="stylesheet"/>
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -60,9 +62,50 @@
</div> </div>
</div> </div>
</div> </div>
<div id="app">
<!-- ... 其他Vue模板代码 ... -->
<!-- 文件上传弹出层 -->
<div id="uploadModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">上传不良报告</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- 这里放置el-upload组件 -->
<el-upload
ref="upload"
:action="fileUploadUrl"
:on-success="uploadSuccess"
:on-remove="uploadRemove"
:file-list="fileList"
:limit="1"
list-type="picture-card"
accept=".jpg,.png,.pdf"
>
<i class="el-icon-plus"></i>
</el-upload>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" @click="saveFile()">保存</button>
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<!--用于可以修改列表字段的插件--> <!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: summernote-js" />
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var removeFlag = [[${@permission.hasPermi('aftersales:complaintNotice:remove')}]]; var removeFlag = [[${@permission.hasPermi('aftersales:complaintNotice:remove')}]];
@ -293,47 +336,37 @@
type: 'text', // 表示该列可以被编辑为文本 type: 'text', // 表示该列可以被编辑为文本
}, },
}, },
// {
// title: '紧急程度',
// field: 'emergencyDegree',
// editable: {
// type: 'select', // 使用下拉选择框作为编辑类型
// source: aftersalesDatas, // 这里需要一个数组,包含{value: 'dictValue', text: 'dictLabel'}格式的项
// },
// formatter: function(value, row, index) {
// // 格式化显示值,类似于thymeleaf模板中的th:text
// return $.table.selectDictLabel(aftersalesDatas, value);
// }
// },
// {
// field: 'emergencyDegree',
// title: '紧急程度',
// // 使用formatter处理显示值
// formatter: function(value, row, index) {
// var dictItem = aftersalesDatas.find(function(dict) {
// return dict.dictValue === value;
// });
// return dictItem ? dictItem.dictLabel : '';
// },
// // 编辑时的配置
// editor: {
// type: 'select',
// options: aftersalesDatas.map(function(item) {
// return {value: item.dictValue, text: item.dictLabel};
// })
// }
// },
{ {
title: '售后问题', title: '售后问题',
field: 'adverseReportUrl', field: 'adverseReportUrl',
editable: { editable: {
type: 'text', // 表示该列可以被编辑为文本 type: 'text', // 表示该列可以被编辑为文本
// 可以在这里定义更多编辑行为,比如验证、提交等 // 可以在这里定义更多编辑行为,比如验证、提交等
}, },
}, },
{
title: '不良报告',
field: 'adverseReportUrl',
formatter: function(value, row, index) {
// 这里根据value(文件URL)生成相应的HTML来展示预览或链接
if(value) {
return `<a href="${value}" target="_blank">查看报告</a>`;
} else {
return '无报告';
}
},
// 添加自定义属性,用于后续编辑时识别
editOptions: {
type: 'custom',
events: {
'click .edit-btn': function(e, value, row, index) {
// 点击编辑时触发的事件,可以在这里打开上传对话框
// 注意这里的逻辑需要你手动编写
}
}
}
},
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
@ -382,6 +415,53 @@
}) })
} }
function imageFormatter(value, row, index) {
if (value) {
return '<img src="' + value + '" alt="不良报告" height="50"/>';
}
return '';
}
new Vue({
el: '#app',
data: function() {
return {
fileList: [],
fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
fileIdList:[],
}
},
methods: {
// ... 其它已有的方法 ...
openUploadModal(row) {
$('#uploadModal').modal('show');
this.currentRow = row; // 记录当前编辑行
},
saveFile() {
// 假设你已经处理了文件上传逻辑,这里直接更新表格数据
if(this.fileList.length > 0) {
this.currentRow.adverseReportUrl = this.fileList[0].url; // 假设只上传一个文件,取第一个文件的URL
$('#uploadModal').modal('hide'); // 关闭模态框
// 这里可能还需要调用Bootstrap Table的refresh方法来刷新表格
} else {
$.modal.alertWarning("请先上传文件。");
}
},
// ... 其它已有的方法 ...
},
mounted() {
// 绑定Bootstrap Table的编辑按钮事件
$('table').on('click', '.edit-btn', function(e) {
const index = $(e.currentTarget).closest('tr').data('index');
this.openUploadModal(this.tableData[index]); // 假设tableData是Bootstrap Table的数据源
}.bind(this));
}
})
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save