卡启动

This commit is contained in:
ZZ 2022-02-24 18:06:25 +08:00
parent 614b246896
commit 858819a855
2 changed files with 8 additions and 3 deletions

View File

@ -634,6 +634,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
} }
@Override @Override
@Transactional
public R cardStartup(Long userId, String serialNumber, Integer userType, String tenantId, Integer type, public R cardStartup(Long userId, String serialNumber, Integer userType, String tenantId, Integer type,
String grantOperator, String rateModelId) { String grantOperator, String rateModelId) {
@ -665,7 +666,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
} }
if (type != 0) { if (type != 0) {
//获取桩信息 //获取桩信息
if (grantOperator.equals(xhpcChargingPileById.get("corpNo").toString())) { if (!grantOperator.equals(xhpcChargingPileById.get("corpNo").toString())) {
return R.fail(Constants.INVALID_OPERATOR); return R.fail(Constants.INVALID_OPERATOR);
} }
} }

View File

@ -25,6 +25,8 @@ import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.xhpc.common.data.redis.StaticBeanUtil.seqHex;
@Lazy @Lazy
@Component("PileStartChargingDataLogic") @Component("PileStartChargingDataLogic")
public class PileStartChargingDataLogic implements ServiceLogic { public class PileStartChargingDataLogic implements ServiceLogic {
@ -56,7 +58,7 @@ public class PileStartChargingDataLogic implements ServiceLogic {
if (pileStartChargingData.getStartType().equals("01")) { //刷卡启动 if (pileStartChargingData.getStartType().equals("01")) { //刷卡启动
IccardInfoExample example = new IccardInfoExample(); IccardInfoExample example = new IccardInfoExample();
IccardInfoExample.Criteria criteria = example.createCriteria(); IccardInfoExample.Criteria criteria = example.createCriteria();
criteria.andCardidEqualTo(accountOrCardNo.startsWith("00000000") ? accountOrCardNo.substring(8) : accountOrCardNo).andCorpnoEqualTo(corpNo); criteria.andCardidEqualTo(accountOrCardNo.startsWith("00000000") ? accountOrCardNo.substring(8) : accountOrCardNo).andCorpnoEqualTo(corpNo); // todo remove corpNo
List<IccardInfo> iccardInfos = iccardInfoMapper.selectByExample(example); List<IccardInfo> iccardInfos = iccardInfoMapper.selectByExample(example);
if (iccardInfos.size() == 1) { if (iccardInfos.size() == 1) {
IccardInfo iccardInfo = iccardInfos.get(0); IccardInfo iccardInfo = iccardInfos.get(0);
@ -78,7 +80,9 @@ public class PileStartChargingDataLogic implements ServiceLogic {
resultStr = "01"; resultStr = "01";
} }
} }
String hex = orderNo.concat(connectorId).concat(cardNo).concat(balance).concat(result).concat(resultStr); String skey = "gun:".concat(connectorId).concat(".seqhex");
String hex =
"682A".concat(seqHex(skey)).concat("0032").concat(orderNo).concat(connectorId).concat(cardNo).concat(balance).concat(result).concat(resultStr);
hex = hex.concat(CRCCalculator.calcCrc(hex)); hex = hex.concat(CRCCalculator.calcCrc(hex));
String remark = "充电桩发起充电"; String remark = "充电桩发起充电";
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage(); XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();