场站详情包含站点信息

This commit is contained in:
yuyang 2021-07-22 13:52:21 +08:00
parent e10fde5e9a
commit 7ee6a9d044
10 changed files with 244 additions and 11 deletions

View File

@ -169,4 +169,22 @@ public class XhpcChargingStationController extends BaseController {
}
/**
* 电站详情站点详情
* @param chargingStationId 站点id
* @param longitude 经度
* @param latitude 维度
* @return
*/
@GetMapping(value = "/getXhpcChargingStationMassage")
public AjaxResult getXhpcChargingStationMassage(@Param("chargingStationId") Long chargingStationId,@Param("longitude")String longitude,@Param("latitude")String latitude)
{
return AjaxResult.success(xhpcChargingStationService.getXhpcChargingStationMassage(chargingStationId,longitude,latitude));
}
}

View File

@ -88,6 +88,14 @@ public class XhpcChargingStation extends BaseEntity {
@Excel(name = "图片id")
private String imgId;
/** 营业说明 */
@Excel(name = "营业说明")
private String pbusinessInstructions;
/** 温馨提示说明 */
@Excel(name = "温馨提示说明")
private String reminderInstructions;
public void setChargingStationId(Long chargingStationId)
{
this.chargingStationId = chargingStationId;
@ -261,4 +269,24 @@ public class XhpcChargingStation extends BaseEntity {
this.imgId = imgId;
}
public String getPbusinessInstructions() {
return pbusinessInstructions;
}
public void setPbusinessInstructions(String pbusinessInstructions) {
this.pbusinessInstructions = pbusinessInstructions;
}
public String getReminderInstructions() {
return reminderInstructions;
}
public void setReminderInstructions(String reminderInstructions) {
this.reminderInstructions = reminderInstructions;
}
}

View File

@ -1,7 +1,8 @@
package com.xhpc.charging.station.domain;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
/**
* 费率对象 xhpc_rate
@ -20,10 +21,10 @@ public class XhpcRate extends BaseEntity {
private Long chargingStationId;
/** 电费 */
private Decimal powerFee;
private BigDecimal powerFee;
/** 服务费 */
private Decimal serviceFee;
private BigDecimal serviceFee;
/** 名称 */
private String name;
@ -37,4 +38,84 @@ public class XhpcRate extends BaseEntity {
/** 费率模型id */
private Long rateModelId;
public Long getRateId() {
return rateId;
}
public void setRateId(Long rateId) {
this.rateId = rateId;
}
public Long getChargingStationId() {
return chargingStationId;
}
public void setChargingStationId(Long chargingStationId) {
this.chargingStationId = chargingStationId;
}
public BigDecimal getPowerFee() {
return powerFee;
}
public void setPowerFee(BigDecimal powerFee) {
this.powerFee = powerFee;
}
public BigDecimal getServiceFee() {
return serviceFee;
}
public void setServiceFee(BigDecimal serviceFee) {
this.serviceFee = serviceFee;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public Long getRateModelId() {
return rateModelId;
}
public void setRateModelId(Long rateModelId) {
this.rateModelId = rateModelId;
}
}

View File

@ -110,5 +110,15 @@ public interface XhpcChargingStationMapper {
*/
List<Map<String,Object>> getCode(@Param("code")String code,@Param("serviceFacilities")List<String> serviceFacilities);
/**
* 电站详情站点详情
*
* @param chargingStationId 电站ID
* @return 电站
*/
Map<String,Object> getXhpcChargingStationMassage(@Param("chargingStationId")Long chargingStationId,@Param("longitude")String longitude,@Param("latitude")String latitude);
List<Map<String,Object>> getImageList(@Param("imgIds")List<String> imgIds);
}

View File

@ -13,7 +13,7 @@ public interface XhpcRateTimeMapper {
* @param datchargingStationId 电站id
* @return
*/
Long getXhpcRateTime(@Param("date")String date,@Param("datchargingStationId")Long datchargingStationId);
Map<String,Object> getXhpcRateTime(@Param("date")String date,@Param("datchargingStationId")Long datchargingStationId);
/**
* 获取在这个时间段的费率

View File

@ -111,4 +111,16 @@ public interface IXhpcChargingStationService {
*/
public List<Map<String,Object>> wxList(String name,String serviceFacilities,Integer code,String longitude,String latitude);
/**
* 电站详情站点详情
*
* @param chargingStationId 电站ID
* @return 电站
*/
Map<String,Object> getXhpcChargingStationMassage(Long chargingStationId,String longitude,String latitude);
}

View File

@ -207,7 +207,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
//判断结束时间是否小于开始时间
//检查格式是否正确
//冒泡排序结束时间小于开始时间
//每个时间段都要存
@ -241,7 +241,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
serviceFacilitiesList=Arrays.asList(split);
}
//获取标签
List<Map<String, Object>> label_type = xhpcChargingStationMapper.getCode("label_type",serviceFacilitiesList);
List<Map<String, Object>> label_type = xhpcChargingStationMapper.getCode("service_facilities",serviceFacilitiesList);
map.put("serviceFacilities",label_type);
//空闲和使用从redis获取
@ -250,5 +250,41 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
return list;
}
@Override
public Map<String, Object> getXhpcChargingStationMassage(Long chargingStationId,String longitude,String latitude) {
//获取基本信息
Map<String, Object> map = xhpcChargingStationMapper.getXhpcChargingStationMassage(chargingStationId,longitude,latitude);
//桩空闲数量从redis获取
//标签
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> imgList =new ArrayList<>();
if(map.get("imgId") !=null && map.get("imgId").toString() !=""){
String[] split = map.get("imgId").toString().split(",");
imgList=Arrays.asList(split);
List<Map<String, Object>> imgLists = xhpcChargingStationMapper.getImageList(imgList);
map.put("imgIdList",imgLists);
}else{
map.put("imgIdList",new ArrayList<>());
}
//获取该时段电费
//HH:mm:ss
String tiem = DateUtil.formatTime(new Date());
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
if(xhpcRateTime!=null){
map.putAll(xhpcRateTime);
}
return map;
}
}

View File

@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
@ -26,12 +27,20 @@ public class XhpcRateTimeServiceImpl implements IXhpcRateTimeService{
@Override
public Map<String, Object> getXhpcRateTime(String date,Long datchargingStationIde) {
Long rateId = xhpcRateTimeMapper.getXhpcRateTime(date, datchargingStationIde);
if(rateId ==null){
//判断本时间段的电费
Map<String,Object> hpcRateTimeMap = xhpcRateTimeMapper.getXhpcRateTime(date, datchargingStationIde);
//该判断防止某个时间段费率没有录入
if(hpcRateTimeMap ==null){
//获取剩余时间费率
return xhpcRateTimeMapper.getXhpcRateTimeType(datchargingStationIde);
}
return xhpcRateTimeMapper.getXhpcTimeType(datchargingStationIde,rateId);
Map<String,Object> map =new HashMap<>();
Long rateId = Long.valueOf(hpcRateTimeMap.get("rateId").toString());
Map<String, Object> xhpcTimeType = xhpcRateTimeMapper.getXhpcTimeType(datchargingStationIde, rateId);
map.put("startTime",hpcRateTimeMap.get("startTime"));
map.put("endTime",hpcRateTimeMap.get("endTime"));
map.putAll(xhpcTimeType);
return map;
}
}

View File

@ -29,6 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
<result property="rateModelId" column="rate_model_id" />
<result property="imgId" column="img_id" />
<result property="pbusinessInstructions" column="business_instructions" />
<result property="reminderInstructions" column="reminder_instructions" />
</resultMap>
<sql id="selectXhpcChargingStationVo">
@ -207,4 +209,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</select>
<select id="getXhpcChargingStationMassage" resultType="map">
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) as type,
name as name,
reminder_instructions as reminderInstructions,
detailed_address as detailedAddress,
parking_instructions as parkingInstructions,
business_instructions as businessInstructions,
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,4)AS distance
from xhpc_charging_station
where charging_station_id=#{chargingStationId} and del_flag=0 and status=0
</select>
<select id="getImageList" resultType="map">
select
img_id as imgId,
url as url
from xhpc_img where del_flag=0 and status=0
<if test="imgIds !=null and imgIds.size()>0 ">
img_id in
<foreach collection="imgIds" item="chargingStationId" open="(" separator="," close=")">
#{chargingStationId}
</foreach>
</if>
</select>
</mapper>

View File

@ -21,8 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
</resultMap>
<select id="getXhpcRateTime" resultType="Long">
select rate_id as rateId from xhpc_rate_time where charging_station_id =#{datchargingStationId} and start_time &lt;=#{date} and end_time &gt;=#{date} and status=0 and del_flag=0 and type=0
<select id="getXhpcRateTime" resultType="map">
select
rate_time_id as rateTimeId,
rate_id as rateId,
start_time as startTime,
end_time as endTime
from xhpc_rate_time where charging_station_id =#{datchargingStationId} and start_time &lt;=#{date} and end_time &gt;=#{date} and status=0 and del_flag=0 and type=0
</select>
<select id="getXhpcTimeType" resultType="map">