PC端实时数据列表接口

This commit is contained in:
yuyang 2021-08-10 18:52:50 +08:00
parent 30171b39aa
commit f609fb861b
6 changed files with 109 additions and 32 deletions

View File

@ -77,7 +77,9 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService{
}
String req = HttpUtils.postFormData(URL, null, assembleSmsReq(phone,content));
JSONObject json = JSONObject.parseObject(req);
if(!"".equals(random) && random !=null){
xhpcSms.setCode(random);
}
xhpcSms.setPhone(phone);
xhpcSms.setContent(content);
xhpcSms.setCreateTime(new Date());
@ -103,7 +105,6 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService{
}
}
private static HashMap<String, String> assembleSmsReq(String phone, String content) {
HashMap<String, String> params = new HashMap<>();
params.put("account", ACCOUNT);

View File

@ -1,14 +1,12 @@
package com.xhpc.order.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -33,19 +31,27 @@ public class XhpcRealTimeOrderController extends BaseController {
* @param transactionNumber 订单编号
* @param source 用户类型 0C端用户 1流量用户
* @param chargingStationName 电站名称
* @param name 运营商\流量方
* @param terminalName 终端名称
* @param operatorId 运营商
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @return
*/
@GetMapping("/list")
public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String name,String startTime,String endTime)
public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime)
{
startPage();
List<Map<String,Object>> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName, name, startTime, endTime);
List<Map<String,Object>> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime);
return getDataTable(list);
}
/**
* 实时订单详情
*/
@GetMapping("/message")
public AjaxResult message(@RequestParam Long realTimeOrderId)
{
return null;
}
}

View File

@ -2,6 +2,7 @@ package com.xhpc.order.mapper;
import com.xhpc.order.domain.XhpcChargeOrderSoc;
import com.xhpc.order.domain.XhpcRealTimeOrder;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -34,11 +35,12 @@ public interface XhpcRealTimeOrderMapper {
* @param transactionNumber 订单编号
* @param source 用户类型 0C端用户 1流量用户
* @param chargingStationName 电站名称
* @param type 1 运营商 2流量方
* @param id 运营商或流量方 id
* @param terminalName 终端名称
* @param operatorId 运营商
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @param type 0 都没有 1 phone 2 用户类型有 3 都有
* @return
*/
List<Map<String,Object>> list(String phone, String transactionNumber, Integer source, String chargingStationName, String type,Long id, String startTime, String endTime);
List<Map<String,Object>> list(@Param("phone") String phone,@Param("transactionNumber") String transactionNumber,@Param("source") Integer source,@Param("chargingStationName") String chargingStationName,@Param("terminalName")String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
}

View File

@ -19,16 +19,17 @@ public interface IXhpcRealTimeOrderService {
/**
* 实时订单接口
* @param phone
* @param transactionNumber
* @param source
* @param chargingStationName
* @param name
* @param startTime
* @param endTime
* @param phone 用户账号
* @param transactionNumber 订单编号
* @param source 用户类型 0C端用户 1流量用户
* @param chargingStationName 电站名称
* @param terminalName 终端名称
* @param operatorId 运营商
* @param startTime 订单开始时间
* @param endTime 订单结束时间
* @return
*/
List<Map<String,Object>> list(String phone,String transactionNumber,Integer source,String chargingStationName,String name,String startTime,String endTime);
List<Map<String,Object>> list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime);
}

View File

@ -1,6 +1,7 @@
package com.xhpc.order.service.impl;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,6 +18,9 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
@Autowired
private RedisService redisService;
@Autowired
private XhpcRealTimeOrderMapper xhpcRealTimeOrderMapper;
/**
* 添加实时数据
@ -42,18 +46,18 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
}
@Override
public List<Map<String, Object>> list(String phone, String transactionNumber, Integer source, String chargingStationName, String name, String startTime, String endTime) {
//当name不为空时解析
if(!"".equals(name) && name !=null){
public List<Map<String, Object>> list(String phone, String transactionNumber, Integer source, String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime) {
Integer type =0;
if(!"".equals(phone) && phone!=null && !"".equals(source) && source !=null){
type =3;
}else if (!"".equals(phone) && phone!=null){
type =1;
}else{
type =2;
}
return xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,type);
}
return null;
}
}

View File

@ -201,6 +201,69 @@
<select id="list" resultType="map">
select * from xhpc_real_time_order
select
ro.real_time_order_id as realTimeOrderId,
co.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ro.soc as soc,
co.status as status,
co.create_time as createTime,
ro.charging_degree as chargingDegree,
ro.charging_time as chargingTime,
co.source as source,
(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
from xhpc_charge_order co
left join xhpc_real_time_order as ro 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_operator as op on op.operator_id = ct.operator_id
left join xhpc_terminal as ter on ter.serial_number = ro.gun_number
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
where co.status=0 and co.del_flag=0
<if test="startTime !=null and startTime !=''">
and co.start_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and co.start_time &lt;= #{startTime}
</if>
<if test="transactionNumber !=null and transactionNumber !=''">
and co.serial_number like concat('%', #{transactionNumber}, '%')
</if>
<if test="chargingStationName !=null and chargingStationName !=''">
and co.serial_number like concat('%', #{transactionNumber}, '%')
</if>
<if test="terminalName !=null and terminalName !=''">
and ter.name like concat('%', #{terminalName}, '%')
</if>
<if test="operatorId !=null">
and op.operator_id =#{operatorId}
</if>
<if test="type==1">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%')) or
co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))
</if>
<if test="type==2">
<if test="source !=null and source ==0">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user)
</if>
<if test="source !=null and source ==1">
and co.user_id in (SELECT internet_user_id from xhpc_internet_user)
</if>
</if>
<if test="type==3">
<if test="source !=null and source ==0">
and co.user_id in (SELECT app_user_id FROM xhpc_app_user where phone like concat('%', #{phone}, '%'))
</if>
<if test="source !=null and source ==1">
and co.user_id in (SELECT internet_user_id from xhpc_internet_user where phone like concat('%', #{phone}, '%'))
</if>
</if>
order by co.create_time desc
</select>
</mapper>