优化小程序列表,场站信息接口

This commit is contained in:
yuyang 2021-08-13 19:12:07 +08:00
parent 207b26010b
commit bcad0b0230
6 changed files with 69 additions and 87 deletions

View File

@ -200,7 +200,7 @@ public class XhpcChargingStationController extends BaseController {
* @return
*/
@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));
}
@ -212,7 +212,7 @@ public class XhpcChargingStationController extends BaseController {
* @return
*/
@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));
}

View File

@ -115,7 +115,7 @@ public interface XhpcChargingStationMapper {
* @param clientVisible 微信小程序是否可见 2可见
* @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);
/**

View File

@ -573,30 +573,13 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
String[] split = serviceFacilities.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) {
for (int i = 0; i < list.size(); 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获取
map.put("free", 10);
map.put("common", 12);
}
}
return list;
@ -607,29 +590,10 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
//获取基本信息
Map<String, Object> map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude);
//空闲和使用从redis获取
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<>();
if (map.get("imgId") != null && map.get("imgId").toString() != "") {

View File

@ -220,12 +220,14 @@
ct.type as type,
(select dict_value
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.construction_site as constructionSite,
(select dict_value
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.remark as remark,
ct.detailed_address as detailedAddress,
@ -246,29 +248,44 @@
<select id="getWXList" resultType="map">
select
charging_station_id as chargingStationId,
name as name,
parking_instructions as parkingInstructions,
detailed_address as detailedAddress,
service_facilities as serviceFacilities,
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,4)AS distance
from xhpc_charging_station
where del_flag =0 and status =0
and FIND_IN_SET(#{clientVisible},client_visible)>0
cs.charging_station_id as chargingStationId,
cs.name as name,
cs.parking_instructions as parkingInstructions,
cs.detailed_address as detailedAddress,
cs.service_facilities as serviceFacilities,
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and
charging_station_id=cs.charging_station_id) as common,
(select (ra.power_fee+ra.service_fee) as serviceFee
from xhpc_rate as ra
where ra.status = 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 &lt;= #{date}
and end_time &gt;= #{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 !=''">
and name like CONCAT('%',#{name},'%')
and cs.name like CONCAT('%',#{name},'%')
</if>
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
and
<foreach collection="serviceFacilities" item="item" index="index" open="(" close=")" separator="or">
service_facilities like CONCAT('%',#{item},'%')
cs.service_facilities like CONCAT('%',#{item},'%')
</foreach>
</if>
<if test="code !=null and code !=''">
and (area_code in (select
code
and (cs.area_code in (select
cscode
from xhpc_area where pcode=#{code}) or area_code=#{code})
</if>
ORDER BY distance asc
@ -290,7 +307,11 @@
select charging_station_id as chargingStationId,
(select type
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,
reminder_instructions as reminderInstructions,
detailed_address as detailedAddress,
@ -299,9 +320,7 @@
service_facilities as serviceFacilities,
img_id as imgId,
remark as remark,
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,
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,
4) AS distance
from xhpc_charging_station

View File

@ -21,7 +21,6 @@
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>

View File

@ -84,7 +84,7 @@
balance as balance,
is_refund_application as isRefundApplication
from xhpc_app_user
where del_flag=0
where del_flag=0 and app_user_id=#{userId}
</select>
<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