|
@ -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); |
|
|
} |
|
|
} |
|
|