Browse Source

[fix]售后管理:

售后单
修改售后详情报错问题,修改查询逻辑
修改派单和上传报告的表格样式
修改上传报告业务逻辑
新增根据id和类型查询附件信息
新增根据id和类型更新附件信息
dev
liuxiaoxu 6 months ago
parent
commit
bf8cf166f7
  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

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.StringUtils;
import com.ruoyi.system.domain.SysAttach;
import com.ruoyi.system.mapper.SysAttachMapper;
import com.ruoyi.system.service.ISysAttachFileService;
import com.ruoyi.system.service.ISysAttachService;
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.service.IAftersalesOrderService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/**
* 售后单Service业务层处理
@ -35,6 +37,10 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService
@Autowired
private ISysAttachFileService attachFileService;
@Autowired
private SysAttachMapper sysAttachMapper;
/**
* 查询售后单
*
@ -96,6 +102,7 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService
* @param aftersalesOrder 售后单
* @return 结果
*/
@Transactional
@Override
public int updateAftersalesOrder(AftersalesOrder aftersalesOrder)
{
@ -104,17 +111,33 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService
aftersalesOrder.setUpdateTime(DateUtils.getNowDate());
Long aftersalesOrderId = aftersalesOrder.getAftersalesOrderId();
String fileIdStr = aftersalesOrder.getFileIdStr();
Long attachId = null;
if (StringUtils.isNotEmpty(fileIdStr)){
//保存文件附件关联
SysAttach sysAttach = new SysAttach();
sysAttach.setCreateBy(ShiroUtils.getLoginName());
sysAttach.setCreateTime(new Date());
sysAttach.setSourceType("aftersalesOrder");
sysAttach.setSourceSubType("photo");
sysAttach.setRelId(aftersalesOrderId);
attachService.insertSysAttach(sysAttach);
SysAttach tempSysAttach = new SysAttach();
tempSysAttach.setSourceType("aftersalesOrder");
tempSysAttach.setSourceSubType("photo");
tempSysAttach.setRelId(aftersalesOrderId);
List<SysAttach> sysAttaches = attachService.selectSysAttachList(tempSysAttach);
if (StringUtils.isEmpty(sysAttaches)){
// 保存新的文件附件关联
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(","));
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);
/**
* 查询附件业务关联列表
*
@ -44,6 +48,15 @@ public interface SysAttachMapper
*/
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}
</select>
<insert id="insertSysAttach" parameterType="SysAttach" useGeneratedKeys="true" keyProperty="id">
insert into sys_attach
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -77,6 +78,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</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 from sys_attach where id = #{id}
</delete>

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

@ -47,21 +47,6 @@
</div>
</form>
</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">
<table id="bootstrap-table"></table>
</div>
@ -71,8 +56,6 @@
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:edit')}]];
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 uploadReportFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:uploadReport')}]];
var detailFlag = [[${@permission.hasPermi('aftersales:aftersalesOrder:detail')}]];
@ -201,26 +184,20 @@
// 示例逻辑:
// 1. 确认用户操作
if (confirm('确认要派单吗?')) {
var url = ctx + 'aftersales/aftersalesOrder/sendOrders/'+aftersalesOrderId;
console.log(url);
$.modal.open("派单",url);
}
}
/*上传报告*/
function uploadReport(aftersalesOrderId) {
// 在这里编写派单操作的逻辑,使用传入的aftersalesOrderId参数
// 示例逻辑:
// 1. 确认用户操作
if (confirm('确认要上传报告吗?')) {
var url = ctx + 'aftersales/aftersalesOrder/uploadReport/'+aftersalesOrderId;
console.log(url);
$.modal.open("上传报告",url);
}
}
</script>
</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">
</div>
</div>
<div class="form-row">
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<h3 class="mb-4">选择设备</h3>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<div class="form-group">
<h3 class="mb-4">派单</h3>
<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 class="form-row">
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<h3 class="mb-4">选择设备</h3>
<table id="bootstrap-table"></table>

Loading…
Cancel
Save