|
|
package com.yoho.ufo.order.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.order.dal.TradeBillsMapper;
|
|
|
import com.yoho.order.model.*;
|
|
|
import com.yoho.ufo.order.constant.TradeStatusEnum;
|
|
|
import com.yoho.ufo.order.service.ITradeBillsService;
|
|
|
import com.yoho.ufo.service.impl.UserHelper;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yohobuy.ufo.model.order.resp.*;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
...
|
...
|
@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
...
|
...
|
@@ -47,6 +50,13 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
if(!checkAndBuildParam(req)) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
if(req.getUid()==null&&StringUtils.isNotBlank(req.getMobile())){
|
|
|
Integer uid = getUidByMobile(req.getMobile());
|
|
|
if(uid!=null){
|
|
|
req.setUid(uid);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int total = tradeBillsMapper.selectCountByCondition(req);
|
|
|
if(total == 0) {
|
...
|
...
|
@@ -82,12 +92,13 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
TradeBillsResp resp=new TradeBillsResp();
|
|
|
resp.setId(item.getId());
|
|
|
resp.setUid(item.getUid());
|
|
|
resp.setMobile(getMobileByUid(item.getUid()));
|
|
|
resp.setOrderCode(item.getOrderCode());
|
|
|
resp.setAmount(item.getAmount());
|
|
|
resp.setIncomeOutcome(item.getIncomeOutcome());
|
|
|
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setOperatorUid(item.getDealUid());
|
|
|
resp.setOperatorName(item.getDealUid()==0?"系统":"XXX");
|
|
|
resp.setOperatorName(item.getDealUid()==0?"系统":item.getDealUserName());
|
|
|
resp.setTradeStatus(item.getTradeStatus());
|
|
|
//打款失败原因
|
|
|
if(100!=item.getTradeStatus()){
|
...
|
...
|
@@ -98,7 +109,31 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
respList.add(resp);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return respList;
|
|
|
}
|
|
|
|
|
|
private String getMobileByUid(Integer uid) {
|
|
|
LOGGER.info("TradeBillsServiceImpl call getMobileByUid uid is{}", uid);
|
|
|
Map<String,Integer> request = Collections.singletonMap("uid", uid);
|
|
|
JSONObject jsonObject = serviceCaller.get("uic.getProfileAction", "http://" + uicServerIpAndPort + UIC_GETPROFILE_URL, request, JSONObject.class, null).get(1);
|
|
|
|
|
|
if(null == jsonObject.getJSONObject("data") || null == jsonObject.getJSONObject("data").getString("mobile_phone")) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
return jsonObject.getJSONObject("data").getString("mobile_phone");
|
|
|
}
|
|
|
|
|
|
private Integer getUidByMobile(String mobile) {
|
|
|
Map<String,String> request = Collections.singletonMap("account", mobile);
|
|
|
JSONObject jsonObject = serviceCaller.get("uic.getProfileAction", "http://" + uicServerIpAndPort + UIC_GETPROFILE_URL, request, JSONObject.class, null).get(1);
|
|
|
if(null == jsonObject.getJSONObject("data") || null == jsonObject.getJSONObject("data").getInteger("uid")) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
return jsonObject.getJSONObject("data").getInteger("uid");
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|