Authored by tanling

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

... ... @@ -16,5 +16,5 @@ public interface OrdersPayRefundMapper {
//查看部分退款记录是否存在 -- (新)
OrdersPayRefund selectByRefundCode(@Param("refundCode") String refundCode);
List<OrdersPayRefund> selectByRefundCodes(@Param("refundCodes") Collection<String> refundCode);
List<OrdersPayRefund> selectByRefundCodes(@Param("refundOrderCodes") Collection<String> refundCode);
}
\ No newline at end of file
... ...
... ... @@ -42,8 +42,8 @@
select
<include refid="Base_Column_List" />
from orders_pay_refund
where refund_order_code in
<foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundOrderCode">
where refund_code in
<foreach collection="refundOrderCodes" open="(" close=")" separator="," item="refundCode">
#{refundCode,jdbcType=VARCHAR}
</foreach>
</select>
... ...
package com.yohoufo.order.controller;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
... ... @@ -9,8 +10,11 @@ import com.yohoufo.common.lock.RedisLock;
import com.yohoufo.common.lock.RedisLockFactory;
import com.yohoufo.common.utils.ExecutorServiceUtils;
import com.yohoufo.order.model.request.TransferMoneyRequest;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.service.impl.PaymentServiceImpl;
import com.yohoufo.order.service.impl.TransferService;
import com.yohoufo.order.utils.NamedThreadFactory;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
... ... @@ -35,6 +40,9 @@ public class OrderHelpController {
private TransferService transferService;
@Autowired
private PaymentServiceImpl paymentService;
@Autowired
private RedisLockFactory redisLockFactory;
/**
... ... @@ -57,6 +65,28 @@ public class OrderHelpController {
@IgnoreSession
@IgnoreSignature
@InnerApi
@RequestMapping(value = "/transAllEarnest")
public ApiResponse transAllEarnest(@RequestBody TransferAllEarnestRequest req) {
return new ApiResponse.ApiResponseBuilder()
.code(200)
.message(paymentService.transAllEarnest(req.getOrderCode(), req.getUid(), req.getAmount(), req.getAliPayAccount()) ? "ok" : "ko")
.build();
}
@Data
public static class TransferAllEarnestRequest {
long orderCode;
Integer uid;
BigDecimal amount;
AuthorizeResultRespVO aliPayAccount;
}
/**
* 转账
*/
@IgnoreSession
@IgnoreSignature
@InnerApi
@RequestMapping(value = "/lock")
public ApiResponse lock(String key, @RequestParam(required = false, defaultValue = "100") int taskNum) {
ExecutorService executorService = new ThreadPoolExecutor(5, 10,
... ...
package com.yohoufo.order.service;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
... ... @@ -137,18 +138,30 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService {
}
return false;
}
private static final List<Integer> canRefundStatusListOfPaidAppraiseOrder = Lists.newArrayList(
AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()
);
final static List<Integer> canRefundStatusList = Arrays.asList(AppraiseOrderStatus.WAITING_PAY.getCode(),
AppraiseOrderStatus.HAS_PAYED.getCode());
private static final List<Integer> canRefundStatusListOfDepositOrder = Lists.newArrayList(
AppraiseOrderStatus.HAS_PAYED.getCode(),
AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode(),
AppraiseOrderStatus.JUDGE_PASS_WAIT_WAREHOUSE.getCode(),
AppraiseOrderStatus.SHAM_SEND_OUT.getCode(),
AppraiseOrderStatus.SEND_OUT_TIMEOUT.getCode()
);
@Override
public boolean canRefund(OrderInfo orderInfo) {
OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes());
switch (oa){
case APPRAISE:
if (canRefundStatusListOfPaidAppraiseOrder.contains(orderInfo.getStatus())){
return true;
}
throw new UfoServiceException(400, "鉴定订单暂不支持退款");
case DEPOSITE:
if (orderInfo.getStatus() != null && canRefundStatusList.contains(orderInfo.getStatus().intValue())){
if (orderInfo.getStatus() != null && canRefundStatusListOfDepositOrder.contains(orderInfo.getStatus().intValue())){
return true;
}
break;
... ...
... ... @@ -122,7 +122,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
logger.info("appraise order unsure update status, orderCode {} rows {}", orderCode, rows);
return rows;
}
... ... @@ -133,7 +133,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
expectedStatus = AppraiseOrderStatus.SELLER_SEND_OUT;
int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
logger.info("appraise order shamDeliver update status, orderCode {} rows {}", orderCode, rows);
return rows;
}
... ... @@ -144,7 +144,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
logger.info("appraise order findFlaw update status, orderCode {} rows {}", orderCode, rows);
return rows;
}
}
... ...
... ... @@ -19,10 +19,7 @@ import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
import com.yohoufo.dal.order.AppraiseOrderMapper;
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
import com.yohoufo.dal.order.model.AppraiseOrder;
import com.yohoufo.dal.order.model.AppraiseOrderGoods;
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
import com.yohoufo.dal.order.model.QiniuLiveRecord;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.ClientType;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor;
... ... @@ -30,6 +27,7 @@ import com.yohoufo.order.convert.SellerOrderConvertor;
import com.yohoufo.order.model.dto.AppraiseOrderContext;
import com.yohoufo.order.service.IExpressInfoService;
import com.yohoufo.order.service.IGoodsService;
import com.yohoufo.order.service.handler.GoodsServiceRefundHandler;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.UserProxyService;
... ... @@ -86,6 +84,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
@Autowired
private InBoxFacade inBoxFacade;
@Autowired
private PayRefundService payRefundService;
public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){
logger.info("in AppraiseOrderService.compute req {}", req);
... ... @@ -410,6 +411,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
return rows;
}
/**
* 无法鉴别
* @param appraiseOrder
... ... @@ -418,8 +420,20 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
public int unsure(AppraiseOrder appraiseOrder){
int rows;
if ((rows=super.unsure(appraiseOrder))>0){
Integer uid = appraiseOrder.getUid();
Long orderCode = appraiseOrder.getOrderCode();
new GoodsServiceRefundHandler()
.loadLogger(logger)
.loadUser(uid)
.loadActionCase(SellerWalletDetail.Type.APPRAISE_UNSURE)
.loadRefundAction(payRefundService::refund)
.loadOrder(orderCode, orderCode, appraiseOrder.getPayment(), appraiseOrder.getAmount())
.refund();
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE;
inBoxFacade.paidAppraiseOrderNotice(appraiseOrder.getUid(), appraiseOrder.getOrderCode(), targetStatus);
inBoxFacade.paidAppraiseOrderNotice(uid, orderCode, targetStatus);
}
return rows;
}
... ...
... ... @@ -1754,13 +1754,14 @@ public class AppraiseService {
List<Integer> skupList = buyerOrderGoodses.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
sellerOrderGoodsMapper.updateDeptNoBySkups(skupList, appraiseExpressInfoBo.getDepotNum());
expressRecordMapper.updateDeptNoByOrder(orderCodeList, EnumExpressType.EXPRESS_TYPE_1.getCode(), appraiseExpressInfoBo.getDepotNum());
productProxyService.setBatchDepotNum(skupList, appraiseExpressInfoBo.getDepotNum());
}
// 更新鉴定订单的鉴定室
appraiseOrderGoodsMapper.updateBatchDepotNo(orderCodeList, appraiseExpressInfoBo.getDepotNum());
expressRecordMapper.updateDeptNoByOrder(orderCodeList, EnumExpressType.EXPRESS_TYPE_1.getCode(), appraiseExpressInfoBo.getDepotNum());
}
}
... ...
... ... @@ -546,7 +546,9 @@ public class PaymentServiceImpl implements IPaymentService {
@Database(ForceMaster = true)
public boolean transAllEarnest(long orderCode, Integer uid, BigDecimal amount,
AuthorizeResultRespVO aliPayAccount) {
logger.info("退还商家所有保证金,转账开始,orderCode = {}, uid={}, amount={}, alipayAccount={}", orderCode, uid, amount, aliPayAccount);
String logTag = String.format("transfer all earnest {}-{}", orderCode, uid);
logger.info("{}, amount is {} and alipay account is {}", logTag, amount, aliPayAccount);
int now = (int) (System.currentTimeMillis() / 1000);
// 查看是否已经有转账记录
... ... @@ -563,6 +565,7 @@ public class PaymentServiceImpl implements IPaymentService {
TradeBills record = new TradeBills();
record.setUid(uid);
record.setOrderCode(orderCode);
record.setPaidOrderCode(0L);
record.setUserType(2);
record.setPayType(1);
record.setTradeType(1);
... ... @@ -574,7 +577,7 @@ public class PaymentServiceImpl implements IPaymentService {
if (amount == null || amount.compareTo(new BigDecimal("0.1")) < 0) {
logger.warn("transAllEarnestErr transferMon计算费用结果为 {}, 小于0.1或为null", amount);
logger.warn("{}, amount {} less 0.1 or null", logTag, amount);
alarm("转账金额小于0.1或为null", "ufo.order.transAllEarnest", "退还商家入驻所有金额,订单号:" + orderCode + "操作类型(" + 6 + ")计算金额结果为" + amount);
record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode());
addTradeBills(record);
... ... @@ -582,20 +585,20 @@ public class PaymentServiceImpl implements IPaymentService {
}
if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId())) {
logger.warn("transAllEarnestErr uid {} 支付宝账号不合法", account);
logger.warn("{}, alipay account is not exist", logTag);
record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALIPAY_ACCOUNT.getCode());
addTradeBills(record);
throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法");
}
logger.info("transAllEarnest参数检查成功!");
logger.info("{}, data check ok.", logTag);
tradeBillsMapper.insert(record);
// 转账
JSONObject jsonObject = null;
boolean exceedMillionAndSuccess = false;
transfer.setUpdateTime(now);
try {
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
logger.info("{}, transfer start", logTag);
shoppingRiskWatchDog.checkAlipayBlackUser(aliPayAccount.getUid(), aliPayAccount);
if (alipayTransferChancelSelector.isTransferWithAlipayExceedMillionTransfer()) {
transfer.setInterfaceType(2);
... ... @@ -615,7 +618,7 @@ public class PaymentServiceImpl implements IPaymentService {
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount);
if (jsonObject == null) {
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
logger.warn("{}, transfer fail.", logTag);
transfer.setStatus(3);
throw new ServiceException(500, "转账失败:阿里接口返回null");
}
... ... @@ -627,7 +630,7 @@ public class PaymentServiceImpl implements IPaymentService {
&& (code = jsonObject.getInteger("code")) == 10000
&& jsonObject.containsKey("order_id")
&& StringUtils.isNotBlank(orderId = jsonObject.getString("order_id"))) {
logger.info("转账成功,targeAccount is {}, amount is {}", account, amount);
logger.info("{}, transfer success, account is {}, amount is {}", logTag, account, amount);
transfer.setAlipayTradeId(orderId);
transfer.setStatus(1);
return true;
... ... @@ -644,16 +647,15 @@ public class PaymentServiceImpl implements IPaymentService {
return true;
}
} else {
logger.warn("transAllEarnestErr 返回code或者order_id不是成功状态,code={}, orderId={}", code, orderId);
logger.warn("{}, transfer fail, return_code is {} and return_order_id is {}", logTag, code, orderId);
throw new ServiceException(500, "转账失败:code或者order_id不是成功状态");
}
} catch (Exception e) {
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
logger.warn("{}, transfer fail", logTag, e);
String alarmMsg = "订单号:" + orderCode + ",操作类型(商家退出入驻退保证金),msg=" + e.getMessage();
if (jsonObject != null) {
alarmMsg += ",阿里返回DETAIL=" + jsonObject.toJSONString();
}
logger.info("transAllEarnestErr 转账失败 , alarmMsg is {}", alarmMsg);
alarm("转账失败", "ufo.order.transAllEarnest", alarmMsg);
transfer.setStatus(3);
if (e instanceof ServiceException) {
... ... @@ -663,17 +665,17 @@ public class PaymentServiceImpl implements IPaymentService {
}
} finally {
if (exceedMillionAndSuccess) {
logger.info("transferMon exceedMillion,转账结束,等待回调 orderCode is {}!", orderCode);
logger.info("{}, transfer exceed million waiting...", logTag);
return true;
}
logger.info("transAllEarnest最后更新状态 status= {}", transfer.getStatus());
logger.info("{}, transfer end update status to {}", logTag, transfer.getStatus());
transfer.setUpdateTime(now);
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
// 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败
BillTradeStatus bts = transfer.getStatus() == 1 ? BillTradeStatus.SUCCESS : BillTradeStatus.TRANSFER_FAIL;
record.setTradeStatus(bts.getCode());
tradeBillsMapper.updateSelectiveByPrimaryKey(record);
logger.info("transAllEarnest最后更新状态完成,转账结束, orderCode is {}!", orderCode);
logger.info("{}, transfer end update status to {} ok", logTag, transfer.getStatus());
}
}
... ... @@ -1364,6 +1366,7 @@ public class PaymentServiceImpl implements IPaymentService {
TradeBills record = new TradeBills();
record.setUid(targetUid);
record.setOrderCode(buyerOrderCode);
record.setPaidOrderCode(0L);
record.setUserType(targetUserType.getCode());
record.setPayType(1);
// 如果[全部货款->卖家],否则[补偿款->卖家或买家] 2:货款;3:补偿款
... ...
... ... @@ -3,13 +3,18 @@ package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
import com.yohoufo.dal.order.SellerOrderMetaMapper;
import com.yohoufo.dal.order.TradeBillsMapper;
import com.yohoufo.dal.order.model.AppraiseOrderMeta;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderMeta;
import com.yohoufo.dal.order.model.TradeBills;
import com.yohobuy.ufo.model.order.common.Payment;
import com.yohoufo.order.common.BillTradeStatus;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -33,6 +38,12 @@ public class TradeBillsService {
@Autowired
TradeBillsMapper tradeBillsMapper;
@Autowired
private ServiceOrderProcessor serviceOrderProcessor;
@Autowired
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
/**
* 退保证金流水记录
*
... ... @@ -42,54 +53,88 @@ public class TradeBillsService {
* @param payType
* @param tradeStatus
*/
public void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, Integer payType, Integer tradeStatus) {
backPayEnsureRecord(uid, skup, orderCode, payType, tradeStatus, null, null);
}
public void backPayEnsureRecord(Integer uid,
Integer skup,
Long orderCode,
Integer payType,
Integer tradeStatus) {
public void backPayEnsureRecord(SellerOrder sellerOrder, Integer tradeStatus, BigDecimal backEarnestMoney, SellerOrderMeta meta) {
backPayEnsureRecord(sellerOrder.getUid(), sellerOrder.getSkup(), sellerOrder.getOrderCode(), sellerOrder.getPayment(), tradeStatus, backEarnestMoney, meta);
}
private void backPayEnsureRecord(Integer uid, Integer skup, Long orderCode, Integer payType,
Integer tradeStatus,
BigDecimal backEarnestMoney, SellerOrderMeta meta) {
if (payType != null && Payment.WALLET.getCode() == payType) {
String computeResultVal = null;
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
AppraiseOrderMeta feeCondition = new AppraiseOrderMeta();
feeCondition.setOrderCode(orderCode);
feeCondition.setMetaKey(MetaKey.SELLER_FEE);
AppraiseOrderMeta feeMeta = appraiseOrderMetaMapper.selectByOrderCode(feeCondition);
computeResultVal = Objects.nonNull(feeMeta) ? feeMeta.getMetaValue() : null;
logger.info("in backPayEnsureRecord isGoodsServiceOrder orderCode {} computeResultVal {}", orderCode, computeResultVal);
}else {
SellerOrderMeta meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
computeResultVal = Objects.nonNull(meta) ? meta.getMetaValue() : null;
logger.info("in backPayEnsureRecord buyerorder orderCode {} computeResultVal {}", orderCode, computeResultVal);
}
if (Objects.isNull(computeResultVal)) {
logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup);
return;
}
if (Objects.isNull(meta)) {
meta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, "fee");
try{
SellerOrderComputeResult socr = JSONObject.parseObject(computeResultVal, SellerOrderComputeResult.class);
BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney();
BigDecimal systemAmount = calSystemAmountByComputeResult(socr);
backPayEnsureRecord0(uid, orderCode, payType, tradeStatus, earnestMoney, systemAmount);
}catch (Exception ex){
logger.error("backPayEnsureRecord error, uid {},orderCode {} computeResultVal {}",
uid, orderCode, computeResultVal, ex);
}
if (Objects.isNull(meta)) {
logger.error("PayRecordErr记录交易到数据库出错 err=meta费率信息未查到, uid = {}, skup={}", uid, skup);
}
private void backPayEnsureRecord0(Integer uid,
Long orderCode,
Integer payType,
Integer tradeStatus,
BigDecimal earnestMoney,
BigDecimal systemAmount
) {
if (payType != null && Payment.WALLET.getCode() == payType) {
return;
}
// 增加流水记录
TradeBills record = new TradeBills();
record.setUid(uid);
record.setOrderCode(orderCode);
record.setPaidOrderCode(0L);
record.setUserType(2);// 1:买家uid; 2:卖家uid
record.setPayType(payType);// 1:支付宝; 2:微信
record.setTradeType(1);//1:保证金;2:货款;3:补偿款
record.setIncomeOutcome(1);// 1:用户收入; 2:用户支出
BigDecimal earnestMoney = backEarnestMoney;
BigDecimal amount = BigDecimal.ZERO;
try {
JSONObject metavalue = JSON.parseObject(meta.getMetaValue());
BigDecimal rate = metavalue.getJSONObject("serviceFeeRate").getBigDecimal("payChannelRate");
if (Objects.isNull(earnestMoney)) {
earnestMoney = metavalue.getJSONObject("earnestMoney").getBigDecimal("earnestMoney");
}
amount = earnestMoney.multiply(BigDecimal.ONE.subtract(rate)).multiply(new BigDecimal("-1")).setScale(2, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
logger.error("PayRecordErr计费信息不完整, uid is {}, skup is {}, err is {}", uid, skup, e.getMessage());
}
record.setAmount(earnestMoney);
record.setSystemAmount(amount);// 有货收入
record.setSystemAmount(systemAmount);// 有货收入
record.setTradeStatus(tradeStatus);//0:订单未完结;1:订单完结
record.setCreateTime((int) (System.currentTimeMillis() / 1000));
addTradeBills(record);
}
BigDecimal calSystemAmountByComputeResult(SellerOrderComputeResult socr){
BigDecimal amount = BigDecimal.ZERO;
try {
BigDecimal rate = socr.getServiceFeeRate().getPayChannelRate();
BigDecimal earnestMoney = socr.getEarnestMoney().getEarnestMoney();
amount = BigDecimalHelper.halfUp(earnestMoney.multiply(BigDecimal.ONE.subtract(rate)).negate());
} catch (Exception e) {
logger.warn("calSystemAmountByComputeResult fail SellerOrderComputeResult {}", socr);
}
return amount;
}
/**
* 退付货款流水记录
*
... ... @@ -118,6 +163,7 @@ public class TradeBillsService {
TradeBills record = new TradeBills();
record.setUid(uid);
record.setOrderCode(orderCode);
record.setPaidOrderCode(0L);
record.setUserType(1);// 1:买家uid; 2:卖家uid
record.setPayType(payType);// 1:支付宝; 2:微信
record.setTradeType(2);//1:保证金;2:货款;3:补偿款
... ... @@ -200,6 +246,7 @@ public class TradeBillsService {
TradeBills record = new TradeBills();
record.setUid(uid);
record.setOrderCode(orderCode);
record.setPaidOrderCode(0L);
record.setUserType(1);// 1:买家uid; 2:卖家uid
record.setPayType(payType);// 1:支付宝; 2:微信
record.setTradeType(2);//1:保证金;2:货款;3:补偿款
... ... @@ -239,6 +286,7 @@ public class TradeBillsService {
TradeBills record = new TradeBills();
record.setUid(uid);
record.setOrderCode(orderCode);
record.setPaidOrderCode(0L);
record.setUserType(2);// 1:买家uid; 2:卖家uid
record.setPayType(payType);// 1:支付宝; 2:微信
record.setTradeType(1);//1:保证金;2:货款;3:补偿款
... ... @@ -265,6 +313,7 @@ public class TradeBillsService {
TradeBills record = new TradeBills();
record.setUid(uid);
record.setOrderCode(orderCode);
record.setPaidOrderCode(0L);
record.setUserType(2);// 1:买家uid; 2:卖家uid
record.setPayType(payType);// 1:支付宝; 2:微信
record.setTradeType(1);//1:保证金;2:货款;3:补偿款
... ...
... ... @@ -16,6 +16,7 @@ import com.yohobuy.ufo.model.order.vo.GoodsVo;
import com.yohobuy.ufo.model.order.vo.ProductVo;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.BigDecimalHelper;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.constants.MetaKey;
... ... @@ -200,6 +201,8 @@ public class SellerDepositOrderListService extends AbsOrderViewService {
.orderCode(pao.getOrderCode())
.status(pao.getStatus())
.statuStr(appraiseOrderStatus.statusStr(oa))
.payTime(DateUtil.formatYYMMddHHmmssPoint(pao.getCreateTime()))
.payTime(DateUtil.formatYYMMddHHmmssPoint(ordersPayRefund.getCreateTime()))
.build();
return resp;
... ...
... ... @@ -260,17 +260,19 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
switch (appraiseOrderStatus){
case WAITING_PAY:
Payment payment = Payment.getPayment(pao.getPayment());
AbstractPayService payService = paymentService.getPayService(payment.getCode());
PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());
if (payQueryBo != null && payQueryBo.isPayStatus()){
logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());
EventBusPublisher.publishEvent(event);
}
// 如果近1分钟有预支付记录,则发送 自动取消延迟消息
if ( !orderCancelEvent.isFinalRetry()){
paymentService.checkPrePay(uid, orderCode);
if (Objects.nonNull(payment)) {
AbstractPayService payService = paymentService.getPayService(payment.getCode());
PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime());
if (payQueryBo != null && payQueryBo.isPayStatus()) {
logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode);
PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment());
EventBusPublisher.publishEvent(event);
}
// 如果近1分钟有预支付记录,则发送 自动取消延迟消息
if (!orderCancelEvent.isFinalRetry()) {
paymentService.checkPrePay(uid, orderCode);
}
}
rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus);
break;
... ... @@ -768,6 +770,7 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple
}
public void triggerStatusConsistencyCheck(long orderCode){
logger.info("triggerStatusConsistencyCheck orderCode {}", orderCode);
SellerDepositOrderStatusConsistencyAsyncEvent asyncEvent
= new SellerDepositOrderStatusConsistencyAsyncEvent(this::detectAppraiseFinish);
asyncEvent.setOrderCode(orderCode);
... ...
... ... @@ -8,7 +8,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.sun.org.apache.xpath.internal.operations.Bool;
import com.yoho.tools.common.beans.ApiResponse;
import com.yohoufo.common.ApiResponse;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.caller.UfoServiceCaller;
... ... @@ -822,14 +822,15 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
Map<String, Object> resultMap = new HashMap<>();
if (isServiceOrder(orderCode)) {
AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode);
resultMap.put("status", order.getStatus());
AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode);
AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCode(orderCode);
resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
resultMap.put("productId", goods == null ? "" : goods.getProductId());
resultMap.put("productName", goods == null ? "" : goods.getProductName());
resultMap.put("productCode", goods == null ? "" : goods.getProductCode());
resultMap.put("size", storage == null ? "" : storage.getSizeName());
resultMap.put("color", storage == null ? "" : storage.getColorName());
resultMap.put("size", storage == null ? "-" : storage.getSizeName());
resultMap.put("color", storage == null ? "-" : storage.getColorName());
resultMap.put("uid", order == null ? "" : order.getUid());
} else {
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
... ... @@ -860,7 +861,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
}
private boolean isServiceOrder(long orderCode) {
ApiResponse<Boolean> resp = ufoServiceCaller.call("ufo.order.isServiceOrder", ApiResponse.class, orderCode);
ApiResponse resp = ufoServiceCaller.call("ufo.order.isServiceOrder", ApiResponse.class, orderCode);
if (resp != null) {
return (Boolean) resp.getData();
}
... ...