diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java index 0e0ffc24..874ff8d3 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectOrderInfoController.java @@ -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); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java index 28fd7174..e8467eb0 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectOrderInfoServiceImpl.java @@ -82,7 +82,13 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService { */ @Override public int insertProjectOrderInfo(ProjectOrderInfo projectOrderInfo) { - + if (projectOrderInfo.getProjectId() == null) { + throw new ServiceException("请选择项目"); + } + List 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 selectProjectOrderInfoByProjectId(List projectId) { - if (CollUtil.isNotEmpty(projectId)) { + if (CollUtil.isEmpty(projectId)) { return Collections.emptyList(); } return projectOrderInfoMapper.selectProjectOrderInfoByProjectId(projectId); diff --git a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml index b98e238e..c0d56f0f 100644 --- a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml @@ -61,6 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.project_id = #{projectId} + and t2.project_code = #{projectCode} + and t2.project_name = #{projectName} and t1.province = #{province} and t1.city = #{city} and t1.business_person = #{businessPerson} @@ -77,11 +79,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.notifier_email = #{notifierEmail} and t1.notifier_phone = #{notifierPhone} and t1.duty = #{duty} + and t5.user_name like concat('%', #{dutyName}, '%') and t1.duty_email = #{dutyEmail} and t1.duty_phone = #{dutyPhone} and t1.order_channel = #{orderChannel} and t1.partner_code = #{partnerCode} and t1.supplier = #{supplier} + and t1.supplier = #{supplier} and t1.order_status = #{orderStatus}