Authored by mali

Merge branch 'dev_bills'

... ... @@ -41,6 +41,8 @@ public class TradeBills {
//手工打款相关字段
//操作员id
private Integer dealUid;
//操作员名字,存储起来,展示的时候用
private String dealUserName;
//打款状态:1 表示成功, 现在只有成功的才记录
private Integer dealStatus;
//打款时间
... ... @@ -63,6 +65,7 @@ public class TradeBills {
", tradeStatus=" + tradeStatus +
", createTime=" + createTime +
", dealUid=" + dealUid +
", dealUserName='" + dealUserName + '\'' +
", dealStatus=" + dealStatus +
", dealTime=" + dealTime +
", dealRelateId=" + dealRelateId +
... ...
... ... @@ -17,11 +17,12 @@
<result column="deal_status" jdbcType="TINYINT" property="dealStatus" />
<result column="deal_time" jdbcType="INTEGER" property="dealTime" />
<result column="deal_relate_id" jdbcType="INTEGER" property="dealRelateId" />
<result column="deal_user_name" jdbcType="VARCHAR" property="dealUserName" />
</resultMap>
<sql id="Base_Column_List">
id,uid, order_code, user_type,pay_type,trade_type,
income_outcome,amount,system_amount,trade_status,create_time,
deal_uid,deal_status,deal_time,deal_relate_id
deal_uid,deal_status,deal_time,deal_relate_id,deal_user_name
</sql>
<sql id="Query_Condition_Sql" >
... ...
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");
}
}
... ...