refactor(sip): 优化订单合同文件关联逻辑

- 在 IProjectOrderFileLogService 接口中添加 updateOrderIdByIdList 方法
- 在 ProjectOrderFileLogMapper 接口中添加对应的 SQL 更新语句- 修改 ProjectOrderFileLogServiceImpl 实现类,添加 updateOrderIdByIdList 方法的实现
- 更新 ProjectOrderInfoController 中的文件上传逻辑,返回更详细的成功信息
-优化 ProjectOrderInfoServiceImpl 中的订单信息保存逻辑,关联合同文件- 调整 ProjectOperateLog 中操作时间的格式,增加时分秒信息
master
chenhao 2025-06-06 17:35:17 +08:00
parent 69ead14b10
commit 3f43659714
7 changed files with 34 additions and 3 deletions

View File

@ -182,7 +182,7 @@ public class ProjectOrderInfoController extends BaseController
return AjaxResult.error("上传失败");
}
fileLogService.insertProjectOrderFileLog(projectOrderFileLog);
return AjaxResult.success("导入成功");
return AjaxResult.success(projectOrderFileLog);
}

View File

@ -34,7 +34,7 @@ public class ProjectOperateLog extends BaseEntity
private String operateUserName;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operateTime;

View File

@ -2,6 +2,7 @@ package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.ProjectOrderFileLog;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -62,4 +63,8 @@ public interface ProjectOrderFileLogMapper
void deleteProjectOrderFileLogByOrderIdList(List<Long> longs);
List<ProjectOrderFileLog> listByOrderId(List<Long> orderIdList);
void updateOrderIdByIdList(@Param("orderId") Long orderId,@Param("list") List<Long> idList);
}

View File

@ -62,4 +62,6 @@ public interface IProjectOrderFileLogService
void deleteProjectOrderFileLogByOrderIdList(List<Long> longs);
List<ProjectOrderFileLog> listByOrderId(List<Long> longs);
void updateOrderIdByIdList(Long orderId, List<Long> idList) ;
}

View File

@ -2,6 +2,9 @@ package com.ruoyi.sip.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.ProjectOrderFileLogMapper;
@ -102,4 +105,12 @@ public class ProjectOrderFileLogServiceImpl implements IProjectOrderFileLogServi
public List<ProjectOrderFileLog> listByOrderId(List<Long> orderIdList) {
return projectOrderFileLogMapper.listByOrderId(orderIdList);
}
@Override
public void updateOrderIdByIdList(Long orderId, List<Long> idList) {
if (CollUtil.isEmpty(idList)){
return;
}
projectOrderFileLogMapper.updateOrderIdByIdList(orderId,idList);
}
}

View File

@ -89,7 +89,12 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
projectOrderInfo.setCreateTime(DateUtils.getNowDate());
projectOrderInfo.setCreateBy(ShiroUtils.getUserId().toString());
saveProductInfo(projectOrderInfo);
return projectOrderInfoMapper.insertProjectOrderInfo(projectOrderInfo);
List<ProjectOrderFileLog> contractFileList = projectOrderInfo.getContractFileList();
int i = projectOrderInfoMapper.insertProjectOrderInfo(projectOrderInfo);
if (CollUtil.isNotEmpty(contractFileList)) {
fileLogService.updateOrderIdByIdList(projectOrderInfo.getId(), contractFileList.stream().map(ProjectOrderFileLog::getId).collect(Collectors.toList()));
}
return i;
}
private void saveProductInfo(ProjectOrderInfo projectOrderInfo) {

View File

@ -75,6 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateOrderIdByIdList">
update project_order_file_log set order_id=#{orderId}
where id in
<foreach item="item" collection="list" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<delete id="deleteProjectOrderFileLogById" parameterType="Long">
delete from project_order_file_log where id = #{id}