Commit a0cc8a1eef342b050e2c506db8b8e1a60698926c

Authored by fengliang
1 parent f1721899

update:地址列表筛选是否可配送

Showing 18 changed files with 223 additions and 43 deletions
etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderContactPersonController.java
@@ -92,5 +92,17 @@ public class OrderContactPersonController { @@ -92,5 +92,17 @@ public class OrderContactPersonController {
92 List<BaseRegionNextVo> baseRegionNextVoList = baseRegionService.getNextList(co); 92 List<BaseRegionNextVo> baseRegionNextVoList = baseRegionService.getNextList(co);
93 return Message.success(baseRegionNextVoList); 93 return Message.success(baseRegionNextVoList);
94 } 94 }
  95 +
  96 +
  97 + /**
  98 + * 查询地址是否可配送
  99 + * @param co
  100 + * @return
  101 + */
  102 + @PostMapping(value = "/checkRegion")
  103 + public Message<Boolean> checkRegion(@RequestBody BaseRegionCo co) {
  104 + baseRegionService.checkRegion(co.getProvinceId(),co.getCityId(),co.getDistrictId(),co.getStreetId(),co.getMarketId());
  105 + return Message.success(true);
  106 + }
95 } 107 }
96 108
etrade-order/src/main/java/com/diligrp/etrade/order/api/OrderDeliveryController.java
@@ -2,6 +2,7 @@ package com.diligrp.etrade.order.api; @@ -2,6 +2,7 @@ package com.diligrp.etrade.order.api;
2 2
3 import com.diligrp.etrade.core.domain.Message; 3 import com.diligrp.etrade.core.domain.Message;
4 import com.diligrp.etrade.order.domain.OrderOperateDto; 4 import com.diligrp.etrade.order.domain.OrderOperateDto;
  5 +import com.diligrp.etrade.order.service.BaseRegionService;
5 import com.diligrp.etrade.order.service.OrderDeliveryService; 6 import com.diligrp.etrade.order.service.OrderDeliveryService;
6 import com.diligrp.etrade.order.type.OrderOrderType; 7 import com.diligrp.etrade.order.type.OrderOrderType;
7 import com.diligrp.etrade.order.util.OrderConstant; 8 import com.diligrp.etrade.order.util.OrderConstant;
@@ -34,6 +35,7 @@ public class OrderDeliveryController { @@ -34,6 +35,7 @@ public class OrderDeliveryController {
34 @Resource 35 @Resource
35 private RedissonClient redissonClient; 36 private RedissonClient redissonClient;
36 37
  38 +
37 /** 39 /**
38 * 选择配送方式 40 * 选择配送方式
39 * @param orderOperateDto 操作标识 41 * @param orderOperateDto 操作标识
etrade-order/src/main/java/com/diligrp/etrade/order/dao/BaseRegionMapper.java
@@ -4,6 +4,7 @@ package com.diligrp.etrade.order.dao; @@ -4,6 +4,7 @@ package com.diligrp.etrade.order.dao;
4 import com.diligrp.etrade.core.mybatis.MybatisMapperSupport; 4 import com.diligrp.etrade.core.mybatis.MybatisMapperSupport;
5 import com.diligrp.etrade.order.domain.contactPerson.BaseRegionCo; 5 import com.diligrp.etrade.order.domain.contactPerson.BaseRegionCo;
6 import com.diligrp.etrade.order.model.BaseRegion; 6 import com.diligrp.etrade.order.model.BaseRegion;
  7 +import org.apache.ibatis.annotations.Param;
7 8
8 import java.util.List; 9 import java.util.List;
9 10
@@ -18,4 +19,6 @@ import java.util.List; @@ -18,4 +19,6 @@ import java.util.List;
18 public interface BaseRegionMapper extends MybatisMapperSupport { 19 public interface BaseRegionMapper extends MybatisMapperSupport {
19 20
20 List<BaseRegion> selectNextList(BaseRegionCo co); 21 List<BaseRegion> selectNextList(BaseRegionCo co);
  22 +
  23 + BaseRegion getRegionsByIds(@Param("provinceId") Long provinceId,@Param("cityId") Long cityId,@Param("districtId") Long districtId,@Param("streetId") Long streetId,@Param("marketId") Long marketId);
21 } 24 }
etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderDeliveryDto.java
@@ -36,13 +36,16 @@ public class OrderDeliveryDto { @@ -36,13 +36,16 @@ public class OrderDeliveryDto {
36 private Integer wayType; 36 private Integer wayType;
37 37
38 /** 省份 */ 38 /** 省份 */
  39 + @NotNull(message = "省份不能为空")
39 private Long provinceId; 40 private Long provinceId;
40 41
41 /** 省份名称 */ 42 /** 省份名称 */
  43 +
42 @NotNull(message = "省份不能为空") 44 @NotNull(message = "省份不能为空")
43 private String provinceName; 45 private String provinceName;
44 46
45 /** 城市 */ 47 /** 城市 */
  48 + @NotNull(message = "城市不能为空")
46 private Long cityId; 49 private Long cityId;
47 50
48 /** 城市 */ 51 /** 城市 */
@@ -50,12 +53,26 @@ public class OrderDeliveryDto { @@ -50,12 +53,26 @@ public class OrderDeliveryDto {
50 private String cityName; 53 private String cityName;
51 54
52 /** 区县 */ 55 /** 区县 */
  56 + @NotNull(message = "区县不能为空")
53 private Long districtId; 57 private Long districtId;
54 58
55 /** 区县 */ 59 /** 区县 */
56 @NotNull(message = "区县不能为空") 60 @NotNull(message = "区县不能为空")
57 private String districtName; 61 private String districtName;
58 62
  63 + /**
  64 + * 街道
  65 + */
  66 + @NotNull(message = "街道不能为空")
  67 + private Long streetId;
  68 +
  69 + /**
  70 + * 街道名称
  71 + */
  72 + @NotNull(message = "街道名称不能为空")
  73 + private String streetName;
  74 +
  75 +
59 /** 收货人电话 */ 76 /** 收货人电话 */
60 @NotNull(message = "电话号码不能为空") 77 @NotNull(message = "电话号码不能为空")
61 @Length(max = 11,message = "电话号码不能超过11位") 78 @Length(max = 11,message = "电话号码不能超过11位")
@@ -229,4 +246,20 @@ public class OrderDeliveryDto { @@ -229,4 +246,20 @@ public class OrderDeliveryDto {
229 public void setModifierId(Long modifierId) { 246 public void setModifierId(Long modifierId) {
230 this.modifierId = modifierId; 247 this.modifierId = modifierId;
231 } 248 }
  249 +
  250 + public Long getStreetId() {
  251 + return streetId;
  252 + }
  253 +
  254 + public void setStreetId(Long streetId) {
  255 + this.streetId = streetId;
  256 + }
  257 +
  258 + public String getStreetName() {
  259 + return streetName;
  260 + }
  261 +
  262 + public void setStreetName(String streetName) {
  263 + this.streetName = streetName;
  264 + }
232 } 265 }
etrade-order/src/main/java/com/diligrp/etrade/order/domain/contactPerson/OrderContactPersonCo.java
@@ -51,32 +51,47 @@ public class OrderContactPersonCo extends BaseDo { @@ -51,32 +51,47 @@ public class OrderContactPersonCo extends BaseDo {
51 /** 51 /**
52 * 省份 52 * 省份
53 */ 53 */
  54 + @NotNull(message = "省份不能为空")
54 private Long provinceId; 55 private Long provinceId;
55 /** 56 /**
56 - * 省份 57 + * 省份名称
57 */ 58 */
58 - @NotNull(message = "省份不能为空") 59 + @NotNull(message = "省份名称不能为空")
59 private String provinceName; 60 private String provinceName;
60 /** 61 /**
61 * 城市 62 * 城市
62 */ 63 */
  64 + @NotNull(message = "城市不能为空")
63 private Long cityId; 65 private Long cityId;
64 /** 66 /**
65 - * 城市 67 + * 城市名称
66 */ 68 */
67 - @NotNull(message = "城市不能为空") 69 + @NotNull(message = "城市名称不能为空")
68 private String cityName; 70 private String cityName;
69 /** 71 /**
70 * 区县 72 * 区县
71 */ 73 */
  74 + @NotNull(message = "区县不能为空")
72 private Long districtId; 75 private Long districtId;
73 /** 76 /**
74 - * 区县 77 + * 区县名称
75 */ 78 */
76 - @NotNull(message = "区县不能为空") 79 + @NotNull(message = "区县名称不能为空")
77 private String districtName; 80 private String districtName;
78 81
79 /** 82 /**
  83 + * 街道
  84 + */
  85 + @NotNull(message = "街道不能为空")
  86 + private Long streetId;
  87 +
  88 + /**
  89 + * 街道名称
  90 + */
  91 + @NotNull(message = "街道名称不能为空")
  92 + private String streetName;
  93 +
  94 + /**
80 * 状态 1:启用 2:禁用 95 * 状态 1:启用 2:禁用
81 * @return 96 * @return
82 */ 97 */
etrade-order/src/main/java/com/diligrp/etrade/order/domain/contactPerson/OrderContactPersonListCo.java
@@ -18,6 +18,11 @@ public class OrderContactPersonListCo extends BasePageQuery { @@ -18,6 +18,11 @@ public class OrderContactPersonListCo extends BasePageQuery {
18 private Long createrId; 18 private Long createrId;
19 19
20 /** 20 /**
  21 + * 市场id
  22 + */
  23 + private Long marketId;
  24 +
  25 + /**
21 * 姓名 26 * 姓名
22 */ 27 */
23 private String name; 28 private String name;
@@ -65,4 +70,12 @@ public class OrderContactPersonListCo extends BasePageQuery { @@ -65,4 +70,12 @@ public class OrderContactPersonListCo extends BasePageQuery {
65 public void setMobile(String mobile) { 70 public void setMobile(String mobile) {
66 this.mobile = mobile; 71 this.mobile = mobile;
67 } 72 }
  73 +
  74 + public Long getMarketId() {
  75 + return marketId;
  76 + }
  77 +
  78 + public void setMarketId(Long marketId) {
  79 + this.marketId = marketId;
  80 + }
68 } 81 }
69 \ No newline at end of file 82 \ No newline at end of file
etrade-order/src/main/java/com/diligrp/etrade/order/domain/contactPerson/OrderContactPersonListVo.java
@@ -79,6 +79,11 @@ public class OrderContactPersonListVo implements Serializable { @@ -79,6 +79,11 @@ public class OrderContactPersonListVo implements Serializable {
79 79
80 private Integer defaultType; 80 private Integer defaultType;
81 81
  82 + /**
  83 + * 是否可配送 0 不可配送,1可配送
  84 + */
  85 + private Integer deliverable;
  86 +
82 public Integer getDefaultType() { 87 public Integer getDefaultType() {
83 return defaultType; 88 return defaultType;
84 } 89 }
@@ -209,4 +214,12 @@ public class OrderContactPersonListVo implements Serializable { @@ -209,4 +214,12 @@ public class OrderContactPersonListVo implements Serializable {
209 public void setVersion(Integer version) { 214 public void setVersion(Integer version) {
210 this.version = version; 215 this.version = version;
211 } 216 }
  217 +
  218 + public Integer getDeliverable() {
  219 + return deliverable;
  220 + }
  221 +
  222 + public void setDeliverable(Integer deliverable) {
  223 + this.deliverable = deliverable;
  224 + }
212 } 225 }
213 \ No newline at end of file 226 \ No newline at end of file
etrade-order/src/main/java/com/diligrp/etrade/order/model/OrderContactPerson.java
@@ -62,6 +62,15 @@ public class OrderContactPerson extends BaseDo { @@ -62,6 +62,15 @@ public class OrderContactPerson extends BaseDo {
62 * 区县 62 * 区县
63 */ 63 */
64 private String districtName; 64 private String districtName;
  65 + /**
  66 + * 街道
  67 + */
  68 + private Long streetId;
  69 +
  70 + /**
  71 + * 街道名称
  72 + */
  73 + private String streetName;
65 74
66 /** 75 /**
67 * 状态 1:启用 2:禁用 76 * 状态 1:启用 2:禁用
@@ -186,6 +195,22 @@ public class OrderContactPerson extends BaseDo { @@ -186,6 +195,22 @@ public class OrderContactPerson extends BaseDo {
186 this.state = state; 195 this.state = state;
187 } 196 }
188 197
  198 + public Long getStreetId() {
  199 + return streetId;
  200 + }
  201 +
  202 + public void setStreetId(Long streetId) {
  203 + this.streetId = streetId;
  204 + }
  205 +
  206 + public String getStreetName() {
  207 + return streetName;
  208 + }
  209 +
  210 + public void setStreetName(String streetName) {
  211 + this.streetName = streetName;
  212 + }
  213 +
189 @Override 214 @Override
190 public String toString() { 215 public String toString() {
191 return "EcapContactPersonDo{" + 216 return "EcapContactPersonDo{" +
@@ -201,6 +226,8 @@ public class OrderContactPerson extends BaseDo { @@ -201,6 +226,8 @@ public class OrderContactPerson extends BaseDo {
201 ", cityName='" + cityName + '\'' + 226 ", cityName='" + cityName + '\'' +
202 ", districtId=" + districtId + 227 ", districtId=" + districtId +
203 ", districtName='" + districtName + '\'' + 228 ", districtName='" + districtName + '\'' +
  229 + ", streetId=" + streetId +
  230 + ", streetName='" + streetName + '\'' +
204 ", state=" + state + 231 ", state=" + state +
205 ", id=" + id + 232 ", id=" + id +
206 ", version=" + version + 233 ", version=" + version +
etrade-order/src/main/java/com/diligrp/etrade/order/model/OrderDelivery.java
@@ -43,6 +43,15 @@ public class OrderDelivery { @@ -43,6 +43,15 @@ public class OrderDelivery {
43 43
44 /** 区县 */ 44 /** 区县 */
45 private String districtName; 45 private String districtName;
  46 + /**
  47 + * 街道
  48 + */
  49 + private Long streetId;
  50 +
  51 + /**
  52 + * 街道名称
  53 + */
  54 + private String streetName;
46 55
47 /** 收货人电话 */ 56 /** 收货人电话 */
48 private String receiverPhone; 57 private String receiverPhone;
etrade-order/src/main/java/com/diligrp/etrade/order/service/BaseRegionService.java
@@ -14,4 +14,13 @@ import java.util.List; @@ -14,4 +14,13 @@ import java.util.List;
14 */ 14 */
15 public interface BaseRegionService { 15 public interface BaseRegionService {
16 List<BaseRegionNextVo> getNextList(BaseRegionCo co); 16 List<BaseRegionNextVo> getNextList(BaseRegionCo co);
  17 +
  18 + /**
  19 + * 校验是否可配送
  20 + * @param provinceId
  21 + * @param cityId
  22 + * @param districtId
  23 + * @param streetId
  24 + */
  25 + void checkRegion(Long provinceId, Long cityId, Long districtId, Long streetId,Long marketId);
17 } 26 }
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderContactPersonService.java
@@ -3,6 +3,7 @@ package com.diligrp.etrade.order.service; @@ -3,6 +3,7 @@ package com.diligrp.etrade.order.service;
3 3
4 import com.diligrp.etrade.core.domain.Message; 4 import com.diligrp.etrade.core.domain.Message;
5 import com.diligrp.etrade.core.domain.PageMessage; 5 import com.diligrp.etrade.core.domain.PageMessage;
  6 +import com.diligrp.etrade.order.domain.OrderCreateDto;
6 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonCo; 7 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonCo;
7 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListCo; 8 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListCo;
8 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListVo; 9 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListVo;
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderDeliveryService.java
1 package com.diligrp.etrade.order.service; 1 package com.diligrp.etrade.order.service;
2 2
  3 +import com.diligrp.etrade.order.domain.OrderCreateDto;
3 import com.diligrp.etrade.order.domain.OrderOperateDto; 4 import com.diligrp.etrade.order.domain.OrderOperateDto;
4 import com.diligrp.etrade.order.model.Order; 5 import com.diligrp.etrade.order.model.Order;
5 import com.diligrp.etrade.order.model.OrderDelivery; 6 import com.diligrp.etrade.order.model.OrderDelivery;
@@ -26,4 +27,10 @@ public interface OrderDeliveryService { @@ -26,4 +27,10 @@ public interface OrderDeliveryService {
26 27
27 /** 订单配送超时自动收货 */ 28 /** 订单配送超时自动收货 */
28 void endOrderDeliveryOutTime(); 29 void endOrderDeliveryOutTime();
  30 +
  31 + /**
  32 + * 校验配送地址
  33 + * @param orderCreateDto
  34 + */
  35 + void checkPersonContact(OrderCreateDto orderCreateDto);
29 } 36 }
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/BaseRegionServiceImpl.java
@@ -76,23 +76,8 @@ public class BaseRegionServiceImpl implements BaseRegionService { @@ -76,23 +76,8 @@ public class BaseRegionServiceImpl implements BaseRegionService {
76 citiesMap = new HashMap<>(); 76 citiesMap = new HashMap<>();
77 provinces.add(baseProvince); 77 provinces.add(baseProvince);
78 } 78 }
79 -// BaseRegionNextVo city = new BaseRegionNextVo(baseRegion.getCityId(), baseRegion.getCityName(),2);  
80 -// citiesMap.put(baseRegion.getCityId(),city);  
81 - }/*else{  
82 - if(citiesMap.get(baseRegion.getCityId())==null){  
83 - BaseRegionNextVo city = new BaseRegionNextVo(baseRegion.getCityId(), baseRegion.getCityName(),2);  
84 - citiesMap.put(baseRegion.getCityId(),city);  
85 - }  
86 - }*/  
87 -// BaseRegionNextVo district = new BaseRegionNextVo(baseRegion.getDistrictId(), baseRegion.getDistrictName(),3);  
88 -// districtsMap.put(district.getId(),district);  
89 - }/*else{  
90 - if(districtsMap.get(baseRegion.getDistrictId())==null){  
91 - BaseRegionNextVo district = new BaseRegionNextVo(baseRegion.getDistrictId(), baseRegion.getDistrictName(),3);  
92 - districtsMap.put(baseRegion.getDistrictId(),district);  
93 } 79 }
94 -  
95 - }*/ 80 + }
96 BaseRegionNextVo street = new BaseRegionNextVo(baseRegion.getStreetId(), baseRegion.getStreetName(),4); 81 BaseRegionNextVo street = new BaseRegionNextVo(baseRegion.getStreetId(), baseRegion.getStreetName(),4);
97 streetList.add(street); 82 streetList.add(street);
98 lastBaseRegion = baseRegion; 83 lastBaseRegion = baseRegion;
@@ -122,4 +107,12 @@ public class BaseRegionServiceImpl implements BaseRegionService { @@ -122,4 +107,12 @@ public class BaseRegionServiceImpl implements BaseRegionService {
122 107
123 return provinces; 108 return provinces;
124 } 109 }
  110 +
  111 + @Override
  112 + public void checkRegion(Long provinceId, Long cityId, Long districtId, Long streetId,Long marketId) {
  113 + BaseRegion baseRegions = baseRegionMapper.getRegionsByIds(provinceId,cityId,districtId,streetId,marketId);
  114 + if(baseRegions == null){
  115 + throw new OrderException(OrderErrorCode.PARAM_ERROR,"暂不支持该地址配送");
  116 + }
  117 + }
125 } 118 }
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderContactPersonServiceImpl.java
@@ -4,11 +4,14 @@ import com.diligrp.etrade.core.domain.Message; @@ -4,11 +4,14 @@ import com.diligrp.etrade.core.domain.Message;
4 import com.diligrp.etrade.core.domain.PageMessage; 4 import com.diligrp.etrade.core.domain.PageMessage;
5 import com.diligrp.etrade.core.util.JsonUtils; 5 import com.diligrp.etrade.core.util.JsonUtils;
6 import com.diligrp.etrade.order.dao.OrderContactPersonMapper; 6 import com.diligrp.etrade.order.dao.OrderContactPersonMapper;
  7 +import com.diligrp.etrade.order.domain.OrderCreateDto;
7 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonCo; 8 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonCo;
8 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListCo; 9 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListCo;
9 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListVo; 10 import com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListVo;
10 import com.diligrp.etrade.order.model.OrderContactPerson; 11 import com.diligrp.etrade.order.model.OrderContactPerson;
11 import com.diligrp.etrade.order.service.OrderContactPersonService; 12 import com.diligrp.etrade.order.service.OrderContactPersonService;
  13 +import com.diligrp.etrade.order.type.OrderAchieveState;
  14 +import com.diligrp.etrade.order.type.OrderAchieveType;
12 import com.diligrp.etrade.order.type.OrderContactDefaultType; 15 import com.diligrp.etrade.order.type.OrderContactDefaultType;
13 import com.github.pagehelper.Page; 16 import com.github.pagehelper.Page;
14 import com.github.pagehelper.PageHelper; 17 import com.github.pagehelper.PageHelper;
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderDeliveryServiceImpl.java
@@ -3,6 +3,7 @@ package com.diligrp.etrade.order.service.impl; @@ -3,6 +3,7 @@ package com.diligrp.etrade.order.service.impl;
3 import com.diligrp.etrade.order.dao.OrderDeliveryMapper; 3 import com.diligrp.etrade.order.dao.OrderDeliveryMapper;
4 import com.diligrp.etrade.order.dao.OrderExtraMapper; 4 import com.diligrp.etrade.order.dao.OrderExtraMapper;
5 import com.diligrp.etrade.order.dao.OrderMapper; 5 import com.diligrp.etrade.order.dao.OrderMapper;
  6 +import com.diligrp.etrade.order.domain.OrderCreateDto;
6 import com.diligrp.etrade.order.domain.OrderDeliveryCheckDto; 7 import com.diligrp.etrade.order.domain.OrderDeliveryCheckDto;
7 import com.diligrp.etrade.order.domain.OrderGetDto; 8 import com.diligrp.etrade.order.domain.OrderGetDto;
8 import com.diligrp.etrade.order.domain.OrderOperateDto; 9 import com.diligrp.etrade.order.domain.OrderOperateDto;
@@ -11,11 +12,9 @@ import com.diligrp.etrade.order.exception.OrderException; @@ -11,11 +12,9 @@ import com.diligrp.etrade.order.exception.OrderException;
11 import com.diligrp.etrade.order.model.Order; 12 import com.diligrp.etrade.order.model.Order;
12 import com.diligrp.etrade.order.model.OrderDelivery; 13 import com.diligrp.etrade.order.model.OrderDelivery;
13 import com.diligrp.etrade.order.model.OrderExtra; 14 import com.diligrp.etrade.order.model.OrderExtra;
14 -import com.diligrp.etrade.order.service.OrderDeliveryService;  
15 -import com.diligrp.etrade.order.service.OrderExtraService;  
16 -import com.diligrp.etrade.order.service.OrderPaymentService;  
17 -import com.diligrp.etrade.order.service.OrderService; 15 +import com.diligrp.etrade.order.service.*;
18 import com.diligrp.etrade.order.type.OrderAchieveState; 16 import com.diligrp.etrade.order.type.OrderAchieveState;
  17 +import com.diligrp.etrade.order.type.OrderAchieveType;
19 import com.diligrp.etrade.order.type.OrderOrderState; 18 import com.diligrp.etrade.order.type.OrderOrderState;
20 import com.diligrp.etrade.order.type.OrderState; 19 import com.diligrp.etrade.order.type.OrderState;
21 import com.diligrp.etrade.order.util.OrderConstant; 20 import com.diligrp.etrade.order.util.OrderConstant;
@@ -58,6 +57,9 @@ public class OrderDeliveryServiceImpl implements OrderDeliveryService { @@ -58,6 +57,9 @@ public class OrderDeliveryServiceImpl implements OrderDeliveryService {
58 @Resource 57 @Resource
59 private RedissonClient redissonClient; 58 private RedissonClient redissonClient;
60 59
  60 + @Resource
  61 + private BaseRegionService baseRegionService;
  62 +
61 @Override 63 @Override
62 public int createOrderDelivery(OrderDelivery orderDelivery) { 64 public int createOrderDelivery(OrderDelivery orderDelivery) {
63 return orderDeliveryMapper.save(orderDelivery); 65 return orderDeliveryMapper.save(orderDelivery);
@@ -239,4 +241,13 @@ public class OrderDeliveryServiceImpl implements OrderDeliveryService { @@ -239,4 +241,13 @@ public class OrderDeliveryServiceImpl implements OrderDeliveryService {
239 241
240 242
241 } 243 }
  244 + @Override
  245 + public void checkPersonContact(OrderCreateDto orderCreateDto) {
  246 + if(orderCreateDto==null||orderCreateDto.getDelivery()==null){
  247 + return;
  248 + }
  249 + if(OrderAchieveType.SELLER_DELIVERY.getCodeInteger().equals(orderCreateDto.getAchieveType())){
  250 + baseRegionService.checkRegion(orderCreateDto.getDelivery().getProvinceId(),orderCreateDto.getDelivery().getCityId(),orderCreateDto.getDelivery().getDistrictId(),orderCreateDto.getDelivery().getStreetId(),orderCreateDto.getMarketId());
  251 + }
  252 + }
242 } 253 }
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
@@ -85,9 +85,6 @@ public class OrderServiceImpl implements OrderService { @@ -85,9 +85,6 @@ public class OrderServiceImpl implements OrderService {
85 private OrderPaymentService orderPaymentService; 85 private OrderPaymentService orderPaymentService;
86 86
87 @Resource 87 @Resource
88 - private OrderPaymentFeeService orderPaymentFeeService;  
89 -  
90 - @Resource  
91 private OrderCouponService orderCouponService; 88 private OrderCouponService orderCouponService;
92 89
93 @Resource 90 @Resource
@@ -107,8 +104,6 @@ public class OrderServiceImpl implements OrderService { @@ -107,8 +104,6 @@ public class OrderServiceImpl implements OrderService {
107 104
108 @Resource 105 @Resource
109 private PayRpcResolver payRpcResolver; 106 private PayRpcResolver payRpcResolver;
110 - @Resource  
111 - private WeChatPayRpcResolver weChatPayRpcResolver;  
112 107
113 @Resource 108 @Resource
114 private SettingShopCommonService settingShopCommonService; 109 private SettingShopCommonService settingShopCommonService;
@@ -116,15 +111,9 @@ public class OrderServiceImpl implements OrderService { @@ -116,15 +111,9 @@ public class OrderServiceImpl implements OrderService {
116 private OrderExtraService orderExtraService; 111 private OrderExtraService orderExtraService;
117 112
118 @Resource 113 @Resource
119 - private ShopService shopService;  
120 -  
121 - @Resource  
122 private OrderDeliveryService orderDeliveryService; 114 private OrderDeliveryService orderDeliveryService;
123 115
124 @Resource 116 @Resource
125 - private BasicDataConfigRpc basicDataConfigRpc;  
126 -  
127 - @Resource  
128 private IShopCartMessageService shopCartMessageService; 117 private IShopCartMessageService shopCartMessageService;
129 118
130 @Resource 119 @Resource
@@ -144,6 +133,8 @@ public class OrderServiceImpl implements OrderService { @@ -144,6 +133,8 @@ public class OrderServiceImpl implements OrderService {
144 orderCreateDto.setShopCustomerId(shop.getCustomerId()); 133 orderCreateDto.setShopCustomerId(shop.getCustomerId());
145 orderCreateDto.setShopName(shop.getName()); 134 orderCreateDto.setShopName(shop.getName());
146 orderCreateDto.setShopCustomerName(shop.getCustomerName()); 135 orderCreateDto.setShopCustomerName(shop.getCustomerName());
  136 + //效验买方地址是否可配送
  137 + orderDeliveryService.checkPersonContact(orderCreateDto);
147 //验证订单商品总重量与订单商品总价格 138 //验证订单商品总重量与订单商品总价格
148 orderGoodsService.checkBuyerOrderDto(orderCreateDto,orderType,transportFeeFlag); 139 orderGoodsService.checkBuyerOrderDto(orderCreateDto,orderType,transportFeeFlag);
149 //创建订单 140 //创建订单
@@ -188,6 +179,8 @@ public class OrderServiceImpl implements OrderService { @@ -188,6 +179,8 @@ public class OrderServiceImpl implements OrderService {
188 orderCreateDto.setShopCustomerId(shop.getCustomerId()); 179 orderCreateDto.setShopCustomerId(shop.getCustomerId());
189 orderCreateDto.setShopName(shop.getName()); 180 orderCreateDto.setShopName(shop.getName());
190 orderCreateDto.setShopCustomerName(shop.getCustomerName()); 181 orderCreateDto.setShopCustomerName(shop.getCustomerName());
  182 + //效验买方地址是否可配送
  183 + orderDeliveryService.checkPersonContact(orderCreateDto);
191 //验证订单商品总重量与订单商品总价格 184 //验证订单商品总重量与订单商品总价格
192 orderGoodsService.checkBuyerOrderDto(orderCreateDto,identityType,true); 185 orderGoodsService.checkBuyerOrderDto(orderCreateDto,identityType,true);
193 //创建订单 186 //创建订单
@@ -423,6 +416,8 @@ public class OrderServiceImpl implements OrderService { @@ -423,6 +416,8 @@ public class OrderServiceImpl implements OrderService {
423 @Transactional 416 @Transactional
424 @Override 417 @Override
425 public void updateOrder(OrderCreateDto buyerOrderDto, Integer orderType) { 418 public void updateOrder(OrderCreateDto buyerOrderDto, Integer orderType) {
  419 + //效验买方地址是否可配送
  420 + orderDeliveryService.checkPersonContact(buyerOrderDto);
426 //验证订单商品总重量与订单商品总价格 421 //验证订单商品总重量与订单商品总价格
427 orderGoodsService.checkBuyerOrderDto(buyerOrderDto,orderType,true); 422 orderGoodsService.checkBuyerOrderDto(buyerOrderDto,orderType,true);
428 //获取原始订单 423 //获取原始订单
@@ -455,6 +450,8 @@ public class OrderServiceImpl implements OrderService { @@ -455,6 +450,8 @@ public class OrderServiceImpl implements OrderService {
455 public void updateSellerOrder(OrderCreateDto buyerOrderDto, Integer orderType) { 450 public void updateSellerOrder(OrderCreateDto buyerOrderDto, Integer orderType) {
456 //获取订单并效验状态 451 //获取订单并效验状态
457 Order order = getOrderAndCheckState(null, buyerOrderDto.getCode(), buyerOrderDto.getMarketId(),OrderOrderState.SELLER_FIX,buyerOrderDto); 452 Order order = getOrderAndCheckState(null, buyerOrderDto.getCode(), buyerOrderDto.getMarketId(),OrderOrderState.SELLER_FIX,buyerOrderDto);
  453 + //效验买方地址是否可配送
  454 + orderDeliveryService.checkPersonContact(buyerOrderDto);
458 //验证订单商品总重量与订单商品总价格 455 //验证订单商品总重量与订单商品总价格
459 orderGoodsService.checkBuyerOrderDto(buyerOrderDto,orderType,true); 456 orderGoodsService.checkBuyerOrderDto(buyerOrderDto,orderType,true);
460 //判断卖方修改人是否有权限修改订单 457 //判断卖方修改人是否有权限修改订单
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/contactPerson/OrderContactPersonMapper.xml
@@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
17 <result column="city_name" jdbcType="VARCHAR" property="cityName" /> 17 <result column="city_name" jdbcType="VARCHAR" property="cityName" />
18 <result column="district_id" jdbcType="BIGINT" property="districtId" /> 18 <result column="district_id" jdbcType="BIGINT" property="districtId" />
19 <result column="district_name" jdbcType="VARCHAR" property="districtName" /> 19 <result column="district_name" jdbcType="VARCHAR" property="districtName" />
  20 + <result column="street_id" jdbcType="BIGINT" property="streetId" />
  21 + <result column="street_name" jdbcType="VARCHAR" property="streetName" />
20 <result column="address" jdbcType="VARCHAR" property="address" /> 22 <result column="address" jdbcType="VARCHAR" property="address" />
21 <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" /> 23 <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
22 <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" /> 24 <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
@@ -25,10 +27,7 @@ @@ -25,10 +27,7 @@
25 <result column="default_type" jdbcType="INTEGER" property="defaultType" /> 27 <result column="default_type" jdbcType="INTEGER" property="defaultType" />
26 </resultMap> 28 </resultMap>
27 <sql id="Base_Column_List"> 29 <sql id="Base_Column_List">
28 - <!--  
29 - WARNING - @mbg.generated  
30 - -->  
31 - id,creater_id,creater, name, mobile,extension_number,province_id,province_name,city_id,city_name, district_id,district_name, address, created_time, modified_time,state,version,default_type 30 + id,creater_id,creater, `name`, mobile,extension_number,province_id,province_name,city_id,city_name, district_id,district_name, street_id,street_name, address, created_time, modified_time,state,version,default_type
32 </sql> 31 </sql>
33 <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.diligrp.etrade.order.model.OrderContactPerson"> 32 <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.diligrp.etrade.order.model.OrderContactPerson">
34 INSERT INTO ecap_contact_person( 33 INSERT INTO ecap_contact_person(
@@ -43,6 +42,8 @@ @@ -43,6 +42,8 @@
43 city_name, 42 city_name,
44 district_id, 43 district_id,
45 district_name, 44 district_name,
  45 + street_id,
  46 + street_name,
46 address, 47 address,
47 version, 48 version,
48 state, 49 state,
@@ -57,6 +58,8 @@ @@ -57,6 +58,8 @@
57 #{provinceName}, 58 #{provinceName},
58 #{cityId}, 59 #{cityId},
59 #{cityName}, 60 #{cityName},
  61 + #{streetId},
  62 + #{streetName},
60 #{districtId}, 63 #{districtId},
61 #{districtName}, 64 #{districtName},
62 #{address}, 65 #{address},
@@ -70,6 +73,7 @@ @@ -70,6 +73,7 @@
70 name = #{name},mobile = #{mobile},extension_number = #{extensionNumber}, 73 name = #{name},mobile = #{mobile},extension_number = #{extensionNumber},
71 province_id = #{provinceId},city_id = #{cityId}, 74 province_id = #{provinceId},city_id = #{cityId},
72 district_id = #{districtId},province_name = #{provinceName}, 75 district_id = #{districtId},province_name = #{provinceName},
  76 + street_id = #{streetId},street_name = #{streetName},
73 city_name = #{cityName},district_name = #{districtName}, 77 city_name = #{cityName},district_name = #{districtName},
74 address = #{address},version = #{version}+1, 78 address = #{address},version = #{version}+1,
75 state = #{state},default_type = #{defaultType} 79 state = #{state},default_type = #{defaultType}
@@ -87,8 +91,13 @@ @@ -87,8 +91,13 @@
87 91
88 <select id="list" resultType="com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListVo"> 92 <select id="list" resultType="com.diligrp.etrade.order.domain.contactPerson.OrderContactPersonListVo">
89 SELECT 93 SELECT
90 - <include refid="Base_Column_List" /> 94 + p.id id,p.creater_id creater_id,p.creater creater, p.`name` name, p.mobile mobile,p.extension_number extension_number,p.province_id province_id,
  95 + p.province_name province_name,p.city_id city_id,p.city_name city_name, p.district_id district_id,p.district_name district_name, p.street_id street_id,
  96 + p.street_name street_name, p.address address, p.created_time created_time, p.modified_time modified_time,p.state state,p.version version,
  97 + p.default_type default_type,
  98 + case when br.state is not null then br.state else 0 end as deliverable
91 FROM ecap_contact_person p 99 FROM ecap_contact_person p
  100 + left join base_region br on p.street_id = br.street_id and br.market_id = #{marketId}
92 WHERE p.state = 1 101 WHERE p.state = 1
93 AND p.creater_id = #{createrId} 102 AND p.creater_id = #{createrId}
94 <if test="keyWords !=null and keyWords !=''"> 103 <if test="keyWords !=null and keyWords !=''">
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/BaseRegionMapper.xml
@@ -25,7 +25,8 @@ @@ -25,7 +25,8 @@
25 select 25 select
26 <include refid="Base_Column_List" /> 26 <include refid="Base_Column_List" />
27 from base_region 27 from base_region
28 - <where> 1=1 28 + <where>
  29 + market_id = #{marketId,jdbcType=BIGINT}
29 <if test="provinceId != null"> 30 <if test="provinceId != null">
30 and province_id = #{provinceId,jdbcType=BIGINT} 31 and province_id = #{provinceId,jdbcType=BIGINT}
31 </if> 32 </if>
@@ -42,4 +43,26 @@ @@ -42,4 +43,26 @@
42 </where> 43 </where>
43 order by province_id,city_id,district_id,street_id 44 order by province_id,city_id,district_id,street_id
44 </select> 45 </select>
  46 + <select id="getRegionsByIds" resultType="com.diligrp.etrade.order.model.BaseRegion">
  47 + select
  48 + <include refid="Base_Column_List" />
  49 + from base_region
  50 + <where>
  51 + market_id = #{marketId,jdbcType=BIGINT}
  52 + <if test="provinceId != null">
  53 + and province_id = #{provinceId,jdbcType=BIGINT}
  54 + </if>
  55 + <if test="cityId != null">
  56 + and city_id = #{cityId,jdbcType=BIGINT}
  57 + </if>
  58 + <if test="districtId != null">
  59 + and district_id= #{districtId,jdbcType=BIGINT}
  60 + </if>
  61 + <if test="streetId != null">
  62 + and street_id= #{streetId,jdbcType=BIGINT}
  63 + </if>
  64 + and state = 1
  65 + </where>
  66 + limit 1
  67 + </select>
45 </mapper> 68 </mapper>
46 \ No newline at end of file 69 \ No newline at end of file