Authored by mlge

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

... ... @@ -22,7 +22,7 @@
</resultMap>
<sql id="Base_Column_List">
id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name,
color_id, color_name, goods_price, status, image_url, is_del, batch_no, num, skup_list
color_id, color_name, goods_price, status, image_url, is_del, batch_no
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap">
select
... ...
... ... @@ -29,8 +29,8 @@ public class MerchantController {
@RequestMapping(params = "method=ufo.merchant.accountDetail")
@ResponseBody
public ApiResponse getAccountDetailInfo(@RequestParam("uid") int uid,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit) {
LOG.info("getAccountDetailInfo uid={}, page={}, limit={}", uid, page, limit);
return service.getMerchantWalletDetailInfo(uid, page, limit);
}
... ...
... ... @@ -325,9 +325,9 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
return new com.yohoufo.common.ApiResponse(400, "钱包不可用", null);
}
JSONObject result = new JSONObject();
result.put("all", sw.getAmount().add(sw.getLockAmount()));
result.put("locked", sw.getLockAmount());
result.put("avail", sw.getAmount());
result.put("all", sw.getAmount().add(sw.getLockAmount()).setScale(2).toString());
result.put("locked", sw.getLockAmount().setScale(2).toString());
result.put("avail", sw.getAmount().setScale(2).toString());
return new com.yohoufo.common.ApiResponse(200, "查询成功", result);
}
... ... @@ -356,7 +356,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
for (SellerWalletDetail detail : resultList) {
JSONObject result = new JSONObject();
result.put("amount", detail.getAmount());
result.put("amount", detail.getAmount().setScale(2).toString());
result.put("type", sw.getType());
result.put("info", SellerWalletDetail.Type.of(sw.getType()).getName());
result.put("time", sdf.format(new Date(1000L * detail.getCreateTime())));
... ...
... ... @@ -568,19 +568,27 @@ public class PaymentServiceImpl implements IPaymentService {
throw new ServiceException(400, "不合法的金额:" + transferAmount);
}
String alipayAccount = getAlipayAccount(targetUid);
transfer.setAlipayAccount(alipayAccount);
if (StringUtils.isBlank(alipayAccount)) {
AuthorizeResultRespVO account = getAlipayAccount(targetUid);
if (account == null ||
(StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) {
logger.warn("transferMonErr uid {} 没有获取到有效的支付宝账号", targetUid);
record.setTradeStatus(201);
addTradeBills(record);
throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号");
}
if(StringUtils.isNotBlank(account.getAlipayId())) {
logger.info("transferMon uid {} 支付宝账号uid有值优先使用{}", targetUid, account.getAlipayId());
transfer.setAlipayAccount(account.getAlipayId());
} else if(StringUtils.isNotBlank(account.getAlipayAccount())) {
logger.info("transferMon uid {} 支付宝账号uid无值使用账号{}", targetUid, account.getAlipayAccount());
transfer.setAlipayAccount(account.getAlipayAccount());
}
String alipayAccount = transfer.getAlipayAccount();
// 转账
try {
logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
JSONObject jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), null, alipayAccount, transferAmount);
JSONObject jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
if (jsonObject == null) {
logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
transfer.setStatus(3);
... ... @@ -801,10 +809,6 @@ public class PaymentServiceImpl implements IPaymentService {
if (StringUtils.isBlank(req.getOperateUname())) {
throw new ServiceException(400, "manualDeal:客服名称不合法");
}
String alipayAccount = req.getAlipayAccount();
if (StringUtils.isBlank(alipayAccount)) {
throw new ServiceException(400, "manualDeal:支付宝账号不合法");
}
TradeBills tradeBills = tradeBillsMapper.selectByPrimaryKey(tradeBillsId);
if (tradeBills == null) {
throw new ServiceException(400, "manualDeal:流水不存在");
... ... @@ -819,10 +823,19 @@ public class PaymentServiceImpl implements IPaymentService {
if (tradeBillsMapper.selectByDealRelateId(tradeBillsId) != null) {
throw new ServiceException(400, "manualDeal:该流水已经处理过");
}
String alipayAccountDb = getAlipayAccount(tradeBills.getUid());
if (!StringUtils.equals(alipayAccount, alipayAccountDb)) {
logger.warn("manualDeal:传入支付宝账号和系统不一致{},{}", alipayAccount, alipayAccountDb);
throw new ServiceException(400, "manualDeal:传入支付宝账号(" + alipayAccount + ")和系统不一致(" + alipayAccountDb + ")");
AuthorizeResultRespVO account = getAlipayAccount(tradeBills.getUid());
if (account == null ||
(StringUtils.isBlank(account.getAlipayAccount()) && StringUtils.isBlank(account.getAlipayId()))) {
logger.warn("manualDealErr uid {} 没有获取到有效的支付宝账号", tradeBills.getUid());
throw new ServiceException(400, "uid[" + tradeBills.getUid() + "]没有获取到有效的支付宝账号");
}
String alipayAccount = null;
if(StringUtils.isNotBlank(account.getAlipayId())) {
logger.info("manualDeal uid {} 支付宝账号uid有值优先使用{}", tradeBills.getUid(), account.getAlipayId());
alipayAccount = account.getAlipayId();
} else if(StringUtils.isNotBlank(account.getAlipayAccount())) {
logger.info("manualDeal uid {} 支付宝账号uid无值使用账号{}", tradeBills.getUid(), account.getAlipayAccount());
alipayAccount = account.getAlipayAccount();
}
long orderCode = tradeBills.getOrderCode();
... ... @@ -894,7 +907,7 @@ public class PaymentServiceImpl implements IPaymentService {
throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId);
}
JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), null, alipayAccount, amount);
JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
if (jsonObject == null) {
logger.warn("manualDeal 转账失败 , req is {}", req);
throw new ServiceException(500, "转账失败:阿里接口返回null");
... ... @@ -1109,12 +1122,12 @@ public class PaymentServiceImpl implements IPaymentService {
@SuppressWarnings("unchecked")
private String getAlipayAccount(int targetUid) {
private AuthorizeResultRespVO getAlipayAccount(int targetUid) {
ApiResponse<AuthorizeResultRespVO> resp = ufoServiceCaller.call("ufo.user.aliPayAccountQuery", ApiResponse.class, targetUid);
if (resp != null) {
AuthorizeResultRespVO data = (AuthorizeResultRespVO) resp.getData();
if (data != null && data.getAlipayAccount() != null) {
return data.getAlipayAccount();
if (data != null) {
return data;
}
}
return null;
... ...
... ... @@ -131,10 +131,10 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
if (amount==null||amount.compareTo(BigDecimal.ZERO) <= 0) {
throw new UfoServiceException(400, "金额不合法,预存金额必须大于0");
}
/*
if(amount.compareTo(new BigDecimal(depositPreStore))<0){
throw new UfoServiceException(400, "金额不合法,预存金额小于系统预设值");
}
}*/
if(!isZhiMaCertPass(uid)){
throw new UfoServiceException(400, "请先实名认证");
... ...
... ... @@ -56,7 +56,7 @@ datasources:
- com.yohoufo.dal.order.SellerWalletDetailMapper
- com.yohoufo.dal.order.OrderCouponMapper
- com.yohoufo.dal.order.EntrySellerRechargeOrderMapper
- com.yohoufo.dal.user.IStoredSellerDao
- com.yohoufo.dal.order.IStoredSellerDao
ufo_promotion:
... ...
... ... @@ -56,7 +56,7 @@ datasources:
- com.yohoufo.dal.order.SellerWalletDetailMapper
- com.yohoufo.dal.order.OrderCouponMapper
- com.yohoufo.dal.order.EntrySellerRechargeOrderMapper
- com.yohoufo.dal.user.IStoredSellerDao
- com.yohoufo.dal.order.IStoredSellerDao
ufo_promotion:
... ...