From 01314496c23270fc48c34a2a648ea564e436795d Mon Sep 17 00:00:00 2001 From: ZZ Date: Tue, 11 Jan 2022 17:03:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A9=E5=90=AF=E5=8A=A8=E5=85=85=E7=94=B5(?= =?UTF-8?q?=E5=88=B7=E5=8D=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pp/logic/PileStartChargingDataLogic.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java index d6b0b655..2b41f152 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/PileStartChargingDataLogic.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.xhpc.common.data.up.PileStartChargingData; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.pp.domain.XhpcDeviceMessage; +import com.xhpc.pp.mapper.ServiceFieldMapper; import com.xhpc.pp.mapper.XhpcDeviceMessageMapper; import com.xhpc.pp.tx.ServiceParameter; import com.xhpc.pp.tx.ServiceResult; @@ -14,16 +15,20 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; import java.util.Map; @Lazy @Component("PileStartChargingDataLogic") public class PileStartChargingDataLogic implements ServiceLogic { - private static Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class); + private static final Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class); @Resource - XhpcDeviceMessageMapper deviceMessageMapper; + private XhpcDeviceMessageMapper deviceMessageMapper; + @Resource + private ServiceFieldMapper fieldMapper; @Override public ServiceResult service(ServiceParameter sp) throws Exception { @@ -31,11 +36,21 @@ public class PileStartChargingDataLogic implements ServiceLogic { Map req = sp.getParameters(); ObjectMapper objectMapper = new ObjectMapper(); PileStartChargingData pileStartChargingData = objectMapper.convertValue(req, PileStartChargingData.class); - //todo + String terminalId = pileStartChargingData.getPileNo().concat(pileStartChargingData.getGunId()); + String accountOrCardNo = pileStartChargingData.getAccountOrCardNo(); + String corpNo = terminalId.substring(0, 6); + if (pileStartChargingData.getStartType().equals("01")) { //刷卡启动 + String sql = "select i.* from t_iccard_info i where cardNo='" + accountOrCardNo + "' and corpNo = '" + corpNo + + "'"; + Map param = new HashMap<>(); + param.put("sql", sql); + List> resultMap = fieldMapper.querySQL(param); + + } String remark = "充电桩主动申请起动充电"; XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); deviceMessage.setType(StationDeviceEnum.PILE.getCode()); - deviceMessage.setSerialNumber(sp.getPileNo()); + deviceMessage.setSerialNumber(terminalId); deviceMessage.setRemark(remark); deviceMessage.setStatus(0); deviceMessage.setContent((String) req.get("hex"));