mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 联联接口返回值加密
This commit is contained in:
@@ -16,6 +16,7 @@ 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.SignUtils;
|
||||
import com.jsowell.thirdparty.lianlian.vo.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -360,8 +361,9 @@ public class LianLianController extends BaseController {
|
||||
String dataStr = new String(plainText, "UTF-8");
|
||||
// 转换成相应对象
|
||||
QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class);
|
||||
LianLianPageResponse response = lianLianService.query_stations_info(queryStationInfoDTO);
|
||||
return CommonResult.success(response);
|
||||
Map<String, String> map = lianLianService.query_stations_info(dto.getOperatorID(), queryStationInfoDTO);
|
||||
|
||||
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface LianLianService {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
LianLianPageResponse query_stations_info(QueryStationInfoDTO dto);
|
||||
Map<String, String> query_stations_info(String operatorId, QueryStationInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 设备接口状态查询
|
||||
|
||||
@@ -211,7 +211,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LianLianPageResponse query_stations_info(QueryStationInfoDTO dto) {
|
||||
public Map<String, String> query_stations_info(String operatorId, QueryStationInfoDTO dto) {
|
||||
List<StationInfo> resultList = new ArrayList<>();
|
||||
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
@@ -222,6 +222,10 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
// 未查到数据
|
||||
return null;
|
||||
}
|
||||
DockingPlatformConfig configInfo = dockingPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
}
|
||||
PageInfo<PileStationInfo> pageInfo = new PageInfo<>(stationInfos);
|
||||
for (PileStationInfo pileStationInfo : pageInfo.getList()) {
|
||||
StationInfo stationInfo = new StationInfo();
|
||||
@@ -272,7 +276,19 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
.ItemSize(resultList.size())
|
||||
.list(resultList)
|
||||
.build();
|
||||
return pageResponse;
|
||||
// 加密
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(pageResponse).getBytes(),
|
||||
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||
String encryptData = Encodes.encodeBase64(encryptText);
|
||||
|
||||
resultMap.put("Data", encryptData);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user