瀏覽代碼

维多利亚

home 2 年之前
父節點
當前提交
893f9331c7

+ 26 - 4
hx-common/common-client-util/src/main/java/com/fjhx/utils/RegionClientUtil.java

@@ -48,13 +48,13 @@ public class RegionClientUtil {
 
     }
 
-    public static void setEntityRegionName(List<? extends region> list) {
+    public static void setEntityRegionName(List<? extends Region> list) {
         if (list.size() == 0) return;
 
 
         HashSet<String> regionSet = new HashSet<>();
 
-        for (region region : list) {
+        for (Region region : list) {
             // 查询国省市
             regionSet.add(region.getCountryId());
             regionSet.add(region.getProvinceId());
@@ -68,7 +68,7 @@ public class RegionClientUtil {
         R<Map<String, String>> r = getRegionClient().getChineseNameById(regionSet);
         Map<String, String> regionMap = Assert.result(r);
 
-        for (region region : list) {
+        for (Region region : list) {
             // 赋值国省市
             region.setCountryName(regionMap.get(region.getCountryId()));
             region.setProvinceName(regionMap.get(region.getProvinceId()));
@@ -77,7 +77,29 @@ public class RegionClientUtil {
 
     }
 
-    public interface region {
+
+    public static void setEntityRegionName(Region region) {
+
+        HashSet<String> regionSet = new HashSet<>();
+        regionSet.add(region.getCountryId());
+        regionSet.add(region.getProvinceId());
+        regionSet.add(region.getCityId());
+        regionSet.remove(null);
+
+        if (regionSet.size() == 0) return;
+
+        R<Map<String, String>> r = getRegionClient().getChineseNameById(regionSet);
+        Map<String, String> regionMap = Assert.result(r);
+
+        // 赋值国省市
+        region.setCountryName(regionMap.get(region.getCountryId()));
+        region.setProvinceName(regionMap.get(region.getProvinceId()));
+        region.setCityName(regionMap.get(region.getCityId()));
+
+    }
+
+
+    public interface Region {
 
         String getCountryId();
 

+ 1 - 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京东订单)
+     * 订单类型(1线上 2线下 3京东订单 4补发 5线下退换货
      */
     private Integer type;
 

+ 1 - 1
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/customer/CustomerInfoEx.java

@@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class CustomerInfoEx extends CustomerInfo implements RegionClientUtil.region {
+public class CustomerInfoEx extends CustomerInfo implements RegionClientUtil.Region {
 
     private String countryName;
 

+ 9 - 1
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/params/order/OrderInfoEx.java

@@ -5,6 +5,8 @@ import com.fjhx.utils.RegionClientUtil;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.List;
+
 /**
  * 销售订单
  *
@@ -13,7 +15,7 @@ import lombok.EqualsAndHashCode;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class OrderInfoEx extends OrderInfo implements RegionClientUtil.region {
+public class OrderInfoEx extends OrderInfo implements RegionClientUtil.Region {
     /**
      * 客户名称
      */
@@ -24,4 +26,10 @@ public class OrderInfoEx extends OrderInfo implements RegionClientUtil.region {
     private String provinceName;
 
     private String cityName;
+
+    /**
+     * 订单明细
+     */
+    List<OrderDetailsEx> orderDetailsList;
+
 }

+ 13 - 3
hx-service/victoriatourist/src/main/java/com/fjhx/controller/customer/CustomerInfoController.java

@@ -1,16 +1,19 @@
 package com.fjhx.controller.customer;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.BaseEntity;
+import com.fjhx.entity.customer.CustomerInfo;
 import com.fjhx.params.customer.CustomerInfoEx;
-import org.springblade.core.tool.api.R;
 import com.fjhx.params.customer.CustomerInfoVo;
 import com.fjhx.service.customer.CustomerInfoService;
+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.List;
 import java.util.Map;
 
 /**
@@ -28,14 +31,21 @@ public class CustomerInfoController {
     @Autowired
     private CustomerInfoService customerInfoService;
 
+    @PostMapping("/list")
+    public R list() {
+        List<CustomerInfo> list = customerInfoService.list(
+                q -> q.select(BaseEntity::getId, CustomerInfo::getName, CustomerInfo::getCode));
+        return R.success(list);
+    }
+
     @PostMapping("/page")
-    public R page(@RequestBody Map<String, Object> condition){
+    public R page(@RequestBody Map<String, Object> condition) {
         Page<CustomerInfoEx> result = customerInfoService.getPage(condition);
         return R.success(result);
     }
 
     @PostMapping("/add")
-    public R add(@RequestBody CustomerInfoVo customerInfoVo){
+    public R add(@RequestBody CustomerInfoVo customerInfoVo) {
         customerInfoService.add(customerInfoVo);
         return R.success();
     }

+ 3 - 4
hx-service/victoriatourist/src/main/java/com/fjhx/controller/order/OrderDetailsController.java

@@ -1,6 +1,6 @@
 package com.fjhx.controller.order;
 
-import com.fjhx.params.order.IssueVo;
+import com.fjhx.entity.order.OrderInfo;
 import com.fjhx.params.order.OrderDetailsEx;
 import com.fjhx.service.order.OrderDetailsService;
 import org.springblade.core.tool.api.R;
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>
@@ -29,8 +28,8 @@ public class OrderDetailsController {
     private OrderDetailsService orderDetailsService;
 
     @PostMapping("/listByOrderSalesId")
-    public R listByOrderSalesId(@RequestBody Map<String, Object> condition) {
-        List<OrderDetailsEx> result = orderDetailsService.listByOrderSalesId(condition);
+    public R listByOrderSalesId(@RequestBody OrderInfo orderInfo) {
+        List<OrderDetailsEx> result = orderDetailsService.listByOrderSalesId(orderInfo.getId());
         return R.success(result);
     }
 

+ 21 - 2
hx-service/victoriatourist/src/main/java/com/fjhx/controller/order/OrderSalesController.java

@@ -1,6 +1,7 @@
 package com.fjhx.controller.order;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.order.OrderInfo;
 import com.fjhx.enums.stock.OutTypeEnum;
 import com.fjhx.params.order.IssueVo;
 import com.fjhx.params.order.OrderInfoEx;
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -61,8 +63,6 @@ public class OrderSalesController {
 
     /**
      * 销售出库
-     * @param issueVo
-     * @return
      */
     @PostMapping("/issue")
     public R issue(@RequestBody IssueVo issueVo) {
@@ -71,5 +71,24 @@ public class OrderSalesController {
         return R.success();
     }
 
+    /**
+     * 根据客户id查询订单
+     */
+    @PostMapping("/getOrderByCustomerId")
+    public R getOrderByCustomerId(@RequestBody OrderInfo orderInfo) {
+        List<OrderInfo> list = orderInfoService.getOrderByCustomerId(orderInfo.getCustomerInfoId());
+        return R.success(list);
+    }
+
+    /**
+     * 订单明细
+     */
+    @PostMapping("/getDetails")
+    public R getDetails(@RequestBody OrderInfo orderInfo) {
+        OrderInfoEx orderInfoEx = orderInfoService.getDetails(orderInfo.getId());
+        return R.success(orderInfoEx);
+    }
+
+
 }
 

+ 3 - 3
hx-service/victoriatourist/src/main/java/com/fjhx/mapper/order/OrderDetailsMapper.java

@@ -1,8 +1,8 @@
 package com.fjhx.mapper.order;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fjhx.entity.order.OrderDetails;
 import com.fjhx.params.order.OrderDetailsEx;
-import com.fjhx.utils.wrapperUtil.IWrapper;
 import com.github.yulichang.base.MPJBaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -10,7 +10,7 @@ import java.util.List;
 
 /**
  * <p>
- * 销售订单明细表 Mapper 接口
+ * 订单明细表 Mapper 接口
  * </p>
  *
  * @author ${author}
@@ -18,6 +18,6 @@ import java.util.List;
  */
 public interface OrderDetailsMapper extends MPJBaseMapper<OrderDetails> {
 
-    List<OrderDetailsEx> listByOrderSalesId(@Param("ew") IWrapper<Object> wrapper);
+    List<OrderDetailsEx> listByOrderSalesId(@Param("ew") QueryWrapper<Object> wrapper);
 
 }

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

@@ -1,5 +1,6 @@
 package com.fjhx.mapper.order;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.order.OrderInfo;
 import com.fjhx.params.order.OrderInfoEx;
@@ -19,4 +20,6 @@ public interface OrderInfoMapper extends MPJBaseMapper<OrderInfo> {
 
     Page<OrderInfoEx> getPage(@Param("page") Page<OrderInfo> page, @Param("ew") IWrapper<Object> wrapper);
 
+    OrderInfoEx getDetails(@Param("ew") QueryWrapper<OrderInfo> wrapper);
+
 }

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

@@ -25,4 +25,27 @@
             ${ew.customSqlSegment}
     </select>
 
+    <select id="getDetails" resultType="com.fjhx.params.order.OrderInfoEx">
+        select oi.id,
+               oi.customer_info_id,
+               oi.type,
+               oi.code,
+               oi.amount_money,
+               oi.order_time,
+               oi.status,
+               oi.issue_status,
+               oi.country_id,
+               oi.province_id,
+               oi.city_id,
+               oi.detailed_address,
+               oi.contacts,
+               oi.phone,
+               oi.phone_prefix_type,
+               oi.remark,
+               ci.name customerName
+        from order_info oi
+                 left join customer_info ci on oi.customer_info_id = ci.id
+            ${ew.customSqlSegment}
+    </select>
+
 </mapper>

+ 2 - 1
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/OrderDetailsService.java

@@ -2,6 +2,7 @@ package com.fjhx.service.order;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.order.OrderDetails;
+import com.fjhx.entity.order.OrderInfo;
 import com.fjhx.params.order.IssueVo;
 import com.fjhx.params.order.OrderDetailsEx;
 import com.fjhx.params.order.OrderDetailsVo;
@@ -28,7 +29,7 @@ public interface OrderDetailsService extends BaseService<OrderDetails> {
 
     void delete(OrderDetailsVo orderDetailsVo);
 
-    List<OrderDetailsEx> listByOrderSalesId(Map<String, Object> condition);
+    List<OrderDetailsEx> listByOrderSalesId(Long orderId);
 
     void issue(IssueVo issueVo);
 

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

@@ -7,6 +7,7 @@ import com.fjhx.params.order.OrderInfoEx;
 import com.fjhx.params.order.OrderInfoVo;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -27,4 +28,8 @@ public interface OrderInfoService extends BaseService<OrderInfo> {
 
     Long excelImport(MultipartFile file);
 
+    List<OrderInfo> getOrderByCustomerId(Long customerInfoId);
+
+    OrderInfoEx getDetails(Long id);
+
 }

+ 5 - 6
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderDetailsServiceImpl.java

@@ -1,5 +1,7 @@
 package com.fjhx.service.order.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.entity.logistics.LogisticsInfo;
@@ -73,12 +75,9 @@ public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, Ord
     }
 
     @Override
-    public List<OrderDetailsEx> listByOrderSalesId(Map<String, Object> condition) {
-        Assert.notEmpty(condition.get("orderId"), "订单id不能为空");
-
-        IWrapper<Object> wrapper = IWrapper.getWrapper(condition)
-                .eq("od", OrderDetails::getOrderId);
-
+    public List<OrderDetailsEx> listByOrderSalesId(Long orderId) {
+        Assert.notEmpty(orderId, "订单id不能为空");
+        QueryWrapper<Object> wrapper = Wrappers.query().eq("od.order_id", orderId);
         return baseMapper.listByOrderSalesId(wrapper);
     }
 

+ 44 - 8
hx-service/victoriatourist/src/main/java/com/fjhx/service/order/impl/OrderInfoInfoServiceImpl.java

@@ -2,7 +2,9 @@ package com.fjhx.service.order.impl;
 
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.base.BaseEntity;
@@ -13,6 +15,7 @@ import com.fjhx.entity.order.OrderDetails;
 import com.fjhx.entity.order.OrderInfo;
 import com.fjhx.entity.product.ProductInfo;
 import com.fjhx.mapper.order.OrderInfoMapper;
+import com.fjhx.params.order.OrderDetailsEx;
 import com.fjhx.params.order.OrderInfoEx;
 import com.fjhx.params.order.OrderInfoVo;
 import com.fjhx.params.order.OrderJdExcelVo;
@@ -64,25 +67,31 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
     @Override
     public Page<OrderInfoEx> getPage(Map<String, Object> condition) {
 
+
         IWrapper<Object> wrapper = IWrapper.getWrapper(condition)
-                .keyword(new KeywordData("oi", OrderInfo::getCode), new KeywordData("ci", CustomerInfo::getName))
                 // 京东订单销售订单
                 .func(q -> {
                     Integer type = Convert.toInt(condition.get("type"));
+                    Boolean issue = Convert.toBool(condition.get("deliverable"), false);
+                    // 如果类型为空,默认为销售订单
                     if (type == null) {
-                        q.in("oi", OrderInfo::getType, 1, 2);
+                        // 如果是出货
+                        if (issue) {
+                            q.in("oi", OrderInfo::getType, 1, 2, 4, 5);
+                        } else {
+                            q.in("oi", OrderInfo::getType, 1, 2);
+                        }
                     } else {
                         q.eq("oi", OrderInfo::getType);
                     }
-                })
-                // 搜索可以出库的列表
-                .func(q -> {
-                    Boolean issue = Convert.toBool(condition.get("deliverable"));
-                    if (Boolean.TRUE.equals(issue)) {
+
+                    // 如果是出货,订单状态为1进行中,出库状态为1未出库或2进行中
+                    if (issue) {
                         q.eq("oi", OrderInfo::getStatus, 1);
-                        q.lt("oi", OrderInfo::getIssueStatus, 3);
+                        q.in("oi", OrderInfo::getIssueStatus, 1, 2);
                     }
                 })
+                .keyword(new KeywordData("oi", OrderInfo::getCode), new KeywordData("ci", CustomerInfo::getName))
                 .eq("oi", OrderInfo::getStatus)
                 .like("oi", OrderInfo::getCode)
                 .like("ci", CustomerInfo::getName, condition.get("customerName"))
@@ -229,6 +238,33 @@ public class OrderInfoInfoServiceImpl extends ServiceImpl<OrderInfoMapper, Order
         return flag;
     }
 
+    @Override
+    public List<OrderInfo> getOrderByCustomerId(Long customerInfoId) {
+        Assert.notEmpty(customerInfoId, "客户id不能为空");
+
+        return list(q -> q
+                .select(BaseEntity::getId, OrderInfo::getCode)
+                .eq(OrderInfo::getCustomerInfoId, customerInfoId)
+                .in(OrderInfo::getType, 1, 2)
+                .orderByDesc(BaseEntity::getId)
+        );
+    }
+
+    @Override
+    public OrderInfoEx getDetails(Long id) {
+        Assert.notEmpty(id, "订单id不能为空");
+        QueryWrapper<OrderInfo> wrapper = Wrappers.query();
+        wrapper.eq("oi.id", id);
+        OrderInfoEx orderInfoEx = baseMapper.getDetails(wrapper);
+        // 赋值国省市
+        RegionClientUtil.setEntityRegionName(orderInfoEx);
+
+        List<OrderDetailsEx> orderDetailsExes = orderDetailsService.listByOrderSalesId(id);
+
+        orderInfoEx.setOrderDetailsList(orderDetailsExes);
+        return orderInfoEx;
+    }
+
     /**
      * 验证订单编号是否重复
      */