Authored by qinchao

打款管理:查询区分金额类型(买家货款、买家补偿金、卖家货款、卖家保证金)

package com.yoho.order.model;
import com.yoho.ufo.service.model.PageRequestBO;
import lombok.Data;
import lombok.ToString;
import java.util.List;
/**
* Created by craig.qin.
*/
@Data
@ToString
public class TradeBillsReq extends PageRequestBO{
/**
... ... @@ -25,54 +29,14 @@ public class TradeBillsReq extends PageRequestBO{
///// status 并不是表里面的字段,是查询条件:全部、交易正常的订单、交易异常的订单
private Integer status;
public Integer getId() {
return id;
}
///// moneyType 并不是表里面的字段,是查询条件:全部、MoneyTypeEnum
private Integer moneyType;
public void setId(Integer id) {
this.id = id;
}
/// 1:买家uid; 2:卖家uid
private Integer userType;
public Long getOrderCode() {
return orderCode;
}
/// 1:保证金;2:货款;3:补偿款
private Integer tradeType;
public void setOrderCode(Long orderCode) {
this.orderCode = orderCode;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "TradeBillsReq{" +
"id=" + id +
", orderCode=" + orderCode +
", uid=" + uid +
", mobile='" + mobile + '\'' +
", status=" + status +
'}';
}
}
... ...
... ... @@ -34,6 +34,12 @@
</if>
and income_outcome=1
and deal_status != 1
<if test="billsTradeReq.userType != null">
and user_type = #{billsTradeReq.userType}
</if>
<if test="billsTradeReq.tradeType != null">
and trade_type = #{billsTradeReq.tradeType}
</if>
<if test="billsTradeReq.status != null ">
<choose>
<when test="billsTradeReq.status == 100 ">
... ...
package com.yoho.ufo.order.constant;
import lombok.Getter;
/**
* 资金状态
*/
@Getter
public enum MoneyTypeEnum {
buyer_goodsPayment(12,1,2,"买家货款"),
buyer_compensatoryPayment(13,1,3,"买家补偿款"),
seller_goodsPayment(22,2,2,"卖家货款"),
seller_deposit(21,2,1,"卖家保证金");
private Integer code;
private Integer userType;
private Integer tradeType;
private String desc;
MoneyTypeEnum(Integer code,Integer userType,Integer tradeType, String desc){
this.code = code;
this.userType=userType;
this.tradeType=tradeType;
this.desc = desc;
}
public static MoneyTypeEnum getMoneyTypeByCode(Integer code){
if(code==null){
return null;
}
for(MoneyTypeEnum item: MoneyTypeEnum.values()){
if(code.intValue() == item.code.intValue()){
return item;
}
}
return null;
}
public static MoneyTypeEnum getMoneyTypeByUserTypeAndTradeType(Integer userType,Integer tradeType){
if(userType==null||tradeType==null){
return null;
}
for(MoneyTypeEnum item: MoneyTypeEnum.values()){
if(userType.intValue() == item.userType.intValue()
&& tradeType.intValue() == item.tradeType.intValue()){
return item;
}
}
return null;
}
}
... ...
... ... @@ -5,8 +5,10 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.error.exception.ServiceException;
import com.yoho.order.dal.TradeBillsMapper;
import com.yoho.order.model.*;
import com.yoho.ufo.order.constant.MoneyTypeEnum;
import com.yoho.ufo.order.constant.TradeStatusEnum;
import com.yoho.ufo.order.service.ITradeBillsService;
import com.yoho.ufo.service.impl.UserHelper;
... ... @@ -56,9 +58,15 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
private TradeBillsMapper tradeBillsMapper;
public PageResponseBO<TradeBillsResp> queryTradeBillsList(TradeBillsReq req) {
if(!checkAndBuildParam(req)) {
return null;
}
if(req.getMoneyType()!=null){
MoneyTypeEnum moneyTypeClass =MoneyTypeEnum.getMoneyTypeByCode(req.getMoneyType());
if(moneyTypeClass!=null){
req.setUserType(moneyTypeClass.getUserType());
req.setTradeType(moneyTypeClass.getTradeType());
}else{
throw new ServiceException(400,"参数错误:不合法的金额类型");
}
}
if(req.getUid()==null&&StringUtils.isNotBlank(req.getMobile())){
Integer uid = getUidByMobile(req.getMobile());
... ... @@ -88,12 +96,6 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
return result;
}
private boolean checkAndBuildParam(TradeBillsReq req){
/*if(req.getUid()==null&&req.getOrderCode()==null&&StringUtils.isBlank(req.getMobile())){
return false;
}*/
return true;
}
private List<TradeBillsResp> convertToResp(List<TradeBills> tradeBillsList){
List<TradeBillsResp> respList = Lists.newArrayList();
... ... @@ -110,6 +112,14 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
resp.setOperatorUid(item.getDealUid());
resp.setOperatorName((item.getDealUid()==null||item.getDealUid()==0)?"系统":item.getDealUserName());
resp.setTradeStatus(item.getTradeStatus());
//金额类型
MoneyTypeEnum moneyTypeClass=MoneyTypeEnum.getMoneyTypeByUserTypeAndTradeType(item.getUserType(),item.getTradeType());
if(moneyTypeClass!=null){
resp.setMoneyType(moneyTypeClass.getCode());
resp.setMoneyTypeDesc(moneyTypeClass.getDesc());
}
//打款失败原因
if(100!=item.getTradeStatus()){
String failReason = TradeStatusEnum.getDescByCode(item.getTradeStatus());
... ...
... ... @@ -8,7 +8,7 @@
<body class="easyui-layout">
<input type="hidden" id="buyerOrderCode">
<input type="skup" id="skup">
<div region="north" style="height:180px;">
<div region="north" style="height:230px;">
<script>
document.write(addHead('打款管理', '列表管理'));
</script>
... ... @@ -23,8 +23,18 @@
<label>手机号:</label>
<input id="mobile" type="text" class="easyui-textbox" style="width:150px"/>
<label>金额类型:</label>
<select id="moneyType" class="easyui-combobox" style="width:150px;" >
<option value="">全部状态</option>
<option value="12">买家货款</option>
<option value="13">买家补偿款</option>
<option value="22">卖家货款</option>
<option value="21">卖家保证金</option>
</select>
<br><br>
<label>订单状态:</label>
<select id="status" class="easyui-combobox" style="width:100px;" >
<select id="status" class="easyui-combobox" style="width:150px;">
<option value="">全部状态</option>
<option value="100">打款成功</option>
<option value="999">打款失败</option>
... ... @@ -64,9 +74,14 @@
<script>
$(function() {
$("#moneyType").combobox({
panelHeight:'auto',
multiple:false
});
$("#status").combobox({
panelHeight:'auto',
multiple:false,
multiple:false
});
$("#searchBtn").linkbutton({
... ... @@ -89,6 +104,7 @@ $(function() {
function loadTradeBillsData() {
$("#tradeBillsListTable").datagrid("load", {
moneyType:$("#moneyType").myCombobox("getValue"),
status : $("#status").myCombobox("getValue"),
orderCode : $("#orderCode").val(),
uid : $("#uid").val(),
... ... @@ -122,6 +138,11 @@ function getTradeBillsList(){
width: 30,
align: "center"
},{
title: "金额类型",
field: "moneyTypeDesc",
width: 30,
align: "center"
},{
title: "用户uid",
field: "uid",
width: 30,
... ...