yzc 1 éve
szülő
commit
38b7efa323
29 módosított fájl, 1061 hozzáadás és 3 törlés
  1. 2 2
      code/src/test/java/SaleDataSource.java
  2. 67 0
      hx-sale/src/main/java/com/fjhx/sale/controller/after/AfterSalesController.java
  3. 37 0
      hx-sale/src/main/java/com/fjhx/sale/controller/after/AfterSalesDetailController.java
  4. 46 0
      hx-sale/src/main/java/com/fjhx/sale/controller/after/AfterSalesRecordsController.java
  5. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesDetailDto.java
  6. 32 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesDetailSelectDto.java
  7. 25 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesDto.java
  8. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesRecordSelectDto.java
  9. 25 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesRecordsDto.java
  10. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesSelectDto.java
  11. 46 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSales.java
  12. 58 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSalesDetail.java
  13. 41 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSalesRecords.java
  14. 62 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/vo/AfterSalesDetailVo.java
  15. 22 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/vo/AfterSalesRecordsVo.java
  16. 17 0
      hx-sale/src/main/java/com/fjhx/sale/entity/after/vo/AfterSalesVo.java
  17. 26 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/after/AfterSalesDetailMapper.java
  18. 17 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/after/AfterSalesMapper.java
  19. 26 0
      hx-sale/src/main/java/com/fjhx/sale/mapper/after/AfterSalesRecordsMapper.java
  20. 25 0
      hx-sale/src/main/java/com/fjhx/sale/service/after/AfterSalesDetailService.java
  21. 31 0
      hx-sale/src/main/java/com/fjhx/sale/service/after/AfterSalesRecordsService.java
  22. 42 0
      hx-sale/src/main/java/com/fjhx/sale/service/after/AfterSalesService.java
  23. 81 0
      hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesDetailServiceImpl.java
  24. 49 0
      hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesRecordsServicesImpl.java
  25. 184 0
      hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesServiceImpl.java
  26. 23 0
      hx-sale/src/main/resources/mapper/after/AfterSalesDetailMapper.xml
  27. 4 0
      hx-sale/src/main/resources/mapper/after/AfterSalesMapper.xml
  28. 18 0
      hx-sale/src/main/resources/mapper/after/AfterSalesRecordsMapper.xml
  29. 4 1
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/emums/StockWaitType.java

+ 2 - 2
code/src/test/java/SaleDataSource.java

@@ -4,9 +4,9 @@ public class SaleDataSource {
 
     public static void main(String[] args) {
         GeneratorApplication.builder()
-                .url("jdbc:mysql://36.134.91.96:12333/bytesailing_sale?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
+                .url("jdbc:mysql://121.37.194.75:30102/bytesailing_sale?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true")
                 .username("root")
-                .password("Fjhx@pwd123")
+                .password("5fWD*oa^nso@kmKa")
                 .port(9989)
                 .module("hx-sale")
                 .parent("com.fjhx.sale")

+ 67 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/after/AfterSalesController.java

@@ -0,0 +1,67 @@
+package com.fjhx.sale.controller.after;
+
+import com.fjhx.sale.entity.after.dto.AfterSalesDto;
+import com.fjhx.sale.service.after.AfterSalesService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 售后管理 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@RestController
+@RequestMapping("/afterSales")
+public class AfterSalesController {
+
+    @Autowired
+    private AfterSalesService afterSalesService;
+
+    /**
+     * 售后管理新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody AfterSalesDto afterSalesDto) {
+        afterSalesService.add(afterSalesDto);
+    }
+
+    /**
+     * 售后管理编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody AfterSalesDto afterSalesDto) {
+        afterSalesService.edit(afterSalesDto);
+    }
+
+    /**
+     * 售后退货
+     */
+    @PostMapping("/salesReturn")
+    public void salesReturn(@RequestBody AfterSalesDto afterSalesDto) {
+        afterSalesService.salesReturn(afterSalesDto);
+    }
+
+    /**
+     * 售后换货
+     */
+    @PostMapping("/salesReplace")
+    public void salesReplace(@RequestBody AfterSalesDto afterSalesDto) {
+        afterSalesService.salesReplace(afterSalesDto);
+    }
+
+    /**
+     * 发起采购
+     */
+    @PostMapping("/initPurchase")
+    public void initPurchase(@RequestBody AfterSalesDto afterSalesDto) {
+        afterSalesService.initPurchase(afterSalesDto);
+    }
+
+}

+ 37 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/after/AfterSalesDetailController.java

@@ -0,0 +1,37 @@
+package com.fjhx.sale.controller.after;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.after.dto.AfterSalesDetailSelectDto;
+import com.fjhx.sale.entity.after.vo.AfterSalesDetailVo;
+import com.fjhx.sale.service.after.AfterSalesDetailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 售后明细 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@RestController
+@RequestMapping("/afterSalesDetail")
+public class AfterSalesDetailController {
+
+    @Autowired
+    private AfterSalesDetailService afterSalesDetailService;
+
+    /**
+     * 售后明细分页
+     */
+    @PostMapping("/page")
+    public Page<AfterSalesDetailVo> page(@RequestBody AfterSalesDetailSelectDto dto) {
+        return afterSalesDetailService.getPage(dto);
+    }
+
+}

+ 46 - 0
hx-sale/src/main/java/com/fjhx/sale/controller/after/AfterSalesRecordsController.java

@@ -0,0 +1,46 @@
+package com.fjhx.sale.controller.after;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.after.dto.AfterSalesRecordSelectDto;
+import com.fjhx.sale.entity.after.dto.AfterSalesRecordsDto;
+import com.fjhx.sale.entity.after.vo.AfterSalesRecordsVo;
+import com.fjhx.sale.service.after.AfterSalesRecordsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 售后跟进记录 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@RestController
+@RequestMapping("/afterSalesRecords")
+public class AfterSalesRecordsController {
+
+    @Autowired
+    private AfterSalesRecordsService afterSalesRecordsService;
+
+    /**
+     * 售后跟进记录分页
+     */
+    @PostMapping("/page")
+    public Page<AfterSalesRecordsVo> page(@RequestBody AfterSalesRecordSelectDto dto) {
+        return afterSalesRecordsService.getPage(dto);
+    }
+
+    /**
+     * 售后跟进记录新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody AfterSalesRecordsDto afterSalesRecordDto) {
+        afterSalesRecordsService.add(afterSalesRecordDto);
+    }
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesDetailDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.after.dto;
+
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后明细新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesDetailDto extends AfterSalesDetail {
+
+}

+ 32 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesDetailSelectDto.java

@@ -0,0 +1,32 @@
+package com.fjhx.sale.entity.after.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后明细列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesDetailSelectDto extends BaseSelectDto {
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
+
+    /**
+     * 售后类型
+     */
+    private String type;
+
+    /**
+     * 售后状态
+     */
+    private String status;
+
+}

+ 25 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesDto.java

@@ -0,0 +1,25 @@
+package com.fjhx.sale.entity.after.dto;
+
+import com.fjhx.sale.entity.after.po.AfterSales;
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 售后管理新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesDto extends AfterSales {
+
+    /**
+     * 售后明细列表
+     */
+    List<AfterSalesDetail> afterSalesDetailList;
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesRecordSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.after.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后跟进记录列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesRecordSelectDto extends BaseSelectDto {
+
+}

+ 25 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesRecordsDto.java

@@ -0,0 +1,25 @@
+package com.fjhx.sale.entity.after.dto;
+
+import com.fjhx.file.entity.ObsFile;
+import com.fjhx.sale.entity.after.po.AfterSalesRecords;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 售后跟进记录新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesRecordsDto extends AfterSalesRecords {
+
+    /**
+     * 附件列表
+     */
+    private List<ObsFile> fileList;
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/dto/AfterSalesSelectDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.after.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后管理列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesSelectDto extends BaseSelectDto {
+
+}

+ 46 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSales.java

@@ -0,0 +1,46 @@
+package com.fjhx.sale.entity.after.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 售后管理
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+@TableName("after_sales")
+public class AfterSales extends BasePo {
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
+
+    /**
+     * 销售合同id
+     */
+    private Long contractId;
+
+    /**
+     * 售后类型 字典
+     */
+    private String type;
+
+    /**
+     * 说明
+     */
+    private String remark;
+
+    /**
+     * 售后状态 0进行中1关闭
+     */
+    private Integer status;
+
+}

+ 58 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSalesDetail.java

@@ -0,0 +1,58 @@
+package com.fjhx.sale.entity.after.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 售后明细
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+@TableName("after_sales_detail")
+public class AfterSalesDetail extends BasePo {
+
+    /**
+     * 售后id
+     */
+    private Long afterSalesId;
+
+    /**
+     * 产品id
+     */
+    private Long productId;
+
+    /**
+     * 售后数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 销售合同明细id
+     */
+    private Long contractProductId;
+
+    /**
+     * 商品单价
+     */
+    private BigDecimal price;
+
+    /**
+     * 商品金额
+     */
+    private BigDecimal amount;
+
+}

+ 41 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/po/AfterSalesRecords.java

@@ -0,0 +1,41 @@
+package com.fjhx.sale.entity.after.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 售后跟进记录
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+@TableName("after_sales_records")
+public class AfterSalesRecords extends BasePo {
+
+    /**
+     * 售后id
+     */
+    private Long afterSalesId;
+
+    /**
+     * 销售合同id
+     */
+    private Long followUpTime;
+
+    /**
+     * 跟进用户id
+     */
+    private Long followUpUserId;
+
+    /**
+     * 说明
+     */
+    private String remark;
+
+}

+ 62 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/vo/AfterSalesDetailVo.java

@@ -0,0 +1,62 @@
+package com.fjhx.sale.entity.after.vo;
+
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后明细列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesDetailVo extends AfterSalesDetail {
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
+    /**
+     * 客户名称
+     */
+    private String customerName;
+    /**
+     * 合同id
+     */
+    private Long contractId;
+    /**
+     * 合同编号
+     */
+    private String contractCode;
+    /**
+     * 售后类型
+     */
+    private String type;
+    /**
+     * 售后状态
+     */
+    private Integer status;
+
+    /**
+     * 产品编码
+     */
+    private String productCode;
+
+    /**
+     * 产品名称
+     */
+    private String productName;
+
+    /**
+     * 产品规格
+     */
+    private String productSpec;
+
+    /**
+     * 产品规格
+     */
+    private String productUnit;
+
+}

+ 22 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/vo/AfterSalesRecordsVo.java

@@ -0,0 +1,22 @@
+package com.fjhx.sale.entity.after.vo;
+
+import com.fjhx.sale.entity.after.po.AfterSalesRecords;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后跟进记录列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesRecordsVo extends AfterSalesRecords {
+
+    /**
+     * 跟进用户名称
+     */
+    private String followUpUserName;
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/after/vo/AfterSalesVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.entity.after.vo;
+
+import com.fjhx.sale.entity.after.po.AfterSales;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 售后管理列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Getter
+@Setter
+public class AfterSalesVo extends AfterSales {
+
+}

+ 26 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/after/AfterSalesDetailMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.sale.mapper.after;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import com.fjhx.sale.entity.after.vo.AfterSalesDetailVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 售后明细 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+public interface AfterSalesDetailMapper extends BaseMapper<AfterSalesDetail> {
+
+    /**
+     * 售后明细分页
+     */
+    Page<AfterSalesDetailVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<AfterSalesDetail> wrapper);
+
+}

+ 17 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/after/AfterSalesMapper.java

@@ -0,0 +1,17 @@
+package com.fjhx.sale.mapper.after;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.sale.entity.after.po.AfterSales;
+
+
+/**
+ * <p>
+ * 售后管理 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+public interface AfterSalesMapper extends BaseMapper<AfterSales> {
+
+}

+ 26 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/after/AfterSalesRecordsMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.sale.mapper.after;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.after.po.AfterSalesRecords;
+import com.fjhx.sale.entity.after.vo.AfterSalesRecordsVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 售后跟进记录 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+public interface AfterSalesRecordsMapper extends BaseMapper<AfterSalesRecords> {
+
+    /**
+     * 售后跟进记录分页
+     */
+    Page<AfterSalesRecordsVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<AfterSalesRecords> wrapper);
+
+}

+ 25 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/AfterSalesDetailService.java

@@ -0,0 +1,25 @@
+package com.fjhx.sale.service.after;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.after.dto.AfterSalesDetailSelectDto;
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import com.fjhx.sale.entity.after.vo.AfterSalesDetailVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 售后明细 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+public interface AfterSalesDetailService extends BaseService<AfterSalesDetail> {
+
+    /**
+     * 售后明细分页
+     */
+    Page<AfterSalesDetailVo> getPage(AfterSalesDetailSelectDto dto);
+
+}

+ 31 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/AfterSalesRecordsService.java

@@ -0,0 +1,31 @@
+package com.fjhx.sale.service.after;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.sale.entity.after.dto.AfterSalesRecordSelectDto;
+import com.fjhx.sale.entity.after.dto.AfterSalesRecordsDto;
+import com.fjhx.sale.entity.after.po.AfterSalesRecords;
+import com.fjhx.sale.entity.after.vo.AfterSalesRecordsVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 售后跟进记录 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+public interface AfterSalesRecordsService extends BaseService<AfterSalesRecords> {
+
+    /**
+     * 售后跟进记录分页
+     */
+    Page<AfterSalesRecordsVo> getPage(AfterSalesRecordSelectDto dto);
+
+    /**
+     * 售后跟进记录新增
+     */
+    void add(AfterSalesRecordsDto afterSalesRecordDto);
+
+}

+ 42 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/AfterSalesService.java

@@ -0,0 +1,42 @@
+package com.fjhx.sale.service.after;
+
+import com.fjhx.sale.entity.after.dto.AfterSalesDto;
+import com.fjhx.sale.entity.after.po.AfterSales;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 售后管理 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+public interface AfterSalesService extends BaseService<AfterSales> {
+
+    /**
+     * 售后管理新增
+     */
+    void add(AfterSalesDto afterSalesDto);
+
+    /**
+     * 售后管理编辑
+     */
+    void edit(AfterSalesDto afterSalesDto);
+
+    /**
+     * 售后退货
+     */
+    void salesReturn(AfterSalesDto afterSalesDto);
+
+    /**
+     * 售后换货
+     */
+    void salesReplace(AfterSalesDto afterSalesDto);
+
+    /**
+     * 销售发起采购
+     */
+    void initPurchase(AfterSalesDto afterSalesDto);
+}

+ 81 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesDetailServiceImpl.java

@@ -0,0 +1,81 @@
+package com.fjhx.sale.service.after.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.customer.service.customer.CustomerService;
+import com.fjhx.item.entity.product.po.ProductInfo;
+import com.fjhx.item.service.product.ProductInfoService;
+import com.fjhx.sale.entity.after.dto.AfterSalesDetailSelectDto;
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import com.fjhx.sale.entity.after.vo.AfterSalesDetailVo;
+import com.fjhx.sale.mapper.after.AfterSalesDetailMapper;
+import com.fjhx.sale.service.after.AfterSalesDetailService;
+import com.fjhx.sale.service.contract.ContractService;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * <p>
+ * 售后明细 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Service
+public class AfterSalesDetailServiceImpl extends ServiceImpl<AfterSalesDetailMapper, AfterSalesDetail> implements AfterSalesDetailService {
+
+    @Autowired
+    private CustomerService customerService;
+    @Autowired
+    private ContractService contractService;
+    @Autowired
+    private ProductInfoService productInfoService;
+
+    @Override
+    public Page<AfterSalesDetailVo> getPage(AfterSalesDetailSelectDto dto) {
+        IWrapper<AfterSalesDetail> wrapper = getWrapper();
+        //客户id过滤
+        wrapper.eq("as1", AfterSalesDetailVo::getCustomerId, dto.getCustomerId());
+        //售后类型过滤
+        wrapper.eq("as1", AfterSalesDetailVo::getType, dto.getType());
+        //售后状态过滤
+        wrapper.eq("as1", AfterSalesDetailVo::getStatus, dto.getStatus());
+        //关键字搜索
+        if (ObjectUtils.isNotEmpty(dto.getKeyword())) {
+            List<Long> pIds = productInfoService.listObject(ProductInfo::getId, q -> q
+                    .like(ProductInfo::getCode, dto.getKeyword())
+                    .like(ProductInfo::getName, dto.getKeyword())
+                    .like(ProductInfo::getSpec, dto.getKeyword())
+            );
+            pIds.add(null);
+            wrapper.in("asd", AfterSalesDetail::getProductId, pIds);
+        }
+        //根据创建时间倒序
+        wrapper.orderByDesc("as1", AfterSalesDetail::getCreateTime);
+        Page<AfterSalesDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<AfterSalesDetailVo> records = page.getRecords();
+        //赋值客户名称
+        customerService.attributeAssign(records, AfterSalesDetailVo::getCustomerId, (item, customer) -> {
+            item.setCustomerName(customer.getName());
+        });
+        //赋值合同编号
+        contractService.attributeAssign(records, AfterSalesDetailVo::getContractId, (item, contract) -> {
+            item.setContractCode(contract.getCode());
+        });
+        //赋值产品信息
+        productInfoService.attributeAssign(records, AfterSalesDetailVo::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCode());
+            item.setProductName(productInfo.getName());
+            item.setProductUnit(productInfo.getSpec());
+            item.setProductUnit(productInfo.getUnit());
+        });
+        return page;
+    }
+
+}

+ 49 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesRecordsServicesImpl.java

@@ -0,0 +1,49 @@
+package com.fjhx.sale.service.after.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.file.utils.ObsFileUtil;
+import com.fjhx.sale.entity.after.dto.AfterSalesRecordSelectDto;
+import com.fjhx.sale.entity.after.dto.AfterSalesRecordsDto;
+import com.fjhx.sale.entity.after.po.AfterSalesRecords;
+import com.fjhx.sale.entity.after.vo.AfterSalesRecordsVo;
+import com.fjhx.sale.mapper.after.AfterSalesRecordsMapper;
+import com.fjhx.sale.service.after.AfterSalesRecordsService;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.system.utils.UserUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * <p>
+ * 售后跟进记录 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Service
+public class AfterSalesRecordsServicesImpl extends ServiceImpl<AfterSalesRecordsMapper, AfterSalesRecords> implements AfterSalesRecordsService {
+
+    @Override
+    public Page<AfterSalesRecordsVo> getPage(AfterSalesRecordSelectDto dto) {
+        IWrapper<AfterSalesRecords> wrapper = getWrapper();
+        wrapper.orderByDesc("asr", AfterSalesRecords::getFollowUpTime);
+        Page<AfterSalesRecordsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<AfterSalesRecordsVo> records = page.getRecords();
+        //赋值跟进人名称
+        UserUtil.assignmentNickName(records, AfterSalesRecordsVo::getFollowUpUserId, AfterSalesRecordsVo::setFollowUpUserName);
+        return page;
+    }
+
+    @DSTransactional
+    @Override
+    public void add(AfterSalesRecordsDto afterSalesRecordDto) {
+        this.save(afterSalesRecordDto);
+        ObsFileUtil.saveFile(afterSalesRecordDto.getFileList(), afterSalesRecordDto.getId());
+    }
+
+}

+ 184 - 0
hx-sale/src/main/java/com/fjhx/sale/service/after/impl/AfterSalesServiceImpl.java

@@ -0,0 +1,184 @@
+package com.fjhx.sale.service.after.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.utils.Assert;
+import com.fjhx.sale.entity.after.dto.AfterSalesDto;
+import com.fjhx.sale.entity.after.po.AfterSales;
+import com.fjhx.sale.entity.after.po.AfterSalesDetail;
+import com.fjhx.sale.entity.contract.po.ContractProduct;
+import com.fjhx.sale.mapper.after.AfterSalesMapper;
+import com.fjhx.sale.service.after.AfterSalesDetailService;
+import com.fjhx.sale.service.after.AfterSalesService;
+import com.fjhx.sale.service.contract.ContractProductService;
+import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.po.StockWait;
+import com.fjhx.wms.entity.stock.po.StockWaitDetails;
+import com.fjhx.wms.service.stock.StockWaitDetailsService;
+import com.fjhx.wms.service.stock.StockWaitService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * <p>
+ * 售后管理 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-20
+ */
+@Service
+public class AfterSalesServiceImpl extends ServiceImpl<AfterSalesMapper, AfterSales> implements AfterSalesService {
+    @Autowired
+    private AfterSalesDetailService afterSalesDetailService;
+    @Autowired
+    private StockWaitService stockWaitService;
+    @Autowired
+    private StockWaitDetailsService stockWaitDetailsService;
+    @Autowired
+    private ContractProductService contractProductService;
+
+    @DSTransactional
+    @Override
+    public void add(AfterSalesDto afterSalesDto) {
+        this.save(afterSalesDto);
+        List<AfterSalesDetail> afterSalesDetailList = afterSalesDto.getAfterSalesDetailList();
+        afterSalesDetailList.forEach(item -> item.setAfterSalesId(afterSalesDto.getId()));
+        //赋值dan
+        List<Long> contractProductIds = afterSalesDetailList.stream().distinct().map(AfterSalesDetail::getContractProductId).collect(Collectors.toList());
+        Map<Long, ContractProduct> longContractProductMap = new HashMap<>();
+        if (ObjectUtil.isNotEmpty(contractProductIds)) {
+            longContractProductMap = contractProductService.mapKEntity(ContractProduct::getId, q -> q.in(ContractProduct::getId, contractProductIds));
+        }
+        for (AfterSalesDetail afterSalesDetail : afterSalesDetailList) {
+            //赋值单价信息
+            ContractProduct oldContractProduct = longContractProductMap.get(afterSalesDetail.getContractProductId());
+            afterSalesDetail.setPrice(BigDecimal.ZERO);
+            if (ObjectUtil.isNotEmpty(oldContractProduct)) {
+                afterSalesDetail.setPrice(oldContractProduct.getPrice());
+            }
+            afterSalesDetail.setAmount(afterSalesDetail.getQuantity().multiply(afterSalesDetail.getPrice()));
+        }
+        afterSalesDetailService.saveBatch(afterSalesDetailList);
+    }
+
+    @Override
+    public void edit(AfterSalesDto afterSalesDto) {
+        this.updateById(afterSalesDto);
+    }
+
+    /**
+     * 退货
+     */
+    @DSTransactional
+    @Override
+    public void salesReturn(AfterSalesDto afterSalesDto) {
+        Assert.notEmpty(afterSalesDto.getId(), "售后id不能为空");
+        AfterSales afterSales = this.getById(afterSalesDto.getId());
+        Assert.notEmpty(afterSales, "查询不到售后信息");
+
+        //生成售后退货待入库信息
+        StockWait stockWait = new StockWait();
+        stockWait.setType(1);//入库
+        stockWait.setStatus(0);//待入库
+        stockWait.setBusinessType(StockWaitType.SALES_RETURN_IN.getDetailType());
+        stockWait.setBusinessId(afterSales.getId());
+        stockWaitService.save(stockWait);
+
+        //生成售后退货待入库明细
+        List<AfterSalesDetail> afterSalesDetailList = afterSalesDetailService.list(q -> q.eq(AfterSalesDetail::getAfterSalesId, afterSales.getId()));
+        List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();
+        for (AfterSalesDetail afterSalesDetail : afterSalesDetailList) {
+            StockWaitDetails stockWaitDetails = new StockWaitDetails();
+            stockWaitDetails.setStockWaitId(stockWait.getId());
+            stockWaitDetails.setProductId(afterSalesDetail.getProductId());
+            stockWaitDetails.setQuantity(afterSalesDetail.getQuantity());
+            stockWaitDetailsList.add(stockWaitDetails);
+        }
+        stockWaitDetailsService.saveBatch(stockWaitDetailsList);
+    }
+
+    /**
+     * 销售换货
+     */
+    @DSTransactional
+    @Override
+    public void salesReplace(AfterSalesDto afterSalesDto) {
+        Assert.notEmpty(afterSalesDto.getId(), "售后id不能为空");
+        AfterSales afterSales = this.getById(afterSalesDto.getId());
+        Assert.notEmpty(afterSales, "查询不到售后信息");
+
+        //生成售后换货待入库信息
+        StockWait stockWait = new StockWait();
+        stockWait.setType(1);//入库
+        stockWait.setStatus(0);//待入库
+        stockWait.setBusinessType(StockWaitType.SALES_REPLACE_IN.getDetailType());
+        stockWait.setBusinessId(afterSales.getId());
+        stockWaitService.save(stockWait);
+        //生成售后换货待出库信息
+        StockWait stockWait1 = new StockWait();
+        stockWait1.setType(2);//出库
+        stockWait1.setStatus(0);//待出库
+        stockWait1.setBusinessType(StockWaitType.SALES_REPLACE_OUT.getDetailType());
+        stockWait1.setBusinessId(afterSales.getId());
+        stockWaitService.save(stockWait1);
+
+        //生成售后换货待出入库明细
+        List<AfterSalesDetail> afterSalesDetailList = afterSalesDetailService.list(q -> q.eq(AfterSalesDetail::getAfterSalesId, afterSales.getId()));
+        List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();
+        List<StockWaitDetails> stockWaitDetailsList1 = new ArrayList<>();
+        for (AfterSalesDetail afterSalesDetail : afterSalesDetailList) {
+            //生成入库明细
+            StockWaitDetails stockWaitDetails = new StockWaitDetails();
+            stockWaitDetails.setStockWaitId(stockWait.getId());
+            stockWaitDetails.setProductId(afterSalesDetail.getProductId());
+            stockWaitDetails.setQuantity(afterSalesDetail.getQuantity());
+            stockWaitDetailsList.add(stockWaitDetails);
+            //生成出库明细
+            StockWaitDetails stockWaitDetails1 = new StockWaitDetails();
+            stockWaitDetails.setStockWaitId(stockWait1.getId());
+            stockWaitDetails.setProductId(afterSalesDetail.getProductId());
+            stockWaitDetails.setQuantity(afterSalesDetail.getQuantity());
+            stockWaitDetailsList1.add(stockWaitDetails1);
+        }
+        stockWaitDetailsService.saveBatch(stockWaitDetailsList);
+        stockWaitDetailsService.saveBatch(stockWaitDetailsList1);
+    }
+
+    /**
+     * 发起采购
+     */
+    @Override
+    @Transactional
+    public void initPurchase(AfterSalesDto afterSalesDto) {
+        Assert.notEmpty(afterSalesDto.getId(), "售后id不能为空");
+        AfterSales afterSales = this.getById(afterSalesDto.getId());
+        Assert.notEmpty(afterSales, "查询不到售后信息");
+        List<AfterSalesDetail> afterSalesDetailList = afterSalesDetailService.list(q -> q.eq(AfterSalesDetail::getAfterSalesId, afterSales.getId()));
+        //创建交接单
+        List<ContractProduct> newContractProductList = new ArrayList<>();
+        for (AfterSalesDetail afterSalesDetail : afterSalesDetailList) {
+            ContractProduct contractProduct = new ContractProduct();
+            contractProduct.setProductId(afterSalesDetail.getProductId());
+            contractProduct.setQuantity(afterSalesDetail.getQuantity());
+            contractProduct.setExpendQuantity(afterSalesDetail.getQuantity());
+            contractProduct.setContractId(afterSales.getContractId());
+            contractProduct.setPrice(afterSalesDetail.getPrice());
+            contractProduct.setAmount(afterSalesDetail.getAmount());
+            contractProduct.setRemark(afterSalesDetail.getRemark());
+            newContractProductList.add(contractProduct);
+        }
+        contractProductService.saveBatch(newContractProductList);
+    }
+
+}

+ 23 - 0
hx-sale/src/main/resources/mapper/after/AfterSalesDetailMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fjhx.sale.mapper.after.AfterSalesDetailMapper">
+    <select id="getPage" resultType="com.fjhx.sale.entity.after.vo.AfterSalesDetailVo">
+        SELECT asd.id,
+               asd.after_sales_id,
+               asd.product_id,
+               asd.quantity,
+               as1.customer_id,
+               as1.contract_id,
+               as1.type,
+               as1.`status`,
+               as1.remark,
+               as1.create_user,
+               as1.create_time,
+               as1.update_user,
+               as1.update_time
+        FROM after_sales_detail asd
+                 LEFT JOIN after_sales as1 ON asd.after_sales_id = as1.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 4 - 0
hx-sale/src/main/resources/mapper/after/AfterSalesMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fjhx.sale.mapper.after.AfterSalesMapper">
+</mapper>

+ 18 - 0
hx-sale/src/main/resources/mapper/after/AfterSalesRecordsMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fjhx.sale.mapper.after.AfterSalesRecordsMapper">
+    <select id="getPage" resultType="com.fjhx.sale.entity.after.vo.AfterSalesRecordsVo">
+        select asr.id,
+               asr.after_sales_id,
+               asr.follow_up_time,
+               asr.follow_up_user_id,
+               asr.remark,
+               asr.create_user,
+               asr.create_time,
+               asr.update_user,
+               asr.update_time
+        from after_sales_record asr
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 4 - 1
hx-wms/src/main/java/com/fjhx/wms/entity/stock/emums/StockWaitType.java

@@ -13,7 +13,10 @@ public enum StockWaitType {
     BACK_OUT(InOutType.OUT, 4, "退货出库", ""),
     JD_ORDER_OUT(InOutType.OUT, 5, "京东订单出库", "jd_order"),
     SALE_ORDER_OUT(InOutType.OUT, 6, "销售订单出库", "order_info"),
-    PRODUCTION_TASK_OUT(InOutType.OUT, 7, "生产任务待出库", "production_task");
+    PRODUCTION_TASK_OUT(InOutType.OUT, 7, "生产任务待出库", "production_task"),
+    SALES_RETURN_IN(InOutType.IN, 8, "售后退货入库", "after_sales"),
+    SALES_REPLACE_IN(InOutType.IN, 9, "售后换货入库", "after_sales"),
+    SALES_REPLACE_OUT(InOutType.OUT, 10, "售后换货出库", "after_sales");
 
 
     /**