Authored by qinchao

修改地址参考有货规则

@@ -123,6 +123,9 @@ public class BuyerOrderController { @@ -123,6 +123,9 @@ public class BuyerOrderController {
123 123
124 /** 124 /**
125 * 买家修改收货地址 125 * 买家修改收货地址
  126 + * 最新逻辑:手机号码、详细地址和收货人如果存在*号,先判断是不是跟原来的一样,如果不一样,
  127 + * 详细地址和收货人存在*号,直接报错,手机号码肯定不符合数字规则
  128 + *
126 * @return 129 * @return
127 */ 130 */
128 @RequestMapping(params = "method=ufo.buyer.modifyAddress") 131 @RequestMapping(params = "method=ufo.buyer.modifyAddress")
@@ -15,6 +15,7 @@ import com.yohobuy.ufo.model.order.resp.PageResp; @@ -15,6 +15,7 @@ import com.yohobuy.ufo.model.order.resp.PageResp;
15 import com.yohobuy.ufo.model.order.vo.OrderListVo; 15 import com.yohobuy.ufo.model.order.vo.OrderListVo;
16 import com.yohoufo.common.exception.UfoServiceException; 16 import com.yohoufo.common.exception.UfoServiceException;
17 import com.yohoufo.common.utils.DateUtil; 17 import com.yohoufo.common.utils.DateUtil;
  18 +import com.yohoufo.common.utils.UserInfoHiddenHelper;
18 import com.yohoufo.dal.order.BuyerOrderGoodsMapper; 19 import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
19 import com.yohoufo.dal.order.BuyerOrderMapper; 20 import com.yohoufo.dal.order.BuyerOrderMapper;
20 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 21 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
@@ -156,14 +157,29 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -156,14 +157,29 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
156 //详细地址没有变化 157 //详细地址没有变化
157 if(StringUtils.equals(dbAddressInfo_hidden.getAddress(),changedAddress.getAddress())){ 158 if(StringUtils.equals(dbAddressInfo_hidden.getAddress(),changedAddress.getAddress())){
158 changedAddress.setAddress(dbAddressInfo.getAddress()); 159 changedAddress.setAddress(dbAddressInfo.getAddress());
  160 + }else{
  161 + if(changedAddress.getAddress().contains("*")){
  162 + logger.warn("dbAddressInfo_hidden is null ,uid {} ,orderCode {} , invalid address with * {}",uid,orderCode,changedAddress.getAddress());
  163 + throw new UfoServiceException(400,"详细地址信息格式填写错误");
  164 + }
159 } 165 }
160 //收货人没有变化 166 //收货人没有变化
161 if(StringUtils.equals(dbAddressInfo_hidden.getConsignee(),changedAddress.getConsignee())){ 167 if(StringUtils.equals(dbAddressInfo_hidden.getConsignee(),changedAddress.getConsignee())){
162 changedAddress.setConsignee(dbAddressInfo.getConsignee()); 168 changedAddress.setConsignee(dbAddressInfo.getConsignee());
  169 + }else{
  170 + if(changedAddress.getConsignee().contains("*")){
  171 + logger.warn("dbAddressInfo_hidden is null ,uid {} ,orderCode {} , invalid consignee with * {}",uid,orderCode,changedAddress.getConsignee());
  172 + throw new UfoServiceException(400,"收货人格式填写错误");
  173 + }
163 } 174 }
164 //手机号没有变化 175 //手机号没有变化
165 if(StringUtils.equals(dbAddressInfo_hidden.getMobile(),changedAddress.getMobile())){ 176 if(StringUtils.equals(dbAddressInfo_hidden.getMobile(),changedAddress.getMobile())){
166 changedAddress.setMobile(dbAddressInfo.getMobile()); 177 changedAddress.setMobile(dbAddressInfo.getMobile());
  178 + }else{
  179 + if(!UserInfoHiddenHelper.isPhone(changedAddress.getMobile())){
  180 + logger.warn("dbAddressInfo_hidden is null ,uid {} ,orderCode {} , invalid mobile {}",uid,orderCode,changedAddress.getMobile());
  181 + throw new UfoServiceException(400,"手机号码格式填写错误");
  182 + }
167 } 183 }
168 184
169 boolean changed = convertAddressInfoFrontRequest(dbAddressInfo,changedAddress); 185 boolean changed = convertAddressInfoFrontRequest(dbAddressInfo,changedAddress);
@@ -190,9 +206,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -190,9 +206,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
190 } 206 }
191 207
192 //买家已付款,卖家已发货,只有这两种状态的情况下,才允许改地址 208 //买家已付款,卖家已发货,只有这两种状态的情况下,才允许改地址
193 - /*boolean allowChange = buyerOrder.getStatus().intValue() == OrderStatus.HAS_PAYED.getCode()  
194 - ||buyerOrder.getStatus().intValue() == OrderStatus.SELLER_SEND_OUT.getCode() ;*/  
195 -  
196 boolean allowChange = ActionStatusHold.buyerCanModifyAddress(buyerOrder.getStatus()); 209 boolean allowChange = ActionStatusHold.buyerCanModifyAddress(buyerOrder.getStatus());
197 if(!allowChange){ 210 if(!allowChange){
198 logger.warn("buyerModifyAddress check orderCode status not invalid, uid is {}, orderCode is {} ,status is {}", 211 logger.warn("buyerModifyAddress check orderCode status not invalid, uid is {}, orderCode is {} ,status is {}",