This commit is contained in:
Lemon
2024-01-18 14:31:07 +08:00
parent 50d0873a68
commit 475917d2d4
3 changed files with 177 additions and 4 deletions

View File

@@ -36,10 +36,10 @@ spring:
druid:
# 主库数据源
master:
# url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: jsowell_dev
url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: jsowell_prd_copy
url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: jsowell_dev
# url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: jsowell_prd_copy
password: 123456
# 从库数据源
slave:

View File

@@ -0,0 +1,47 @@
package com.jsowell.thirdparty.hainan.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* TODO
*
* @author Lemon
* @Date 2024/1/18 13:58:10
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HNStationInfo extends ZDLStationInfo {
/**
* 站点照片
*/
@JSONField(name = "Pictures")
private List<String> pictures;
/**
* 电费描述
*/
@JSONField(name = "ElectricityFee")
private String electricityFee;
/**
* 服务费描述
*/
@JSONField(name = "ServiceFee")
private String serviceFee;
/**
* 停车费描述
*/
@JSONField(name = "ParkFee")
private String parkFee;
}

View File

@@ -0,0 +1,126 @@
package com.jsowell.thirdparty.hainan.service;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.PileBillingTemplateService;
import com.jsowell.pile.service.PileStationInfoService;
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
import com.jsowell.thirdparty.hainan.domain.HNStationInfo;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* TODO
*
* @author Lemon
* @Date 2024/1/18 10:05:23
*/
@Service
public class HaiNanChargeService {
@Autowired
private ZDLService zdlService;
@Autowired
private PileStationInfoService pileStationInfoService;
@Autowired
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
@Autowired
private PileBillingTemplateService pileBillingTemplateService;
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
List<HNStationInfo> resultList = new ArrayList<>();
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
PageUtils.startPage(pageNo, pageSize);
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto);
if (CollectionUtils.isEmpty(stationInfos)) {
// 未查到数据
return null;
}
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
if (configInfo == null) {
return null;
}
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
HNStationInfo stationInfo = new HNStationInfo();
stationInfo.setStationId(String.valueOf(pileStationInfo.getId()));
stationInfo.setOperatorId(Constants.OPERATORID_JIANG_SU); // 组织机构代码
String organizationCode = pileStationInfo.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
stationInfo.setEquipmentOwnerId(equipmentOwnerId);
}else {
stationInfo.setEquipmentOwnerId(Constants.OPERATORID_JIANG_SU);
}
stationInfo.setStationName(pileStationInfo.getStationName());
stationInfo.setCountryCode(pileStationInfo.getCountryCode());
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
// 根据逗号分组
String[] split = StringUtils.split(areaCode, ",");
// 只取最后一部分 330213
String subAreaCode = split[split.length - 1];
stationInfo.setAreaCode(subAreaCode);
stationInfo.setAddress(pileStationInfo.getAddress());
stationInfo.setServiceTel(pileStationInfo.getStationTel());
stationInfo.setStationType(Integer.parseInt(pileStationInfo.getStationType()));
stationInfo.setStationStatus(Integer.parseInt(pileStationInfo.getStationStatus()));
stationInfo.setParkNums(Integer.parseInt(pileStationInfo.getParkNums()));
stationInfo.setStationLng(new BigDecimal(pileStationInfo.getStationLng()));
stationInfo.setStationLat(new BigDecimal(pileStationInfo.getStationLat()));
stationInfo.setConstruction(Integer.parseInt(pileStationInfo.getConstruction()));
// 停车费率描述
if (StringUtils.isNotBlank(pileStationInfo.getParkFeeDescribe())) {
stationInfo.setParkFee(pileStationInfo.getParkFeeDescribe());
}
// 站点图片
if (StringUtils.isNotBlank(pileStationInfo.getPictures())) {
stationInfo.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(",")));
}
// 查询计费模板详情
List<BillingPriceVO> billingPriceVOList = pileBillingTemplateService.queryBillingPrice(String.valueOf(pileStationInfo.getId()));
if (CollectionUtils.isEmpty(billingPriceVOList)) {
return null;
}
for (BillingPriceVO billingPriceVO : billingPriceVOList) {
}
// 电费描述
// 服务费描述
// TODO 获取桩列表
// List<ZDLEquipmentInfo> pileList = getPileList(pileStationInfo);
// if (CollectionUtils.isNotEmpty(pileList)) {
// stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
// }
resultList.add(stationInfo);
}
return null;
}
}