Authored by chenjian

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

# Conflicts:
#	order/src/main/java/com/yohoufo/order/service/impl/AbsOrderViewService.java
... ... @@ -185,20 +185,20 @@
select
count(*)
from seller_wallet_detail
where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (1,31,32,33,61)
where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (1,31,32,33,34,61)
</select>
<select id="selectUserDetail" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from seller_wallet_detail
where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (1,31,32,33,61) order by id desc limit #{start},#{count}
where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (1,31,32,33,34,61) order by id desc limit #{start},#{count}
</select>
<select id="selectUserPunishAmount" resultMap="BaseResultMap" >
select
uid, sum(amount) as amount
from seller_wallet_detail
where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (31,32,33)
where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (31,32,33,34)
</select>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.inboxclient.model;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;
/**
... ... @@ -21,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
* }
* Created by chang@yoho.cn on 2015/11/3.
*/
@ToString
public class InBoxResponse {
private static String DEFAULT_MSG = "操作成功";
... ...
... ... @@ -332,7 +332,7 @@ public class BuyerOrderController {
@RequestMapping(params = "method=ufo.order.getAllCnt")
public ApiResponse submit(@RequestParam(name = "uid") int uid,
public ApiResponse getOrderCnt(@RequestParam(name = "uid") int uid,
@RequestParam("tabType") String tabType,
@RequestParam(name = "client_type", required = false) String clientType){
LOG.info("in ufo.order.getAllCnt, uid {}, clientType is {}", uid, clientType);
... ...
... ... @@ -104,8 +104,7 @@ public class ShoppingController {
* @return
*/
@RequestMapping(params = "method=ufo.order.summary")
//@Cachable(expire = 300, excludeArgs = {1})
public ApiResponse submit(@RequestParam(name = "uid") int uid,
public ApiResponse summary(@RequestParam(name = "uid") int uid,
@RequestParam(name = "client_type", required = false) String clientType){
logger.info("in ufo.order.summary, uid {}, clientType is {}", uid, clientType);
... ...
... ... @@ -70,13 +70,13 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
private String publishMoneyTip = "保证金余额不足";
//@Value("${order.seller.tip.publishFunctionTip:请充值后进行正常上架/下架}")
private String publishFunctionTip = "请充值后进行正常上架/下架";
private String publishFunctionTip = "请充值后进行正常上架";
//@Value("${order.seller.tip.canSaleMoneyTip:保证金余额低于}")
private String canSaleMoneyTip = "保证金余额低于";
private String canSaleMoneyTip = "保证金余额不足";
//@Value("${order.seller.tip.canSaleFunctionTip:平台下架您所有出售中的商品}")
private String canSaleFunctionTip = "平台下架您所有出售中的商品";
private String canSaleFunctionTip = "上架所有商品将会被强制隐藏,不会给用户展示";
//@Value("${order.seller.tip.recoverTip:充值 ¥{} 恢复超级商家权限}")
private String recoverTip = "充值 ¥{} 恢复超级商家权限";
... ...
package com.yohoufo.order.service.handler;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.order.model.response.OrderDetailInfo;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* Created by chao.chen on 2019/1/21.
*/
public class BuyerOrderButtonsHandler {
private List<OrderListInfo> orderListInfos;
OrderDetailInfo orderDetailInfo;
private BiFunction<List<Long>, List<Integer>, List<BuyerOrder>> buyerOrderDS;
public BuyerOrderButtonsHandler(List<OrderListInfo> orderListInfos){
this.orderListInfos = orderListInfos;
}
public BuyerOrderButtonsHandler(OrderDetailInfo orderDetailInfo){
this.orderDetailInfo = orderDetailInfo;
}
public BuyerOrderButtonsHandler loadBuyerOrderDS(BiFunction<List<Long>, List<Integer>, List<BuyerOrder>> buyerOrderDS){
this.buyerOrderDS = buyerOrderDS;
return this;
}
BiFunction<BuyerOrder,List<ButtonShowBo>,List<ButtonShowBo>> fmtBtnFunc;
public BuyerOrderButtonsHandler loadFmtBtnFunc(BiFunction<BuyerOrder,List<ButtonShowBo>,List<ButtonShowBo>> fmtBtnFunc){
this.fmtBtnFunc = fmtBtnFunc;
return this;
}
public void processDetail(){
if (Objects.isNull(orderDetailInfo)){
return;
}
final OrderStatus npos = OrderStatus.HAS_PAYED;
boolean isNeedProcess = Objects.equals(orderDetailInfo.getStatusDetail().getStatus(), npos.getCode());
if (!isNeedProcess){
return;
}
List<BuyerOrder> pbos;
List<Long> paidOrderCodes = new ArrayList<>(1);
paidOrderCodes.add(orderDetailInfo.getOrderCode());
List<Integer> statusList = Lists.newArrayList(npos.getCode());
pbos = buyerOrderDS.apply(paidOrderCodes, statusList);
if (CollectionUtils.isNotEmpty(pbos)){
BuyerOrder pbo = pbos.get(0);
List<ButtonShowBo> fbsbs = fmtBtnFunc.apply(pbo, orderDetailInfo.getButtons());
orderDetailInfo.setButtons(fbsbs);
}
}
public void process(){
if (CollectionUtils.isEmpty(orderListInfos)){
return;
}
Predicate<OrderListInfo> olip = oli -> Objects.equals(oli.getStatus(), OrderStatus.HAS_PAYED.getCode());
List<Long> paidOrderCodes = orderListInfos.parallelStream()
.filter(olip)
.map(OrderListInfo::getOrderCode).collect(Collectors.toList());
List<BuyerOrder> pbos = null;
if (CollectionUtils.isNotEmpty(paidOrderCodes)){
List<Integer> statusList = Lists.newArrayList(OrderStatus.HAS_PAYED.getCode());
pbos = buyerOrderDS.apply(paidOrderCodes, statusList);
}
if (CollectionUtils.isNotEmpty(pbos)){
Map<Long, BuyerOrder> codeBuyorderMap = pbos.parallelStream()
.collect(Collectors.toMap(BuyerOrder::getOrderCode, Function.identity()));
for(OrderListInfo oli : orderListInfos){
if(olip.test(oli)) {
Long orderCode = oli.getOrderCode();
BuyerOrder pbo = codeBuyorderMap.get(orderCode);
List<ButtonShowBo> fbsbs = fmtBtnFunc.apply(pbo, oli.getButtons());
oli.setButtons(fbsbs);
}
}
}
}
}
... ...
... ... @@ -41,7 +41,7 @@ public abstract class AbsOrderViewService {
* @return
*/
List<ButtonShowBo> formatButtons(BuyerOrder buyerOrder, List<ButtonShowBo> buttons, int actType){
if (CollectionUtils.isEmpty(buttons)){
if (CollectionUtils.isEmpty(buttons) || Objects.isNull(buyerOrder)){
return buttons;
}
... ...
... ... @@ -350,7 +350,8 @@ public class AppraiseService {
//发消息给卖家
QualityCheck qualityCheck = qualityCheckMapper.selectByOrderCode(orderCode);
int type = 1 ;//鉴定不通过
if(qualityCheck!=null&&EnumQualityCheckType.MINI_FAULT.getCode().equals(qualityCheck.getType())){
if(qualityCheck!=null&&qualityCheck.getType()!=null&&qualityCheck.getStatus()!=null
&&EnumQualityCheckType.MINI_FAULT.getCode().intValue()==qualityCheck.getType().intValue()){
if(EnumQualityCheckStatus.REJECT_BY_BUYER.getCode().intValue()==qualityCheck.getStatus().intValue()){
type = 2;//用户不接受瑕疵
}else if(EnumQualityCheckStatus.REJECT_BY_OUTER_TIME.getCode().intValue()==qualityCheck.getStatus().intValue()){
... ...
... ... @@ -19,6 +19,7 @@ import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.service.IOrderDetailService;
import com.yohoufo.order.service.handler.BuyerOrderButtonsHandler;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
... ... @@ -142,9 +143,18 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
return statusDetail;
}
private void procsessButtons(OrderDetailInfo orderDetailInfo){
new BuyerOrderButtonsHandler(orderDetailInfo)
.loadBuyerOrderDS(buyerOrderMapper::selectByOrderCodes)
.loadFmtBtnFunc(this::formatButtons)
.processDetail();
}
@Override
protected void resetDynamicProporties(OrderDetailInfo orderDetailInfo) {
procsessButtons(orderDetailInfo);
Integer leftTime = getLeftTime(TabType.BUY, orderDetailInfo.getUid(), orderDetailInfo.getOrderCode(),
orderDetailInfo.getStatusDetail().getStatus(), orderDetailInfo.getSecendLevelCreateTime());
... ...
... ... @@ -4,9 +4,9 @@ import com.google.common.collect.Maps;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
... ... @@ -18,6 +18,7 @@ import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.service.AbsBuyerOrderViewService;
import com.yohoufo.order.service.IBuyerOrderMetaService;
import com.yohoufo.order.service.IOrderListService;
import com.yohoufo.order.service.handler.BuyerOrderButtonsHandler;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -115,9 +116,17 @@ public class BuyerOrderListServiceImpl extends AbsOrderListService implements IO
return qiniuLiveRecordService.getAppraiseVideoUrl(orderCodes);
}
private void processButtons(List<OrderListInfo> list){
new BuyerOrderButtonsHandler(list)
.loadBuyerOrderDS(buyerOrderMapper::selectByOrderCodes)
.loadFmtBtnFunc(this::formatButtons)
.process();
}
@Override
protected void resetDynamicProporties(List<OrderListInfo> list, int type) {
if(CollectionUtils.isNotEmpty(list)){
processButtons(list);
list.forEach(oli -> {
Integer leftTime = getLeftTime(TabType.BUY, oli.getUid(), oli.getOrderCode(), oli.getStatus(),
oli.getSecendLevelCreateTime());
... ...
... ... @@ -48,6 +48,11 @@ public class QiniuLiveRecordService {
if (StringUtils.isBlank(filename)) {
return null;
}
if (filename.startsWith("http")) { // 如果数据库存放的是绝对路径,则直接返回
return filename;
}
return LIVE_VIDEO_DOMAIN + MP4_FILEKEY_PRE + filename;
}
... ...
... ... @@ -16,6 +16,7 @@ import com.yohoufo.dal.order.model.SellerEnterApply;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.order.constants.SellerConfig;
import com.yohoufo.order.service.IStoredSellerService;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.LoggerUtils;
... ... @@ -65,6 +66,9 @@ public class SellerEnterApplyService {
@Autowired
private InBoxFacade inBoxFacade;
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
/**
* 申请成为超级卖家
* 对于未支付的某一种身份申请做订单号替换
... ... @@ -247,6 +251,11 @@ public class SellerEnterApplyService {
if (noStoredSeller && isMatchedET){
SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb);
if (EntrySellerType.SUPER_ENTRY.equals(targetEst)){
logger.info("in upgradeLevel ready pass apply then changeWalletToSuperSeller, uid {} orderCode {} currentEnterType {} PreEnterType {} noStoredSeller {} target Level {} isMatchedET {}",
uid, orderCode, currentEnterType,preEnterType, noStoredSeller, level, isMatchedET);
merchantOrderPaymentService.changeWalletToSuperSeller(uid);
}
}else{
logger.warn("in upgradeLevel add StoredSeller fail, uid {} orderCode {}",
uid, orderCode);
... ...
... ... @@ -724,7 +724,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
public boolean batchDownShelf(SellerBatchChangeReq req) {
Map<Integer, SkupDto> skupDtoMap = sellerDownShelfPrepareProcessor.checkAndAcquire(req);
SellerBo sellerBo = sellerAuthCheckService.checkAuth(req.getUid(), SellerFuncEnum.BATCH_OFFSHELVE);
SellerTaskDTO<Map<Integer, SkupDto>> taskDTO = new SellerTaskDTO(req.getUid(),
SellerWalletDetail.Type.SELLER_OFF.getValue(),
sellerDownShelfTaskHandler,
... ...
... ... @@ -37,12 +37,11 @@ public class SellerAuthCheckService {
Integer level = slfb.getLevel();
switch (sellerFunc){
case BATCH_PUBLISH:
case BATCH_OFFSHELVE:
case BATCH_CHANGEPRICE:
if (CollectionUtils.isEmpty(funcIdList)
||!funcIdList.contains(sellerFunc.getCode())){
logger.warn("in checkAuth fail uid {} est {} level {}", uid, est, level);
throw new UfoServiceException(518, "您已经被降级");
throw new UfoServiceException(518, "您的账户保证金余额不足,请完成充值后上架");
}
break;
}
... ...
... ... @@ -599,7 +599,7 @@ public class InBoxFacade {
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record sellerQualityCheckNotPass_send_back inbox msg, SellerOrderGoods {} ,sellerUid {}, prdName {}, sizeName {},type {}resp {}",
logger.info("record sellerQualityCheckNotPass_send_back inbox msg, SellerOrderGoods {} ,sellerUid {}, prdName {}, sizeName {},type {}, resp {}",
JSON.toJSONString(sog),sellerUid, prdName, sizeName,type , resp);
//短信
... ... @@ -617,8 +617,8 @@ public class InBoxFacade {
}
String content = getReplacedContent(sms.getContent(),prdName,orderCode,wayBillCode);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerQualityCheckNotPass_send_back inbox sms msg,sellerUid {}, prdName {},orderCode {}",
sellerUid, prdName,orderCode);
logger.info("record sellerQualityCheckNotPass_send_back inbox sms msg,sellerUid {}, prdName {},type {},orderCode {}",
sellerUid, prdName,type,orderCode);
});
} catch (Exception e) {
... ...
... ... @@ -396,6 +396,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
if (StringUtils.isBlank(filename)) {
return null;
}
if (filename.startsWith("http")) {
return filename;
}
logger.info("getLiveVideoUrlByOrderCode success! orderCode={},filename={}", orderCode,filename);
return QNliveConstants.LIVE_VIDEO_DOMAIN + QNliveConstants.MP4_FILEKEY_PRE + filename;
}
... ...