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