mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-05 02:20:12 +08:00
新增 宁夏交投 相关service方法
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.jsowell.pile.dto.ningxiajiaotou;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 宁夏交投查询订单信息DTO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/11/13 15:51:17
|
||||
*/
|
||||
@Data
|
||||
public class NXJTQueryOrdersInfoDTO {
|
||||
private Integer pageNo;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private String licensePlateNumber;
|
||||
|
||||
private String operatorId;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jsowell.pile.dto.ningxiajiaotou;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询充电站信息DTO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/11/13 13:52:41
|
||||
*/
|
||||
@Data
|
||||
public class NXJTQueryStationInfoDTO {
|
||||
|
||||
private String operatorId;
|
||||
|
||||
private Integer pageNo;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private String stationId;
|
||||
|
||||
}
|
||||
@@ -258,4 +258,11 @@ public interface OrderBasicInfoMapper {
|
||||
List<NROrderInfoVO> getNROrderInfoByOrderCode(@Param("dto") NRQueryOrderDTO dto);
|
||||
|
||||
List<OrderPayDetailVO> queryOrderPayDetail(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
/**
|
||||
* 根据车牌号查询订单信息(宁夏交投 用)
|
||||
* @param licensePlateNumber
|
||||
* @return
|
||||
*/
|
||||
List<OrderVO> getOrderInfoByLicensePlateNumber(String licensePlateNumber);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.jsowell.pile.mapper;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -106,4 +107,11 @@ public interface PileStationInfoMapper {
|
||||
* @return
|
||||
*/
|
||||
List<PileStationVO> getStationSelectList(@Param("dto") QueryStationDTO dto);
|
||||
|
||||
/**
|
||||
* 宁夏交投查询充电站信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<PileStationInfo> NXJTQueryStationsInfo(NXJTQueryStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -371,4 +371,11 @@ public interface IOrderBasicInfoService {
|
||||
List<NROrderInfoVO> getNROrderInfos(NRQueryOrderDTO dto);
|
||||
|
||||
List<OrderPayDetailVO> queryOrderPayDetail(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 根据车牌号查询订单信息(宁夏交投 用)
|
||||
* @param licensePlateNumber
|
||||
* @return
|
||||
*/
|
||||
List<OrderVO> getOrderInfoByLicensePlateNumber(String licensePlateNumber);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 充电站信息Service接口
|
||||
@@ -121,4 +123,11 @@ public interface IPileStationInfoService {
|
||||
* 查询充电站下拉列表
|
||||
*/
|
||||
List<PileStationVO> getStationSelectList(QueryStationDTO dto);
|
||||
|
||||
/**
|
||||
* 宁夏交投查询站点信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<PileStationInfo> NXJTQueryStationsInfo(NXJTQueryStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -3483,4 +3483,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
public List<OrderPayDetailVO> queryOrderPayDetail(String startTime, String endTime) {
|
||||
return orderBasicInfoMapper.queryOrderPayDetail(startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据车牌号查询订单信息(宁夏交投 用)
|
||||
* @param licensePlateNumber
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OrderVO> getOrderInfoByLicensePlateNumber(String licensePlateNumber) {
|
||||
return orderBasicInfoMapper.getOrderInfoByLicensePlateNumber(licensePlateNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
||||
import com.jsowell.pile.mapper.PileStationInfoMapper;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
@@ -568,5 +569,14 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
return pileStationInfoMapper.getStationSelectList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 宁夏交投查询充电站信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PileStationInfo> NXJTQueryStationsInfo(NXJTQueryStationInfoDTO dto) {
|
||||
return pileStationInfoMapper.NXJTQueryStationsInfo(dto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1216,4 +1216,18 @@
|
||||
and t1.settle_amount > 0.00
|
||||
and t1.pay_mode = '4'
|
||||
</select>
|
||||
|
||||
<select id="getOrderInfoByLicensePlateNumber" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
|
||||
SELECT
|
||||
t1.charge_start_time AS startTime,
|
||||
t1.station_id AS stationId,
|
||||
t2.station_name AS stationName,
|
||||
t1.order_amount AS orderAmount
|
||||
FROM
|
||||
order_basic_info t1
|
||||
JOIN pile_station_info t2 ON t1.station_id = t2.id
|
||||
AND t1.del_flag = '0'
|
||||
where
|
||||
t1.plate_number = #{licensePlateNumber,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -536,4 +536,16 @@
|
||||
and public_flag = '1'
|
||||
and amap_flag = '1'
|
||||
</select>
|
||||
|
||||
<select id="NXJTQueryStationsInfo" resultMap="PileStationInfoResult">
|
||||
SELECT
|
||||
id AS stationId,
|
||||
station_name AS stationName,
|
||||
address,
|
||||
station_lng AS stationLng,
|
||||
station_lat AS stationLat,
|
||||
support_order AS supportOrder
|
||||
FROM
|
||||
pile_station_info
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,10 +1,60 @@
|
||||
package com.jsowell.thirdparty.ningxiajiaotou.service;
|
||||
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/11/12 9:33:03
|
||||
*/
|
||||
public class NXJTService {
|
||||
public interface NXJTService {
|
||||
|
||||
/**
|
||||
* 生成令牌
|
||||
* @param dto
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
Map<String, String> generateToken(CommonParamsDTO dto) throws UnsupportedEncodingException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取令牌
|
||||
* @param urlAddress
|
||||
* @param operatorId
|
||||
* @param operatorSecret
|
||||
* @return
|
||||
*/
|
||||
String getToken(String urlAddress, String operatorId, String operatorSecret,
|
||||
String dataSecretIv, String signSecret, String dataSecret);
|
||||
|
||||
|
||||
/**
|
||||
* 获取充电站信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, String> queryStationsInfo(NXJTQueryStationInfoDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站中空闲桩数量
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, String> queryFreePileNumber(NXJTQueryStationInfoDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, String> queryOrdersInfo(NXJTQueryOrdersInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
package com.jsowell.thirdparty.ningxiajiaotou.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.enums.ykc.PileStatusEnum;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationInfo;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||
import com.jsowell.thirdparty.lianlian.util.Encodes;
|
||||
import com.jsowell.thirdparty.lianlian.util.GBSignUtils;
|
||||
import com.jsowell.thirdparty.ningxiajiaotou.service.NXJTService;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 宁夏交投Service
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/11/13 8:58:06
|
||||
*/
|
||||
@Service
|
||||
public class NXJTServiceImpl implements NXJTService {
|
||||
|
||||
@Autowired
|
||||
private LianLianService lianLianService;
|
||||
|
||||
@Autowired
|
||||
private IPileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private IThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
|
||||
|
||||
@Autowired
|
||||
private IPileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private IPileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 生成令牌
|
||||
* @param dto
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> generateToken(CommonParamsDTO dto) throws UnsupportedEncodingException {
|
||||
return lianLianService.generateToken(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取令牌
|
||||
* @param urlAddress
|
||||
* @param operatorId
|
||||
* @param operatorSecret
|
||||
* @param dataSecretIv
|
||||
* @param signSecret
|
||||
* @param dataSecret
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getToken(String urlAddress, String operatorId, String operatorSecret, String dataSecretIv, String signSecret, String dataSecret) {
|
||||
return lianLianService.getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryStationsInfo(NXJTQueryStationInfoDTO dto) {
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// 分页
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
List<PileStationInfo> stationInfos = pileStationInfoService.NXJTQueryStationsInfo(dto);
|
||||
PageInfo<PileStationInfo> pageInfo = new PageInfo<>(stationInfos);
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("pageNo", pageInfo.getPageNum());
|
||||
map.put("pageCount", pageInfo.getPages());
|
||||
map.put("itemSize", pageInfo.getList().size());
|
||||
map.put("stationInfos", pageInfo.getList());
|
||||
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站中空闲桩数量
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryFreePileNumber(NXJTQueryStationInfoDTO dto) {
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
long stationId = Long.parseLong(dto.getStationId());
|
||||
List<ConnectorInfoVO> connectorList = pileConnectorInfoService.getUniAppConnectorList(stationId);
|
||||
// 先根据pileSn分组,获取设备总数
|
||||
List<String> pileSnList = connectorList.stream()
|
||||
.map(ConnectorInfoVO::getPileSn)
|
||||
.collect(Collectors.toList());
|
||||
// 根据枪口编号批量查询枪口状态
|
||||
Map<String, Integer> pileTypeNum = pileConnectorInfoService.getPileTypeNum(stationId);
|
||||
// Integer fastTotal = pileTypeNum.get("fastTotal");// 快充总数
|
||||
Integer fastFree = pileTypeNum.get("fastFree"); // 快充空闲
|
||||
// Integer slowTotal = pileTypeNum.get("slowTotal");// 慢充总数
|
||||
Integer slowFree = pileTypeNum.get("slowFree");// 慢充空闲
|
||||
|
||||
int freePileNumber = fastFree + slowFree; // 总空闲数量 = 快充空闲 + 慢充空闲
|
||||
int pileNumber = pileSnList.size(); // 总设备数 就是桩号集合的长度
|
||||
|
||||
// 拼装参数
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("pileNum", pileNumber);
|
||||
map.put("freePileNum", freePileNumber);
|
||||
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryOrdersInfo(NXJTQueryOrdersInfoDTO dto) {
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// 分页
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
// 根据车牌号查询消费情况
|
||||
List<OrderVO> orderVOList = orderBasicInfoService.getOrderInfoByLicensePlateNumber(dto.getLicensePlateNumber());
|
||||
PageInfo<OrderVO> pageInfo = new PageInfo<>(orderVOList);
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("pageNo", pageInfo.getPageNum());
|
||||
map.put("pageCount", pageInfo.getPages());
|
||||
map.put("itemSize", pageInfo.getList().size());
|
||||
map.put("orderInfos", pageInfo.getList());
|
||||
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
|
||||
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user