| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.chargingPile.api.feignClient.*; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | import com.ruoyi.other.api.domain.Operator; |
| | | import com.ruoyi.other.api.feignClient.OperatorClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | |
| | | * @author zhibing.pu |
| | | * @Date 2025/1/21 17:52 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/evcs/v1.0") |
| | | public class TCECController { |
| | |
| | | baseResult.setTimeStamp(mapKey); |
| | | baseResult.setSeq(String.format("%04d", integer)); |
| | | //清空小于当前时间的map中的无效数据 |
| | | for (Long k : map.keySet()) { |
| | | Set<Long> set = map.keySet(); |
| | | Iterator<Long> iterator = set.iterator(); |
| | | while (iterator.hasNext()){ |
| | | Long k = iterator.next(); |
| | | if(k <= (mapKey - 10)){ |
| | | map.remove(k); |
| | | } |
| | |
| | | } |
| | | |
| | | Operator operator = r.getData(); |
| | | baseResult.setOperator(operator); |
| | | baseRequest.setOperator(operator); |
| | | //校验签名 |
| | | String sign = TCECUtil.buildSign(baseRequest); |
| | |
| | | baseResult.setMsg("签名校验失败"); |
| | | return baseResult; |
| | | } |
| | | baseResult.setOperator(operator); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(false, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | QueryTokenResult queryTokenResult = new QueryTokenResult(); |
| | |
| | | queryTokenResult.setFailReason(1); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryTokenResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | queryTokenResult.setFailReason(2); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryTokenResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | queryTokenResult.setTokenAvailableTime(expires_in * 60); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryTokenResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | queryStationsInfoResult.setStationInfos(buildSite(parkingLots, siteListPaging.getRecords())); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryStationsInfoResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | result.setStationStatusInfos(StationStatusInfos); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | result.setStationStats(stationStats); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | } |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryEquipAuthResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | baseResult.setMsg("connectorID 参数无效"); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryEquipBusinessPolicyResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Integer accountingStrategyId = tChargingGun.getAccountingStrategyId(); |
| | |
| | | queryEquipBusinessPolicyResult.setSumPeriod(0); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryEquipBusinessPolicyResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | List<PolicyInfo> PolicyInfos = new ArrayList<>(); |
| | |
| | | queryEquipBusinessPolicyResult.setPolicyInfos(PolicyInfos); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryEquipBusinessPolicyResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | result.setStartChargeSeqStat(5); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | //设备离线 |
| | |
| | | result.setStartChargeSeqStat(5); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | //调用充电接口 |
| | |
| | | result.setStartChargeSeqStat(2); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | result.setStartChargeSeqStat(1); |
| | |
| | | result.setFailReason(0); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | QueryEquipChargeStatusResult queryEquipChargeStatusResult = buildQueryEquipChargeStatusResult(queryEquipChargeStatus.getStartChargeSeq()); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryEquipChargeStatusResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | queryStopChargeResult.setFailReason(3); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryStopChargeResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryStopChargeResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(queryTerminalCodeResult); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |
| | |
| | | BaseResult baseResult = requestCheck(true, baseRequest, request); |
| | | if(0 != baseResult.getRet()){ |
| | | baseResult.setData(""); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | Operator operator = baseResult.getOperator(); |
| | |
| | | QueryChargeOrderInfoResult result = buildQueryChargeOrderInfoResult(queryChargeOrderInfo); |
| | | //参数加密 |
| | | String jsonString = JSON.toJSONString(result); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getDataSecret(), operator.getDataSecretIv()); |
| | | String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); |
| | | baseResult.setData(encrypt); |
| | | baseResult.setSig(TCECUtil.buildSign(baseResult)); |
| | | baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); |
| | | return baseResult; |
| | | } |
| | | |