桩启动充电(刷卡)
This commit is contained in:
parent
726f1ac319
commit
01314496c2
@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.xhpc.common.data.up.PileStartChargingData;
|
import com.xhpc.common.data.up.PileStartChargingData;
|
||||||
import com.xhpc.common.enums.StationDeviceEnum;
|
import com.xhpc.common.enums.StationDeviceEnum;
|
||||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||||
|
import com.xhpc.pp.mapper.ServiceFieldMapper;
|
||||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||||
import com.xhpc.pp.tx.ServiceParameter;
|
import com.xhpc.pp.tx.ServiceParameter;
|
||||||
import com.xhpc.pp.tx.ServiceResult;
|
import com.xhpc.pp.tx.ServiceResult;
|
||||||
@ -14,16 +15,20 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Component("PileStartChargingDataLogic")
|
@Component("PileStartChargingDataLogic")
|
||||||
public class PileStartChargingDataLogic implements ServiceLogic {
|
public class PileStartChargingDataLogic implements ServiceLogic {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class);
|
private static final Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
private XhpcDeviceMessageMapper deviceMessageMapper;
|
||||||
|
@Resource
|
||||||
|
private ServiceFieldMapper fieldMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||||
@ -31,11 +36,21 @@ public class PileStartChargingDataLogic implements ServiceLogic {
|
|||||||
Map<String, Object> req = sp.getParameters();
|
Map<String, Object> req = sp.getParameters();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
PileStartChargingData pileStartChargingData = objectMapper.convertValue(req, PileStartChargingData.class);
|
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 = "充电桩主动申请起动充电";
|
String remark = "充电桩主动申请起动充电";
|
||||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
deviceMessage.setSerialNumber(terminalId);
|
||||||
deviceMessage.setRemark(remark);
|
deviceMessage.setRemark(remark);
|
||||||
deviceMessage.setStatus(0);
|
deviceMessage.setStatus(0);
|
||||||
deviceMessage.setContent((String) req.get("hex"));
|
deviceMessage.setContent((String) req.get("hex"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user