Authored by mlge

no message

Showing 27 changed files with 305 additions and 165 deletions
... ... @@ -13,7 +13,8 @@ import java.util.regex.Pattern;
* Created by chunhua.zhang@yoho.cn on 2015/12/15.
*/
public class BigDecimalHelper {
public static final String FORMAT_TWOBITAFTERPOINT = "##0.00";
public static final String FORMAT_TWOBITAFTERPOINT = "##0.00",
FORMAT_NOPOINT = "##0";
private static Map<String,DecimalFormat> DecimalFormatCache = new HashMap<>();
... ... @@ -95,7 +96,7 @@ public class BigDecimalHelper {
}
public static void main(String[] args) {
System.out.println(formatNumber(new BigDecimal(111123.0011D), FORMAT_NOPOINT));
System.out.println(isDigitalNumber("11111"));
System.out.println(isDigitalNumber("1111.00"));
System.out.println(isDigitalNumber("1111.0"));
... ...
... ... @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2018/9/25
*/
@RestController
@RequestMapping(value="/order/appraise")
@RequestMapping(value="/erp/order/appraise")
@ServiceDesc("orderAppraise")
public class AppraiseController {
... ...
... ... @@ -40,16 +40,7 @@ public class BuyerOrderController {
private SellerFeeService sellerFeeService;
@RequestMapping(params = "method=ufo.buyer.orderNums")
@ResponseBody
@IgnoreSession
@IgnoreSignature
// @InnerApi
public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
return buyerOrderNums;
}
/**
* [购买]订单列表
... ... @@ -234,7 +225,7 @@ public class BuyerOrderController {
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/confirmReceive")
@RequestMapping(value = "/erp/confirmReceive")
@ResponseBody
public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
... ...
... ... @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value="/order/buyerOrderMeta")
@RequestMapping(value="/erp/order/buyerOrderMeta")
@ServiceDesc("orderBuyerOrderMeta")
public class BuyerOrderMeta4PlatformController {
private final Logger logger = LoggerUtils.getBuyerOrderLogger();
... ...
package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.resp.BuyerOrderNums;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.order.service.IBuyerOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/erp")
public class ErpGWOrderController {
@Autowired
IBuyerOrderService buyerOrderService;
@RequestMapping(params = "method=ufo.buyer.orderNums")
@ResponseBody
@IgnoreSession
public BuyerOrderNums getBuyerOrderNums(@RequestParam("uid") int uid){
BuyerOrderNums buyerOrderNums = buyerOrderService.getBuyerOrderNums(uid);
return buyerOrderNums;
}
}
... ...
... ... @@ -111,7 +111,7 @@ public class PaymentController {
* 退款结果确认
* @return
*/
@RequestMapping(params = "method=ufo.order.refund")
@RequestMapping(params = "/erp/order/refund")
public ApiResponse refund(@RequestParam(name = "orderCode") long orderCode,
@RequestParam(name = "refundAmount") double refundAmount){
... ... @@ -271,7 +271,7 @@ public class PaymentController {
@IgnoreSignature
@IgnoreSession
//@RequestMapping(params = "method=ufo.order.manualDealMon")
@RequestMapping(value="/manualDealMon")
@RequestMapping(value="/erp/manualDealMon")
public ApiResponse manualDealMon(@RequestBody ManualDealRequest req) {
try {
paymentService.manualDeal(req);
... ...
... ... @@ -185,7 +185,7 @@ public class SellerOrderController {
* @return
* @throws GatewayException
*/
@RequestMapping(value="/offShelveByErp")
@RequestMapping(value="/erp/offShelveByErp")
@ResponseBody
@IgnoreSession
@IgnoreSignature
... ...
package com.yohoufo.order.event;
import com.yohoufo.common.alarm.Event;
public class ErpBuyerOrderEvent extends Event {
private int uid;
public ErpBuyerOrderEvent(int uid) {
this.uid = uid;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
}
... ...
... ... @@ -4,6 +4,7 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.SellerType;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.product.response.StorageDataResp;
... ... @@ -88,7 +89,7 @@ public interface AbsSellerOrderViewService {
}
default String buildLeastPriceTips(BigDecimal leastPrice){
return "当前尺码最低售价¥" + leastPrice.toPlainString();
return "该尺码最低售价¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT);
}
... ...
... ... @@ -19,6 +19,7 @@ import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.event.DeliverNoticeEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.event.SellerCancelDeliverEvent;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohoufo.order.model.request.PaymentRequest;
... ... @@ -114,6 +115,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderInfo.getOrderCode()),
CacheKeyBuilder.buyerOrderNums(uid)));
ErpBuyerOrderEvent erpEvent = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(erpEvent);
}
... ...
package com.yohoufo.order.service.handler;
import com.google.common.eventbus.Subscribe;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.core.rest.client.ServiceCaller;
import com.yohoufo.common.alarm.IEventHandler;
import com.yohoufo.order.event.PayConfirmEvent;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class CleanGWOrderNumsEventHandler implements IEventHandler<PayConfirmEvent> {
public class CleanGWOrderNumsEventHandler implements IEventHandler<ErpBuyerOrderEvent> {
final Logger logger = LoggerFactory.getLogger(getClass());
@Resource
ServiceCaller serviceCaller;
@Value("${yoho.gateway.url:http://service.yoho.yohoops.org}")
String yoho_gateway;
@Subscribe
@Override
public void handle(PayConfirmEvent event) {
public void handle(ErpBuyerOrderEvent event) {
if (event.getUid() < 0){
return;
}
logger.info("clean gw ufo order uid is {}", event.getUid());
serviceCaller.get("clean.buyerOrderNums", clearGWIndexUfo(event.getUid()), null, null, null);
}
private String clearGWIndexUfo(int uid){
StringBuilder sb = new StringBuilder(yoho_gateway);
sb.append("?");
sb.append("method=app.clean.ufoOrder");
sb.append("&client_type=h5");
sb.append("&uid=");
sb.append(uid);
return sb.toString();
}
}
\ No newline at end of file
... ...
... ... @@ -20,6 +20,7 @@ import com.yohoufo.order.constants.AlarmConfig;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.event.BuyerConfirmEvent;
import com.yohoufo.order.event.BuyerRefundCouponEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.request.TransferMoneyRequest;
import com.yohoufo.order.model.response.AppraiseAddressResp;
... ... @@ -213,6 +214,9 @@ public class AppraiseService {
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
LOGGER.info("in appraiseSuccess, refund earnestMoney finish, seller {}, order code {}, skup {}, earnestMoney {}",
sellerUid, sellerOrderCode, skup, earnestMoney );
... ... @@ -360,6 +364,10 @@ public class AppraiseService {
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
//将卖家的保证金分账给平台和买家
TransferCase transferCase = TransferCase.APPRAISE_FAIL;
TransferMoneyRequest tmReq = TransferMoneyRequest.builder().buyerOrderCode(orderCode)
... ...
... ... @@ -19,6 +19,7 @@ import com.yohoufo.order.common.TransferCase;
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
import com.yohoufo.order.event.BillLogEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.PayRefundBo;
import com.yohoufo.order.model.bo.CouponBo;
import com.yohoufo.order.model.request.PaymentRequest;
... ... @@ -132,6 +133,10 @@ public class BuyerOrderCancelService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
logger.info("use one thread to execute buyer cancel BeforeSellerDeliver buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
buyerUid, orderCode, skup, compensate, transferCase);
}
... ... @@ -188,6 +193,10 @@ public class BuyerOrderCancelService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
logger.info("use one thread to execute buyer cancel BeforeDepotReceive buyerUid {}, orderCode {}, skup {}, compensate {}, transferCase {}",
buyerUid, orderCode, skup, compensate, transferCase);
}
... ...
... ... @@ -31,6 +31,7 @@ import com.yohoufo.order.common.Payment;
import com.yohoufo.order.event.BeforeDepotReceiveEvent;
import com.yohoufo.order.event.BeforeSellerDeliverEvent;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.event.PayConfirmEvent;
import com.yohoufo.order.model.PayQueryBo;
import com.yohoufo.order.model.request.OrderListRequest;
... ... @@ -126,6 +127,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(uid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(event);
} else {
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
}
... ... @@ -407,6 +411,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
}
... ... @@ -638,7 +645,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderListKey(uid, TabType.BUY.getValue()),
CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode)));
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(uid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(event);
}
}
... ...
... ... @@ -10,6 +10,7 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.constant.EnumExpressSender;
import com.yohoufo.common.constant.ExpressInfoConstant;
import com.yohoufo.common.exception.UfoServiceException;
... ... @@ -19,6 +20,7 @@ import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.ExpressForMqSend;
import com.yohoufo.order.constants.MetaKey;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.service.IExpressCompanyService;
import com.yohoufo.order.service.IExpressInfoService;
... ... @@ -159,6 +161,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
}
LOGGER.info("deliverToDepot update buyer order status result {} ",updateBuyerCnt);
... ...
... ... @@ -443,6 +443,9 @@ public class SellerOrderCancelService {
CacheKeyBuilder.orderDetailKey(buyerUid, TabType.BUY.getValue(), buyerOrderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
//update seller order
SellerOrderStatus targetSOStatus;
targetSOStatus = SellerOrderStatus.PLAY_BUYER;
... ...
... ... @@ -125,8 +125,8 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
private PriceComputePrepareProcessor priceComputePrepareProcessor;
@Autowired
private ChangePricePrepareProcessor changePricePrepareProcessor;
// @Autowired
// private ChangePricePrepareProcessor changePricePrepareProcessor;
@Autowired
private AdjustPricePrepareProcessor adjustPricePrepareProcessor;
... ... @@ -177,7 +177,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
public SoldPrdComputeBo computeChangePrice(BatchChangePriceReq req) throws GatewayException {
log.info("in computeChangePrice, req {}", req);
ChangePricePrepareDTO pcn = changePricePrepareProcessor.checkAndAcquire(req);
ChangePricePrepareDTO pcn = null;
/*
if (pcn.getTips() != null){
throw new UfoServiceException(SellerOrderPrepareProcessor.TIPS_ERROR_CODE, pcn.getTips() );
... ... @@ -588,7 +588,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
* @return
*/
public BatchChangePriceResp batchChangePrice(BatchChangePriceReq req) throws GatewayException {
ChangePricePrepareDTO cppDto = changePricePrepareProcessor.checkAndAcquire(req);
ChangePricePrepareDTO cppDto = null;
BigDecimal preSalePrice = cppDto.getPreSalePrice(),
salePrice = cppDto.getSalePrice();
boolean isSurper = cppDto.isSuper();
... ...
... ... @@ -20,6 +20,7 @@ import com.yohoufo.order.charge.model.ChargeParam;
import com.yohoufo.order.charge.model.ChargeResult;
import com.yohoufo.order.charge.model.CouponMatchResult;
import com.yohoufo.order.event.BuyerCancelEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.event.NotPaidNoticeEvent;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.order.model.bo.CouponBo;
... ... @@ -301,6 +302,10 @@ public class ShoppingServiceImpl implements IShoppingService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), sellerOrderCode),
CacheKeyBuilder.buyerOrderNums(shoppingRequest.getUid())
));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(uid);
EventBusPublisher.publishEvent(event);
NotPaidNoticeEvent notPaidNoticeEvent = NotPaidNoticeEvent.builder().actorType(TabType.BUY)
.uid(shoppingRequest.getUid()).orderCode(orderCode).build();
EventBusPublisher.publishEvent(notPaidNoticeEvent);
... ...
package com.yohoufo.order.service.impl.processor;
import com.google.common.base.Splitter;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.req.BatchChangePriceReq;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
import com.yohoufo.order.model.dto.SkupDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by chao.chen on 2018/11/21.
* 根据批次号来调价
*/
@Service
public class ChangePricePrepareProcessor extends AbstractChangePricePrepareProcessor<BatchChangePriceReq> {
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Override
public ChangePricePrepareDTO checkAndAcquire(BatchChangePriceReq req) throws GatewayException {
String skupList = req.getSkupList();
if (StringUtils.isBlank(skupList)) {
logger.warn("ChangePrice checkAndAcquire uid illegal , req {}", req);
throw new UfoServiceException(400, "参数[skupList]为空");
}
return super.checkAndAcquire(req);
}
@Override
protected List<Integer> getExpectedSkups(BatchChangePriceReq req) {
List<String> skupStrList = Splitter.on(',').trimResults().omitEmptyStrings().splitToList(req.getSkupList());
return skupStrList.parallelStream().map(Integer::valueOf).collect(Collectors.toList());
}
@Override
protected List<SellerOrderGoods> getRealSkupOrderGoodsList(BatchChangePriceReq req) {
Long batchNo = checkNAcquireBatchNo(req.getBatchNo());
SellerOrderGoods condition = new SellerOrderGoods();
condition.setBatchNo(batchNo);
//按照批次,同一个批次不需要有两个价格,需要排除支付中的订单
return sellerOrderGoodsMapper.selectByBatchNo(condition, Arrays.asList(SkupStatus.CAN_SELL.getCode(), SkupStatus.SELL_OUT.getCode()));
}
@Override
protected Map<Integer, SkupDto> checkNeedProcessSkups(List<Integer> expectedSkups,
BigDecimal oldPrice,
BigDecimal newPrice,
Map<Integer, SkupDto> skupOfSalingMap) {
Assert.notEmpty(expectedSkups,"expectedSkups must not be empty");
Assert.notEmpty(skupOfSalingMap,"skupOfSalingMap must not be empty");
Map<Integer, SkupDto> map = new HashMap<>(expectedSkups.size());
for (Integer skup : expectedSkups) {
if (!skupOfSalingMap.containsKey(skup)) {
logger.warn("ChangePrice checkNeedProcessSkups skup is in other status , skup {}", skup);
throw new UfoServiceException(501, "部分商品不可调价");
}
SellerOrderGoods sellerOrderGoods = skupOfSalingMap.get(skup).getSellerOrderGoods();
//校验价格
if (sellerOrderGoods.getGoodsPrice().compareTo(newPrice) == 0) {
logger.warn("skup:{} goodsPrice:{} and newPrice:{} must not be equals",
skup, sellerOrderGoods.getGoodsPrice(), newPrice);
throw new UfoServiceException(401, "前后价格没有变化");
}
map.put(skup, skupOfSalingMap.get(skup));
}
return map;
}
private Long checkNAcquireBatchNo(String batchNoStr) {
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 , batchNoStr {}", batchNoStr, ex);
}
if (isIllegalBatchNo) {
throw new UfoServiceException(400, "参数[batchNoStr]非法");
}
return batchNo;
}
}
//package com.yohoufo.order.service.impl.processor;
//
//import com.google.common.base.Splitter;
//import com.yohobuy.ufo.model.order.common.SkupStatus;
//import com.yohobuy.ufo.model.order.req.BatchChangePriceReq;
//import com.yohoufo.common.exception.GatewayException;
//import com.yohoufo.common.exception.UfoServiceException;
//import com.yohoufo.dal.order.SellerOrderGoodsMapper;
//import com.yohoufo.dal.order.model.SellerOrderGoods;
//import com.yohoufo.order.model.dto.ChangePricePrepareDTO;
//import com.yohoufo.order.model.dto.SkupDto;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.Assert;
//
//import java.math.BigDecimal;
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
///**
// * Created by chao.chen on 2018/11/21.
// * 根据批次号来调价
// */
//@Service
//public class ChangePricePrepareProcessor extends AbstractChangePricePrepareProcessor<BatchChangePriceReq> {
//
// @Autowired
// private SellerOrderGoodsMapper sellerOrderGoodsMapper;
//
// @Override
// public ChangePricePrepareDTO checkAndAcquire(BatchChangePriceReq req) throws GatewayException {
// String skupList = req.getSkupList();
// if (StringUtils.isBlank(skupList)) {
// logger.warn("ChangePrice checkAndAcquire uid illegal , req {}", req);
// throw new UfoServiceException(400, "参数[skupList]为空");
// }
// return super.checkAndAcquire(req);
// }
//
//
// @Override
// protected List<Integer> getExpectedSkups(BatchChangePriceReq req) {
// List<String> skupStrList = Splitter.on(',').trimResults().omitEmptyStrings().splitToList(req.getSkupList());
// return skupStrList.parallelStream().map(Integer::valueOf).collect(Collectors.toList());
// }
//
// @Override
// protected List<SellerOrderGoods> getRealSkupOrderGoodsList(BatchChangePriceReq req) {
// Long batchNo = checkNAcquireBatchNo(req.getBatchNo());
// SellerOrderGoods condition = new SellerOrderGoods();
// condition.setBatchNo(batchNo);
// //按照批次,同一个批次不需要有两个价格,需要排除支付中的订单
// return sellerOrderGoodsMapper.selectByBatchNo(condition, Arrays.asList(SkupStatus.CAN_SELL.getCode(), SkupStatus.SELL_OUT.getCode()));
// }
//
// @Override
// protected Map<Integer, SkupDto> checkNeedProcessSkups(List<Integer> expectedSkups,
// BigDecimal oldPrice,
// BigDecimal newPrice,
// Map<Integer, SkupDto> skupOfSalingMap) {
// Assert.notEmpty(expectedSkups,"expectedSkups must not be empty");
// Assert.notEmpty(skupOfSalingMap,"skupOfSalingMap must not be empty");
// Map<Integer, SkupDto> map = new HashMap<>(expectedSkups.size());
//
// for (Integer skup : expectedSkups) {
//
// if (!skupOfSalingMap.containsKey(skup)) {
// logger.warn("ChangePrice checkNeedProcessSkups skup is in other status , skup {}", skup);
// throw new UfoServiceException(501, "部分商品不可调价");
// }
//
// SellerOrderGoods sellerOrderGoods = skupOfSalingMap.get(skup).getSellerOrderGoods();
//
// //校验价格
// if (sellerOrderGoods.getGoodsPrice().compareTo(newPrice) == 0) {
// logger.warn("skup:{} goodsPrice:{} and newPrice:{} must not be equals",
// skup, sellerOrderGoods.getGoodsPrice(), newPrice);
// throw new UfoServiceException(401, "前后价格没有变化");
// }
//
// map.put(skup, skupOfSalingMap.get(skup));
// }
//
//
// return map;
// }
//
//
// private Long checkNAcquireBatchNo(String batchNoStr) {
// 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 , batchNoStr {}", batchNoStr, ex);
// }
//
// if (isIllegalBatchNo) {
// throw new UfoServiceException(400, "参数[batchNoStr]非法");
// }
// return batchNo;
// }
//}
... ...
... ... @@ -364,6 +364,11 @@ public class ProductController {
cacheAop.clearCache(
ProductController.class.getMethod("queryStorageInfo", new Class[] { Integer.class }),
new Object[] { storageId });
LOG.info("clearCache queryStorageSuggestPrice storageId = {}, ", storageId);
cacheAop.clearCache(
ProductController.class.getMethod("queryStorageSuggestPrice", new Class[] { Collection.class }),
new Object[] { storageId });
}
}
} catch (Exception e) {
... ... @@ -436,7 +441,7 @@ public class ProductController {
@ApiOperation(name = "ufo.product.storage.info", desc="sku建议价")
@RequestMapping(params = "method=ufo.product.storage.info")
@Cachable(expire = 180)
//@Cachable(expire = 180)
public StorageInfoResp[] queryStorageSuggestPrice(@RequestParam(value = "skuList", required = true) Collection<Integer> skuList) {
if (CollectionUtils.isEmpty(skuList)) {
... ...
... ... @@ -45,7 +45,7 @@ public class ProductIdentifyController {
ProductIdentifyResp info = identifyService.queryIdentifyInfo(tagId, nfcUid);
return new ApiResponse.ApiResponseBuilder().code(200).data(info).build();
}catch (Exception e){
logger.warn("queryIdentifyInfo error! tagId={}, nfcUid={}, e {}", tagId, nfcUid, e);
logger.warn("queryIdentifyInfo error! tagId={}, nfcUid={}, e is {}", tagId, nfcUid, e);
if( e instanceof GatewayException){
throw e;
}
... ...
... ... @@ -58,25 +58,6 @@ public class CouponController {
/**
* 个人中心优惠券数量,给内部用接口
* @param uid
* @return
*/
@RequestMapping(params = "method=ufo.coupons.innerCnt")
@ResponseBody
@IgnoreSession
@IgnoreSignature
// @InnerApi
public ApiResponse queryCouponInnerCnt(@RequestParam(value = "uid") Integer uid) {
logger.info("query user coupons cnt, uid: {}", uid);
int couponCnt = couponService.queryCouponCnt(uid);
logger.info("query user coupons cnt uid: {}, v: {}", uid, couponCnt);
return new ApiResponse.ApiResponseBuilder().code(200).data(couponCnt).build();
}
/**
* 领券接口
* @param uid
* @return
... ...
package com.yohoufo.promotion.controller;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.promotion.service.ICouponService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/erp")
public class ErpGWCouponController {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
ICouponService couponService;
/**
* 给gw使用
* @param uid
* @return
*/
@RequestMapping(params = "method=ufo.coupons.innerCnt")
@ResponseBody
@IgnoreSession
public ApiResponse queryCouponInnerCnt(@RequestParam(value = "uid") Integer uid) {
logger.info("query inner user coupons cnt, uid: {}", uid);
int couponCnt = couponService.queryCouponCnt(uid);
logger.info("query inner user coupons cnt uid: {}, v: {}", uid, couponCnt);
return new ApiResponse.ApiResponseBuilder().code(200).data(couponCnt).build();
}
}
... ...
... ... @@ -83,7 +83,6 @@ public class InBoxController {
*/
@RequestMapping(params = "method=ufo.users.addInbox")
@IgnoreSession
@IgnoreSignature
public ApiResponse addInbox(@RequestParam(name = "uid") int uid,
@RequestParam(name = "type") Integer type,
@RequestParam(name = "businessType") Integer businessType,
... ...
... ... @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
* Created by craig.qin on 2018/9/11.
*/
@RestController
@RequestMapping(value="/user/realNameAuthorize")
@RequestMapping(value="/erp/user/realNameAuthorize")
@ServiceDesc("userRealNameAuthorize")
public class RealNameAuthorize4PlatformController {
private Logger logger = LoggerFactory.getLogger(RealNameAuthorize4PlatformController.class);
... ...
... ... @@ -115,3 +115,6 @@ yoho.message.controller.url=http://message-controller.yohoops.org/yoho-message-c
rabbit_host=192.168.102.45:5672
rabbit_user=yoho
rabbit_password=yoho
yoho.gateway.url=http://api-test3.dev.yohocorp.com
... ...
... ... @@ -88,4 +88,7 @@ yoho.message.controller.url=${yoho.message.controller.url}
#rabbit address for transaction compensate
rabbit_host=${rabbit_ufo}
rabbit_user=${rabbit_ufo_user}
rabbit_password=${rabbit_ufo_password}
\ No newline at end of file
rabbit_password=${rabbit_ufo_password}
yoho.gateway.url=${yoho.gateway.url}
\ No newline at end of file
... ...