Browse Source

维多利亚

home 2 years ago
parent
commit
a71ed5b59d
17 changed files with 448 additions and 12 deletions
  1. 1 1
      hx-common/code-generator/src/main/java/com/fjhx/modular/Victoriatourist.java
  2. 0 0
      hx-service-api/service-flow-api/src/main/java/com/fjhx/enums/FlowStatusEnum.java
  3. 49 0
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/order/OrderFollow.java
  4. 6 1
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/order/OrderInfo.java
  5. 17 0
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/order/OrderFollowEx.java
  6. 17 0
      hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/order/OrderFollowVo.java
  7. 59 0
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/order/AfterSalesController.java
  8. 56 0
      hx-service/victoriatourist/src/main/java/com/fjhx/controller/order/OrderFollowController.java
  9. 16 0
      hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderFollowMapper.java
  10. 5 0
      hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderFollowMapper.xml
  11. 1 0
      hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderInfoMapper.xml
  12. 49 0
      hx-service/victoriatourist/src/main/java/com/fjhx/service/flow/CompensateFlowService.java
  13. 31 0
      hx-service/victoriatourist/src/main/java/com/fjhx/service/order/OrderFollowService.java
  14. 2 0
      hx-service/victoriatourist/src/main/java/com/fjhx/service/order/OrderInfoService.java
  15. 30 7
      hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderDetailsServiceImpl.java
  16. 66 0
      hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderFollowServiceImpl.java
  17. 43 3
      hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderInfoInfoServiceImpl.java

+ 1 - 1
hx-common/code-generator/src/main/java/com/fjhx/modular/Victoriatourist.java

@@ -12,7 +12,7 @@ public class Victoriatourist {
         CodeGenerator.MODULAR_NAME = "victoriatourist";
 
         // 需要生成的表名称,多表用,隔开
-        CodeGenerator.INCLUDE = "stock_transfer";
+        CodeGenerator.INCLUDE = "order_follow";
 
         // mysql连接
         CodeGenerator.MYSQL_URL = "36.134.91.96:17330";

+ 0 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/enums/FlowStatusEnum.java → hx-service-api/service-flow-api/src/main/java/com/fjhx/enums/FlowStatusEnum.java


+ 49 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/order/OrderFollow.java

@@ -0,0 +1,49 @@
+package com.fjhx.entity.order;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fjhx.base.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 售后跟进
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderFollow extends BaseEntity {
+
+
+    /**
+     * 订单id
+     */
+    private Long oredrInfoId;
+
+    /**
+     * 售后状态 1跟进中(补发中、未补发未收到退货) 2已补发 3未补发收到退货 4已补发收到退货 5已补发未收到退货 6结束
+     */
+    private Integer afterSalesStatus;
+
+    /**
+     * 跟进说明
+     */
+    private String remark;
+
+    /**
+     * 逻辑删除 0未删除 1已删除
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer delFlag;
+
+
+}

+ 6 - 1
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/order/OrderInfo.java

@@ -23,7 +23,7 @@ import java.util.Date;
 public class OrderInfo extends BaseEntity {
 
     /**
-     * 订单类型(1线上 2线下 3京东订单 4补发 5线下退换货)
+     * 订单类型(1线上 2线下 3京东订单 4补偿 5补发 6线下退换货)
      */
     private Integer type;
 
@@ -58,6 +58,11 @@ public class OrderInfo extends BaseEntity {
     private Integer issueStatus;
 
     /**
+     * 售后状态 1跟进中(补发中、未补发未收到退货) 2已补发 3未补发收到退货 4已补发收到退货 5已补发未收到退货 6结束
+     */
+    private Integer afterSalesStatus;
+
+    /**
      * 国家
      */
     private String countryId;

+ 17 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/order/OrderFollowEx.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.order;
+
+import com.fjhx.entity.order.OrderFollow;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 售后跟进
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderFollowEx extends OrderFollow {
+
+}

+ 17 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/order/OrderFollowVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.order;
+
+import com.fjhx.entity.order.OrderFollow;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 售后跟进
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OrderFollowVo extends OrderFollow {
+
+}

+ 59 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/controller/order/AfterSalesController.java

@@ -0,0 +1,59 @@
+package com.fjhx.controller.order;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.order.OrderFollow;
+import com.fjhx.params.order.OrderInfoEx;
+import com.fjhx.params.order.OrderInfoVo;
+import com.fjhx.service.order.OrderFollowService;
+import com.fjhx.service.order.OrderInfoService;
+import org.springblade.core.tool.api.R;
+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;
+
+import java.util.Map;
+
+/**
+ * 售后管理
+ */
+@RestController
+@RequestMapping("/afterSales")
+public class AfterSalesController {
+
+    @Autowired
+    private OrderInfoService orderInfoService;
+
+    @Autowired
+    private OrderFollowService orderFollowService;
+
+    /**
+     * 添加售后管理
+     */
+    @PostMapping("/add")
+    public R add(@RequestBody OrderInfoVo orderInfoVo) {
+        orderInfoService.addAfterSales(orderInfoVo);
+        return R.success();
+    }
+
+    /**
+     * 分页
+     */
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, Object> condition) {
+        condition.put("afterSales", true);
+        Page<OrderInfoEx> result = orderInfoService.getPage(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 跟进
+     */
+    @PostMapping("/followUp")
+    public R followUp(@RequestBody OrderFollow orderFollow) {
+        orderFollowService.followUp(orderFollow);
+        return R.success();
+    }
+
+}

+ 56 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/controller/order/OrderFollowController.java

@@ -0,0 +1,56 @@
+package com.fjhx.controller.order;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springblade.core.tool.api.R;
+import com.fjhx.entity.order.OrderFollow;
+import com.fjhx.params.order.OrderFollowVo;
+import com.fjhx.service.order.OrderFollowService;
+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;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 售后跟进 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+@RestController
+@RequestMapping("/orderFollow")
+public class OrderFollowController {
+
+    @Autowired
+    private OrderFollowService orderFollowService;
+
+    // @PostMapping("/page")
+    // public R page(@RequestBody Map<String, Object> condition){
+    //     Page<OrderFollow> result = orderFollowService.getPage(condition);
+    //     return R.success(result);
+    // }
+    //
+    // @PostMapping("/add")
+    // public R add(@RequestBody OrderFollowVo orderFollowVo){
+    //     orderFollowService.add(orderFollowVo);
+    //     return R.success();
+    // }
+    //
+    // @PostMapping("/edit")
+    // public R edit(@RequestBody OrderFollowVo orderFollowVo){
+    //     orderFollowService.edit(orderFollowVo);
+    //     return R.success();
+    // }
+    //
+    // @PostMapping("/delete")
+    // public R delete(@RequestBody OrderFollowVo orderFollowVo){
+    //     orderFollowService.delete(orderFollowVo);
+    //     return R.success();
+    // }
+
+}
+

+ 16 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderFollowMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.mapper.order;
+
+import com.fjhx.entity.order.OrderFollow;
+import com.github.yulichang.base.MPJBaseMapper;
+
+/**
+ * <p>
+ * 售后跟进 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+public interface OrderFollowMapper extends MPJBaseMapper<OrderFollow> {
+
+}

+ 5 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderFollowMapper.xml

@@ -0,0 +1,5 @@
+<?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.mapper.order.OrderFollowMapper">
+
+</mapper>

+ 1 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderInfoMapper.xml

@@ -19,6 +19,7 @@
                oi.phone,
                oi.phone_prefix_type,
                oi.remark,
+               oi.create_time,
                ci.name customerName
         from order_info oi
                  left join customer_info ci on oi.customer_info_id = ci.id

+ 49 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/service/flow/CompensateFlowService.java

@@ -0,0 +1,49 @@
+package com.fjhx.service.flow;
+
+import com.fjhx.params.JumpVo;
+import com.fjhx.params.order.OrderInfoVo;
+import com.fjhx.service.order.OrderInfoService;
+import com.fjhx.utils.ExampleAbstract;
+import com.fjhx.utils.FlowConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 发起申购
+ */
+@Service
+public class CompensateFlowService {
+
+    @Lazy
+    @Autowired
+    private OrderInfoService orderInfoService;
+
+
+    private final FlowConstructor flowConstructor = FlowConstructor.init(new ExampleAbstract() {
+
+        @Override
+        public String getCode() {
+            return "v_compensate";
+        }
+
+        @Override
+        public void end() {
+
+        }
+
+    });
+
+
+    @Transactional(rollbackFor = Exception.class)
+    public void create(OrderInfoVo orderInfoVo) {
+        flowConstructor.create(orderInfoVo.getId(), "订单补偿", orderInfoVo.getRemark(), orderInfoVo.getId());
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void jump(JumpVo jumpVo) {
+        flowConstructor.jump(jumpVo);
+    }
+
+}

+ 31 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/OrderFollowService.java

@@ -0,0 +1,31 @@
+package com.fjhx.service.order;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.order.OrderFollow;
+import com.fjhx.entity.order.OrderInfo;
+import com.fjhx.params.order.OrderFollowVo;
+import com.fjhx.base.BaseService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 售后跟进 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+public interface OrderFollowService extends BaseService<OrderFollow> {
+
+    Page<OrderFollow> getPage(Map<String, Object> condition);
+
+    void add(OrderFollowVo orderFollowVo);
+
+    void edit(OrderFollowVo orderFollowVo);
+
+    void delete(OrderFollowVo orderFollowVo);
+
+    void followUp(OrderFollow orderFollow);
+
+}

+ 2 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/OrderInfoService.java

@@ -32,4 +32,6 @@ public interface OrderInfoService extends BaseService<OrderInfo> {
 
     OrderInfoEx getDetails(Long id);
 
+    void addAfterSales(OrderInfoVo orderInfoVo);
+
 }

+ 30 - 7
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderDetailsServiceImpl.java

@@ -116,15 +116,38 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
             }
             updateBatchById(list);
 
-            // 如果未出库数量全为0,修改订单完成状态
-            long count = list.stream().filter(item -> item.getNotIssuedQuantity().compareTo(BigDecimal.ZERO) > 0).count();
+            // 修改订单状态
             OrderInfo orderInfo = new OrderInfo();
-            orderInfo.setId(orderId);
-            if (count == 0) {
-                orderInfo.setStatus(2);
+            // 如果是退换货或者补发,出库一次算完成
+            if (orderInfo.getType() == 5) {
+                orderInfo.setIssueStatus(3);
+                // 补发跟进中变已补发
+                if (orderInfo.getAfterSalesStatus() == 1) {
+                    orderInfo.setAfterSalesStatus(2);
+                }
+            } else if (orderInfo.getType() == 6) {
                 orderInfo.setIssueStatus(3);
-            } else {
-                orderInfo.setIssueStatus(2);
+                switch (orderInfo.getAfterSalesStatus()) {
+                    // 未补发未收到退货变已补发未收到退货
+                    case 1:
+                        orderInfo.setAfterSalesStatus(5);
+                        break;
+                    // 未补发已收到退货变已补发已收到退货
+                    case 2:
+                        orderInfo.setAfterSalesStatus(3);
+                        break;
+                }
+            }
+            // 如果未出库数量全为0,修改订单完成状态
+            else {
+                long count = list.stream().filter(item -> item.getNotIssuedQuantity().compareTo(BigDecimal.ZERO) > 0).count();
+                orderInfo.setId(orderId);
+                if (count == 0) {
+                    orderInfo.setStatus(2);
+                    orderInfo.setIssueStatus(3);
+                } else {
+                    orderInfo.setIssueStatus(2);
+                }
             }
             orderInfoService.updateById(orderInfo);
         }

+ 66 - 0
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderFollowServiceImpl.java

@@ -0,0 +1,66 @@
+package com.fjhx.service.order.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.entity.order.OrderFollow;
+import com.fjhx.entity.order.OrderInfo;
+import com.fjhx.mapper.order.OrderFollowMapper;
+import com.fjhx.params.order.OrderFollowVo;
+import com.fjhx.service.order.OrderFollowService;
+import com.fjhx.service.order.OrderInfoService;
+import com.fjhx.utils.wrapperUtil.IWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 售后跟进 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-12-16
+ */
+@Service
+public class OrderFollowServiceImpl extends ServiceImpl<OrderFollowMapper, OrderFollow> implements OrderFollowService {
+
+    @Autowired
+    private OrderInfoService orderInfoService;
+
+    @Override
+    public Page<OrderFollow> getPage(Map<String, Object> condition) {
+
+        IWrapper<OrderFollow> wrapper = IWrapper.getWrapper(condition);
+
+        return page(condition, wrapper);
+    }
+
+    @Override
+    public void add(OrderFollowVo orderFollowVo) {
+        save(orderFollowVo);
+    }
+
+    @Override
+    public void edit(OrderFollowVo orderFollowVo) {
+        updateById(orderFollowVo);
+    }
+
+    @Override
+    public void delete(OrderFollowVo orderFollowVo) {
+        removeById(orderFollowVo.getId());
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void followUp(OrderFollow orderFollow) {
+        save(orderFollow);
+
+        OrderInfo orderInfo = new OrderInfo();
+        orderInfo.setId(orderFollow.getOredrInfoId());
+        orderInfo.setAfterSalesStatus(orderFollow.getAfterSalesStatus());
+        orderInfoService.updateById(orderInfo);
+    }
+
+}

+ 43 - 3
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderInfoInfoServiceImpl.java

@@ -20,6 +20,7 @@ import com.fjhx.params.order.OrderInfoEx;
 import com.fjhx.params.order.OrderInfoVo;
 import com.fjhx.params.order.OrderJdExcelVo;
 import com.fjhx.service.excel.ExcelImportLogService;
+import com.fjhx.service.flow.CompensateFlowService;
 import com.fjhx.service.order.OrderDetailsService;
 import com.fjhx.service.order.OrderInfoService;
 import com.fjhx.service.product.ProductInfoService;
@@ -64,21 +65,32 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
     @Autowired
     private SystemConfigService systemConfigService;
 
+    @Autowired
+    private CompensateFlowService compensateFlowService;
+
+
     @Override
     public Page<OrderInfoEx> getPage(Map<String, Object> condition) {
 
-
         IWrapper<Object> wrapper = IWrapper.getWrapper(condition)
                 // 京东订单销售订单
                 .func(q -> {
                     Integer type = Convert.toInt(condition.get("type"));
                     Boolean issue = Convert.toBool(condition.get("deliverable"), false);
+                    Boolean afterSales = Convert.toBool(condition.get("afterSales"), false);
+
                     // 如果类型为空,默认为销售订单
                     if (type == null) {
                         // 如果是出货
                         if (issue) {
-                            q.in("oi", OrderInfo::getType, 1, 2, 4, 5);
-                        } else {
+                            q.in("oi", OrderInfo::getType, 1, 2, 5, 6);
+                        }
+                        // 如果是售后
+                        else if (afterSales) {
+                            q.in("oi", OrderInfo::getType, 4, 5, 6);
+                        }
+                        // 默认销售订单
+                        else {
                             q.in("oi", OrderInfo::getType, 1, 2);
                         }
                     } else {
@@ -92,6 +104,7 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
                     }
                 })
                 .keyword(new KeywordData("oi", OrderInfo::getCode), new KeywordData("ci", CustomerInfo::getName))
+                .eq("oi", OrderInfo::getAfterSalesStatus)
                 .eq("oi", OrderInfo::getStatus)
                 .like("oi", OrderInfo::getCode)
                 .like("ci", CustomerInfo::getName, condition.get("customerName"))
@@ -265,6 +278,33 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
         return orderInfoEx;
     }
 
+    @Override
+    public void addAfterSales(OrderInfoVo orderInfoVo) {
+        Long oldId = orderInfoVo.getId();
+
+        OrderInfo orderInfo = getById(oldId);
+        orderInfo.setId(null);
+        orderInfo.setType(orderInfoVo.getType());
+        orderInfo.setStatus(1);
+        orderInfo.setIssueStatus(1);
+        orderInfo.setAfterSalesStatus(1);
+        orderInfo.setRemark(orderInfo.getRemark());
+        save(orderInfo);
+
+        if (orderInfoVo.getType().equals(4)) {
+            compensateFlowService.create(orderInfoVo);
+        } else {
+            List<OrderDetails> list = orderDetailsService.list(q -> q.eq(OrderDetails::getOrderId, oldId));
+            for (OrderDetails orderDetails : list) {
+                orderDetails.setId(null);
+                orderDetails.setOrderId(orderInfo.getId());
+                orderDetails.setNotIssuedQuantity(orderDetails.getQuantity());
+                orderDetails.setRemark(null);
+            }
+            orderDetailsService.saveBatch(list);
+        }
+    }
+
     /**
      * 验证订单编号是否重复
      */