优化小程序列表,场站信息接口
This commit is contained in:
parent
207b26010b
commit
bcad0b0230
@ -200,7 +200,7 @@ public class XhpcChargingStationController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getWXXhpcRateTimeMassage")
|
@GetMapping(value = "/getWXXhpcRateTimeMassage")
|
||||||
public AjaxResult getXhpcRateTimeMassage(@RequestParam(value = "chargingStationId", required = true) Long chargingStationId) {
|
public AjaxResult getXhpcRateTimeMassage(@RequestParam Long chargingStationId) {
|
||||||
|
|
||||||
return AjaxResult.success(xhpcChargingStationService.getWXXhpcRateTimeMassage(chargingStationId));
|
return AjaxResult.success(xhpcChargingStationService.getWXXhpcRateTimeMassage(chargingStationId));
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ public class XhpcChargingStationController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getWXXhpcTerminalMassage")
|
@GetMapping(value = "/getWXXhpcTerminalMassage")
|
||||||
public AjaxResult getWXXhpcTerminalMassage(@RequestParam(value = "chargingStationId", required = true) Long chargingStationId) {
|
public AjaxResult getWXXhpcTerminalMassage(@RequestParam Long chargingStationId) {
|
||||||
|
|
||||||
return AjaxResult.success(xhpcChargingStationService.getWXXhpcTerminalMassage(chargingStationId));
|
return AjaxResult.success(xhpcChargingStationService.getWXXhpcTerminalMassage(chargingStationId));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public interface XhpcChargingStationMapper {
|
|||||||
* @param clientVisible 微信小程序是否可见 2可见
|
* @param clientVisible 微信小程序是否可见 2可见
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> getWXList(@Param("name") String name, @Param("serviceFacilities") List<String> serviceFacilities, @Param("code") Integer code, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("clientVisible") Integer clientVisible);
|
List<Map<String, Object>> getWXList(@Param("name") String name, @Param("serviceFacilities") List<String> serviceFacilities, @Param("code") Integer code, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("clientVisible") Integer clientVisible,@Param("date") String date);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -573,30 +573,13 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
String[] split = serviceFacilities.split(",");
|
String[] split = serviceFacilities.split(",");
|
||||||
stringList = Arrays.asList(split);
|
stringList = Arrays.asList(split);
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude, 2);
|
String date = DateUtil.formatTime(new Date());
|
||||||
|
List<Map<String, Object>> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude, 2,date);
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
Map<String, Object> map = list.get(i);
|
Map<String, Object> map = list.get(i);
|
||||||
Long chargingStationId = Long.valueOf(map.get("chargingStationId").toString());
|
|
||||||
//获取该时段电费
|
|
||||||
//HH:mm:ss
|
|
||||||
String tiem = DateUtil.formatTime(new Date());
|
|
||||||
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
|
|
||||||
if (xhpcRateTime != null) {
|
|
||||||
map.putAll(xhpcRateTime);
|
|
||||||
}
|
|
||||||
List<String> serviceFacilitiesList = new ArrayList<>();
|
|
||||||
if (map.get("serviceFacilities") != null && map.get("serviceFacilities").toString() != "") {
|
|
||||||
String[] split = map.get("serviceFacilities").toString().split(",");
|
|
||||||
serviceFacilitiesList = Arrays.asList(split);
|
|
||||||
}
|
|
||||||
//获取标签
|
|
||||||
List<Map<String, Object>> label_type = xhpcChargingStationMapper.getCode("service_facilities", serviceFacilitiesList);
|
|
||||||
map.put("serviceFacilities", label_type);
|
|
||||||
//桩(空闲和使用从redis获取)
|
//桩(空闲和使用从redis获取)
|
||||||
map.put("free", 10);
|
map.put("free", 10);
|
||||||
|
|
||||||
map.put("common", 12);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
@ -607,29 +590,10 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
|
|
||||||
//获取基本信息
|
//获取基本信息
|
||||||
Map<String, Object> map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude);
|
Map<String, Object> map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude);
|
||||||
|
|
||||||
//桩(空闲和使用从redis获取)
|
//桩(空闲和使用从redis获取)
|
||||||
map.put("free", 10);
|
map.put("free", 10);
|
||||||
|
|
||||||
map.put("common", 12);
|
|
||||||
|
|
||||||
//服务设施
|
|
||||||
List<String> serviceFacilitiesList = new ArrayList<>();
|
|
||||||
if (map.get("serviceFacilities") != null && map.get("serviceFacilities").toString() != "") {
|
|
||||||
String[] split = map.get("serviceFacilities").toString().split(",");
|
|
||||||
serviceFacilitiesList = Arrays.asList(split);
|
|
||||||
}
|
|
||||||
List<Map<String, Object>> service_facilities = xhpcChargingStationMapper.getCode("service_facilities", serviceFacilitiesList);
|
|
||||||
map.put("serviceFacilitiesList", service_facilities);
|
|
||||||
|
|
||||||
//周边设施
|
|
||||||
// List<String> peripheryFacilities =new ArrayList<>();
|
|
||||||
// if(map.get("peripheryFacilities") !=null && map.get("peripheryFacilities").toString() !=""){
|
|
||||||
// String[] split = map.get("peripheryFacilities").toString().split(",");
|
|
||||||
// peripheryFacilities=Arrays.asList(split);
|
|
||||||
// }
|
|
||||||
// List<Map<String, Object>> charging_periphery_facilities = xhpcChargingStationMapper.getCode("charging_periphery_facilities",peripheryFacilities);
|
|
||||||
// map.put("peripheryFacilities",charging_periphery_facilities);
|
|
||||||
|
|
||||||
//图片信息
|
//图片信息
|
||||||
List<String> imgList = new ArrayList<>();
|
List<String> imgList = new ArrayList<>();
|
||||||
if (map.get("imgId") != null && map.get("imgId").toString() != "") {
|
if (map.get("imgId") != null && map.get("imgId").toString() != "") {
|
||||||
|
|||||||
@ -220,12 +220,14 @@
|
|||||||
ct.type as type,
|
ct.type as type,
|
||||||
(select dict_value
|
(select dict_value
|
||||||
from xhpc_dict_biz
|
from xhpc_dict_biz
|
||||||
where code = 'charging_station_type' and dict_key = ct.station_type) as stationTypeName,
|
where code = 'charging_station_type'
|
||||||
|
and dict_key = ct.station_type) as stationTypeName,
|
||||||
ct.serial_number as serialNumber,
|
ct.serial_number as serialNumber,
|
||||||
ct.construction_site as constructionSite,
|
ct.construction_site as constructionSite,
|
||||||
(select dict_value
|
(select dict_value
|
||||||
from xhpc_dict_biz
|
from xhpc_dict_biz
|
||||||
where code = 'charging_construction_site' and dict_key = ct.construction_site) as constructionSiteName,
|
where code = 'charging_construction_site'
|
||||||
|
and dict_key = ct.construction_site) as constructionSiteName,
|
||||||
ct.address as address,
|
ct.address as address,
|
||||||
ct.remark as remark,
|
ct.remark as remark,
|
||||||
ct.detailed_address as detailedAddress,
|
ct.detailed_address as detailedAddress,
|
||||||
@ -246,29 +248,44 @@
|
|||||||
|
|
||||||
<select id="getWXList" resultType="map">
|
<select id="getWXList" resultType="map">
|
||||||
select
|
select
|
||||||
charging_station_id as chargingStationId,
|
cs.charging_station_id as chargingStationId,
|
||||||
name as name,
|
cs.name as name,
|
||||||
parking_instructions as parkingInstructions,
|
cs.parking_instructions as parkingInstructions,
|
||||||
detailed_address as detailedAddress,
|
cs.detailed_address as detailedAddress,
|
||||||
service_facilities as serviceFacilities,
|
cs.service_facilities as serviceFacilities,
|
||||||
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180 ) *SIN((latitude * 3.141593) / 180 ) +
|
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and
|
||||||
COS((#{latitude} * 3.141593) / 180 ) * COS((latitude * 3.141593) / 180 ) *
|
charging_station_id=cs.charging_station_id) as common,
|
||||||
COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180 ) ) * 6370.9968,4)AS distance
|
(select (ra.power_fee+ra.service_fee) as serviceFee
|
||||||
from xhpc_charging_station
|
from xhpc_rate as ra
|
||||||
where del_flag =0 and status =0
|
where ra.status = 0
|
||||||
and FIND_IN_SET(#{clientVisible},client_visible)>0
|
and ra.del_flag = 0
|
||||||
|
and ra.rate_id = (
|
||||||
|
select rate_id from xhpc_rate_time
|
||||||
|
where charging_station_id = cs.charging_station_id
|
||||||
|
and start_time <= #{date}
|
||||||
|
and end_time >= #{date}
|
||||||
|
and status = 0
|
||||||
|
and del_flag = 0)) money,
|
||||||
|
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,cs.service_facilities ) and code
|
||||||
|
= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
|
||||||
|
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180 ) *SIN((cs.latitude * 3.141593) / 180 ) +
|
||||||
|
COS((#{latitude} * 3.141593) / 180 ) * COS((cs.latitude * 3.141593) / 180 ) *
|
||||||
|
COS((#{longitude} * 3.141593) / 180 - (cs.longitude * 3.141593) / 180 ) ) * 6370.9968,4)AS distance
|
||||||
|
from xhpc_charging_station as cs
|
||||||
|
where cs.del_flag =0 and cs.status =0
|
||||||
|
and FIND_IN_SET(#{clientVisible},cs.client_visible)>0
|
||||||
<if test="name !=null and name !=''">
|
<if test="name !=null and name !=''">
|
||||||
and name like CONCAT('%',#{name},'%')
|
and cs.name like CONCAT('%',#{name},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
|
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
|
||||||
and
|
and
|
||||||
<foreach collection="serviceFacilities" item="item" index="index" open="(" close=")" separator="or">
|
<foreach collection="serviceFacilities" item="item" index="index" open="(" close=")" separator="or">
|
||||||
service_facilities like CONCAT('%',#{item},'%')
|
cs.service_facilities like CONCAT('%',#{item},'%')
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="code !=null and code !=''">
|
<if test="code !=null and code !=''">
|
||||||
and (area_code in (select
|
and (cs.area_code in (select
|
||||||
code
|
cscode
|
||||||
from xhpc_area where pcode=#{code}) or area_code=#{code})
|
from xhpc_area where pcode=#{code}) or area_code=#{code})
|
||||||
</if>
|
</if>
|
||||||
ORDER BY distance asc
|
ORDER BY distance asc
|
||||||
@ -290,7 +307,11 @@
|
|||||||
select charging_station_id as chargingStationId,
|
select charging_station_id as chargingStationId,
|
||||||
(select type
|
(select type
|
||||||
from xhpc_charging_pile
|
from xhpc_charging_pile
|
||||||
where charging_station_id = charging_station_id and del_flag = 0 and status = 0 limit 1) as type,
|
where charging_station_id = charging_station_id
|
||||||
|
and del_flag = 0
|
||||||
|
and status = 0 limit 1) as type,
|
||||||
|
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=charging_station_id) as common,
|
||||||
|
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,service_facilities ) and code= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
|
||||||
name as name,
|
name as name,
|
||||||
reminder_instructions as reminderInstructions,
|
reminder_instructions as reminderInstructions,
|
||||||
detailed_address as detailedAddress,
|
detailed_address as detailedAddress,
|
||||||
@ -299,9 +320,7 @@
|
|||||||
service_facilities as serviceFacilities,
|
service_facilities as serviceFacilities,
|
||||||
img_id as imgId,
|
img_id as imgId,
|
||||||
remark as remark,
|
remark as remark,
|
||||||
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180) * SIN((latitude * 3.141593) / 180) +
|
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180) * SIN((latitude * 3.141593) / 180) + COS((#{latitude} * 3.141593) / 180) * COS((latitude * 3.141593) / 180) * COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180)) * 6370.9968,
|
||||||
COS((#{latitude} * 3.141593) / 180) * COS((latitude * 3.141593) / 180) *
|
|
||||||
COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180)) * 6370.9968,
|
|
||||||
4) AS distance
|
4) AS distance
|
||||||
from xhpc_charging_station
|
from xhpc_charging_station
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
|||||||
@ -84,7 +84,7 @@
|
|||||||
balance as balance,
|
balance as balance,
|
||||||
is_refund_application as isRefundApplication
|
is_refund_application as isRefundApplication
|
||||||
from xhpc_app_user
|
from xhpc_app_user
|
||||||
where del_flag=0
|
where del_flag=0 and app_user_id=#{userId}
|
||||||
</select>
|
</select>
|
||||||
<select id="countXhpcRealTimeOrder" resultType="int">
|
<select id="countXhpcRealTimeOrder" resultType="int">
|
||||||
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0
|
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user