From 475917d2d4805da6224b2f3c772e5aa2c6d2a976 Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 18 Jan 2024 14:31:07 +0800 Subject: [PATCH] update --- .../src/main/resources/application-dev.yml | 8 +- .../hainan/domain/HNStationInfo.java | 47 +++++++ .../hainan/service/HaiNanChargeService.java | 126 ++++++++++++++++++ 3 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/domain/HNStationInfo.java create mode 100644 jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/service/HaiNanChargeService.java diff --git a/jsowell-admin/src/main/resources/application-dev.yml b/jsowell-admin/src/main/resources/application-dev.yml index 248424319..01a6c12db 100644 --- a/jsowell-admin/src/main/resources/application-dev.yml +++ b/jsowell-admin/src/main/resources/application-dev.yml @@ -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: diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/domain/HNStationInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/domain/HNStationInfo.java new file mode 100644 index 000000000..23e8189f0 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/domain/HNStationInfo.java @@ -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 pictures; + + /** + * 电费描述 + */ + @JSONField(name = "ElectricityFee") + private String electricityFee; + + /** + * 服务费描述 + */ + @JSONField(name = "ServiceFee") + private String serviceFee; + + /** + * 停车费描述 + */ + @JSONField(name = "ParkFee") + private String parkFee; + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/service/HaiNanChargeService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/service/HaiNanChargeService.java new file mode 100644 index 000000000..79373e95b --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/hainan/service/HaiNanChargeService.java @@ -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 queryStationsInfo(QueryStationInfoDTO dto) { + List resultList = new ArrayList<>(); + int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo(); + int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize(); + + PageUtils.startPage(pageNo, pageSize); + List stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto); + if (CollectionUtils.isEmpty(stationInfos)) { + // 未查到数据 + return null; + } + ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); + if (configInfo == null) { + return null; + } + PageInfo 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 billingPriceVOList = pileBillingTemplateService.queryBillingPrice(String.valueOf(pileStationInfo.getId())); + if (CollectionUtils.isEmpty(billingPriceVOList)) { + return null; + } + for (BillingPriceVO billingPriceVO : billingPriceVOList) { + + } + + // 电费描述 + // 服务费描述 + + // TODO 获取桩列表 + // List pileList = getPileList(pileStationInfo); + // if (CollectionUtils.isNotEmpty(pileList)) { + // stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 + // } + + resultList.add(stationInfo); + } + + + return null; + } + +}