|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.zsElectric.boot.charging.entity.*;
|
|
import com.zsElectric.boot.charging.entity.*;
|
|
|
import com.zsElectric.boot.business.mapper.FirmInfoMapper;
|
|
import com.zsElectric.boot.business.mapper.FirmInfoMapper;
|
|
@@ -21,6 +22,8 @@ import com.zsElectric.boot.business.model.query.ThirdPartyStationInfoQuery;
|
|
|
import com.zsElectric.boot.business.model.vo.PartyStationInfoVO;
|
|
import com.zsElectric.boot.business.model.vo.PartyStationInfoVO;
|
|
|
import com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO;
|
|
import com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO;
|
|
|
import com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO;
|
|
import com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO;
|
|
|
|
|
+import com.zsElectric.boot.business.model.vo.StationDetailVO;
|
|
|
|
|
+import com.zsElectric.boot.business.model.dto.StationDetailDTO;
|
|
|
import com.zsElectric.boot.business.service.ThirdPartyChargingService;
|
|
import com.zsElectric.boot.business.service.ThirdPartyChargingService;
|
|
|
import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
|
|
import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
|
|
|
import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
|
|
import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
|
|
@@ -184,8 +187,12 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
|
|
|
ThirdPartyStationInfo entity = new ThirdPartyStationInfo();
|
|
ThirdPartyStationInfo entity = new ThirdPartyStationInfo();
|
|
|
if (existingStation != null) {
|
|
if (existingStation != null) {
|
|
|
entity.setId(existingStation.getId());
|
|
entity.setId(existingStation.getId());
|
|
|
- // 保留原有的配置状态
|
|
|
|
|
|
|
+ // 保留原有的自有字段(不会被第三方接口覆盖)
|
|
|
entity.setPolicyConfigured(existingStation.getPolicyConfigured());
|
|
entity.setPolicyConfigured(existingStation.getPolicyConfigured());
|
|
|
|
|
+ entity.setStationTips(existingStation.getStationTips());
|
|
|
|
|
+ entity.setOwnBusinessHours(existingStation.getOwnBusinessHours());
|
|
|
|
|
+ entity.setCustomerServiceHotline(existingStation.getCustomerServiceHotline());
|
|
|
|
|
+ entity.setBannerPictures(existingStation.getBannerPictures());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 设置字段值
|
|
// 设置字段值
|
|
@@ -692,4 +699,56 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
|
|
|
.eq(ThirdPartyStationInfo::getId, stationId)
|
|
.eq(ThirdPartyStationInfo::getId, stationId)
|
|
|
.set(ThirdPartyStationInfo::getStationTips, stationTips)) > 0;
|
|
.set(ThirdPartyStationInfo::getStationTips, stationTips)) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public StationDetailVO getStationDetail(Long stationId) {
|
|
|
|
|
+ ThirdPartyStationInfo station = stationInfoMapper.selectById(stationId);
|
|
|
|
|
+ if (station == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ StationDetailVO vo = new StationDetailVO();
|
|
|
|
|
+ vo.setId(station.getId());
|
|
|
|
|
+ vo.setStationName(station.getStationName());
|
|
|
|
|
+ vo.setStationTips(station.getStationTips());
|
|
|
|
|
+ vo.setOwnBusinessHours(station.getOwnBusinessHours());
|
|
|
|
|
+ vo.setCustomerServiceHotline(station.getCustomerServiceHotline());
|
|
|
|
|
+
|
|
|
|
|
+ // 解析banner图片JSON
|
|
|
|
|
+ if (station.getBannerPictures() != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ vo.setBannerPictures(objectMapper.readValue(station.getBannerPictures(), new TypeReference<List<String>>() {}));
|
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
|
+ log.warn("解析banner图片失败", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public boolean updateStationDetail(StationDetailDTO dto) {
|
|
|
|
|
+ ThirdPartyStationInfo station = stationInfoMapper.selectById(dto.getId());
|
|
|
|
|
+ if (station == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 转banner图片为JSON
|
|
|
|
|
+ String bannerJson = null;
|
|
|
|
|
+ if (dto.getBannerPictures() != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ bannerJson = objectMapper.writeValueAsString(dto.getBannerPictures());
|
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
|
+ log.warn("banner图片转JSON失败", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return stationInfoMapper.update(null, Wrappers.<ThirdPartyStationInfo>lambdaUpdate()
|
|
|
|
|
+ .eq(ThirdPartyStationInfo::getId, dto.getId())
|
|
|
|
|
+ .set(ThirdPartyStationInfo::getStationTips, dto.getStationTips())
|
|
|
|
|
+ .set(ThirdPartyStationInfo::getOwnBusinessHours, dto.getOwnBusinessHours())
|
|
|
|
|
+ .set(ThirdPartyStationInfo::getCustomerServiceHotline, dto.getCustomerServiceHotline())
|
|
|
|
|
+ .set(bannerJson != null, ThirdPartyStationInfo::getBannerPictures, bannerJson)) > 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|