|
|
|
@ -18,6 +18,7 @@ import com.hchbox.constant.*;
|
|
|
|
|
import com.hchbox.dto.SellerAccountDTO;
|
|
|
|
|
import com.hchbox.entity.master.*;
|
|
|
|
|
import com.hchbox.enums.AppSettingTypeEnum;
|
|
|
|
|
import com.hchbox.enums.RefundStatusEnum;
|
|
|
|
|
import com.hchbox.enums.ResponseCode;
|
|
|
|
|
import com.hchbox.enums.TradeEnum;
|
|
|
|
|
import com.hchbox.hander.message.TaoBaoMessage;
|
|
|
|
@ -139,8 +140,9 @@ public class TopTradeServiceImpl implements TopTradeService {
|
|
|
|
|
if (byTid == null || byTid == DefaultNumberConstants.ZERO_NUMBER) {
|
|
|
|
|
// 设置账户
|
|
|
|
|
topTrade.setUserId(
|
|
|
|
|
sellerAccountDTO.getParentId() != DefaultNumberConstants.ZERO_NUMBER ? sellerAccountDTO.getParentId() :
|
|
|
|
|
sellerAccountDTO.getId());
|
|
|
|
|
sellerAccountDTO.getParentId() != DefaultNumberConstants.ZERO_NUMBER
|
|
|
|
|
? sellerAccountDTO.getParentId() :
|
|
|
|
|
sellerAccountDTO.getId());
|
|
|
|
|
topTrade.setId(GenerateIdUtils.generateLongId());
|
|
|
|
|
topTradeRepository.save(topTrade);
|
|
|
|
|
topOrderService.bulkInsertOrder(tid, topTrade.getSellerNick(), topTrade.getId(), topOrders);
|
|
|
|
@ -156,7 +158,7 @@ public class TopTradeServiceImpl implements TopTradeService {
|
|
|
|
|
TopTrade trade = topTradeRepository.findByTid(message.getTid());
|
|
|
|
|
log.info("=========== update order status the message as {} ===========", message.getStatus());
|
|
|
|
|
if (trade != null && message.getStatus() != null) {
|
|
|
|
|
topTradeRepository.updateOrderStatus(message.getStatus(), message.getTid());
|
|
|
|
|
topTradeRepository.updateOrderStatus(message.getStatus(), message.getTid(), DateUtil.date());
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
return Boolean.FALSE;
|
|
|
|
@ -168,7 +170,8 @@ public class TopTradeServiceImpl implements TopTradeService {
|
|
|
|
|
public Boolean updateOrderStatusByMessage(TaoBaoRefundMessage message) {
|
|
|
|
|
TopTrade trade = topTradeRepository.findByTid(message.getTid());
|
|
|
|
|
if (trade != null) {
|
|
|
|
|
topTradeRepository.updateOrderStatus(TradeEnum.TRADE_REFUND_COMPLETED.getStateValue(), message.getTid());
|
|
|
|
|
topTradeRepository.updateOrderStatus(RefundStatusEnum.SUCCESS.getStateValue(),
|
|
|
|
|
message.getTid(), DateUtil.date());
|
|
|
|
|
return Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
return Boolean.FALSE;
|
|
|
|
@ -368,9 +371,9 @@ public class TopTradeServiceImpl implements TopTradeService {
|
|
|
|
|
|
|
|
|
|
private void sendMessageRemind(Integer type, String buyerNick, Long tid, String orderStatus, String template, AppSetting setting, List<String> sendNickList, SellerAccountDTO sellerAccountDTO) {
|
|
|
|
|
// TODO 使用本地数据
|
|
|
|
|
TopTrade trade = topTradeRepository.findByTid(2148563198943032631L);
|
|
|
|
|
TopTrade trade = topTradeRepository.findByTid(tid);
|
|
|
|
|
if (trade != null) {
|
|
|
|
|
topTradeRepository.updateOrderStatus(orderStatus, tid);
|
|
|
|
|
topTradeRepository.updateOrderStatus(orderStatus, tid,DateUtil.date());
|
|
|
|
|
|
|
|
|
|
// 订单支付成功
|
|
|
|
|
if (type.equals(AppSettingTypeEnum.PAYMENT_SUCCESSFUL.getType())) {
|
|
|
|
@ -387,7 +390,7 @@ public class TopTradeServiceImpl implements TopTradeService {
|
|
|
|
|
topTradeRepository.updateOrderStatusSuccessfulTransaction(orderStatus, tid, DateUtil.date());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<TopOrder> orderList = topOrderRegistry.findByTid(2148563198943032631L);
|
|
|
|
|
List<TopOrder> orderList = topOrderRegistry.findByTid(tid);
|
|
|
|
|
if (!CollectionUtils.isEmpty(orderList)) {
|
|
|
|
|
trade.setOrders(orderList);
|
|
|
|
|
}
|
|
|
|
|