Authored by caoyan

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

Showing 30 changed files with 364 additions and 113 deletions
@@ -10,3 +10,4 @@ @@ -10,3 +10,4 @@
10 MANIFEST.MF 10 MANIFEST.MF
11 deploy/.gitignore 11 deploy/.gitignore
12 product/.gitignore 12 product/.gitignore
  13 +*/.factorypath
@@ -42,4 +42,9 @@ public interface ExpressRecordMapper { @@ -42,4 +42,9 @@ public interface ExpressRecordMapper {
42 * @return 42 * @return
43 */ 43 */
44 int updateDeptNoByOrder(@Param("orderCodeList") List<Long> orderCodeList, @Param("expressType") Integer expressType, @Param("depotNum") Integer depotNum); 44 int updateDeptNoByOrder(@Param("orderCodeList") List<Long> orderCodeList, @Param("expressType") Integer expressType, @Param("depotNum") Integer depotNum);
  45 +
  46 + int updateWaybillCode(@Param("orderCode") Long orderCode,
  47 + @Param("uid") Integer uid,
  48 + @Param("expressType") Integer expressType,
  49 + @Param("waybillCode") String waybillCode);
45 } 50 }
@@ -67,6 +67,9 @@ public class TradeBills { @@ -67,6 +67,9 @@ public class TradeBills {
67 67
68 private String payErrorCode; 68 private String payErrorCode;
69 69
  70 + //支付阶段,0:普通,1:定金
  71 + private int payLevel = 0;
  72 +
70 /** 73 /**
71 * suggest use new enum, define class as blow 74 * suggest use new enum, define class as blow
72 * {@link com.yohoufo.order.common.BillTradeStatus} 75 * {@link com.yohoufo.order.common.BillTradeStatus}
@@ -93,9 +93,9 @@ public interface StoragePriceMapper { @@ -93,9 +93,9 @@ public interface StoragePriceMapper {
93 int updateBatchDepotNum(@Param("skupList") List<Integer> skupList, @Param("depotNum") Integer depotNo); 93 int updateBatchDepotNum(@Param("skupList") List<Integer> skupList, @Param("depotNum") Integer depotNo);
94 94
95 /** 95 /**
96 - * 查询现货各尺码的最低价 96 + * 查询某类型库存各尺码的最低价
97 * @param productId 97 * @param productId
98 * @return 98 * @return
99 */ 99 */
100 - List<StoragePrice> selectInStockLeastPByProductId(@Param("productId") Integer productId, @Param("preSaleFlag") Integer preSaleFlag); 100 + List<StoragePrice> selectLeastPByProductId(@Param("productId") Integer productId, @Param("preSaleFlag") Integer preSaleFlag);
101 } 101 }
@@ -60,4 +60,9 @@ @@ -60,4 +60,9 @@
60 </foreach> 60 </foreach>
61 and express_type = #{expressType, jdbcType=INTEGER} 61 and express_type = #{expressType, jdbcType=INTEGER}
62 </update> 62 </update>
  63 +
  64 + <update id="updateWaybillCode">
  65 + update express_record set waybill_code=#{waybillCode}
  66 + where order_code=#{orderCode} and uid=#{uid} and express_type=#{expressType}
  67 + </update>
63 </mapper> 68 </mapper>
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 <result column="uid" jdbcType="INTEGER" property="uid" /> 6 <result column="uid" jdbcType="INTEGER" property="uid" />
7 <result column="order_code" jdbcType="BIGINT" property="orderCode" /> 7 <result column="order_code" jdbcType="BIGINT" property="orderCode" />
8 <result column="paid_order_code" jdbcType="BIGINT" property="paidOrderCode" /> 8 <result column="paid_order_code" jdbcType="BIGINT" property="paidOrderCode" />
  9 + <result column="pay_level" jdbcType="TINYINT" property="payLevel" />
9 <result column="user_type" jdbcType="TINYINT" property="userType" /> 10 <result column="user_type" jdbcType="TINYINT" property="userType" />
10 <result column="pay_type" jdbcType="TINYINT" property="payType" /> 11 <result column="pay_type" jdbcType="TINYINT" property="payType" />
11 <result column="trade_type" jdbcType="INTEGER" property="tradeType" /> 12 <result column="trade_type" jdbcType="INTEGER" property="tradeType" />
@@ -23,7 +24,7 @@ @@ -23,7 +24,7 @@
23 <result column="pay_error_code" jdbcType="VARCHAR" property="payErrorCode" /> 24 <result column="pay_error_code" jdbcType="VARCHAR" property="payErrorCode" />
24 </resultMap> 25 </resultMap>
25 <sql id="Base_Column_List"> 26 <sql id="Base_Column_List">
26 - id,uid, order_code,paid_order_code, user_type,pay_type,trade_type,income_outcome,amount,system_amount,trade_status,create_time, 27 + id,uid, order_code,paid_order_code,pay_level, user_type,pay_type,trade_type,income_outcome,amount,system_amount,trade_status,create_time,
27 deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name,pay_error_code 28 deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name,pay_error_code
28 </sql> 29 </sql>
29 30
@@ -42,10 +43,10 @@ @@ -42,10 +43,10 @@
42 </select> 43 </select>
43 44
44 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.TradeBills" useGeneratedKeys="true"> 45 <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.TradeBills" useGeneratedKeys="true">
45 - insert into trade_bills (id, uid, order_code, paid_order_code, user_type,pay_type,trade_type, 46 + insert into trade_bills (id, uid, order_code, paid_order_code,pay_level, user_type,pay_type,trade_type,
46 income_outcome,amount,system_amount,trade_status,create_time 47 income_outcome,amount,system_amount,trade_status,create_time
47 ,deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name,pay_error_code) 48 ,deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name,pay_error_code)
48 - values (#{id},#{uid},#{orderCode},#{paidOrderCode},#{userType},#{payType},#{tradeType}, 49 + values (#{id},#{uid},#{orderCode},#{paidOrderCode},#{payLevel},#{userType},#{payType},#{tradeType},
49 #{incomeOutcome},#{amount},#{systemAmount}, 50 #{incomeOutcome},#{amount},#{systemAmount},
50 #{tradeStatus},#{createTime},#{dealUid},#{dealStatus}, 51 #{tradeStatus},#{createTime},#{dealUid},#{dealStatus},
51 #{dealTime},#{dealRelateId},#{dealUserName},#{payErrorCode}) 52 #{dealTime},#{dealRelateId},#{dealUserName},#{payErrorCode})
@@ -271,7 +271,7 @@ @@ -271,7 +271,7 @@
271 </foreach> 271 </foreach>
272 </update> 272 </update>
273 273
274 - <select id="selectInStockLeastPByProductId" resultMap="BaseResultMap"> 274 + <select id="selectLeastPByProductId" resultMap="BaseResultMap">
275 select t.id as id, t.skup as skup, t.storage_id as storage_id, t.price as price, t.status as status, t.pre_sale_flag as pre_sale_flag, t.region as region from storage_price t, 275 select t.id as id, t.skup as skup, t.storage_id as storage_id, t.price as price, t.status as status, t.pre_sale_flag as pre_sale_flag, t.region as region from storage_price t,
276 (select id from (select id ,storage_id 276 (select id from (select id ,storage_id
277 from storage_price FORCE INDEX (`idx_storage_id_price`) 277 from storage_price FORCE INDEX (`idx_storage_id_price`)
@@ -7,5 +7,8 @@ public enum RefundCase { @@ -7,5 +7,8 @@ public enum RefundCase {
7 7
8 SELLER_EARNEST_MONEY, 8 SELLER_EARNEST_MONEY,
9 9
10 - BUYER_GOODS_MONEY; 10 + BUYER_GOODS_MONEY,
  11 +
  12 + //求购定金
  13 + BID_DEPOSIT_MONEY;
11 } 14 }
  1 +package com.yohoufo.order.controller;
  2 +
  3 +import com.yoho.core.rest.annotation.ServiceDesc;
  4 +import com.yohobuy.ufo.model.order.req.AppraiseOrderWaybillUpdateReq;
  5 +import com.yohoufo.common.ApiResponse;
  6 +import com.yohoufo.common.annotation.IgnoreSession;
  7 +import com.yohoufo.common.annotation.IgnoreSignature;
  8 +import com.yohoufo.order.service.impl.AppraiseOrderService;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +@RestController
  17 +@RequestMapping("/erp/appraiseOrder")
  18 +@ServiceDesc("appraiseOrder")
  19 +public class ErpAppraiseOrderController {
  20 +
  21 + private final Logger logger = LoggerFactory.getLogger(getClass());
  22 +
  23 + @Autowired
  24 + private AppraiseOrderService appraiseOrderService;
  25 +
  26 + @IgnoreSession
  27 + @IgnoreSignature
  28 + @RequestMapping("/updateWaybillCode")
  29 + public ApiResponse updateWaybillCode(@RequestBody AppraiseOrderWaybillUpdateReq req){
  30 +
  31 + logger.info("in updateWaybillCode Of AppraiseOrder req {}", req);
  32 + appraiseOrderService.updateWaybillCode(req);
  33 + return new ApiResponse.ApiResponseBuilder().code(200).message("修改快递单号成功").build();
  34 + }
  35 +
  36 +}
@@ -35,4 +35,6 @@ public class BillLogEvent extends Event{ @@ -35,4 +35,6 @@ public class BillLogEvent extends Event{
35 BigDecimal amount; 35 BigDecimal amount;
36 36
37 Integer tradeStatus; 37 Integer tradeStatus;
  38 +
  39 + int payLevel;
38 } 40 }
@@ -86,9 +86,6 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh @@ -86,9 +86,6 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh
86 protected CacheCleaner cacheCleaner; 86 protected CacheCleaner cacheCleaner;
87 87
88 @Autowired 88 @Autowired
89 - protected IPaymentService paymentService;  
90 -  
91 - @Autowired  
92 protected ProductMapper productMapper; 89 protected ProductMapper productMapper;
93 90
94 @Autowired 91 @Autowired
@@ -24,7 +24,7 @@ public class BillLogAsyncHandler implements IEventHandler<BillLogEvent> { @@ -24,7 +24,7 @@ public class BillLogAsyncHandler implements IEventHandler<BillLogEvent> {
24 public void handle(BillLogEvent event) { 24 public void handle(BillLogEvent event) {
25 logger.info("in BillLogAsyncHandler.handle event {}", event); 25 logger.info("in BillLogAsyncHandler.handle event {}", event);
26 26
27 - switch (event.getRefundCase()){ 27 + switch (event.getRefundCase()) {
28 case SELLER_EARNEST_MONEY: 28 case SELLER_EARNEST_MONEY:
29 //Integer uid, Integer skup, Long orderCode, Integer payType, BigDecimal amount, Integer tradeStatus 29 //Integer uid, Integer skup, Long orderCode, Integer payType, BigDecimal amount, Integer tradeStatus
30 tradeBillsService.backPayEnsureRecord(event); 30 tradeBillsService.backPayEnsureRecord(event);
@@ -32,11 +32,14 @@ public class BillLogAsyncHandler implements IEventHandler<BillLogEvent> { @@ -32,11 +32,14 @@ public class BillLogAsyncHandler implements IEventHandler<BillLogEvent> {
32 case BUYER_GOODS_MONEY: 32 case BUYER_GOODS_MONEY:
33 //Integer uid, Integer sellerUid, Integer skup, 33 //Integer uid, Integer sellerUid, Integer skup,
34 //Long orderCode, Integer payType, BigDecimal amount, Integer tradeStatus 34 //Long orderCode, Integer payType, BigDecimal amount, Integer tradeStatus
35 - tradeBillsService.backPayBuyRecord(event.getBuyerUid(), event.getSellerUid(), event.getSkup(), event.getOrderCode(),event.getPaidOrderCode(), 35 + tradeBillsService.backPayBuyRecord(event.getBuyerUid(), event.getSellerUid(), event.getSkup(), event.getOrderCode(), event.getPaidOrderCode(),
36 event.getPayType(), event.getAmount(), event.getTradeStatus()); 36 event.getPayType(), event.getAmount(), event.getTradeStatus());
37 break; 37 break;
38 -  
39 - 38 + case BID_DEPOSIT_MONEY:
  39 + //定金退款记录
  40 + tradeBillsService.backDepositPayBuyRecord(event.getBuyerUid(), event.getOrderCode(), event.getPaidOrderCode(),
  41 + event.getPayType(), event.getAmount(), event.getPayLevel(), event.getTradeStatus());
  42 + break;
40 } 43 }
41 44
42 45
  1 +package com.yohoufo.order.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.google.common.collect.Lists;
  5 +import com.yohobuy.ufo.model.order.vo.AddressInfo;
  6 +import com.yohoufo.dal.order.AppraiseOrderMetaMapper;
  7 +import com.yohoufo.dal.order.model.AppraiseOrderMeta;
  8 +import com.yohoufo.order.constants.MetaKey;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.util.List;
  15 +import java.util.Optional;
  16 +
  17 +@Service
  18 +public class AppraiseOrderAddressService {
  19 + private final Logger logger = LoggerFactory.getLogger(getClass());
  20 +
  21 + @Autowired
  22 + private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
  23 +
  24 +
  25 + public AddressInfo getNoHiddenAddressInfo(Long orderCode){
  26 + final String key = MetaKey.RECALL_ADDRESS;
  27 + List<AppraiseOrderMeta> aomAddressList = appraiseOrderMetaMapper.selectByOrderCodeMetaKeys(orderCode, Lists.newArrayList(key));
  28 + return Optional.ofNullable(aomAddressList)
  29 + .map(appraiseOrderMetas -> appraiseOrderMetas.get(0))
  30 + .map(appraiseOrderMeta -> JSONObject.parseObject(appraiseOrderMeta.getMetaValue(),AddressInfo.class))
  31 + .orElse(null);
  32 +
  33 + }
  34 +}
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.google.common.collect.Lists;
  5 +import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
4 import com.yoho.error.ServiceError; 6 import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 7 import com.yoho.error.exception.ServiceException;
6 import com.yohobuy.ufo.model.ProductInfo; 8 import com.yohobuy.ufo.model.ProductInfo;
7 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; 9 import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo;
8 import com.yohobuy.ufo.model.order.bo.OrderInfo; 10 import com.yohobuy.ufo.model.order.bo.OrderInfo;
9 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 11 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
  12 +import com.yohobuy.ufo.model.order.common.EnumExpressType;
10 import com.yohobuy.ufo.model.order.common.OrderAttributes; 13 import com.yohobuy.ufo.model.order.common.OrderAttributes;
11 import com.yohobuy.ufo.model.order.common.OrderCodeType; 14 import com.yohobuy.ufo.model.order.common.OrderCodeType;
12 import com.yohobuy.ufo.model.order.req.*; 15 import com.yohobuy.ufo.model.order.req.*;
13 import com.yohobuy.ufo.model.order.resp.*; 16 import com.yohobuy.ufo.model.order.resp.*;
14 import com.yohobuy.ufo.model.order.vo.AddressInfo; 17 import com.yohobuy.ufo.model.order.vo.AddressInfo;
15 import com.yohoufo.common.exception.UfoServiceException; 18 import com.yohoufo.common.exception.UfoServiceException;
  19 +import com.yohoufo.common.lock.RedisLock;
  20 +import com.yohoufo.common.lock.RedisLockFactory;
16 import com.yohoufo.common.utils.AddressUtil; 21 import com.yohoufo.common.utils.AddressUtil;
17 import com.yohoufo.common.utils.BigDecimalHelper; 22 import com.yohoufo.common.utils.BigDecimalHelper;
18 import com.yohoufo.common.utils.DateUtil; 23 import com.yohoufo.common.utils.DateUtil;
19 -import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;  
20 -import com.yohoufo.dal.order.AppraiseOrderMapper;  
21 -import com.yohoufo.dal.order.AppraiseOrderMetaMapper;  
22 -import com.yohoufo.dal.order.OrdersPayTransferMapper; 24 +import com.yohoufo.dal.order.*;
23 import com.yohoufo.dal.order.model.*; 25 import com.yohoufo.dal.order.model.*;
24 import com.yohoufo.order.common.ClientType; 26 import com.yohoufo.order.common.ClientType;
25 import com.yohoufo.order.constants.MetaKey; 27 import com.yohoufo.order.constants.MetaKey;
26 import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; 28 import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor;
27 import com.yohoufo.order.model.dto.AppraiseOrderContext; 29 import com.yohoufo.order.model.dto.AppraiseOrderContext;
  30 +import com.yohoufo.order.model.response.AppraiseAddressResp;
28 import com.yohoufo.order.service.IExpressInfoService; 31 import com.yohoufo.order.service.IExpressInfoService;
29 import com.yohoufo.order.service.IGoodsService; 32 import com.yohoufo.order.service.IGoodsService;
30 import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; 33 import com.yohoufo.order.service.handler.GoodsServiceRefundHandler;
31 -import com.yohoufo.order.service.handler.transfer.TransferChancelSelector;  
32 import com.yohoufo.order.service.proxy.InBoxFacade; 34 import com.yohoufo.order.service.proxy.InBoxFacade;
33 import com.yohoufo.order.service.proxy.ProductProxyService; 35 import com.yohoufo.order.service.proxy.ProductProxyService;
34 import com.yohoufo.order.service.proxy.UserProxyService; 36 import com.yohoufo.order.service.proxy.UserProxyService;
@@ -43,13 +45,13 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -43,13 +45,13 @@ import org.springframework.beans.factory.annotation.Autowired;
43 import org.springframework.stereotype.Service; 45 import org.springframework.stereotype.Service;
44 46
45 import java.math.BigDecimal; 47 import java.math.BigDecimal;
46 -import java.util.ArrayList;  
47 -import java.util.List;  
48 -import java.util.Map;  
49 -import java.util.Objects; 48 +import java.util.*;
  49 +import java.util.concurrent.TimeUnit;
50 import java.util.function.Function; 50 import java.util.function.Function;
51 import java.util.stream.Collectors; 51 import java.util.stream.Collectors;
52 52
  53 +import static com.yohoufo.order.utils.ServiceExceptions.throwServiceExceptionIf;
  54 +
53 @Service 55 @Service
54 public class AppraiseOrderService extends AbsGoodsServiceOrderService implements IGoodsService { 56 public class AppraiseOrderService extends AbsGoodsServiceOrderService implements IGoodsService {
55 private final Logger logger = LoggerUtils.getBuyerOrderLogger(); 57 private final Logger logger = LoggerUtils.getBuyerOrderLogger();
@@ -88,7 +90,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -88,7 +90,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
88 OrderCodeGenerator orderCodeGenerator; 90 OrderCodeGenerator orderCodeGenerator;
89 91
90 @Autowired 92 @Autowired
91 - private TransferChancelSelector transferChancelSelector; 93 + private ExpressRecordMapper expressRecordMapper;
92 94
93 @Autowired 95 @Autowired
94 TransferService transferService; 96 TransferService transferService;
@@ -96,6 +98,15 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -96,6 +98,15 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
96 @Autowired 98 @Autowired
97 OrdersPayTransferMapper ordersPayTransferMapper; 99 OrdersPayTransferMapper ordersPayTransferMapper;
98 100
  101 + @Autowired
  102 + private AppraiseAddressService appraiseAddressService;
  103 +
  104 + @Autowired
  105 + private AppraiseOrderAddressService appraiseOrderAddressService;
  106 +
  107 + @Autowired
  108 + private RedisLockFactory redisLockFactory;
  109 +
99 110
100 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ 111 public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){
101 logger.info("in AppraiseOrderService.compute req {}", req); 112 logger.info("in AppraiseOrderService.compute req {}", req);
@@ -452,4 +463,66 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements @@ -452,4 +463,66 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements
452 inBoxFacade.paidAppraiseOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetStatus); 463 inBoxFacade.paidAppraiseOrderNotice(orderInfo.getUid(), orderInfo.getOrderCode(), targetStatus);
453 } 464 }
454 465
  466 +
  467 + public void updateWaybillCode(AppraiseOrderWaybillUpdateReq req){
  468 + Long orderCode = req.getOrderCode();
  469 + String waybillCode = req.getSellerWaybillCode();
  470 + if (Objects.isNull(orderCode) || orderCode<=0L || StringUtils.isBlank(waybillCode)){
  471 + logger.warn("appraise order updateWaybillCode params of req illegal, req {}", req);
  472 + throw new UfoServiceException(400, "请求参数不合法");
  473 + }
  474 +
  475 + //
  476 + AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
  477 + if (Objects.isNull(pao)){
  478 + logger.warn("appraise order updateWaybillCode order not exist, req {}", req);
  479 + throw new UfoServiceException(400, "订单不存在");
  480 + }
  481 + Integer status = pao.getStatus();
  482 + if (status.equals(AppraiseOrderStatus.SELLER_SEND_OUT.getCode()) ){
  483 + RedisKeyBuilder redisLockKey = RedisKeyBuilder.newInstance()
  484 + .appendFixed("ufo:order:lock:appraiseOrder:updateWaybillCode:")
  485 + .appendVar(orderCode);
  486 + RedisLock lock = redisLockFactory.newLock(redisLockKey, 5, TimeUnit.SECONDS);
  487 + throwServiceExceptionIf(!lock.tryLock(), "正在修改快递记录中");
  488 + try{
  489 + doUpdateWaybill(req, pao);
  490 + }finally {
  491 + lock.unlock();
  492 + }
  493 + }else{
  494 + logger.warn("updateWaybillCode status of order not match ,req {} status {}", req, status);
  495 + }
  496 + }
  497 +
  498 +
  499 + private void doUpdateWaybill(AppraiseOrderWaybillUpdateReq req, AppraiseOrder pao){
  500 + Long orderCode = req.getOrderCode();
  501 + String changedWaybillCode = req.getSellerWaybillCode().trim();
  502 + final EnumExpressType teet = EnumExpressType.EXPRESS_TYPE_1;
  503 + ExpressRecord record = expressRecordMapper.selectByOrderCodeAndExpressType(orderCode, teet.getCode());
  504 + if (Objects.isNull(record)){
  505 + logger.warn("appraise order updateWaybillCode ExpressRecord not exist, req {}", req);
  506 + throw new UfoServiceException(400, "快递记录不存在");
  507 + }
  508 + if (record.getWaybillCode().trim().equalsIgnoreCase(changedWaybillCode)){
  509 + logger.warn("appraise order updateWaybillCode waybillCode not change, req {}", req);
  510 + throw new UfoServiceException(400, "快递单号没有变化");
  511 + }
  512 +
  513 + int rows = expressRecordMapper.updateWaybillCode(orderCode, pao.getUid(), teet.getCode(), changedWaybillCode);
  514 + if (rows>0){
  515 +
  516 + String depotMobile = appraiseAddressService.optInitAddressByDepotNum(record.getDepotNum())
  517 + .map(AppraiseAddressResp::getMobile)
  518 + .orElse(null);
  519 + AddressInfo noHiddenAddress = appraiseOrderAddressService.getNoHiddenAddressInfo(orderCode);
  520 + String sellerMobile = Optional.ofNullable(noHiddenAddress)
  521 + .map(AddressInfo::getMobile)
  522 + .orElse(null);
  523 +
  524 + List<String> mobiles = Lists.newArrayList(sellerMobile, depotMobile);
  525 + expressInfoService.triggerExpressMQ(pao.getUid(), record.getLogisticsType(), orderCode, changedWaybillCode, mobiles);
  526 + }
  527 + }
455 } 528 }
@@ -593,7 +593,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -593,7 +593,11 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
593 } 593 }
594 594
595 @Override 595 @Override
596 - public void triggerExpressMQ(Integer uid, Integer expressCompanyId, Long orderCode, String wayBillCode, List<String> mobiles) { 596 + public void triggerExpressMQ(Integer uid,
  597 + Integer expressCompanyId,
  598 + Long orderCode,
  599 + String wayBillCode,
  600 + List<String> mobiles) {
597 // 发送mq获取物流信息 601 // 发送mq获取物流信息
598 sendExpressMQ(uid, expressCompanyId, orderCode, wayBillCode, mobiles); 602 sendExpressMQ(uid, expressCompanyId, orderCode, wayBillCode, mobiles);
599 LOGGER.info("triggerExpressMQ end ! send express to erp "); 603 LOGGER.info("triggerExpressMQ end ! send express to erp ");
@@ -871,8 +871,8 @@ public class PaymentServiceImpl implements IPaymentService { @@ -871,8 +871,8 @@ public class PaymentServiceImpl implements IPaymentService {
871 tradeBills.setPayType(optMarkPaidPayType(req.getSceneId()).get()); 871 tradeBills.setPayType(optMarkPaidPayType(req.getSceneId()).get());
872 markPaid(logTag, tradeBills, lockKey); 872 markPaid(logTag, tradeBills, lockKey);
873 } 873 }
874 - // 退货款或普通用户退保证金  
875 - else if (isRefundGoodsMoneyTradeBills(tradeBills) || isRefundEarnestMoneyTradeBills(tradeBills)) { 874 + // 退求购定金、货款、普通用户退保证金
  875 + else if (isRefundGoodsMoneyOrDepositMoneyTradeBills(tradeBills) || isRefundEarnestMoneyTradeBills(tradeBills)) {
876 refund(logTag, tradeBills, amount, lockKey); 876 refund(logTag, tradeBills, amount, lockKey);
877 } 877 }
878 // 转账 878 // 转账
@@ -905,9 +905,9 @@ public class PaymentServiceImpl implements IPaymentService { @@ -905,9 +905,9 @@ public class PaymentServiceImpl implements IPaymentService {
905 } 905 }
906 906
907 // '1:买家uid; 2:卖家uid','1:保证金;2:货款;3:补偿款', '1:用户收入; 2:用户支出' 907 // '1:买家uid; 2:卖家uid','1:保证金;2:货款;3:补偿款', '1:用户收入; 2:用户支出'
908 - private boolean isRefundGoodsMoneyTradeBills(TradeBills tradeBills) { 908 + private boolean isRefundGoodsMoneyOrDepositMoneyTradeBills(TradeBills tradeBills) {
909 return tradeBills.getUserType() == 1 909 return tradeBills.getUserType() == 1
910 - && tradeBills.getTradeType() == 2 910 + && (tradeBills.getTradeType() == 1 || tradeBills.getTradeType() == 2)
911 && tradeBills.getIncomeOutcome() == 1; 911 && tradeBills.getIncomeOutcome() == 1;
912 } 912 }
913 913
@@ -945,6 +945,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -945,6 +945,7 @@ public class PaymentServiceImpl implements IPaymentService {
945 logger.info("{}, refund money is {}", logTag, tradeBills); 945 logger.info("{}, refund money is {}", logTag, tradeBills);
946 refundManager.create(orderCode, amount.doubleValue()) 946 refundManager.create(orderCode, amount.doubleValue())
947 .withPaidOrderCode(tradeBills.getPaidOrderCode()) 947 .withPaidOrderCode(tradeBills.getPaidOrderCode())
  948 + .withPayLevel(tradeBills.getPayLevel())
948 .withRefundPostHandler(context -> { 949 .withRefundPostHandler(context -> {
949 PayRefundBo refundBo = context.getResponse(); 950 PayRefundBo refundBo = context.getResponse();
950 //退款申请成功 951 //退款申请成功
@@ -112,7 +112,7 @@ public class SellerOrderViewService { @@ -112,7 +112,7 @@ public class SellerOrderViewService {
112 Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient); 112 Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient);
113 if (cnt == null) { 113 if (cnt == null) {
114 final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient); 114 final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
115 - List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient(bce); 115 + List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
116 Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes); 116 Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
117 List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY); 117 List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
118 List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList()); 118 List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
@@ -141,7 +141,7 @@ public class SellerOrderViewService { @@ -141,7 +141,7 @@ public class SellerOrderViewService {
141 final String actor = TabType.SELL.getValue(); 141 final String actor = TabType.SELL.getValue();
142 //not hit in cache 142 //not hit in cache
143 if (CollectionUtils.isEmpty(list)) { 143 if (CollectionUtils.isEmpty(list)) {
144 - List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient(bce); 144 + List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
145 list = new ArrayList<>(8); 145 list = new ArrayList<>(8);
146 SellerOrderListType insale = SellerOrderListType.IN_SALE; 146 SellerOrderListType insale = SellerOrderListType.IN_SALE;
147 int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes); 147 int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
@@ -184,6 +184,38 @@ public class TradeBillsService { @@ -184,6 +184,38 @@ public class TradeBillsService {
184 } 184 }
185 185
186 186
  187 + /**
  188 + * 定金退款流水记录
  189 + *
  190 + * @param uid
  191 + * @param orderCode
  192 + * @param payType
  193 + * @param amount
  194 + * @param tradeStatus
  195 + */
  196 + public void backDepositPayBuyRecord(Integer uid, Long orderCode, Long paidOrderCode, Integer payType, BigDecimal amount, int payLevel, Integer tradeStatus) {
  197 +
  198 + if (payType != null && Payment.WALLET.getCode() == payType) {
  199 + return;
  200 + }
  201 + // 增加流水记录
  202 + TradeBills record = new TradeBills();
  203 + record.setUid(uid);
  204 + record.setOrderCode(orderCode);
  205 + record.setPaidOrderCode(ObjectUtils.defaultIfNull(paidOrderCode, 0L));
  206 + record.setUserType(1);// 1:买家uid; 2:卖家uid
  207 + record.setPayType(payType);// 1:支付宝; 2:微信
  208 + record.setTradeType(1);//1:保证金;2:货款;3:补偿款
  209 + record.setIncomeOutcome(1);// 1:用户收入; 2:用户支出
  210 + record.setAmount(amount);
  211 + record.setSystemAmount(amount.negate());
  212 + record.setTradeStatus(tradeStatus);//0:订单未完结;1:订单完结
  213 + record.setCreateTime((int) (System.currentTimeMillis() / 1000));
  214 + record.setPayLevel(payLevel);
  215 + addTradeBills(record);
  216 + }
  217 +
  218 +
187 public void addTradeBills(TradeBills record) { 219 public void addTradeBills(TradeBills record) {
188 try { 220 try {
189 tradeBillsMapper.insert(record); 221 tradeBillsMapper.insert(record);
@@ -7,14 +7,18 @@ import com.yohobuy.ufo.model.order.common.OrderStatus; @@ -7,14 +7,18 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
7 import com.yohobuy.ufo.model.order.constants.OrderConstant; 7 import com.yohobuy.ufo.model.order.constants.OrderConstant;
8 import com.yohoufo.dal.order.model.*; 8 import com.yohoufo.dal.order.model.*;
9 import com.yohoufo.dal.product.model.Product; 9 import com.yohoufo.dal.product.model.Product;
  10 +import com.yohoufo.order.common.RefundCase;
  11 +import com.yohoufo.order.event.BillLogEvent;
10 import com.yohoufo.order.model.PayRefundBo; 12 import com.yohoufo.order.model.PayRefundBo;
11 import com.yohoufo.order.model.RequestedStatusChangeBuyerOrder; 13 import com.yohoufo.order.model.RequestedStatusChangeBuyerOrder;
12 import com.yohoufo.order.model.request.PaymentRequest; 14 import com.yohoufo.order.model.request.PaymentRequest;
13 import com.yohoufo.order.service.AbstractBuyerOrderStateChanger; 15 import com.yohoufo.order.service.AbstractBuyerOrderStateChanger;
14 -import com.yohoufo.order.service.IPaymentService; 16 +import com.yohoufo.order.service.impl.PayRefundService;
  17 +import lombok.val;
15 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
17 20
  21 +import java.math.BigDecimal;
18 import java.util.Collection; 22 import java.util.Collection;
19 import java.util.LinkedHashMap; 23 import java.util.LinkedHashMap;
20 24
@@ -31,7 +35,7 @@ import static com.yohoufo.order.common.RefundCase.SELLER_EARNEST_MONEY; @@ -31,7 +35,7 @@ import static com.yohoufo.order.common.RefundCase.SELLER_EARNEST_MONEY;
31 public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChanger<RequestedStatusChangeBuyerOrder> { 35 public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChanger<RequestedStatusChangeBuyerOrder> {
32 36
33 @Autowired 37 @Autowired
34 - private IPaymentService paymentService; 38 + private PayRefundService payRefundService;
35 39
36 /** 40 /**
37 * @param statusChangeBuyerOrder 41 * @param statusChangeBuyerOrder
@@ -65,17 +69,28 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange @@ -65,17 +69,28 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange
65 private void refundDeposit(BuyerOrder buyerOrder) { 69 private void refundDeposit(BuyerOrder buyerOrder) {
66 int uid = buyerOrder.getUid(); 70 int uid = buyerOrder.getUid();
67 long orderCode = buyerOrder.getOrderCode(); 71 long orderCode = buyerOrder.getOrderCode();
  72 + //定金金额
  73 + double refundAmount = getDepositAmount(buyerOrder);
  74 +
68 PaymentRequest paymentRequest = PaymentRequest.builder() 75 PaymentRequest paymentRequest = PaymentRequest.builder()
69 .uid(uid) 76 .uid(uid)
70 .refundCase(SELLER_EARNEST_MONEY) 77 .refundCase(SELLER_EARNEST_MONEY)
71 .orderCode(orderCode) 78 .orderCode(orderCode)
72 .payLevel(OrderConstant.PAY_LEVEL_DEPOSIT) 79 .payLevel(OrderConstant.PAY_LEVEL_DEPOSIT)
73 - .refundAmount(getDepositAmount(buyerOrder)) 80 + .refundAmount(refundAmount)
74 .refundattch(MerchantOrderAttachInfo.builder().type(SellerWalletDetail.Type.BID_DEPOSIT.getValue()).build()) 81 .refundattch(MerchantOrderAttachInfo.builder().type(SellerWalletDetail.Type.BID_DEPOSIT.getValue()).build())
75 .build(); 82 .build();
76 83
  84 + val billLogEventBuilder = BillLogEvent.builder()
  85 + .buyerUid(uid)
  86 + .orderCode(orderCode)
  87 + .payType(buyerOrder.getPayment())
  88 + .refundCase(RefundCase.BID_DEPOSIT_MONEY)
  89 + .amount(BigDecimal.valueOf(refundAmount))
  90 + .payLevel(OrderConstant.PAY_LEVEL_DEPOSIT);
  91 +
77 logger.info("[{}] refund deposit,paymentRequest:{}", orderCode, paymentRequest); 92 logger.info("[{}] refund deposit,paymentRequest:{}", orderCode, paymentRequest);
78 - PayRefundBo payRefundBo = paymentService.refund(paymentRequest); 93 + PayRefundBo payRefundBo = payRefundService.refund(paymentRequest, billLogEventBuilder);
79 logger.info("[{}] refund deposit end,result:{}", buyerOrder.getOrderCode(), payRefundBo); 94 logger.info("[{}] refund deposit end,result:{}", buyerOrder.getOrderCode(), payRefundBo);
80 } 95 }
81 96
@@ -26,6 +26,7 @@ import com.yohoufo.order.model.request.PaymentRequest; @@ -26,6 +26,7 @@ import com.yohoufo.order.model.request.PaymentRequest;
26 import com.yohoufo.order.model.request.TranseferCellNode; 26 import com.yohoufo.order.model.request.TranseferCellNode;
27 import com.yohoufo.order.model.request.TransferMoneyRequest; 27 import com.yohoufo.order.model.request.TransferMoneyRequest;
28 import com.yohoufo.order.service.AbstractBuyerOrderStateChanger; 28 import com.yohoufo.order.service.AbstractBuyerOrderStateChanger;
  29 +import com.yohoufo.order.service.IPaymentService;
29 import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler; 30 import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler;
30 import com.yohoufo.order.service.impl.PayRefundService; 31 import com.yohoufo.order.service.impl.PayRefundService;
31 import com.yohoufo.order.service.impl.TransferService; 32 import com.yohoufo.order.service.impl.TransferService;
@@ -62,6 +63,9 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh @@ -62,6 +63,9 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh
62 @Autowired 63 @Autowired
63 private PayRefundService payRefundService; 64 private PayRefundService payRefundService;
64 65
  66 + @Autowired
  67 + private IPaymentService paymentService;
  68 +
65 @Override 69 @Override
66 protected boolean beforeChange(RequestedCancelEventStatusChangeBuyerOrder statusChangeBuyerOrder) { 70 protected boolean beforeChange(RequestedCancelEventStatusChangeBuyerOrder statusChangeBuyerOrder) {
67 BuyerOrder buyerOrder = statusChangeBuyerOrder.getBuyerOrder(); 71 BuyerOrder buyerOrder = statusChangeBuyerOrder.getBuyerOrder();
@@ -15,13 +15,15 @@ import com.yohoufo.common.alarm.SmsAlarmEvent; @@ -15,13 +15,15 @@ import com.yohoufo.common.alarm.SmsAlarmEvent;
15 import com.yohoufo.dal.order.BuyerOrderGoodsMapper; 15 import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
16 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 16 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
17 import com.yohoufo.dal.order.model.*; 17 import com.yohoufo.dal.order.model.*;
  18 +import com.yohoufo.order.common.RefundCase;
18 import com.yohoufo.order.constants.ActivityTypeEnum; 19 import com.yohoufo.order.constants.ActivityTypeEnum;
19 import com.yohoufo.order.constants.MetaKey; 20 import com.yohoufo.order.constants.MetaKey;
  21 +import com.yohoufo.order.event.BillLogEvent;
20 import com.yohoufo.order.model.PayRefundBo; 22 import com.yohoufo.order.model.PayRefundBo;
21 import com.yohoufo.order.model.bo.ActivityBo; 23 import com.yohoufo.order.model.bo.ActivityBo;
22 import com.yohoufo.order.model.bo.BidOrderMetaBo; 24 import com.yohoufo.order.model.bo.BidOrderMetaBo;
23 import com.yohoufo.order.model.request.PaymentRequest; 25 import com.yohoufo.order.model.request.PaymentRequest;
24 -import com.yohoufo.order.service.IPaymentService; 26 +import com.yohoufo.order.service.impl.PayRefundService;
25 import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; 27 import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
26 import com.yohoufo.order.service.proxy.BargainProxyService; 28 import com.yohoufo.order.service.proxy.BargainProxyService;
27 import com.yohoufo.order.service.proxy.BaseServiceCaller; 29 import com.yohoufo.order.service.proxy.BaseServiceCaller;
@@ -32,11 +34,13 @@ import com.yohoufo.order.service.stats.impl.SellerOrderStatsEntry; @@ -32,11 +34,13 @@ import com.yohoufo.order.service.stats.impl.SellerOrderStatsEntry;
32 import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport; 34 import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport;
33 import com.yohoufo.order.utils.LoggerUtils; 35 import com.yohoufo.order.utils.LoggerUtils;
34 import com.yohoufo.order.utils.RetryerUtils; 36 import com.yohoufo.order.utils.RetryerUtils;
  37 +import lombok.val;
35 import org.slf4j.Logger; 38 import org.slf4j.Logger;
36 import org.springframework.beans.factory.annotation.Autowired; 39 import org.springframework.beans.factory.annotation.Autowired;
37 import org.springframework.stereotype.Component; 40 import org.springframework.stereotype.Component;
38 41
39 import javax.annotation.Resource; 42 import javax.annotation.Resource;
  43 +import java.math.BigDecimal;
40 import java.util.List; 44 import java.util.List;
41 import java.util.Objects; 45 import java.util.Objects;
42 46
@@ -78,7 +82,7 @@ public class BuyerOrderChangeBusinessPostProcessor { @@ -78,7 +82,7 @@ public class BuyerOrderChangeBusinessPostProcessor {
78 private SellerService sellerService; 82 private SellerService sellerService;
79 83
80 @Autowired 84 @Autowired
81 - private IPaymentService paymentService; 85 + private PayRefundService payRefundService;
82 86
83 @Autowired 87 @Autowired
84 private StatsConfigManager<SellerOrderStatsEntry, SellerOrderStatsConfiguration> statsConfigurationManager; 88 private StatsConfigManager<SellerOrderStatsEntry, SellerOrderStatsConfiguration> statsConfigurationManager;
@@ -319,17 +323,26 @@ public class BuyerOrderChangeBusinessPostProcessor { @@ -319,17 +323,26 @@ public class BuyerOrderChangeBusinessPostProcessor {
319 private void refundBidDeposit(BuyerOrder buyerOrder) { 323 private void refundBidDeposit(BuyerOrder buyerOrder) {
320 int uid = buyerOrder.getUid(); 324 int uid = buyerOrder.getUid();
321 long orderCode = buyerOrder.getOrderCode(); 325 long orderCode = buyerOrder.getOrderCode();
  326 + double refundAmount = getDepositAmount(buyerOrder);
322 PaymentRequest paymentRequest = PaymentRequest.builder() 327 PaymentRequest paymentRequest = PaymentRequest.builder()
323 .uid(uid) 328 .uid(uid)
324 .refundCase(SELLER_EARNEST_MONEY) 329 .refundCase(SELLER_EARNEST_MONEY)
325 .orderCode(orderCode) 330 .orderCode(orderCode)
326 .payLevel(OrderConstant.PAY_LEVEL_DEPOSIT) 331 .payLevel(OrderConstant.PAY_LEVEL_DEPOSIT)
327 - .refundAmount(getDepositAmount(buyerOrder)) 332 + .refundAmount(refundAmount)
328 .refundattch(MerchantOrderAttachInfo.builder().type(SellerWalletDetail.Type.BID_DEPOSIT.getValue()).build()) 333 .refundattch(MerchantOrderAttachInfo.builder().type(SellerWalletDetail.Type.BID_DEPOSIT.getValue()).build())
329 .build(); 334 .build();
330 335
  336 + val billLogEventBuilder = BillLogEvent.builder()
  337 + .buyerUid(uid)
  338 + .orderCode(orderCode)
  339 + .payType(buyerOrder.getPayment())
  340 + .refundCase(RefundCase.BID_DEPOSIT_MONEY)
  341 + .amount(BigDecimal.valueOf(refundAmount))
  342 + .payLevel(OrderConstant.PAY_LEVEL_DEPOSIT);
  343 +
331 logger.info("[{}] refund deposit,paymentRequest:{}", orderCode, paymentRequest); 344 logger.info("[{}] refund deposit,paymentRequest:{}", orderCode, paymentRequest);
332 - PayRefundBo payRefundBo = paymentService.refund(paymentRequest); 345 + PayRefundBo payRefundBo = payRefundService.refund(paymentRequest, billLogEventBuilder);
333 logger.info("[{}] refund deposit end,result:{}", buyerOrder.getOrderCode(), payRefundBo); 346 logger.info("[{}] refund deposit end,result:{}", buyerOrder.getOrderCode(), payRefundBo);
334 } 347 }
335 348
@@ -402,10 +402,11 @@ public abstract class AbstractAlipayService extends AbstractPayService { @@ -402,10 +402,11 @@ public abstract class AbstractAlipayService extends AbstractPayService {
402 //收集来的错误码 402 //收集来的错误码
403 //TODO 错误码需要不断完善 403 //TODO 错误码需要不断完善
404 if (Objects.nonNull(abtee =AlipayBatchTransferErrorEnum.getByCode(errorCode))) { 404 if (Objects.nonNull(abtee =AlipayBatchTransferErrorEnum.getByCode(errorCode))) {
  405 + String desc = formatErrorDesc(abtee, transferOrderCode);
405 return TransferResult.builder() 406 return TransferResult.builder()
406 .code(501) 407 .code(501)
407 .payErrorCode(errorCode) 408 .payErrorCode(errorCode)
408 - .msg(abtee.getDesc()) 409 + .msg(desc)
409 .build(); 410 .build();
410 411
411 } else { 412 } else {
@@ -428,6 +429,14 @@ public abstract class AbstractAlipayService extends AbstractPayService { @@ -428,6 +429,14 @@ public abstract class AbstractAlipayService extends AbstractPayService {
428 429
429 } 430 }
430 431
  432 + private static String formatErrorDesc(AlipayBatchTransferErrorEnum abtee, String transferOrderCode){
  433 + String desc = abtee.getDesc();
  434 + if (abtee.equals(AlipayBatchTransferErrorEnum.TRANS_NO_NOT_UNIQUE)){
  435 + desc = String.format(desc, transferOrderCode);
  436 + }
  437 + return desc;
  438 + }
  439 +
431 public PayQueryBo transferQuery(String buyerOrderCode) { 440 public PayQueryBo transferQuery(String buyerOrderCode) {
432 JSONObject result = transferQueryAsOriginalResult(buyerOrderCode); 441 JSONObject result = transferQueryAsOriginalResult(buyerOrderCode);
433 // 查询结果转换成 共通的对象 442 // 查询结果转换成 共通的对象
@@ -132,6 +132,8 @@ public class OrderAssist { @@ -132,6 +132,8 @@ public class OrderAssist {
132 private static final List<Integer> FLEAMARKET_CLIENT_ORDERTYPES = new ArrayList<Integer>(){ 132 private static final List<Integer> FLEAMARKET_CLIENT_ORDERTYPES = new ArrayList<Integer>(){
133 { 133 {
134 add(OrderAttributes.COMMON_IN_STOCK.getCode()); 134 add(OrderAttributes.COMMON_IN_STOCK.getCode());
  135 + add(OrderAttributes.FLAW.getCode());
  136 + add(OrderAttributes.SECOND_HAND.getCode());
135 } 137 }
136 }; 138 };
137 139
@@ -143,6 +145,11 @@ public class OrderAssist { @@ -143,6 +145,11 @@ public class OrderAssist {
143 return null; 145 return null;
144 } 146 }
145 147
  148 + public static List<Integer> matchOrderTypesByBusinessClient4Seller(BusinessClientEnum businessClientEnum){
  149 +
  150 + return null;
  151 + }
  152 +
146 public static String matchClientName(BusinessClientEnum businessClientEnum){ 153 public static String matchClientName(BusinessClientEnum businessClientEnum){
147 if (Objects.nonNull(businessClientEnum) 154 if (Objects.nonNull(businessClientEnum)
148 && BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.equals(businessClientEnum)){ 155 && BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.equals(businessClientEnum)){
1 package com.yohoufo.product.request; 1 package com.yohoufo.product.request;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
3 import org.apache.commons.lang3.builder.ToStringBuilder; 4 import org.apache.commons.lang3.builder.ToStringBuilder;
4 5
5 public class ProductSearchReq { 6 public class ProductSearchReq {
@@ -33,29 +34,7 @@ public class ProductSearchReq { @@ -33,29 +34,7 @@ public class ProductSearchReq {
33 34
34 @Override 35 @Override
35 public String toString() { 36 public String toString() {
36 - return new ToStringBuilder(this)  
37 - .append("page", page)  
38 - .append("order", order)  
39 - .append("gender", gender)  
40 - .append("viewNum", viewNum)  
41 - .append("brand", brand)  
42 - .append("size", size)  
43 - .append("query", query)  
44 - .append("maxSort", maxSort)  
45 - .append("midSort", midSort)  
46 - .append("series", series)  
47 - .append("pool", pool)  
48 - .append("isSoonSale", isSoonSale)  
49 - .append("not_id", not_id)  
50 - .append("id", id)  
51 - .append("isIdFilter", isIdFilter)  
52 - .append("filterYearMonth",filterYearMonth)  
53 - .append("startTime",startTime)  
54 - .append("endTime",endTime)  
55 - .append("contain_yoho",containYoho)  
56 - .append("businessClient",businessClient)  
57 - .append("preSaleFlag", preSaleFlag)  
58 - .toString(); 37 + return JSONObject.toJSONString(this);
59 } 38 }
60 39
61 40
@@ -84,7 +84,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -84,7 +84,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
84 84
85 @Override 85 @Override
86 public JSONObject searchProductList(ProductSearchReq req) { 86 public JSONObject searchProductList(ProductSearchReq req) {
87 - SearchParam searchParam = new SearchParam().buildPageSearchParam(req); 87 + SearchParam searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
88 /*if (req.getMidSort() == null && req.getMidSort() == null) { 88 /*if (req.getMidSort() == null && req.getMidSort() == null) {
89 searchParam.setXianYuSort(req.getBusinessClient(), configReader); 89 searchParam.setXianYuSort(req.getBusinessClient(), configReader);
90 }*/ 90 }*/
@@ -107,7 +107,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -107,7 +107,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
107 } 107 }
108 req.setId(info.getContainsProductIds()); 108 req.setId(info.getContainsProductIds());
109 req.setNot_id(info.getExcludeProductIds()); 109 req.setNot_id(info.getExcludeProductIds());
110 - logger.info("contains {} ex {}",info.getContainsProductIds(), info.getExcludeProductIds()); 110 + //logger.info("contains {} ex {}",info.getContainsProductIds(), info.getExcludeProductIds());
111 searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient()); 111 searchParam = new SearchParam().buildPageSearchParam(req).setShowChannel(req.getBusinessClient());
112 } else if (StringUtils.equals("Y", req.getIsSoonSale())) { 112 } else if (StringUtils.equals("Y", req.getIsSoonSale())) {
113 url = ProductSearchConstants.SOON_SALE_PRODUCT_LIST_URL; 113 url = ProductSearchConstants.SOON_SALE_PRODUCT_LIST_URL;
@@ -115,14 +115,12 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -115,14 +115,12 @@ public class ProductSearchServiceImpl implements ProductSearchService {
115 url = ProductSearchConstants.FAVORITE_PRODUCT_LIST_URL; 115 url = ProductSearchConstants.FAVORITE_PRODUCT_LIST_URL;
116 } else if (StringUtils.isNotBlank(req.getQuery()) 116 } else if (StringUtils.isNotBlank(req.getQuery())
117 || (req.getSearchType() != null && req.getSearchType() == 6)) { 117 || (req.getSearchType() != null && req.getSearchType() == 6)) {
118 -  
119 - searchParam.setShowChannel(req.getBusinessClient());  
120 url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL; 118 url = ProductSearchConstants.PRODUCT_SEARCH_QUERY_URL;
121 } else if (StringUtils.isNotBlank(req.getPool()) 119 } else if (StringUtils.isNotBlank(req.getPool())
122 || (req.getSearchType() != null && (req.getSearchType() == 0 || req.getSearchType() == 1))) { 120 || (req.getSearchType() != null && (req.getSearchType() == 0 || req.getSearchType() == 1))) {
123 - searchParam.setShowChannel(req.getBusinessClient());  
124 url = ProductSearchConstants.PRODUCT_POOL_URL; 121 url = ProductSearchConstants.PRODUCT_POOL_URL;
125 } 122 }
  123 +
126 JSONObject data = searchAssistService.search(searchParam.getParam(), url); 124 JSONObject data = searchAssistService.search(searchParam.getParam(), url);
127 // 将图片的相对路径转成绝对路径 125 // 将图片的相对路径转成绝对路径
128 if (null != data) { 126 if (null != data) {
@@ -334,7 +332,7 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -334,7 +332,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
334 Product product = productHelpService.selectByIdCache(productId); 332 Product product = productHelpService.selectByIdCache(productId);
335 if (product != null) { 333 if (product != null) {
336 ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName()); 334 ProductSearchReq req = new ProductSearchReq().setNot_id(productId + "").setMidSort(product.getMidSortId() + "").setBrand(product.getBrandId() + "").setQuery(product.getProductName());
337 - SearchParam searchParam = new SearchParam().buildSearchParam(req); 335 + SearchParam searchParam = new SearchParam().buildSearchParam(req).setShowChannel(businessClient);
338 336
339 JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_LIST_URL); 337 JSONObject data = searchAssistService.search(searchParam.getParam(), ProductSearchConstants.PRODUCT_RECOMMEND_LIST_URL);
340 if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) { 338 if(data != null && !CollectionUtils.isEmpty(data.getJSONArray("product_list"))) {
@@ -564,6 +562,17 @@ public class ProductSearchServiceImpl implements ProductSearchService { @@ -564,6 +562,17 @@ public class ProductSearchServiceImpl implements ProductSearchService {
564 562
565 private CouponInfo getCouponInfo(String token) { 563 private CouponInfo getCouponInfo(String token) {
566 ApiResponse resp = ufoServiceCaller.call("ufo.coupons.getProductIds", ApiResponse.class, token); 564 ApiResponse resp = ufoServiceCaller.call("ufo.coupons.getProductIds", ApiResponse.class, token);
567 - return (CouponInfo) resp.getData(); 565 + CouponInfo couponInfo = (CouponInfo) resp.getData();
  566 +
  567 + // 如果券包含的商品列表、排除的商品列表太多,则调用搜索的时候会报参数链接太长,所以这里进行截取
  568 + if (StringUtils.isNotEmpty(couponInfo.getContainsProductIds())
  569 + && couponInfo.getContainsProductIds().length() > 1800) {
  570 + couponInfo.setContainsProductIds(couponInfo.getContainsProductIds().substring(0, 1799));
  571 + }
  572 + if (StringUtils.isNotEmpty(couponInfo.getExcludeProductIds())
  573 + && couponInfo.getExcludeProductIds().length() > 1800) {
  574 + couponInfo.setExcludeProductIds(couponInfo.getExcludeProductIds().substring(0, 1799));
  575 + }
  576 + return couponInfo;
568 } 577 }
569 } 578 }
1 package com.yohoufo.product.service.impl; 1 package com.yohoufo.product.service.impl;
2 2
3 -import java.util.Collections;  
4 -import java.util.Comparator;  
5 -import java.util.List;  
6 -import java.util.Map; 3 +import java.util.*;
7 import java.util.Map.Entry; 4 import java.util.Map.Entry;
8 import java.util.function.Function; 5 import java.util.function.Function;
9 import java.util.function.Predicate; 6 import java.util.function.Predicate;
@@ -74,24 +71,30 @@ public class StoragePriceService { @@ -74,24 +71,30 @@ public class StoragePriceService {
74 * @return 71 * @return
75 */ 72 */
76 public List<StoragePrice> setStoragePriceCache(Integer productId) { 73 public List<StoragePrice> setStoragePriceCache(Integer productId) {
77 - List<StoragePrice> sizePriceCacheList = storagePriceMapper.selectInStockLeastPByProductId(productId, StorageTypeEnum.NORMAL.getType()); 74 + List<StoragePrice> sizePriceCacheList = storagePriceMapper.selectLeastPByProductId(productId, StorageTypeEnum.NORMAL.getType());
78 productCacheService.setCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, sizePriceCacheList, productId); 75 productCacheService.setCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_IN_STOCK_INFO_KEY, sizePriceCacheList, productId);
79 return sizePriceCacheList; 76 return sizePriceCacheList;
80 } 77 }
81 78
82 public List<StoragePrice> setSecondStoragePriceCache(Integer productId) { 79 public List<StoragePrice> setSecondStoragePriceCache(Integer productId) {
83 - List<StoragePrice> sizePriceCacheList = storagePriceMapper.selectInStockLeastPByProductId(productId, StorageTypeEnum.DEFECT.getType());  
84 - if(CollectionUtils.isEmpty(sizePriceCacheList)) {  
85 - sizePriceCacheList = Lists.newArrayList(); 80 + List<StoragePrice> defectPriceCacheList = storagePriceMapper.selectLeastPByProductId(productId, StorageTypeEnum.DEFECT.getType());
  81 + List<StoragePrice> secondSizePriceCacheList = storagePriceMapper.selectLeastPByProductId(productId, StorageTypeEnum.SECOND.getType());
  82 +
  83 +
  84 + List<StoragePrice> sizePriceCacheList = new ArrayList<>();
  85 +
  86 + if(CollectionUtils.isNotEmpty(defectPriceCacheList)) {
  87 + sizePriceCacheList.addAll(defectPriceCacheList);
86 } 88 }
87 -  
88 - List<StoragePrice> secondSizePriceCacheList = storagePriceMapper.selectInStockLeastPByProductId(productId, StorageTypeEnum.SECOND.getType());  
89 - if(CollectionUtils.isEmpty(secondSizePriceCacheList)) {  
90 - productCacheService.setCacheByString(UfoProductCacheKeyEnum.STORAGE_PRICE_SECOND_INFO_KEY, sizePriceCacheList, productId);  
91 - return sizePriceCacheList; 89 +
  90 + if(CollectionUtils.isNotEmpty(secondSizePriceCacheList)) {
  91 + sizePriceCacheList.addAll(secondSizePriceCacheList);
92 } 92 }
93 -  
94 - sizePriceCacheList.addAll(secondSizePriceCacheList); 93 +
  94 + if(CollectionUtils.isEmpty(sizePriceCacheList)) {
  95 + return Lists.newArrayList();
  96 + }
  97 +
95 Map<Integer, List<StoragePrice>> storagePriceMap = sizePriceCacheList.stream().collect(Collectors.groupingBy(StoragePrice::getStorageId)); 98 Map<Integer, List<StoragePrice>> storagePriceMap = sizePriceCacheList.stream().collect(Collectors.groupingBy(StoragePrice::getStorageId));
96 List<StoragePrice> resultStoragePriceList = Lists.newArrayList(); 99 List<StoragePrice> resultStoragePriceList = Lists.newArrayList();
97 for(Entry<Integer, List<StoragePrice>> entry : storagePriceMap.entrySet()) { 100 for(Entry<Integer, List<StoragePrice>> entry : storagePriceMap.entrySet()) {
@@ -103,8 +106,7 @@ public class StoragePriceService { @@ -103,8 +106,7 @@ public class StoragePriceService {
103 Collections.sort(entry.getValue(), new Comparator<StoragePrice>() { 106 Collections.sort(entry.getValue(), new Comparator<StoragePrice>() {
104 @Override 107 @Override
105 public int compare(StoragePrice o1, StoragePrice o2) { 108 public int compare(StoragePrice o1, StoragePrice o2) {
106 - //升序  
107 - return o1.getPrice().compareTo(o2.getPrice()); 109 + return o1.getPrice().compareTo(o2.getPrice()); //升序
108 } 110 }
109 }); 111 });
110 112
@@ -163,15 +165,14 @@ public class StoragePriceService { @@ -163,15 +165,14 @@ public class StoragePriceService {
163 Map<Integer, StoragePrice> storagePriceMap = selectSecondLeastP(productId); 165 Map<Integer, StoragePrice> storagePriceMap = selectSecondLeastP(productId);
164 goodsSizes.stream().forEach(item -> { 166 goodsSizes.stream().forEach(item -> {
165 StoragePrice storagePrice = storagePriceMap.get(item.getId());//二手 167 StoragePrice storagePrice = storagePriceMap.get(item.getId());//二手
166 - if (null != storagePrice && null != item.getSuggestHighPrice()  
167 - && storagePrice.getPrice().compareTo(item.getSuggestHighPrice()) > 0) { //高于建议价,不展示skup  
168 - item.setStorageNum(0);  
169 - item.setSkup(0); 168 + if (null == storagePrice) {
  169 + item.setSecondHandStorageNum(0);
  170 + item.setSecondHandSkup(0);
170 } else { 171 } else {
171 - item.setSecondHandLeastPrice(storagePrice == null ? null : storagePrice.getPrice());  
172 - item.setStatus(storagePrice == null ? null : storagePrice.getStatus());  
173 - item.setSkup(storagePrice == null ? 0 : storagePrice.getSkup());  
174 - item.setStorageNum(item.getSkup() == null || item.getSkup() == 0 ? 0 : 1); 172 + item.setSecondHandLeastPrice(storagePrice.getPrice());
  173 + item.setSecondHandSkup(storagePrice.getSkup());
  174 + item.setSecondHandStorageNum(1);
  175 + item.setSecondHandStatus(1);
175 } 176 }
176 }); 177 });
177 } 178 }
@@ -54,6 +54,7 @@ public class ConfigTypeController { @@ -54,6 +54,7 @@ public class ConfigTypeController {
54 54
55 /** 55 /**
56 * <p>修改配置信息</p> 56 * <p>修改配置信息</p>
  57 + * 内部调用
57 */ 58 */
58 @ApiOperation(name = "ufo.resource.updateConfigTypeContent", desc = "修改配置信息") 59 @ApiOperation(name = "ufo.resource.updateConfigTypeContent", desc = "修改配置信息")
59 @RequestMapping(params = "method=ufo.resource.updateConfigTypeContent") 60 @RequestMapping(params = "method=ufo.resource.updateConfigTypeContent")
@@ -52,8 +52,13 @@ public class ResourcesController { @@ -52,8 +52,13 @@ public class ResourcesController {
52 request.getClientType()); 52 request.getClientType());
53 return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("resources data").build(); 53 return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("resources data").build();
54 } 54 }
55 -  
56 - 55 +
  56 +
  57 + /**
  58 + * 内部调用
  59 + * @param req
  60 + * @return
  61 + */
57 @ApiOperation(name = "clearResourceCache", desc="资源位清除缓存") 62 @ApiOperation(name = "clearResourceCache", desc="资源位清除缓存")
58 @RequestMapping(value = "/clearResourceCache") 63 @RequestMapping(value = "/clearResourceCache")
59 @IgnoreSession 64 @IgnoreSession
@@ -25,6 +25,8 @@ public class ResourcesGoodsPoolController { @@ -25,6 +25,8 @@ public class ResourcesGoodsPoolController {
25 private ResourcesGoodsPoolService resourcesGoodsPoolService; 25 private ResourcesGoodsPoolService resourcesGoodsPoolService;
26 26
27 /** 27 /**
  28 + * 商品模块 内部调用
  29 + *
28 * <p>获取配置列表,返回map</p> 30 * <p>获取配置列表,返回map</p>
29 * 31 *
30 */ 32 */
@@ -535,12 +535,13 @@ @@ -535,12 +535,13 @@
535 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 535 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
536 <!-- 按天回滚 daily --> 536 <!-- 按天回滚 daily -->
537 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/mq-consumer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> 537 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/mq-consumer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
538 - <!-- 日志最大的历史 60天 --> 538 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  539 + <!-- or whenever the file size reaches 100MB -->
  540 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  541 + </timeBasedFileNamingAndTriggeringPolicy>
  542 + <!-- keep 30 days' worth of history -->
539 <maxHistory>${yoho.logs.maxHistory}</maxHistory> 543 <maxHistory>${yoho.logs.maxHistory}</maxHistory>
540 </rollingPolicy> 544 </rollingPolicy>
541 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
542 - <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>  
543 - </triggeringPolicy>  
544 <encoder> 545 <encoder>
545 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> 546 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
546 </encoder> 547 </encoder>
@@ -551,12 +552,13 @@ @@ -551,12 +552,13 @@
551 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 552 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
552 <!-- 按天回滚 daily --> 553 <!-- 按天回滚 daily -->
553 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/mq-producer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> 554 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/mq-producer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
554 - <!-- 日志最大的历史 60天 --> 555 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  556 + <!-- or whenever the file size reaches 100MB -->
  557 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  558 + </timeBasedFileNamingAndTriggeringPolicy>
  559 + <!-- keep 30 days' worth of history -->
555 <maxHistory>${yoho.logs.maxHistory}</maxHistory> 560 <maxHistory>${yoho.logs.maxHistory}</maxHistory>
556 </rollingPolicy> 561 </rollingPolicy>
557 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
558 - <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>  
559 - </triggeringPolicy>  
560 <encoder> 562 <encoder>
561 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> 563 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
562 </encoder> 564 </encoder>
@@ -567,12 +569,13 @@ @@ -567,12 +569,13 @@
567 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 569 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
568 <!-- 按天回滚 daily --> 570 <!-- 按天回滚 daily -->
569 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/seller-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> 571 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/seller-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
570 - <!-- 日志最大的历史 60天 --> 572 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  573 + <!-- or whenever the file size reaches 100MB -->
  574 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  575 + </timeBasedFileNamingAndTriggeringPolicy>
  576 + <!-- keep 30 days' worth of history -->
571 <maxHistory>${yoho.logs.maxHistory}</maxHistory> 577 <maxHistory>${yoho.logs.maxHistory}</maxHistory>
572 </rollingPolicy> 578 </rollingPolicy>
573 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
574 - <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>  
575 - </triggeringPolicy>  
576 <encoder> 579 <encoder>
577 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> 580 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
578 </encoder> 581 </encoder>
@@ -583,17 +586,20 @@ @@ -583,17 +586,20 @@
583 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 586 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
584 <!-- 按天回滚 daily --> 587 <!-- 按天回滚 daily -->
585 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/buyer-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> 588 <fileNamePattern>${yoho.logs.basedir}/${ufo.gateway.env.namespace}/archived/buyer-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
586 - <!-- 日志最大的历史 60天 --> 589 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  590 + <!-- or whenever the file size reaches 100MB -->
  591 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  592 + </timeBasedFileNamingAndTriggeringPolicy>
  593 + <!-- keep 30 days' worth of history -->
587 <maxHistory>${yoho.logs.maxHistory}</maxHistory> 594 <maxHistory>${yoho.logs.maxHistory}</maxHistory>
588 </rollingPolicy> 595 </rollingPolicy>
589 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
590 - <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>  
591 - </triggeringPolicy> 596 +
592 <encoder> 597 <encoder>
593 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern> 598 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
594 </encoder> 599 </encoder>
595 </appender> 600 </appender>
596 601
  602 +
597 <!-- 数据库操作日志 --> 603 <!-- 数据库操作日志 -->
598 <logger name="java.sql.PreparedStatement" value="${yoho.logs.level.core}"/> 604 <logger name="java.sql.PreparedStatement" value="${yoho.logs.level.core}"/>
599 <logger name="java.sql.Connection" value="${yoho.logs.level.core}"/> 605 <logger name="java.sql.Connection" value="${yoho.logs.level.core}"/>