1、增加设备运行日志写入DB;
2、实现桩运行日志接口
This commit is contained in:
parent
16d4e9bf7e
commit
cbb55697e5
@ -4,6 +4,7 @@ import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.log.service.OrderLogService;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@ -5,7 +5,6 @@ import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.log.service.PileLogService;
|
||||
import com.xhpc.log.service.StationLogService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xhpc.log.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class XhpcDeviceMessageDomain {
|
||||
|
||||
private Long deviceMessageId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private String content;
|
||||
|
||||
private String replyContent;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
import com.xhpc.system.api.domain.SysOperLog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -1,14 +1,9 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
import com.xhpc.common.domain.XhpcChargingStation;
|
||||
import com.xhpc.common.domain.XhpcRate;
|
||||
import com.xhpc.common.domain.XhpcRateModel;
|
||||
import com.xhpc.common.domain.XhpcRateTime;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 电站Mapper接口
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface XhpcDeviceMessageMapper {
|
||||
|
||||
List<Map<String, Object>> selectListByTypeAndSerialNumber(@Param("type") String type,
|
||||
@Param("serialNumber")String serialNumber);
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
package com.xhpc.log.service;
|
||||
|
||||
import com.xhpc.common.domain.XhpcChargingPile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.xhpc.log.service.impl;
|
||||
|
||||
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.log.mapper.XhpcHistoryOrderMapper;
|
||||
import com.xhpc.log.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.log.service.OrderLogService;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.xhpc.log.service.impl;
|
||||
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.log.mapper.XhpcChargingPileMapper;
|
||||
import com.xhpc.log.mapper.XhpcDeviceMessageMapper;
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
from xhpc_charging_station as cs
|
||||
left join xhpc_operator as ope on cs.operator_id = ope.operator_id
|
||||
where cs.del_flag =0
|
||||
<if test="type ==1">
|
||||
<if test="type == 1">
|
||||
and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{operatorId})
|
||||
</if>
|
||||
<if test="type ==2">
|
||||
<if test="type == 2">
|
||||
and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{operatorId})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.XhpcDeviceMessageMapper">
|
||||
|
||||
<select id="selectListByTypeAndSerialNumber" resultType="map">
|
||||
select
|
||||
device_message_id as 'deviceMessageId',
|
||||
type as 'type',
|
||||
serial_number as 'serialNumber',
|
||||
content as 'content',
|
||||
reply_content as 'replyContent',
|
||||
status as 'status',
|
||||
remark as 'remark',
|
||||
create_time as 'createTime',
|
||||
create_by as 'createBy',
|
||||
update_time as 'updateTime',
|
||||
update_by as 'updateBy'
|
||||
from xhpc_device_message
|
||||
where type=#{type} and serial_number=#{serialNumber}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.pp.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
@ -7,7 +8,10 @@ import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.logic.RateModelRequestLogic;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.server.ChargingPileServer;
|
||||
import com.xhpc.pp.utils.HexUtils;
|
||||
import com.xhpc.pp.utils.security.CRCCalculator;
|
||||
@ -20,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
@ -41,6 +46,10 @@ public class ChargingController {
|
||||
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
private static final List<String> etable = Arrays.asList((new String[]{"离线", "故障"}).clone());
|
||||
|
||||
@PostMapping("test/pile/charging/order")
|
||||
@ -328,6 +337,15 @@ public class ChargingController {
|
||||
String msg = HexUtils.toHex(data);
|
||||
msg = msg.concat(CRCCalculator.calcCrc(msg));
|
||||
log.debug("start charging order[{}], send msg >>>> |{}|", startChargingData.getOrderNo(), msg);
|
||||
|
||||
// 写入设备日志表数据
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(startChargingData.getPileNo());
|
||||
deviceMessage.setRemark("平台下发开机指令");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent(msg);
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return HexUtils.toBytes(msg);
|
||||
}
|
||||
|
||||
@ -341,6 +359,14 @@ public class ChargingController {
|
||||
String msg = HexUtils.toHex(data);
|
||||
msg = msg.concat(CRCCalculator.calcCrc(msg));
|
||||
log.debug("stop charging, send msg to terminal ({}) >>>> {}", connectorId, msg);
|
||||
// 写入设备日志表数据
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(StrUtil.sub(connectorId, 0, -2));
|
||||
deviceMessage.setRemark("平台下发停机指令");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent(msg.toString());
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return HexUtils.toBytes(msg);
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ public class BalanceUpdateReplyDataLogic implements ServiceLogic {
|
||||
BalanceUpdateReplyData balanceUpdateReplyData = objectMapper.convertValue(req, BalanceUpdateReplyData.class);
|
||||
log.debug("balanceUpdateResult({}) [{}]", balanceUpdateReplyData.getPileNo(), balanceUpdateReplyData.getModifyResult());
|
||||
|
||||
String remark = "充电桩余额更新";
|
||||
String remark = "充电桩余额更新应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
|
||||
@ -32,7 +32,7 @@ public class OfflineCardSyncReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
OfflineCardSyncReplyData offlineCardSyncReplyData = objectMapper.convertValue(req, OfflineCardSyncReplyData.class);
|
||||
//todo
|
||||
String remark = "充电桩下发离线卡数据同步";
|
||||
String remark = "充电桩下发离线卡数据同步应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.xhpc.tradebill.service;
|
||||
|
||||
|
||||
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
|
||||
import com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user