桩启动充电(刷卡)

This commit is contained in:
ZZ 2022-01-11 17:03:10 +08:00
parent 726f1ac319
commit 01314496c2

View File

@ -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<String, Object> 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<String, String> param = new HashMap<>();
param.put("sql", sql);
List<Map<String, Object>> 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"));