feat(sip): 增强项目订单管理功能
- 添加项目名称和编码查询条件 -增加供应商查询条件 - 实现根据项目 ID 查询订单信息的功能 - 优化文件下载接口,支持自定义文件名 - 增加项目订单信息的插入校验,避免重复添加master
parent
ffa8a38fe8
commit
fae63f6c75
|
@ -8,6 +8,7 @@ import com.ruoyi.common.config.RuoYiConfig;
|
|||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.sip.domain.DeliveryList;
|
||||
|
@ -21,11 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||
|
@ -201,14 +198,14 @@ public class ProjectOrderInfoController extends BaseController
|
|||
}
|
||||
}
|
||||
@GetMapping("/file/download")
|
||||
public void download(String filePath, HttpServletRequest request, HttpServletResponse response) {
|
||||
public void download(@RequestParam("filePath") String filePath, @RequestParam("fileName") String fileName, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 下载名称
|
||||
String downloadPath = filePath.replace(Constants.RESOURCE_PREFIX,localPath);
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, filePath);
|
||||
FileUtils.setAttachmentResponseHeader(response, StringUtils.isEmpty(fileName) ? filePath : fileName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
|
|
|
@ -82,7 +82,13 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
|||
*/
|
||||
@Override
|
||||
public int insertProjectOrderInfo(ProjectOrderInfo projectOrderInfo) {
|
||||
|
||||
if (projectOrderInfo.getProjectId() == null) {
|
||||
throw new ServiceException("请选择项目");
|
||||
}
|
||||
List<ProjectOrderInfo> projectOrderInfos = this.selectProjectOrderInfoByProjectId(Collections.singletonList(projectOrderInfo.getProjectId()));
|
||||
if (CollUtil.isNotEmpty(projectOrderInfos)) {
|
||||
throw new ServiceException("该项目存在订单流转,无法添加");
|
||||
}
|
||||
// 生成订单编号
|
||||
String orderNumber = generateOrderNumber(projectOrderInfo.getProjectId());
|
||||
projectOrderInfo.setOrderCode(orderNumber);
|
||||
|
@ -192,7 +198,7 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
|||
|
||||
@Override
|
||||
public List<ProjectOrderInfo> selectProjectOrderInfoByProjectId(List<Long> projectId) {
|
||||
if (CollUtil.isNotEmpty(projectId)) {
|
||||
if (CollUtil.isEmpty(projectId)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return projectOrderInfoMapper.selectProjectOrderInfoByProjectId(projectId);
|
||||
|
|
|
@ -61,6 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectProjectOrderInfoRelationVo"/>
|
||||
<where>
|
||||
<if test="projectId != null "> and t1.project_id = #{projectId}</if>
|
||||
<if test="projectCode != null and projectCode!='' "> and t2.project_code = #{projectCode}</if>
|
||||
<if test="projectName != null and projectName!=''"> and t2.project_name = #{projectName}</if>
|
||||
<if test="province != null and province != ''"> and t1.province = #{province}</if>
|
||||
<if test="city != null and city != ''"> and t1.city = #{city}</if>
|
||||
<if test="businessPerson != null and businessPerson != ''"> and t1.business_person = #{businessPerson}</if>
|
||||
|
@ -77,11 +79,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="notifierEmail != null and notifierEmail != ''"> and t1.notifier_email = #{notifierEmail}</if>
|
||||
<if test="notifierPhone != null and notifierPhone != ''"> and t1.notifier_phone = #{notifierPhone}</if>
|
||||
<if test="duty != null and duty != ''"> and t1.duty = #{duty}</if>
|
||||
<if test="dutyName != null and dutyName != ''"> and t5.user_name like concat('%', #{dutyName}, '%')</if>
|
||||
<if test="dutyEmail != null and dutyEmail != ''"> and t1.duty_email = #{dutyEmail}</if>
|
||||
<if test="dutyPhone != null and dutyPhone != ''"> and t1.duty_phone = #{dutyPhone}</if>
|
||||
<if test="orderChannel != null and orderChannel != ''"> and t1.order_channel = #{orderChannel}</if>
|
||||
<if test="partnerCode != null and partnerCode != ''"> and t1.partner_code = #{partnerCode}</if>
|
||||
<if test="supplier != null and supplier != ''"> and t1.supplier = #{supplier}</if>
|
||||
<if test="supplier != null and supplier != ''"> and t1.supplier = #{supplier}</if>
|
||||
<if test="orderStatus != null and orderStatus != ''"> and t1.order_status = #{orderStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue