Authored by Lixiaodi

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

... ... @@ -34,5 +34,12 @@ public class MerchantController {
LOG.info("getAccountDetailInfo uid={}, page={}, limit={}", uid, page, limit);
return service.getMerchantWalletDetailInfo(uid, page, limit);
}
@RequestMapping(params = "method=ufo.merchant.accountWarnTip")
@ResponseBody
public ApiResponse getAccountWarnTip(@RequestParam("uid") int uid) {
LOG.info("accountWarnTip uid={}", uid);
return service.getMerchantLowMoneyWarnTip(uid);
}
}
... ...
... ... @@ -26,7 +26,6 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
... ... @@ -68,13 +67,13 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
IStoredSellerService storedSellerService;
//@Value("${order.seller.tip.publishMoneyTip:保证金余额不足}")
private String publishMoneyTip = "保证金余额不足";
private String publishMoneyTip = "保证金余额不足";
//@Value("${order.seller.tip.publishFunctionTip:请充值后进行正常上架/下架}")
private String publishFunctionTip = "请充值后进行正常上架";
//@Value("${order.seller.tip.canSaleMoneyTip:保证金余额低于}")
private String canSaleMoneyTip = "保证金余额不足";
private String canSaleMoneyTip = "保证金余额不足";
//@Value("${order.seller.tip.canSaleFunctionTip:平台下架您所有出售中的商品}")
private String canSaleFunctionTip = "上架所有商品将会被强制隐藏,不会给用户展示";
... ... @@ -416,13 +415,34 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
result.put("canSaleMoneyTip", canSaleMoneyTip + canSaleMoney.toString());
result.put("canSaleFunctionTip", canSaleFunctionTip);
result.put("recoverTip", recoverTip.replace("{}", lackOfMoneyAsSuper.toString()));
if (allMoney.compareTo(canSaleMoney) < 0) {
result.put("saleListLowMoneyTip", saleListLowMoneyTip);
} else {
result.put("saleListLowMoneyTip", StringUtils.EMPTY);
}
return new com.yohoufo.common.ApiResponse(200, "查询成功", result);
}
public com.yohoufo.common.ApiResponse getMerchantLowMoneyWarnTip(Integer uid) {
EntrySellerType sellerType = sellerService.getEntrySellerType(uid);
boolean isSuper = (sellerType != null && sellerType == EntrySellerType.SUPER_ENTRY);
if (isSuper) {
Map<EntrySellerType, EntryThreshold> map = sellerService.getEntryThreshold();
EntryThreshold sp = map.get(EntrySellerType.SUPER_ENTRY);
BigDecimal canSaleMoney = sp.getHiddenGoodsAmount();
SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1);
if (sw == null) {
return new com.yohoufo.common.ApiResponse(400, "钱包不存在", null);
}
if (sw.getStatus() == null || sw.getStatus() == 0) {
return new com.yohoufo.common.ApiResponse(400, "钱包不可用", null);
}
BigDecimal allMoney = sw.getAmount().add(sw.getLockAmount());
if (allMoney.compareTo(canSaleMoney) < 0) {
return new com.yohoufo.common.ApiResponse(200, "查询成功", saleListLowMoneyTip);
} else {
return new com.yohoufo.common.ApiResponse(200, "查询成功", StringUtils.EMPTY);
}
}
return new com.yohoufo.common.ApiResponse(200, "查询成功", StringUtils.EMPTY);
}
public com.yohoufo.common.ApiResponse getMerchantWalletDetailInfo(Integer uid, int page, int limit) {
SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1);
... ...