Authored by Lixiaodi

Merge branch 'test6.8.6' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.6

... ... @@ -6,15 +6,12 @@ import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
... ... @@ -25,7 +22,9 @@ import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
... ... @@ -45,9 +44,6 @@ public class BuyerOrderController {
@Autowired
private SellerFeeService sellerFeeService;
/**
* [购买]订单列表
* 1: 全部
... ... @@ -58,16 +54,12 @@ public class BuyerOrderController {
* 7:交易失败
*/
@RequestMapping(params = "method=ufo.order.list")
@ResponseBody
public ApiResponse getOrderList(@RequestParam("type") int type,
@RequestParam("uid") int uid,
@RequestParam("tabType") String tabType,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
TabType actor = TabType.getTabType(tabType);
if (Objects.isNull(actor)){
return new ApiResponse.ApiResponseBuilder().code(400).message("非法的tab").build();
}
... ... @@ -79,9 +71,7 @@ public class BuyerOrderController {
.tabType(tabType)
.actor(actor)
.build();
LOG.info("in ufo.order.list, req {}", orderListRequest);
PageResp<OrderListInfo> orderListInfoRsp;
switch (actor){
case BUY:
... ... @@ -93,7 +83,6 @@ public class BuyerOrderController {
default:
orderListInfoRsp = null;
}
return new ApiResponse.ApiResponseBuilder().code(200).data(orderListInfoRsp).message("订单列表").build();
}
... ... @@ -105,7 +94,6 @@ public class BuyerOrderController {
* @return
*/
@RequestMapping(params = "method=ufo.order.detail")
@ResponseBody
public ApiResponse getOrderDetail(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid,
@RequestParam("tabType") String tabType) {
... ... @@ -137,8 +125,6 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).data(orderDetailInfo).message("订单详情").build();
}
/**
* 买家修改收货地址
* 最新逻辑:手机号码、详细地址和收货人如果存在*号,先判断是不是跟原来的一样,如果不一样,
... ... @@ -184,28 +170,6 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).message("接受瑕疵").build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/erp/qualityCheckPass")
@ResponseBody
public ApiResponse qualityCheckPass(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.qualityCheckPass in, req is {}", request);
buyerOrderService.qualityCheckPass(request.getOrderCode());
LOG.info("method ufo.depot.qualityCheckPass out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心质检通过成功").build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/erp/miniFaultCreate")
@ResponseBody
public ApiResponse miniFaultCreate(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.miniFaultCreate in, req is {}", request);
buyerOrderService.miniFaultCreate(request.getOrderCode());
LOG.info("method ufo.depot.miniFaultCreate out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("瑕疵创建成功").build();
}
/**
* 用户不接受瑕疵
*/
... ... @@ -229,29 +193,22 @@ public class BuyerOrderController {
*/
@RequestMapping(params = "method=ufo.buyer.cancel")
@ResponseBody
public ApiResponse cancel(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.cancel in, orderCode is {}, uid is {}", orderCode, uid);
OrderRequest orderRequest = OrderRequest.builder()
.uid(uid)
.orderCode(orderCode)
.build();
buyerOrderService.cancel(orderRequest);
LOG.info("method ufo.buyer.cancel out, orderCode is {}, uid is {}", orderCode, uid);
return new ApiResponse.ApiResponseBuilder().code(200).message("取消成功").build();
}
/**
* 取消订单
*/
@RequestMapping(params = "method=ufo.buyer.delete")
@ResponseBody
public ApiResponse delete(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.delete in, orderCode is {}, uid is {}", orderCode, uid);
... ... @@ -260,7 +217,6 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("取消成功").build();
}
/**
* 确认收货
* @param orderCode
... ... @@ -268,7 +224,6 @@ public class BuyerOrderController {
* @return
*/
@RequestMapping(params = "method=ufo.buyer.confirm")
@ResponseBody
public ApiResponse confirm(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.confirm in, orderCode is {}, uid is {}", orderCode, uid);
... ... @@ -285,42 +240,7 @@ public class BuyerOrderController {
}
/**
* 平台确认收货
*/
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/erp/confirmReceive")
@ResponseBody
public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
buyerOrderService.confirmReceive(request.getOrderCode());
LOG.info("method ufo.depot.confirmReceive out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build();
}
/**
* 客服取消买家订单
* 提供给运营平台使用
*
* @return
*/
@RequestMapping(value = "/erp/cancelBuyerOrderByCS")
@IgnoreSession
@IgnoreSignature
public ApiResponse cancelBuyerOrderByCS(@RequestBody BuyerOrderCancelReq request) {
LOG.info("method cs cancel buyer order in, req is {}", request);
// 检查
if (request.getUid() <= 0 || request.getOrderCode() <= 0) {
return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();
}
buyerOrderService.cancelByCS(request.getUid(), request.getOrderCode());
return new ApiResponse.ApiResponseBuilder().code(200).build();
}
@RequestMapping(params = "method=ufo.buyer.computeCompensate")
@ResponseBody
public ApiResponse computeCompensate(@RequestParam("orderCode") long orderCode,
@RequestParam("uid") int uid) {
LOG.info("method ufo.buyer.computeCompensate in, orderCode is {}, uid is {}", orderCode, uid);
... ... @@ -366,7 +286,6 @@ public class BuyerOrderController {
}
@RequestMapping(params = "method=ufo.buyer.orderListNums")
@ResponseBody
public ApiResponse getBuyerOrderNums(@RequestParam("uid") int uid){
LOG.info("in ufo.buyer.orderListNums uid {}", uid);
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
... ... @@ -377,27 +296,21 @@ public class BuyerOrderController {
* [购买] 已购买的商品列表
*/
@RequestMapping(params = "method=ufo.buyedGoods.list")
@ResponseBody
public ApiResponse getMyBuyedGoods(
@RequestParam("uid") int uid,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
TabType actor = TabType.BUY;
OrderListRequest orderListRequest = OrderListRequest.builder()
.uid(uid)
.type(5)
.type(OrderListType.ORDER_SUCCESS.getType())
.page(page)
.limit(limit)
.tabType(actor.getValue())
.actor(actor)
.build();
LOG.info("in ufo.getMyBuyedGoods.list, req {}", orderListRequest);
//TODO remove below codes 2 service level
PageResp<OrderListInfo> orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
List<JSONObject> goods = Lists.newArrayList();
List<Integer> goodsId = Lists.newArrayList();
... ...
package com.yohoufo.order.controller;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq;
import com.yohobuy.ufo.model.order.req.ManualDealRequest;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/erp")
public class ErpGWOrderController {
private final Logger LOG = LoggerUtils.getBuyerOrderLogger();
@Autowired
IBuyerOrderService buyerOrderService;
... ... @@ -23,7 +27,6 @@ public class ErpGWOrderController {
IPaymentService paymentService;
@RequestMapping(params = "method=ufo.buyer.orderNums")
@ResponseBody
@IgnoreSession
public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
... ... @@ -33,7 +36,6 @@ public class ErpGWOrderController {
@IgnoreSignature
@IgnoreSession
//@RequestMapping(params = "method=ufo.order.manualDealMon")
@RequestMapping(value="/manualDealMon")
public ApiResponse manualDealMon(@RequestBody ManualDealRequest req) {
try {
... ... @@ -43,4 +45,56 @@ public class ErpGWOrderController {
}
return new ApiResponse.ApiResponseBuilder().code(200).data("").message("处理成功").build();
}
/**
* 客服取消买家订单
* 提供给运营平台使用
*
* @return
*/
@RequestMapping(value = "/cancelBuyerOrderByCS")
@IgnoreSession
@IgnoreSignature
public ApiResponse cancelBuyerOrderByCS(@RequestBody BuyerOrderCancelReq request) {
LOG.info("method cs cancel buyer order in, req is {}", request);
// 检查
if (request.getUid() <= 0 || request.getOrderCode() <= 0) {
return new ApiResponse.ApiResponseBuilder().code(400).message("参数校验不通过").build();
}
buyerOrderService.cancelByCS(request.getUid(), request.getOrderCode());
return new ApiResponse.ApiResponseBuilder().code(200).build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/qualityCheckPass")
public ApiResponse qualityCheckPass(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.qualityCheckPass in, req is {}", request);
buyerOrderService.qualityCheckPass(request.getOrderCode());
LOG.info("method ufo.depot.qualityCheckPass out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心质检通过成功").build();
}
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/miniFaultCreate")
public ApiResponse miniFaultCreate(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.miniFaultCreate in, req is {}", request);
buyerOrderService.miniFaultCreate(request.getOrderCode());
LOG.info("method ufo.depot.miniFaultCreate out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("瑕疵创建成功").build();
}
/**
* 平台确认收货
*/
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/confirmReceive")
public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
buyerOrderService.confirmReceive(request.getOrderCode());
LOG.info("method ufo.depot.confirmReceive out, req is {}", request);
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定中心确认收货成功").build();
}
}
... ...
... ... @@ -37,8 +37,11 @@ public class ExpressInfoController {
* @return
*/
@RequestMapping(params = "method=ufo.order.deliverToDepot")
public ApiResponse deliverToDepot(@RequestParam("uid") Integer uid,@RequestParam("expressCompanyId") Integer expressCompanyId,
@RequestParam("orderCode") Long orderCode, @RequestParam("wayBillCode") String wayBillCode, @RequestParam("depotNum") Integer depotNum) {
public ApiResponse deliverToDepot(@RequestParam("uid") Integer uid,
@RequestParam("expressCompanyId") Integer expressCompanyId,
@RequestParam("orderCode") Long orderCode,
@RequestParam("wayBillCode") String wayBillCode,
@RequestParam("depotNum") Integer depotNum) {
expressInfoService.deliverToDepot(uid,expressCompanyId, orderCode, wayBillCode,depotNum);
return new ApiResponse();
}
... ... @@ -52,7 +55,9 @@ public class ExpressInfoController {
* @return
*/
@RequestMapping(params = "method=ufo.order.expressDetailInfo")
public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid, @RequestParam("orderCode") Long orderCode,@RequestParam(value = "tabType",required = false) String tabType) {
public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid,
@RequestParam("orderCode") Long orderCode,
@RequestParam(value = "tabType",required = false) String tabType) {
TabType actor = null;
if(StringUtils.isNotBlank(tabType)){
actor = TabType.getTabType(tabType);
... ...
... ... @@ -195,9 +195,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
EventBusPublisher.publishEvent(event);
}
LOGGER.info("deliverToDepot update buyer order status result {} ",updateBuyerCnt);
}
@Override
... ...
... ... @@ -157,20 +157,18 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
log.info("in computePublishPrd, req {}", req);
PriceComputePrepareProcessor.PriceComputeNode pcn = priceComputePrepareProcessor.checkBasePrice(req);
int uid = pcn.getUid();
Integer storageId = pcn.getStorageId();
int num = pcn.getNum();
BigDecimal salePrice = pcn.getPrdPrice();
String tips = null;
ProductProxyService.PrdPrice prdPrice = sellerOrderPrepareProcessor.checkPrice(storageId, salePrice, true);
SkupType skupType = SkupType.getSkupType(req.getSkupType());
try {
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice);
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
}catch (UfoServiceException ex){
tips = ex.getErrorMessage();
}
boolean isSuper = sellerService.isSuperEntrySeller(uid);
SkupType skupType = SkupType.getSkupType(req.getSkupType());
SoldPrdComputeBo spc = buildSoldPrdComputeBo(uid, num, salePrice, isSuper, skupType);
spc.setTips(tips);
return spc;
... ...
... ... @@ -89,13 +89,13 @@ public abstract class AbstractChangePricePrepareProcessor<T extends SellerBaseCh
String tips = null;
ProductProxyService.PrdPrice prdPrice;
prdPrice = sellerOrderPrepareProcessor.checkPrice(storageId, salePrice, req.isShowPriceError());
SkupType skupType = SkupType.getSkupType(req.getSkupType());
try {
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice);
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice, skupType);
}catch (UfoServiceException ex){
tips = ex.getErrorMessage();
}
// compute every fee from price
SkupType skupType = SkupType.getSkupType(req.getSkupType());
OrderComputeHandler computeHandler = orderComputeProvider.findBySkupType(skupType);
SellerOrderComputeResult computeResult = computeHandler.compute(salePrice);
int num = skupMap.size();
... ... @@ -134,43 +134,10 @@ public abstract class AbstractChangePricePrepareProcessor<T extends SellerBaseCh
BigDecimal newPrice,
Map<Integer, SkupDto> skupOfSalingMap);
// Map<Integer, SkupDto> checkNeedProcessSkups(List<Integer> needChangePriceSkupList, Map<Integer, SkupDto> skupOfSalingMap){
// Map<Integer, SkupDto> map = new HashMap<>(needChangePriceSkupList.size());
//
// for(Integer skup: needChangePriceSkupList) {
//
// if (!skupOfSalingMap.containsKey(skup)) {
// logger.warn("ChangePrice checkNeedProcessSkups skup is in other status , skup {}", skup);
// throw new UfoServiceException(501, "部分商品不可调价");
// }
// map.put(skup, skupOfSalingMap.get(skup));
// }
//
// return map;
// }
private BigDecimal calDiffOfEM(BigDecimal sourceEM, BigDecimal targetEM){
return targetEM.subtract(sourceEM);
}
// private Long checkNAcquireBatchNo(String batchNoStr, BatchChangePriceReq req){
// Long batchNo = null;
// boolean isIllegalBatchNo;
// try {
// isIllegalBatchNo = (StringUtils.isBlank(batchNoStr) || (batchNo = Long.valueOf(batchNoStr)) <= 0L);
//
// }catch (Exception ex){
// isIllegalBatchNo = true;
// logger.warn("ChangePrice checkAndAcquire batchNoStr illegal , req {}", req, ex);
// }
//
// if (isIllegalBatchNo){
// throw new UfoServiceException(400, "参数[batchNoStr]非法");
// }
// return batchNo;
// }
/**
* 获取期望变价的skup
* @param req
... ... @@ -186,9 +153,6 @@ public abstract class AbstractChangePricePrepareProcessor<T extends SellerBaseCh
protected abstract List<SellerOrderGoods> getRealSkupOrderGoodsList(T req);
private Map<Integer, SkupDto> checkExistWaitingBuyerPay(T req){
// SellerOrderGoods condition = new SellerOrderGoods();
// condition.setBatchNo(batchNo);
// List<SellerOrderGoods> sellerOrderGoodList = sellerOrderGoodsMapper.selectByBatchNo(condition, Arrays.asList(SkupStatus.CAN_SELL.getCode(), SkupStatus.SELL_OUT.getCode()));
List<SellerOrderGoods> sellerOrderGoodList = getRealSkupOrderGoodsList(req);
if (CollectionUtils.isEmpty(sellerOrderGoodList)){
logger.warn("ChangePrice checkAndAcquire not find skups by req {}", req);
... ...
... ... @@ -137,7 +137,7 @@ public class SellerOrderPrepareProcessor {
ProductProxyService.PrdPrice prdPrice = checkPrice(storageId, salePrice, true);
try {
checkSuggestPrice(prdPrice, salePrice);
checkSuggestPrice(prdPrice, salePrice, skupType);
}catch (UfoServiceException ex){
context.setPriceOverFlowTips( ex.getErrorMessage());
}
... ... @@ -210,7 +210,10 @@ public class SellerOrderPrepareProcessor {
return prdPriceRange;
}
public void checkSuggestPrice(ProductProxyService.PrdPrice prdPrice, BigDecimal salePrice){
public void checkSuggestPrice(ProductProxyService.PrdPrice prdPrice, BigDecimal salePrice, SkupType skupType){
if (Objects.nonNull(skupType) && SkupType.ADVANCE.equals(skupType)){
return;
}
BigDecimal suggestMaxPrice = prdPrice.getSuggestMaxPrice();
if (isOverSuggestMaxPrice(suggestMaxPrice, salePrice)){
log.warn("in computePublishPrd,prdPrice {}, prdPriceRange {}", salePrice, prdPrice);
... ...
... ... @@ -590,8 +590,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
IdentifyTrackResp track = new IdentifyTrackResp();
track.setUid(uid);
track.setType(MESSAGE_TYPE_APPLICANT);
String mobileMask = MobileHelper.coverMobile2(profileInfo.getMobile());//隐位的手机号码--隐藏中间6位
track.setContent(StringUtils.isEmpty(profileInfo.getNickname()) ? mobileMask : profileInfo.getNickname());
track.setContent(getContent(profileInfo));
String headIcon = profileInfo.getHead_ico();
if(DEFAULT_HEAD_IMG.equals(headIcon) || StringUtils.isBlank(headIcon)){//有货的默认头像
//ufo 用户的默认头像
... ... @@ -611,6 +610,14 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
result.getTrackList().add(track);
}
private String getContent(ProfileInfoRsp profileInfo) {
String content = profileInfo.getNickname();
if(StringUtils.isEmpty(content)|| content.startsWith("YOHO-")) {
content = MobileHelper.coverMobile2(profileInfo.getMobile());//隐位的手机号码--隐藏中间6位
}
return content;
}
//交易轨迹
private List<IdentifyTrackResp> getTrackList(IdentifyRecord identifyRecord, String authGroup) {
List<IdentifyTrackResp> trackRespList = new ArrayList<>();
... ... @@ -644,11 +651,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
IdentifyTrackResp item = new IdentifyTrackResp();
Integer toUid = Integer.parseInt(record.getToUid());
item.setUid(toUid);
String content = profileMap.get(toUid).getNickname();
if(StringUtils.isEmpty(content) || content.startsWith("YOHO-")) {
content = MobileHelper.coverMobile2(profileMap.get(toUid).getMobile());//隐位的手机号码--隐藏中间6位
}
item.setContent(content);
item.setContent(getContent(profileMap.get(toUid)));
String headIcon = profileMap.get(toUid).getHead_ico();
if(DEFAULT_HEAD_IMG.equals(headIcon) || StringUtils.isBlank(headIcon)){//有货的默认头像
//ufo 用户的默认头像
... ...