修改订单查询

This commit is contained in:
yuyang 2022-01-28 15:39:25 +08:00
parent 3677a32f5a
commit 8bd1aa2e06
5 changed files with 87 additions and 55 deletions

View File

@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.xhpc.common.api.RefundOrderService; import com.xhpc.common.api.RefundOrderService;
import com.xhpc.common.api.SmsService; import com.xhpc.common.api.SmsService;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R; import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
@ -56,6 +57,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
@Autowired @Autowired
private RefundOrderService refundOrderService; private RefundOrderService refundOrderService;
@Autowired
private UserTypeService userTypeService;
private final ExecutorService executorService = Executors.newFixedThreadPool(20); private final ExecutorService executorService = Executors.newFixedThreadPool(20);
@ -321,15 +325,21 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
xhpcChargeOrder.setStatus(3); xhpcChargeOrder.setStatus(3);
xhpcChargeOrder.setAmountCharged(money); xhpcChargeOrder.setAmountCharged(money);
Long userId = xhpcChargeOrder.getUserId(); Long userId = xhpcChargeOrder.getUserId();
Map<String, Object> userMessage = xhpcChargeOrderService.getUserMessage(userId); Integer source = xhpcChargeOrder.getSource();
if(xhpcChargeOrder.getInternetSerialNumber() ==null && xhpcChargeOrder.getStatus()==0){ String tenantId = xhpcChargeOrder.getTenantId();
if (userMessage == null || userMessage.get("balance") == null) { Map<String, Object> userMessage =new HashMap<>();
//订单异常 if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
xhpcChargeOrder.setStatus(2); R user = userTypeService.getUser(null, userId, source, null, tenantId);
//异常原因 if(user !=null && user.getData() !=null){
xhpcChargeOrder.setErroRemark("".equals(xhpcChargeOrder.getErroRemark())?"用户id:" + userId + "为空":xhpcChargeOrder.getErroRemark()+"用户id:" + userId + "为空"); userMessage = (Map<String, Object>)user.getData();
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder); if (userMessage == null || userMessage.get("balance") == null) {
return AjaxResult.error("用户id:" + userId + "为空"); //订单异常
xhpcChargeOrder.setStatus(2);
//异常原因
xhpcChargeOrder.setErroRemark("".equals(xhpcChargeOrder.getErroRemark())?"用户id:" + userId + "为空":xhpcChargeOrder.getErroRemark()+"用户id:" + userId + "为空");
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
return AjaxResult.error("用户id:" + userId + "为空");
}
} }
} }
//生成一条历史订单 //生成一条历史订单
@ -568,7 +578,11 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
map.put("tenantId",xhpcChargeOrder.getTerminalId()); map.put("tenantId",xhpcChargeOrder.getTerminalId());
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){ if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString()); xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString());
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString()); if(UserTypeUtil.USER_TYPE.equals(source)){
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
}else{
xhpcHistoryOrder.setPhone(userMessage.get("account").toString());
}
//增加流水订单号 //增加流水订单号
if(operatorMessage!=null && operatorMessage.get("operatorId")!=null){ if(operatorMessage!=null && operatorMessage.get("operatorId")!=null){
String evcs = EvcsUtil.transferInternetOrderNo(xhpcChargeOrder.getSerialNumber(), operatorMessage.get("operatorId").toString()); String evcs = EvcsUtil.transferInternetOrderNo(xhpcChargeOrder.getSerialNumber(), operatorMessage.get("operatorId").toString());

View File

@ -662,6 +662,8 @@
ho.platform_svc_commisssion as platformSvcCommisssion, ho.platform_svc_commisssion as platformSvcCommisssion,
ho.operation_commission as operationCommission, ho.operation_commission as operationCommission,
ho.operation_svc_commission as operationSvcCommission, ho.operation_svc_commission as operationSvcCommission,
cop.account as communityAccount,
cup.account as customersAccount,
case when co.source=0 then "C端用户" case when co.source=0 then "C端用户"
when co.source=1 then "流量方用户" when co.source=1 then "流量方用户"
when co.source=2 then "社区用户" when co.source=2 then "社区用户"
@ -682,18 +684,20 @@
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2 left join et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
<if test="number==1"> <if test="number==1">
inner join ( inner join (
select xiu.internet_user_id as user_id from xhpc_internet_user as xiu inner join(select user_id from xhpc_history_order where source=1) us1 on us1.user_id = xiu.internet_user_id where xiu.phone like concat('%', #{phone}, '%') select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%')
union union
select xau.app_user_id as user_id from xhpc_app_user as xau inner join(select user_id from xhpc_history_order where source=0) us2 on us2.user_id = xau.app_user_id where xau.phone like concat('%', #{phone}, '%') select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%')
union union
select xcp.community_personnel_id as user_id from xhpc_community_personnel as xcp inner join(select user_id from xhpc_history_order where source=2)us3 on us3.user_id = xcp.community_personnel_id where xcp.account like concat('%', #{phone}, '%') select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%')
union union
select xcup.customers_personnel_id as user_id from xhpc_customers_personnel as xcup inner join(select user_id from xhpc_history_order where source=3)us3 on us4.user_id = xcup.customers_personnel_id where xcup.account like concat('%', #{phone}, '%') select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%')
) ut on ut.app_user_id = ho.user_id ) ut on ut.history_order_id = ho.history_order_id
</if> </if>
where ho.status =0 and ho.del_flag=0 where ho.status =0 and ho.del_flag=0
<if test="type !=null"> <if test="type !=null">
@ -744,30 +748,30 @@
<if test="number==2"> <if test="number==2">
<if test="source ==0"> <if test="source ==0">
and ho.user_id in(select app_user_id from xhpc_app_user where app_user_id in (select user_id from xhpc_history_order where source=0)) and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0)
</if> </if>
<if test="source ==1"> <if test="source ==1">
and ho.user_id in(select internet_user_id from xhpc_internet_user where internet_user_id in (select user_id from xhpc_history_order where source=1)) and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1)
</if> </if>
<if test="source ==2"> <if test="source ==2">
and ho.user_id in(select community_personnel_id from xhpc_community_personnel where community_personnel_id in (select user_id from xhpc_history_order where source=2)) and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2)
</if> </if>
<if test="source ==3"> <if test="source ==3">
and ho.user_id in(select customers_personnel_id from xhpc_customers_personnel where customers_personnel_id in (select user_id from xhpc_history_order where source=3)) and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3)
</if> </if>
</if> </if>
<if test="number==3"> <if test="number==3">
<if test="source ==0"> <if test="source ==0">
and ho.user_id in(select app_user_id from xhpc_app_user where phone like concat('%', #{phone}, '%') and app_user_id in (select user_id from xhpc_history_order where source=0)) and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
</if> </if>
<if test="source ==1"> <if test="source ==1">
and ho.user_id in(select internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%') and internet_user_id in (select user_id from xhpc_history_order where source=1)) and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
</if> </if>
<if test="source ==2"> <if test="source ==2">
and ho.user_id in(select community_personnel_id from xhpc_community_personnel where account like concat('%', #{phone}, '%') and community_personnel_id in (select user_id from xhpc_history_order where source=2)) and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%'))
</if> </if>
<if test="source ==3"> <if test="source ==3">
and ho.user_id in(select customers_personnel_id from xhpc_customers_personnel where account like concat('%', #{phone}, '%') and customers_personnel_id in (select user_id from xhpc_history_order where source=3)) and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%'))
</if> </if>
</if> </if>
<if test="status==1"> <if test="status==1">
@ -842,8 +846,10 @@
else "自定义!" else "自定义!"
end sanDisputeReason, end sanDisputeReason,
ed.check_order_seq as sanCheckOrderSeq, ed.check_order_seq as sanCheckOrderSeq,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone, (SELECT phone FROM xhpc_app_user where app_user_id = co.user_id and ho.source=0) as appUserPhone,
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone, (SELECT phone from xhpc_internet_user where internet_user_id = co.user_id and ho.source=1) as internetUserPhone,
(SELECT account from xhpc_community_personnel where community_personnel_id = co.user_id and ho.source=2) as communityAccount,
(SELECT account from xhpc_customers_personnel where customers_personnel_id = co.user_id and ho.source=3) as customersAccount,
co.Plate_num as plateNum, co.Plate_num as plateNum,
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source =1) as internetName, (SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source =1) as internetName,
case when ho.stop_reason_evcs=40 then "APP远程停止" case when ho.stop_reason_evcs=40 then "APP远程停止"

View File

@ -401,6 +401,10 @@
co.Plate_num as plateNum, co.Plate_num as plateNum,
inu.name as internetName, inu.name as internetName,
inu.phone as internetUserPhone, inu.phone as internetUserPhone,
cup.name as customersName,
cup.account as customersAccount,
cop.name as communityName,
cop.account as communityAccount,
apu.phone as appUserPhone apu.phone as appUserPhone
from xhpc_charge_order co from xhpc_charge_order co
left join xhpc_charging_station as ct on ct.charging_station_id = co.charging_station_id left join xhpc_charging_station as ct on ct.charging_station_id = co.charging_station_id
@ -409,16 +413,22 @@
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join xhpc_internet_user as inu on inu.internet_user_id = co.user_id and co.source =1 left join xhpc_internet_user as inu on inu.internet_user_id = co.user_id and co.source =1
left join xhpc_app_user as apu on apu.app_user_id = co.user_id and co.source =0 left join xhpc_app_user as apu on apu.app_user_id = co.user_id and co.source =0
left join xhpc_community_personnel as cop on cop.community_personnel_id = co.user_id and co.source =2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = co.user_id and co.source =3
LEFT JOIN ( LEFT JOIN (
SELECT charging_order_id,real_time_order_id,soc,charging_degree,charging_time FROM xhpc_real_time_order SELECT charging_order_id,real_time_order_id,soc,charging_degree,charging_time FROM xhpc_real_time_order
WHERE real_time_order_id IN ( SELECT max( real_time_order_id ) FROM xhpc_real_time_order GROUP BY charging_order_id ) WHERE real_time_order_id IN ( SELECT max( real_time_order_id ) FROM xhpc_real_time_order GROUP BY charging_order_id )
) ro ON ro.charging_order_id = co.charge_order_id ) ro ON ro.charging_order_id = co.charge_order_id
<if test="number==1"> <if test="number==1">
inner join ( inner join (
SELECT cro.user_id user_id FROM xhpc_charge_order cro inner join(SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) us1 on us1.app_user_id = cro.user_id where xco.source = 0 select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_app_user as xau on xau.app_user_id = xco.user_id where xco.source=0 and xau.phone LIKE concat('%',#{phone}, '%')
union union
SELECT cro.user_id user_id FROM xhpc_charge_order xco inner join(SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%')) us2 on us2.internet_user_id = xco.user_id where xco.source = 1 select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = xco.user_id where xco.source=1 and xiu.phone LIKE concat('%',#{phone}, '%')
) ut on ut.app_user_id = xro.user_id union
select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = xco.user_id where xco.source=2 and xcp.account LIKE concat('%',#{phone}, '%')
union
select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = xco.user_id where xco.source=3 and xcup.account LIKE concat('%',#{phone}, '%')
) ut on ut.charge_order_id = co.charge_order_id
</if> </if>
where co.status=#{status} and co.del_flag=0 where co.status=#{status} and co.del_flag=0
<if test="internetId !=null"> <if test="internetId !=null">
@ -455,22 +465,18 @@
</if> </if>
<if test="number==2"> <if test="number==2">
<if test="source !=null and source ==0"> <if test="source !=null and source ==0">
and co.user_id in ( and co.charge_order_id in (select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_app_user as xau on xau.app_user_id = xco.user_id where xco.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 0 AND cro.user_id IN ( SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')))
</if> </if>
<if test="source !=null and source ==1"> <if test="source !=null and source ==1">
and co.user_id in ( and co.charge_order_id in (select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = xco.user_id where xco.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 1 AND cro.user_id IN (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%')))
</if> </if>
</if> </if>
<if test="number==3"> <if test="number==3">
<if test="source !=null and source ==0"> <if test="source !=null and source ==0">
and co.user_id in ( and co.charge_order_id in (select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_app_user as xau on xau.app_user_id = xco.user_id where xco.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 0 AND cro.user_id IN ( SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')))
</if> </if>
<if test="source !=null and source ==1"> <if test="source !=null and source ==1">
and co.user_id in ( a and co.charge_order_id in (select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = xco.user_id where xco.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
SELECT cro.user_id FROM xhpc_charge_order cro WHERE cro.source = 1 AND cro.user_id IN (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%')))
</if> </if>
</if> </if>
<if test="type==1"> <if test="type==1">
@ -509,7 +515,9 @@
co.Plate_num as plateNum, co.Plate_num as plateNum,
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone, (SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone, (SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone,
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source=1) as internetName (SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source=1) as internetName,
(SELECT account from xhpc_community_personnel where community_personnel_id = co.user_id and co.source=2) as communityAccount,
(SELECT account from xhpc_customers_personnel where customers_personnel_id = co.user_id and co.source=3) as customersAccount
from xhpc_real_time_order ro from xhpc_real_time_order ro
Left join xhpc_charge_order co on co.serial_number = ro.transaction_number Left join xhpc_charge_order co on co.serial_number = ro.transaction_number
Left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id Left join xhpc_charging_station as ct on ct.charging_station_id = ro.charging_station_id

View File

@ -139,10 +139,13 @@
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.recharge_order_id rechargeOrderId ,xro.recharge_order_number rechargeOrderNumber, select xro.recharge_order_id rechargeOrderId ,xro.recharge_order_number rechargeOrderNumber,
xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount, xro.alipay_number alipayNumber ,xro.prepay_id prepayid,xro.user_id userId,xro.amount,cop.phone communityPhone,cop.account communityAccount,
cup.phone customersPhone,cup.account customersAccount,
xro.type ,xro.`status`,xro.create_time createTime,xro.source source,xau.phone,sdd.dict_label statusName xro.type ,xro.`status`,xro.create_time createTime,xro.source source,xau.phone,sdd.dict_label statusName
from xhpc_recharge_order xro from xhpc_recharge_order xro
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
LEFT JOIN xhpc_community_personnel cop on cop.community_personnel_id = xro.user_id and xro.source=2
LEFT JOIN xhpc_customers_personnel cup on cup.customers_personnel_id = xro.user_id and xro.source=3
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'recharge_order_status' and sdd.dict_value = xro.`status` LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'recharge_order_status' and sdd.dict_value = xro.`status`
where xro.del_flag = 0 and xro.recharge_order_id = #{rechargeOrderId} where xro.del_flag = 0 and xro.recharge_order_id = #{rechargeOrderId}
</select> </select>
@ -161,15 +164,14 @@
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'recharge_order_status' and sdd.dict_value = xro.`status` LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'recharge_order_status' and sdd.dict_value = xro.`status`
<if test="source == null and phone != null and phone != ''"> <if test="source == null and phone != null and phone != ''">
inner join ( inner join (
select xau.app_user_id from xhpc_app_user as xau inner join (select user_id from xhpc_recharge_order where source=0) us1 on us1.user_id=xau.app_user_id where xau.phone like concat('%', #{phone}, '%') select ro.recharge_order_id as recharge_order_id from xhpc_recharge_order as ro INNER JOIN xhpc_app_user as xau on xau.app_user_id = ro.user_id where ro.source=0 and xau.phone LIKE concat('%',#{phone}, '%')
union union
select xcop.community_personnel_id as app_user_id from xhpc_community_personnel as xcop inner join (select user_id from xhpc_recharge_order where source=2) us2 on us2.user_id=xcop.community_personnel_id where xcop.phone like concat('%', #{phone}, '%') select ro.recharge_order_id as recharge_order_id from xhpc_recharge_order as ro INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = ro.user_id where ro.source=2 and xcp.account LIKE concat('%',#{phone}, '%')
union union
select xcup.customers_personnel_id as app_user_id from xhpc_customers_personnel as xcup inner join (select user_id from xhpc_recharge_order where source=3) us3 on us3.user_id = xcup.customers_personnel_id where xcup.phone like concat('%', #{phone}, '%') select ro.recharge_order_id as recharge_order_id from xhpc_recharge_order as ro INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = ro.user_id where ro.source=3 and xcup.account LIKE concat('%',#{phone}, '%')
) ut on ut.app_user_id = xro.user_id ) ut on ut.recharge_order_id = xro.recharge_order_id
</if> </if>
where xro.del_flag = 0 where xro.del_flag = 0
<if test="source != null and phone != null and phone != ''"> <if test="source != null and phone != null and phone != ''">
<if test="source==0 "> <if test="source==0 ">
and xro.source=#{source} and xau.phone like concat('%', #{phone}, '%') and xro.source=#{source} and xau.phone like concat('%', #{phone}, '%')

View File

@ -172,12 +172,14 @@
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map"> <select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,xro.tenant_id tenantId, select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,xro.tenant_id tenantId,
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,xro.source source,cop.phone communityPhone, xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,xro.source source,cop.phone communityPhone,cop.account communityAccount,
cup.phone customersPhone,cup.account customersAccount,
xro.type,xro.examine_status examineStatus,xro.`status`,xro.source source,xro.create_time createTime,xau.phone, xro.type,xro.examine_status examineStatus,xro.`status`,xro.source source,xro.create_time createTime,xau.phone,
sdd.dict_label statusName,sdds.dict_label examineStatusName sdd.dict_label statusName,sdds.dict_label examineStatusName
from xhpc_refund_order xro from xhpc_refund_order xro
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id and xro.source=0 LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id and xro.source=0
LEFT JOIN xhpc_community_personnel cop on cop.community_personnel_id = xro.user_id and xro.source=2 LEFT JOIN xhpc_community_personnel cop on cop.community_personnel_id = xro.user_id and xro.source=2
LEFT JOIN xhpc_customers_personnel cup on cup.customers_personnel_id = xro.user_id and xro.source=3
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status` LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status`
LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value = xro.examine_status LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value = xro.examine_status
where xro.del_flag = 0 and xro.refund_order_id = #{refundOrderId} where xro.del_flag = 0 and xro.refund_order_id = #{refundOrderId}
@ -196,12 +198,12 @@
LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value =xro.examine_status LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value =xro.examine_status
<if test="source == null and phone != null and phone !=''"> <if test="source == null and phone != null and phone !=''">
inner join ( inner join (
select xau.app_user_id from xhpc_app_user as xau inner join(select user_id from xhpc_recharge_order where source=0) us1 on us1.user_id = xau.app_user_id where xau.phone like concat('%', #{phone}, '%') select ro.refund_order_id as refund_order_id from xhpc_refund_order as ro INNER JOIN xhpc_app_user as xau on xau.app_user_id = ro.user_id where ro.source=0 and xau.phone LIKE concat('%',#{phone}, '%')
union union
select xcop.community_personnel_id as app_user_id from xhpc_community_personnel as xcop inner join (select user_id from xhpc_recharge_order where source=2) us2 on us2.user_id=xcop.community_personnel_id where xcop.phone like concat('%', #{phone}, '%') select ro.refund_order_id as refund_order_id from xhpc_refund_order as ro INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = ro.user_id where ro.source=2 and xcp.account LIKE concat('%',#{phone}, '%')
union union
select xcup.customers_personnel_id as app_user_id from xhpc_customers_personnel as xcup inner join (select user_id from xhpc_recharge_order where source=3) us3 on us3.user_id = xcup.customers_personnel_id where xcup.phone like concat('%', #{phone}, '%') select ro.refund_order_id as refund_order_id from xhpc_refund_order as ro INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = ro.user_id where ro.source=3 and xcup.account LIKE concat('%',#{phone}, '%')
) ut on ut.app_user_id = xro.user_id ) ut on ut.refund_order_id = xro.refund_order_id
</if> </if>
where xro.del_flag = 0 where xro.del_flag = 0
<if test="source != null and phone != null"> <if test="source != null and phone != null">