From 22a1795593fd33c27d338f0485bffdb3ce141ac5 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Sat, 20 Jul 2024 11:21:04 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E5=94=AE=E5=90=8E=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=94=AE=E5=90=8E=E9=80=9A=E7=9F=A5=E5=8D=95=E5=92=8C=E5=94=AE?= =?UTF-8?q?=E5=90=8E=E5=8D=95=E7=9A=84=E5=AE=A2=E6=88=B7=E8=A6=81=E6=B1=82?= =?UTF-8?q?=E5=87=BA=E5=8F=91=E6=97=A5=E6=9C=9F=E7=B1=BB=E5=9E=8B=E4=B8=BA?= =?UTF-8?q?Date=E7=B1=BB=E5=9E=8B=20=E6=96=B0=E5=A2=9E=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=94=AE=E5=90=8E=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=94=80=E5=94=AE=E5=94=AE=E5=90=8E=E9=80=9A=E7=9F=A5=E5=8D=95?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E9=94=80=E5=94=AE=E5=94=AE=E5=90=8E=E9=80=9A=E7=9F=A5=E5=8D=95?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E9=80=9A=E8=BF=87=E5=90=8E=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2=E7=94=9F=E4=BA=A7=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aftersales/domain/AftersalesOrder.java | 16 +++---- .../service/IAftersalesOrderService.java | 5 +++ .../impl/AftersalesOrderServiceImpl.java | 44 ++++++++++++++++++- .../SalesAftersalesNoticeController.java | 10 +++++ .../sales/domain/SalesAftersalesNotice.java | 16 +++---- .../mapper/SalesAftersalesNoticeMapper.java | 5 +++ .../ISalesAftersalesNoticeService.java | 5 +++ .../SalesAftersalesNoticeServiceImpl.java | 9 ++++ .../sales/SalesAftersalesNoticeMapper.xml | 8 +++- 9 files changed, 100 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOrder.java index 99b56e68..9aaf437f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesOrder.java @@ -74,7 +74,7 @@ public class AftersalesOrder extends BaseEntity /** 客户要求出发日期 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "客户要求出发日期", width = 30, dateFormat = "yyyy-MM-dd") - private String startDate; + private Date startDate; /** 收货联系人 */ @Excel(name = "收货联系人") @@ -261,16 +261,16 @@ public class AftersalesOrder extends BaseEntity { return enterpriseSum; } - public void setStartDate(String startDate) - { - this.startDate = startDate; - } - public String getStartDate() - { + public Date getStartDate() { return startDate; } - public void setDeliveryName(String deliveryName) + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public void setDeliveryName(String deliveryName) { this.deliveryName = deliveryName; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOrderService.java index b118a1b1..1951b077 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAftersalesOrderService.java @@ -2,6 +2,7 @@ package com.ruoyi.aftersales.service; import java.util.List; import com.ruoyi.aftersales.domain.AftersalesOrder; +import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; import org.activiti.engine.runtime.ProcessInstance; /** @@ -83,4 +84,8 @@ public interface IAftersalesOrderService */ int restoreAftersalesOrderById(Long aftersalesOrderId); + /** + * 销售售后通知单 审核后生成售后单 + * */ + void generateAftersalesOrderBySalesAftersalesNotice(SalesAftersalesNoticeVO tempSalesAftersalesNoticeVO); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOrderServiceImpl.java index f1d15f54..e6f19eec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesOrderServiceImpl.java @@ -8,12 +8,16 @@ import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; +import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; import com.ruoyi.system.domain.SysAttach; +import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.mapper.SysAttachMapper; +import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachService; import com.ruoyi.system.service.ISysRoleService; +import lombok.extern.slf4j.Slf4j; import org.activiti.engine.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -29,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; * @author 刘晓旭 * @date 2024-04-24 */ +@Slf4j @Service public class AftersalesOrderServiceImpl implements IAftersalesOrderService { @@ -41,6 +46,8 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService @Autowired private ISysAttachFileService attachFileService; + @Autowired + private SysMakeOrderMapper sysMakeOrderMapper; /** * 查询售后单 @@ -64,7 +71,8 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService public AftersalesOrder selectAftersalesOrderWithAttachById(Long aftersalesOrderId) { AftersalesOrder aftersalesOrder = aftersalesOrderMapper.selectAftersalesOrderWithAttachById(aftersalesOrderId); - String startDate = aftersalesOrder.getStartDate(); + + Date startDate = aftersalesOrder.getStartDate(); aftersalesOrder.setStartDate(startDate); return aftersalesOrder; } @@ -193,4 +201,38 @@ public class AftersalesOrderServiceImpl implements IAftersalesOrderService return aftersalesOrderMapper.restoreAftersalesOrderById(aftersalesOrderId); } + + /** + * 销售售后通知单 审核后生成售后单 + * */ + @Override + public void generateAftersalesOrderBySalesAftersalesNotice(SalesAftersalesNoticeVO tempSalesAftersalesNoticeVO) { + + + AftersalesOrder aftersalesOrder = new AftersalesOrder(); + String salesOrderCode = tempSalesAftersalesNoticeVO.getSalesOrderCode(); + SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode); + + if (sysMakeOrder == null){ + log.warn("与生产单号关联的销售单号为空:{}",salesOrderCode); + } + aftersalesOrder.setAftersalesOrderCode(tempSalesAftersalesNoticeVO.getAftersalesNoticeCode()); + aftersalesOrder.setSalesOrderCode(salesOrderCode); + aftersalesOrder.setMakeNo(sysMakeOrder.getMakeNo()); + aftersalesOrder.setBusinessName(tempSalesAftersalesNoticeVO.getBusinessMembers()); + aftersalesOrder.setAftersalesName(tempSalesAftersalesNoticeVO.getApplyUser()); + aftersalesOrder.setAftersalesStatus(tempSalesAftersalesNoticeVO.getAftersalesStatus()); + aftersalesOrder.setCustomerId(tempSalesAftersalesNoticeVO.getEnterpriseCode()); + aftersalesOrder.setCustomerName(tempSalesAftersalesNoticeVO.getEnterpriseName()); + aftersalesOrder.setMaterialSum(tempSalesAftersalesNoticeVO.getMaterialSum()); + aftersalesOrder.setEnterpriseSum(tempSalesAftersalesNoticeVO.getEnterpriseSum()); + aftersalesOrder.setStartDate(tempSalesAftersalesNoticeVO.getStartTime()); + aftersalesOrder.setDeliveryName(tempSalesAftersalesNoticeVO.getCustomerContact()); + aftersalesOrder.setDeliveryNumber(tempSalesAftersalesNoticeVO.getContactNumber()); + aftersalesOrder.setCompanyAddress(tempSalesAftersalesNoticeVO.getCompanyAddress()); + aftersalesOrder.setCreateBy(tempSalesAftersalesNoticeVO.getCreateBy()); + aftersalesOrder.setCreateTime(tempSalesAftersalesNoticeVO.getCreateTime()); + aftersalesOrderMapper.insertAftersalesOrder(aftersalesOrder); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java index 7240a215..9beb6b1b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesAftersalesNoticeController.java @@ -3,6 +3,7 @@ package com.ruoyi.sales.controller; import java.util.HashMap; import java.util.List; +import com.ruoyi.aftersales.service.IAftersalesOrderService; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.sales.domain.VO.SalesAftersalesNoticeVO; import org.activiti.engine.RuntimeService; @@ -51,6 +52,9 @@ public class SalesAftersalesNoticeController extends BaseController @Autowired private IProcessService processService; + @Autowired + private IAftersalesOrderService aftersalesOrderService; + @RequiresPermissions("sales:afterSalesNotice:view") @GetMapping() @@ -168,6 +172,12 @@ public class SalesAftersalesNoticeController extends BaseController if (processIsFinish) { // 审核通过 aftersalesNoticeVO.setAuditStatus("1"); + String aftersalesNoticeCode = aftersalesNoticeVO.getAftersalesNoticeCode(); + SalesAftersalesNoticeVO tempSalesAftersalesNoticeVO = salesAftersalesNoticeService.selectSalesAftersalesNoticeByCode(aftersalesNoticeCode); + + //如果审核通过生成售后单 + aftersalesOrderService.generateAftersalesOrderBySalesAftersalesNotice(tempSalesAftersalesNoticeVO); + // 提交 if("submit".equals(instanceType)){ // 使用状态-是 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesAftersalesNotice.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesAftersalesNotice.java index 27db7e76..0ea051ae 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesAftersalesNotice.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesAftersalesNotice.java @@ -66,7 +66,7 @@ public class SalesAftersalesNotice extends BaseEntity /** 客户要求出发日期 */ @Excel(name = "客户要求出发日期") - private String startTime; + private Date startTime; /** 联系人 */ @Excel(name = "联系人") @@ -221,16 +221,16 @@ public class SalesAftersalesNotice extends BaseEntity { return enterpriseSum; } - public void setStartTime(String startTime) - { - this.startTime = startTime; - } - public String getStartTime() - { + public Date getStartTime() { return startTime; } - public void setCustomerContact(String customerContact) + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public void setCustomerContact(String customerContact) { this.customerContact = customerContact; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java index 905ad7c6..feaf93a2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesAftersalesNoticeMapper.java @@ -75,4 +75,9 @@ public interface SalesAftersalesNoticeMapper * @return 结果 */ public int restoreSalesAftersalesNoticeById(Long aftersalesNoticeId); + + /** + * 根据售后单号查询销售售后通知单 + * */ + SalesAftersalesNoticeVO selectSalesAftersalesNoticeByCode(String aftersalesNoticeCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java index 83afbf0d..92208f86 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesAftersalesNoticeService.java @@ -83,4 +83,9 @@ public interface ISalesAftersalesNoticeService * 审批流程启动 * */ ProcessInstance submitApply(SalesAftersalesNotice salesAftersalesNotice); + + /** + * 根据售后单号查询销售售后通知单 + * */ + SalesAftersalesNoticeVO selectSalesAftersalesNoticeByCode(String aftersalesNoticeCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java index c3482da9..5270a0b6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesAftersalesNoticeServiceImpl.java @@ -242,6 +242,15 @@ public class SalesAftersalesNoticeServiceImpl implements ISalesAftersalesNoticeS return processInstance; } + /** + * 根据售后单号查询销售售后通知单 + * */ + @Override + public SalesAftersalesNoticeVO selectSalesAftersalesNoticeByCode(String aftersalesNoticeCode) { + + return salesAftersalesNoticeMapper.selectSalesAftersalesNoticeByCode(aftersalesNoticeCode); + } + /** * 创建售后单审核流程 diff --git a/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml b/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml index c4448fd0..277d0b3a 100644 --- a/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/sales/SalesAftersalesNoticeMapper.xml @@ -61,7 +61,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where aftersales_notice_id = #{aftersalesNoticeId} - + + + + insert into sales_aftersales_notice