优化卡启动代码
This commit is contained in:
parent
c523d52491
commit
172ce9fb0a
@ -600,3 +600,6 @@ ALTER TABLE `xhpc_statistics_station`
|
||||
ALTER TABLE `xhpc_operator`
|
||||
CHANGE COLUMN `corp_no` `corp_no` VARCHAR(30) NULL COMMENT '运营商代码,用于桩编号前缀,如80836代表翔桦' AFTER `name`,
|
||||
ADD UNIQUE INDEX `corp_no` (`corp_no`);
|
||||
|
||||
ALTER TABLE `t_iccard_client_users`
|
||||
ADD COLUMN `tenant_id` VARCHAR(50) NULL COMMENT '租户id' AFTER `usersTime`;
|
||||
|
||||
@ -17,7 +17,7 @@ public class CardHistoryOrderFactory implements FallbackFactory<CardHistoryOrder
|
||||
return new CardHistoryOrderService() {
|
||||
@Override
|
||||
public R cardStartup(Long userId,String serialNumber,Integer userType,String tenantId,Integer type,String grantOperator,String rateModelId) {
|
||||
return R.fail("卡启动前判断启动失败:" + cause.getMessage());
|
||||
return R.fail("服务回滚:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.domain.XhpcRate;
|
||||
import com.xhpc.order.domain.XhpcChargeOrder;
|
||||
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
@ -169,4 +168,4 @@ public interface IXhpcChargeOrderService {
|
||||
|
||||
R cardStartup(Long userId,String serialNumber,Integer userType,String tenantId, Integer type, String grantOperator,String rateModelId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,22 +653,27 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
}
|
||||
|
||||
//终端信息
|
||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,tenantId);
|
||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber, tenantId);
|
||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||
return R.fail(Constants.INVALID_TERMINAL);
|
||||
}
|
||||
|
||||
if(type !=0){
|
||||
Map<String, Object> xhpcChargingPileById =
|
||||
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(), tenantId);
|
||||
if (xhpcChargingPileById.size() == 0) {
|
||||
return R.fail(Constants.INVALID_OPERATOR);
|
||||
}
|
||||
if (type != 0) {
|
||||
//获取桩信息
|
||||
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
|
||||
if(xhpcChargingPileById ==null || !grantOperator.equals(xhpcChargingPileById.get("corpNo").toString())){
|
||||
if (grantOperator.equals(xhpcChargingPileById.get("corpNo").toString())) {
|
||||
return R.fail(Constants.INVALID_OPERATOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BigDecimal a = new BigDecimal(5);
|
||||
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) {
|
||||
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get(
|
||||
"balance").toString())) == 1) {
|
||||
return R.fail(Constants.INSUFFICIENT_ACCOUNT);
|
||||
}
|
||||
|
||||
@ -728,10 +733,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
xhpcChargeOrder.setStatus(-1);
|
||||
xhpcChargeOrder.setTenantId(tenantId);
|
||||
//获取桩信息
|
||||
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId(),tenantId);
|
||||
if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) {
|
||||
xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString());
|
||||
}
|
||||
xhpcChargeOrder.setPower((String) xhpcChargingPileById.get("power"));
|
||||
xhpcChargeOrder.setRateModelId(Long.valueOf(rateModelId));
|
||||
xhpcChargeOrder.setChargingMode("刷卡");
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user