微信列表接口

This commit is contained in:
yuyang 2021-07-21 16:00:52 +08:00
parent 236f158175
commit 25bfcdaf10
5 changed files with 126 additions and 0 deletions

View File

@ -138,4 +138,23 @@ public class XhpcChargingStationController extends BaseController {
}
/**
* 微信小程序电站列表
* @param name 电站名称
* @param serviceFacilities 标签服务设施
* @param code 城市id
* @param longitude 经度
* @param latitude 维度
* @return
*/
//@PreAuthorize(hasPermi = "system:station:list")
@GetMapping("/wxList")
public TableDataInfo wxList(String name,String serviceFacilities,Integer code,String longitude,String latitude)
{
startPage();
List<Map<String,Object>> list = xhpcChargingStationService.wxList(name,serviceFacilities,code,longitude,latitude);
return getDataTable(list);
}
}

View File

@ -87,4 +87,28 @@ public interface XhpcChargingStationMapper {
* @return 电站
*/
List<Map<String,Object>> stationInternetBlackList(Long chargingStationId);
/**
* 微信小程序电站列表
* @param name 电站名称
* @param serviceFacilities 标签集合服务设施
* @param code 城市id
* @param longitude 经度
* @param latitude 维度
* @param clientVisible 微信小程序是否可见 2可见
* @return
*/
List<Map<String,Object>> wxList(@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);
/**
* 根据code获取数据
*
* @param code 字典code
* @param serviceFacilities 筛选条件
* @return 电站
*/
List<Map<String,Object>> getCode(@Param("code")String code,@Param("serviceFacilities")List<String> serviceFacilities);
}

View File

@ -88,4 +88,18 @@ public interface IXhpcChargingStationService {
* @return 电站
*/
public List<Map<String,Object>> stationInternetBlackList(Long chargingStationId);
/**
* 微信小程序电站列表
* @param name 电站名称
* @param serviceFacilities 标签服务设施
* @param code 城市id
* @param longitude 经度
* @param latitude 维度
* @return
*/
public List<Map<String,Object>> wxList(String name,String serviceFacilities,Integer code,String longitude,String latitude);
}

View File

@ -176,4 +176,35 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
return xhpcChargingStationMapper.stationInternetBlackList(chargingStationId);
}
@Override
public List<Map<String, Object>> wxList(String name, String serviceFacilities, Integer code, String longitude, String latitude) {
List<String> stringList =new ArrayList<>();
if(serviceFacilities !=null && serviceFacilities !=""){
String[] split = serviceFacilities.split(",");
stringList=Arrays.asList(split);
}
List<Map<String, Object>> list = xhpcChargingStationMapper.wxList(name, stringList, code, longitude, latitude,2);
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<Map<String, Object>> label_type = xhpcChargingStationMapper.getCode("label_type",stringList);
map.put("serviceFacilities",label_type);
//空闲和使用从redis获取
}
}
return list;
}
}

View File

@ -166,4 +166,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="stationInternetBlackList" resultType="map">
select name from xhpc_internet_user where del_flag=0 and internet_user_id not in (select internet_user_id from xhpc_station_internet_blacklist where charging_station_id=#{chargingStationId})
</select>
<select id="wxList" resultType="map">
select
charging_station_id as chargingStationId,
name as name,
parking_instructions as parkingInstructions,
detailed_address as detailedAddress,
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
<if test="name !=null and name !=''">
and name like CONCAT('%',#{name},'%')
</if>
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
and service_facilities in
<foreach collection="serviceFacilities" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="code !=null and code !=''">
and area_code=#{code}
</if>
ORDER BY distance asc
</select>
<select id="getCode" resultType="map">
select code, dict_key, dict_value
from xhpc_dict_biz
where code = #{code} and parent_id > 0 and del_flag = 0
<if test="serviceFacilities !=null and serviceFacilities.size()>0 ">
and dict_biz_id in
<foreach collection="serviceFacilities" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>