Authored by Lixiaodi

修改商家警告tip,增加提示接口

@@ -35,4 +35,11 @@ public class MerchantController { @@ -35,4 +35,11 @@ public class MerchantController {
35 return service.getMerchantWalletDetailInfo(uid, page, limit); 35 return service.getMerchantWalletDetailInfo(uid, page, limit);
36 } 36 }
37 37
  38 + @RequestMapping(params = "method=ufo.merchant.accountWarnTip")
  39 + @ResponseBody
  40 + public ApiResponse getAccountWarnTip(@RequestParam("uid") int uid) {
  41 + LOG.info("accountWarnTip uid={}", uid);
  42 + return service.getMerchantLowMoneyWarnTip(uid);
  43 + }
  44 +
38 } 45 }
@@ -26,7 +26,6 @@ import org.apache.commons.lang3.StringUtils; @@ -26,7 +26,6 @@ import org.apache.commons.lang3.StringUtils;
26 import org.slf4j.Logger; 26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory; 27 import org.slf4j.LoggerFactory;
28 import org.springframework.beans.factory.annotation.Autowired; 28 import org.springframework.beans.factory.annotation.Autowired;
29 -import org.springframework.beans.factory.annotation.Value;  
30 import org.springframework.stereotype.Service; 29 import org.springframework.stereotype.Service;
31 30
32 import java.math.BigDecimal; 31 import java.math.BigDecimal;
@@ -68,13 +67,13 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { @@ -68,13 +67,13 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
68 IStoredSellerService storedSellerService; 67 IStoredSellerService storedSellerService;
69 68
70 //@Value("${order.seller.tip.publishMoneyTip:保证金余额不足}") 69 //@Value("${order.seller.tip.publishMoneyTip:保证金余额不足}")
71 - private String publishMoneyTip = "保证金余额不足"; 70 + private String publishMoneyTip = "保证金余额不足";
72 71
73 //@Value("${order.seller.tip.publishFunctionTip:请充值后进行正常上架/下架}") 72 //@Value("${order.seller.tip.publishFunctionTip:请充值后进行正常上架/下架}")
74 private String publishFunctionTip = "请充值后进行正常上架"; 73 private String publishFunctionTip = "请充值后进行正常上架";
75 74
76 //@Value("${order.seller.tip.canSaleMoneyTip:保证金余额低于}") 75 //@Value("${order.seller.tip.canSaleMoneyTip:保证金余额低于}")
77 - private String canSaleMoneyTip = "保证金余额不足"; 76 + private String canSaleMoneyTip = "保证金余额不足";
78 77
79 //@Value("${order.seller.tip.canSaleFunctionTip:平台下架您所有出售中的商品}") 78 //@Value("${order.seller.tip.canSaleFunctionTip:平台下架您所有出售中的商品}")
80 private String canSaleFunctionTip = "上架所有商品将会被强制隐藏,不会给用户展示"; 79 private String canSaleFunctionTip = "上架所有商品将会被强制隐藏,不会给用户展示";
@@ -416,12 +415,33 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService { @@ -416,12 +415,33 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
416 result.put("canSaleMoneyTip", canSaleMoneyTip + canSaleMoney.toString()); 415 result.put("canSaleMoneyTip", canSaleMoneyTip + canSaleMoney.toString());
417 result.put("canSaleFunctionTip", canSaleFunctionTip); 416 result.put("canSaleFunctionTip", canSaleFunctionTip);
418 result.put("recoverTip", recoverTip.replace("{}", lackOfMoneyAsSuper.toString())); 417 result.put("recoverTip", recoverTip.replace("{}", lackOfMoneyAsSuper.toString()));
  418 + return new com.yohoufo.common.ApiResponse(200, "查询成功", result);
  419 + }
  420 +
  421 + public com.yohoufo.common.ApiResponse getMerchantLowMoneyWarnTip(Integer uid) {
  422 + EntrySellerType sellerType = sellerService.getEntrySellerType(uid);
  423 + boolean isSuper = (sellerType != null && sellerType == EntrySellerType.SUPER_ENTRY);
  424 + if (isSuper) {
  425 + Map<EntrySellerType, EntryThreshold> map = sellerService.getEntryThreshold();
  426 + EntryThreshold sp = map.get(EntrySellerType.SUPER_ENTRY);
  427 + BigDecimal canSaleMoney = sp.getHiddenGoodsAmount();
  428 +
  429 + SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1);
  430 + if (sw == null) {
  431 + return new com.yohoufo.common.ApiResponse(400, "钱包不存在", null);
  432 + }
  433 + if (sw.getStatus() == null || sw.getStatus() == 0) {
  434 + return new com.yohoufo.common.ApiResponse(400, "钱包不可用", null);
  435 + }
  436 + BigDecimal allMoney = sw.getAmount().add(sw.getLockAmount());
  437 +
419 if (allMoney.compareTo(canSaleMoney) < 0) { 438 if (allMoney.compareTo(canSaleMoney) < 0) {
420 - result.put("saleListLowMoneyTip", saleListLowMoneyTip); 439 + return new com.yohoufo.common.ApiResponse(200, "查询成功", saleListLowMoneyTip);
421 } else { 440 } else {
422 - result.put("saleListLowMoneyTip", StringUtils.EMPTY); 441 + return new com.yohoufo.common.ApiResponse(200, "查询成功", StringUtils.EMPTY);
423 } 442 }
424 - return new com.yohoufo.common.ApiResponse(200, "查询成功", result); 443 + }
  444 + return new com.yohoufo.common.ApiResponse(200, "查询成功", StringUtils.EMPTY);
425 } 445 }
426 446
427 public com.yohoufo.common.ApiResponse getMerchantWalletDetailInfo(Integer uid, int page, int limit) { 447 public com.yohoufo.common.ApiResponse getMerchantWalletDetailInfo(Integer uid, int page, int limit) {