修改场站监控、版本号管理
This commit is contained in:
parent
94ae833b82
commit
97445c7f50
@ -71,7 +71,7 @@ public class XhpcEquipmenMonitorController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getChargingStationMonitor")
|
||||
public AjaxResult getChargingStationMonitor(String chargingStationId) {
|
||||
public AjaxResult getChargingStationMonitor(Long chargingStationId) {
|
||||
|
||||
return xhpcEquipmenMonitorService.getChargingStationMonitor(chargingStationId);
|
||||
}
|
||||
|
||||
@ -20,4 +20,6 @@ public interface XhpcEquipmenMonitorMapper {
|
||||
int insertquipmenMonitor(XhpcEquipmenMonitor xhpcEquipmenMonitor);
|
||||
|
||||
int updaEquipmenMonitor(XhpcEquipmenMonitor xhpcEquipmenMonitor);
|
||||
|
||||
List<XhpcEquipmenMonitor> getChargingStationId(@Param("chargingStationId")Long chargingStationId);
|
||||
}
|
||||
|
||||
@ -26,4 +26,6 @@ public interface XhpcPileEditionMapper {
|
||||
int insertXhpcPileEdition(XhpcPileEdition xhpcPileEdition);
|
||||
|
||||
int updatePileEdition(XhpcPileEdition xhpcPileEdition);
|
||||
|
||||
XhpcPileEdition getXhpcPileEditionById(@Param("pileEditionId")Long pileEditionId);
|
||||
}
|
||||
|
||||
@ -2,8 +2,6 @@ package com.xhpc.charging.station.service;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.domain.XhpcEquipmenMonitor;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
@ -24,7 +22,7 @@ public interface IXhpcEquipmenMonitorService {
|
||||
|
||||
AjaxResult remove(Long equipmenMonitorId);
|
||||
|
||||
AjaxResult getChargingStationMonitor(String chargingStationId);
|
||||
AjaxResult getChargingStationMonitor(Long chargingStationId);
|
||||
|
||||
AjaxResult getChargingStationEquipmenToken();
|
||||
}
|
||||
|
||||
@ -102,15 +102,28 @@ public class XhpcEquipmenMonitorServiceImpl implements IXhpcEquipmenMonitorServi
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getChargingStationMonitor(String chargingStationId) {
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("chargingStationId",1);
|
||||
map.put("equipmentNumber","C41675932");
|
||||
map.put("equipmentName","公司内部监控");
|
||||
map.put("url","ezopen://open.ys7.com/C41675932/1.hd.live");
|
||||
list.add(map);
|
||||
return AjaxResult.success(list);
|
||||
public AjaxResult getChargingStationMonitor(Long chargingStationId) {
|
||||
|
||||
//获取设备列表
|
||||
List<Map<String, Object>> listMap =new ArrayList<>();
|
||||
List<XhpcEquipmenMonitor> list = xhpcEquipmenMonitorMapper.getChargingStationId(chargingStationId);
|
||||
//获取token
|
||||
String equipmenToken = getEquipmenToken();
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
XhpcEquipmenMonitor xhpcEquipmenMonitor = list.get(i);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String equipmenNumber = xhpcEquipmenMonitor.getEquipmenNumber();
|
||||
String equipmenName = xhpcEquipmenMonitor.getEquipmenName();
|
||||
map.put("chargingStationId",xhpcEquipmenMonitor.getChargingStationId());
|
||||
map.put("equipmentNumber",equipmenNumber);
|
||||
map.put("equipmentName",equipmenName);
|
||||
String equipmenUrl = getEquipmenUrl(equipmenToken, equipmenNumber, "1");
|
||||
if(equipmenUrl !=null && !"".equals(equipmenUrl)){
|
||||
map.put("url",equipmenUrl);
|
||||
listMap.add(map);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(listMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,68 +131,50 @@ public class XhpcEquipmenMonitorServiceImpl implements IXhpcEquipmenMonitorServi
|
||||
|
||||
try{
|
||||
//获取token
|
||||
String equipmenToken = redisService.getCacheObject("equipmen:token");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(equipmenToken ==null || "".equals(equipmenToken)){
|
||||
String resp = HttpClientUtil.sendPost("https://open.ys7.com/api/lapp/token/get?appKey=e87d64ac7c424d7bb37830055a21b57a&appSecret=85d3ea44e86f940ac8274b43f6703803", null);
|
||||
JSONObject jsonObject = JSON.parseObject(resp);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String accessToken = data.getString("accessToken");
|
||||
map.put("accessToken",accessToken);
|
||||
redisService.setCacheObject("equipmen:token",accessToken,259200L, TimeUnit.SECONDS);
|
||||
}else{
|
||||
map.put("accessToken",equipmenToken);
|
||||
}
|
||||
return AjaxResult.success(map);
|
||||
String equipmenToken = getEquipmenToken();
|
||||
return AjaxResult.success(equipmenToken);
|
||||
}catch (Exception e){
|
||||
|
||||
return AjaxResult.error("获取监控token失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//// String st="14:30:00";
|
||||
//// String end="15:30:00";
|
||||
////
|
||||
//// long sttime = DateUtil.parse(st, "HH:mm:ss").getTime();
|
||||
//// long endtime = DateUtil.parse(end, "HH:mm:ss").getTime();
|
||||
////
|
||||
//// System.out.println((endtime-sttime)/1800000);
|
||||
// try{
|
||||
//
|
||||
// //获取token
|
||||
//// HashMap<String, String> headers = new HashMap<>(3);
|
||||
//// String requestUrl = "https://open.ys7.com/api/lapp/token/get";
|
||||
//// String jsonStr = "{\n" +
|
||||
//// " \"appKey\":\"e87d64ac7c424d7bb37830055a21b57a\",\n" +
|
||||
//// " \"appSecret\":\"85d3ea44e86f940ac8274b43f6703803\"\n" +
|
||||
//// "}";
|
||||
//// headers.put("content-type", "application/json");
|
||||
//// // 发送post请求
|
||||
//// String resultData = HttpUtils.sendPostWithJson(requestUrl, jsonStr,headers);
|
||||
//// // 并接收返回结果
|
||||
//// System.out.println(resultData);
|
||||
// Map<String, String> rm = new HashMap<>();
|
||||
// // rm.put("appKey", "e87d64ac7c424d7bb37830055a21b57a");
|
||||
// // rm.put("appSecret", "85d3ea44e86f940ac8274b43f6703803");
|
||||
//
|
||||
//
|
||||
// String resp = HttpClientUtil.sendPost("https://open.ys7.com/api/lapp/token/get?appKey=e87d64ac7c424d7bb37830055a21b57a&appSecret=85d3ea44e86f940ac8274b43f6703803", null);
|
||||
//
|
||||
// JSONObject jsonObject = JSON.parseObject(resp);
|
||||
// System.out.println("==========jsonObject============");
|
||||
// System.out.println("==========jsonObject============"+jsonObject.toString());
|
||||
// System.out.println("==========jsonObject============");
|
||||
// JSONObject data = jsonObject.getJSONObject("data");
|
||||
// String accessToken = data.getString("accessToken");
|
||||
// System.out.println("accessToken:"+accessToken);
|
||||
// String expireTime = data.getString("expireTime");
|
||||
//
|
||||
//
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
public String getEquipmenToken(){
|
||||
String equipmenToken = redisService.getCacheObject("equipmen:token");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(equipmenToken ==null || "".equals(equipmenToken)){
|
||||
String resp = HttpClientUtil.sendPost("https://open.ys7.com/api/lapp/token/get?appKey=e87d64ac7c424d7bb37830055a21b57a&appSecret=85d3ea44e86f940ac8274b43f6703803", null);
|
||||
JSONObject jsonObject = JSON.parseObject(resp);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String accessToken = data.getString("accessToken");
|
||||
map.put("accessToken",accessToken);
|
||||
redisService.setCacheObject("equipmen:token",accessToken,259200L, TimeUnit.SECONDS);
|
||||
return accessToken;
|
||||
}else{
|
||||
return equipmenToken;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getEquipmenUrl(String accessToken,String deviceSerial,String channelNo){
|
||||
String url = "https://open.ys7.com/api/lapp/v2/live/address/get?accessToken=" + accessToken + "&deviceSerial=" + deviceSerial + "&channelNo=" + channelNo;
|
||||
String resp = HttpClientUtil.sendPost(url, null);
|
||||
JSONObject jsonObject = JSON.parseObject(resp);
|
||||
if("200".equals(jsonObject.getString("code"))){
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
return data.getString("url");
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String accessToken = "at.bxecfid28j8vu7baai2o82jydfj74jlw-1hrdvblpz2-1a7773w-vr8r9vdl6";
|
||||
String deviceSerial ="C41675932";
|
||||
String channelNo ="1";
|
||||
String equipmenUrl = getEquipmenUrl(accessToken, deviceSerial, channelNo);
|
||||
System.out.println("equipmenUrl:"+equipmenUrl);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -94,11 +94,20 @@ public class XhpcPileEditionServiceImpl extends BaseService implements IXhpcPil
|
||||
|
||||
@Override
|
||||
public AjaxResult status(Long pileEditionId,Integer status) {
|
||||
XhpcPileEdition xhpcPileEdition = new XhpcPileEdition();
|
||||
|
||||
XhpcPileEdition xhpcPileEdition = xhpcPileEditionMapper.getXhpcPileEditionById(pileEditionId);
|
||||
if(xhpcPileEdition==null){
|
||||
return AjaxResult.error(500, "数据错误,请刷新页面在操作");
|
||||
}
|
||||
String[] split = xhpcPileEdition.getChargingPileIds().split(",");
|
||||
if(split ==null || split.length==0){
|
||||
return AjaxResult.error(500, "请选择桩");
|
||||
}
|
||||
List list = Arrays.asList(split);
|
||||
xhpcPileEdition.setPileEditionId(pileEditionId);
|
||||
xhpcPileEdition.setStatus(status);
|
||||
if(status==0){
|
||||
int xhpcPileEditions = xhpcPileEditionMapper.updatePileEdition(xhpcPileEdition);
|
||||
int xhpcPileEditions = xhpcPileEditionMapper.getXhpcPileEditions(xhpcPileEdition.getPileEditionId(),list,1);
|
||||
if(xhpcPileEditions >0){
|
||||
return AjaxResult.error(500, "有重复桩");
|
||||
}
|
||||
|
||||
@ -158,4 +158,14 @@
|
||||
</trim>
|
||||
where equipmen_monitor_id = #{equipmenMonitorId}
|
||||
</update>
|
||||
|
||||
<select id="getChargingStationId" resultMap="BaseResultMap">
|
||||
select *
|
||||
from xhpc_equipmen_monitor
|
||||
where status=0 and del_flag=0
|
||||
<if test="chargingStationId !=null">
|
||||
and charging_station_id=#{chargingStationId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and xpe.tenant_id=#{tenantId}
|
||||
</if>
|
||||
order by xpe.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getXhpcPileEditions" resultType="int">
|
||||
@ -59,11 +60,11 @@
|
||||
count(xpe.pile_edition_id) number
|
||||
from xhpc_pile_edition xpe
|
||||
where xpe.del_flag=0 and xpe.status =0
|
||||
<if test="type ==1">
|
||||
<if test="type ==1 and pileEditionId !=null">
|
||||
and xpe.pile_edition_id != #{pileEditionId}
|
||||
</if>
|
||||
<foreach collection="chargingPileIds" separator="" item="pileId" close="" open="">
|
||||
and find_in_set(#{pileId},xpe.charging_pile_ids)
|
||||
<foreach collection="chargingPileIds" separator="or" item="pileId" close=")" open="and(">
|
||||
find_in_set(#{pileId},xpe.charging_pile_ids)
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
@ -166,4 +167,8 @@
|
||||
</trim>
|
||||
where pile_edition_id = #{pileEditionId}
|
||||
</update>
|
||||
|
||||
<select id="getXhpcPileEditionById" resultMap="BaseResultMap">
|
||||
select * from xhpc_pile_edition where pile_edition_id = #{pileEditionId}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1447,7 +1447,7 @@
|
||||
COUNT(xh.history_order_id) totalOrder,
|
||||
xcs.`name` name,
|
||||
IFNULL(ut.empty,0) emptyorder,
|
||||
concat(format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2),'%') emptyOrderRate
|
||||
format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2) emptyOrderRate
|
||||
FROM xhpc_charging_station xcs
|
||||
LEFT JOIN xhpc_history_order xh on xcs.charging_station_id =xh.charging_station_id
|
||||
LEFT join (SELECT COUNT(xh.history_order_id) empty,xh.charging_station_id
|
||||
@ -1496,7 +1496,7 @@
|
||||
xt.`name` name,
|
||||
IFNULL(ut.empty,0) emptyorder,
|
||||
xh.terminal_id,
|
||||
concat(format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2),'%') emptyOrderRate
|
||||
format(ifnull(empty/COUNT(xh.history_order_id)*100,0), 2) emptyOrderRate
|
||||
FROM `xhpc_history_order` as xh
|
||||
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id =xh.charging_station_id
|
||||
LEFT JOIN xhpc_terminal xt on xt.terminal_id =xh.terminal_id
|
||||
|
||||
@ -219,38 +219,8 @@
|
||||
(select sum(amount) from xhpc_recharge_order where create_time >= #{time2} and tenant_id =#{tenantId} and del_flag = 0 and status=1) two,
|
||||
(select sum(amount) from xhpc_recharge_order where create_time >= #{time3} and tenant_id =#{tenantId} and del_flag = 0 and status=1) three,
|
||||
(select sum(amount) from xhpc_recharge_order where create_time >= #{time4} and tenant_id =#{tenantId} and del_flag = 0 and status=1) four
|
||||
|
||||
from xhpc_recharge_order xro
|
||||
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
|
||||
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'recharge_order_status' and sdd.dict_value = xro.`status`
|
||||
where xro.del_flag = 0
|
||||
<if test="phone != null and phone != ''">
|
||||
and xau.phone like concat('%', #{phone}, '%')
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and xro.tenant_id =#{tenantId}
|
||||
</if>
|
||||
<if test="rechargeOrderNumber != null and rechargeOrderNumber != ''">
|
||||
and xro.recharge_order_number like concat('%', #{rechargeOrderNumber}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and xro.status like concat('%', #{status}, '%')
|
||||
</if>
|
||||
<if test="createTimeStart != null and createTimeStart != ''"><!-- 开始时间检索 -->
|
||||
AND xro.create_time >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != ''"><!-- 结束时间检索 -->
|
||||
AND xro.create_time <= #{createTimeEnd}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND xro.type = #{type}
|
||||
</if>
|
||||
<if test="source != null">
|
||||
AND xro.source = #{source}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and xro.user_id=#{userId}
|
||||
</if>
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
@ -246,38 +246,13 @@
|
||||
|
||||
<select id="sumMoney" resultType="map">
|
||||
select
|
||||
sum(xro.amount) amount,
|
||||
sum(xro.amount) amount,
|
||||
(select sum(amount) from xhpc_refund_order where create_time >= #{time1} and tenant_id =#{tenantId} and del_flag = 0 and examine_status=1 and status =1) one,
|
||||
(select sum(amount) from xhpc_refund_order where create_time >= #{time2} and tenant_id =#{tenantId} and del_flag = 0 and examine_status=1 and status =1) two,
|
||||
(select sum(amount) from xhpc_refund_order where create_time >= #{time3} and tenant_id =#{tenantId} and del_flag = 0 and examine_status=1 and status =1) three,
|
||||
(select sum(amount) from xhpc_refund_order where create_time >= #{time4} and tenant_id =#{tenantId} and del_flag = 0 and examine_status=1 and status =1) four
|
||||
from xhpc_refund_order xro
|
||||
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
|
||||
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status`
|
||||
LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value =
|
||||
xro.examine_status
|
||||
where xro.del_flag = 0 and xro.examine_status=1 and xro.status =1
|
||||
<if test="phone != null and phone != ''">
|
||||
and xau.phone like concat('%', #{phone}, '%')
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and xro.tenant_id=#{tenantId}
|
||||
</if>
|
||||
<if test="refundOrderNumber != null and refundOrderNumber != ''">
|
||||
and xro.refund_order_number like concat('%', #{refundOrderNumber}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and xro.status like concat('%', #{status}, '%')
|
||||
</if>
|
||||
<if test="createTimeStart != null and createTimeStart != ''"><!-- 开始时间检索 -->
|
||||
AND xro.create_time >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != ''"><!-- 结束时间检索 -->
|
||||
AND xro.create_time <= #{createTimeEnd}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and xro.type = #{type}
|
||||
</if>
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user