diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java index 3ce4de615..8e46935dc 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java @@ -18,6 +18,7 @@ import com.jsowell.pile.domain.ThirdpartyParkingConfig; import com.jsowell.pile.dto.FastCreateStationDTO; import com.jsowell.pile.dto.PushStationInfoDTO; import com.jsowell.pile.dto.QueryStationDTO; +import com.jsowell.pile.dto.ThirdPartyStationRelationDTO; import com.jsowell.pile.dto.amap.EditAmapFlagDTO; import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO; import com.jsowell.pile.service.PileStationInfoService; @@ -350,4 +351,21 @@ public class PileStationInfoController extends BaseController { logger.info("获取停车平台列表 result:{}", response); return response; } + + /** + * 更新站点与第三方平台关系 + */ + @PostMapping("/updateThirdPartyStationRelation") + public AjaxResult updateThirdPartyStationRelation(ThirdPartyStationRelationDTO dto) { + AjaxResult result; + try { + startPage(); + thirdPartyStationRelationService.updateThirdPartyStationRelation(dto); + result = AjaxResult.success(); + } catch (Exception e) { + logger.error("获取停车平台列表 error,", e); + result = AjaxResult.error(e.getMessage()); + } + return result; + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyStationRelation.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyStationRelation.java index 003f6071f..acb844e7f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyStationRelation.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/ThirdPartyStationRelation.java @@ -2,7 +2,10 @@ package com.jsowell.pile.domain; import com.jsowell.common.annotation.Excel; import com.jsowell.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -13,6 +16,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @date 2023-06-06 */ @Data +@NoArgsConstructor +@AllArgsConstructor +@Builder public class ThirdPartyStationRelation extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartyStationRelationDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartyStationRelationDTO.java new file mode 100644 index 000000000..cc3f69393 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/ThirdPartyStationRelationDTO.java @@ -0,0 +1,20 @@ +package com.jsowell.pile.dto; + +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class ThirdPartyStationRelationDTO { + /** + * 站点id + */ + private String stationId; + + /** + * 要推送的第三方平台类型数组 + */ + private List thirdPartyTypes; +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java index 18fa171d9..e1c17b82b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java @@ -35,6 +35,7 @@ public interface ThirdPartyStationRelationMapper { /** * 查询站点、第三方推送平台配置 + * * @param thirdPartyStationRelation * @return */ @@ -72,9 +73,11 @@ public interface ThirdPartyStationRelationMapper { */ public int deleteThirdPartyStationRelationByIds(Long[] ids); + int deleteThirdPartyStationRelationByStationId(String stationId); /** * 通过站点id查询该站点对接了哪些第三方平台 + * * @param stationId * @return */ @@ -82,6 +85,7 @@ public interface ThirdPartyStationRelationMapper { /** * 修改删除标识为1 + * * @param stationId * @param type * @return @@ -90,6 +94,7 @@ public interface ThirdPartyStationRelationMapper { /** * 根据第三方平台类型查询对接第三方平台的运营商列表 + * * @param thirdPlatformType * @return */ @@ -97,8 +102,15 @@ public interface ThirdPartyStationRelationMapper { /** * 根据第三方平台类型查询对接第三方平台的站点列表 + * * @param thirdPlatformType * @return */ List selectStationList(String thirdPlatformType); + + List selectRelationListByStationId(String stationId); + + int insertOrUpdateSelective(ThirdPartyStationRelation thirdPartyStationRelation); + + int batchInsert(List list); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java index 553db052b..f77bb015e 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java @@ -1,6 +1,7 @@ package com.jsowell.pile.service; import com.jsowell.pile.domain.ThirdPartyStationRelation; +import com.jsowell.pile.dto.ThirdPartyStationRelationDTO; import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.StationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; @@ -32,6 +33,8 @@ public interface ThirdPartyStationRelationService { */ public List selectThirdPartyStationRelationList(ThirdPartyStationRelation thirdPartyStationRelation); + List selectRelationListByStationId(String stationId); + List selectThirdPartyStationRelationList(String thirdPlatformType); /** @@ -73,10 +76,10 @@ public interface ThirdPartyStationRelationService { /** * 修改站点、第三方推送平台配置对应 * - * @param thirdPartyStationRelation 站点、第三方推送平台配置对应 + * @param dto 站点、第三方推送平台配置对应 * @return 结果 */ - public int updateThirdPartyStationRelation(ThirdPartyStationRelation thirdPartyStationRelation); + public int updateThirdPartyStationRelation(ThirdPartyStationRelationDTO dto); /** * 批量删除站点、第三方推送平台配置对应 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java index 87e3054a7..bfae2b065 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java @@ -1,15 +1,21 @@ package com.jsowell.pile.service.impl; +import com.google.common.collect.Lists; import com.jsowell.common.constant.Constants; +import com.jsowell.common.enums.DelFlagEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.SecurityUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ThirdPartyStationRelation; +import com.jsowell.pile.dto.ThirdPartyStationRelationDTO; import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.ThirdPartyStationRelationService; import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.StationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -67,6 +73,11 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe return thirdPartyStationRelationMapper.selectThirdPartyStationRelationList(thirdPartyStationRelation); } + @Override + public List selectRelationListByStationId(String stationId) { + return thirdPartyStationRelationMapper.selectRelationListByStationId(stationId); + } + @Override public List selectThirdPartyStationRelationList(String thirdPlatformType) { ThirdPartyStationRelation thirdPartyStationRelation = new ThirdPartyStationRelation(); @@ -132,13 +143,29 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe /** * 修改站点、第三方推送平台配置对应 * - * @param thirdPartyStationRelation 站点、第三方推送平台配置对应 + * @param dto 站点、第三方推送平台配置对应 * @return 结果 */ @Override - public int updateThirdPartyStationRelation(ThirdPartyStationRelation thirdPartyStationRelation) { - // stationSettingRelation.setUpdateTime(DateUtils.getNowDate()); - return thirdPartyStationRelationMapper.updateThirdPartyStationRelation(thirdPartyStationRelation); + public int updateThirdPartyStationRelation(ThirdPartyStationRelationDTO dto) { + String stationId = dto.getStationId(); + // 前端传过来的最新关系 + List thirdPartyTypes = dto.getThirdPartyTypes(); + if (StringUtils.isBlank(stationId) || CollectionUtils.isEmpty(thirdPartyTypes)) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } + // 删除现有的所有站点与第三方平台的活跃关系 + thirdPartyStationRelationMapper.deleteThirdPartyStationRelationByStationId(stationId); + List list = Lists.newArrayList(); + for (String thirdPartyType : thirdPartyTypes) { + ThirdPartyStationRelation build = ThirdPartyStationRelation.builder() + .stationId(Long.parseLong(stationId)) + .thirdPartyType(thirdPartyType) + .delFlag(DelFlagEnum.NORMAL.getValue()) + .build(); + list.add(build); + } + return thirdPartyStationRelationMapper.batchInsert(list); } /** diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml index 707306acc..59b17feb5 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml @@ -15,19 +15,6 @@ - - select id, - station_id, - third_party_type, - start_mode, - create_time, - create_by, - update_time, - update_by, - del_flag - from thirdparty_station_relation - - id, station_id, @@ -40,6 +27,11 @@ del_flag + + select + from thirdparty_station_relation + + select t1.station_id as stationId, t1.third_party_type as thirdPartyType, @@ -237,4 +248,89 @@ where t1.del_flag = '0' and t1.third_party_type = #{thirdPlatformType,jdbcType=VARCHAR} + + + + + + insert into thirdparty_station_relation + + + id, + + + station_id, + + + third_party_type, + + + start_mode, + + + create_by, + + + update_by, + + + del_flag, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{stationId,jdbcType=INTEGER}, + + + #{thirdPartyType,jdbcType=VARCHAR}, + + + #{startMode,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=CHAR}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + station_id = #{stationId,jdbcType=INTEGER}, + + + third_party_type = #{thirdPartyType,jdbcType=VARCHAR}, + + + start_mode = #{startMode,jdbcType=VARCHAR}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + del_flag = #{delFlag,jdbcType=CHAR}, + + + + + \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java index 587593998..00e748a74 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java @@ -433,9 +433,9 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { String urlAddress = secretInfoVO.getTheirUrlPrefix(); String url = urlAddress + "supervise_notification_station_status"; - JSONObject json = new JSONObject(); - json.put("ConnectorStatusInfo", info); - String jsonString = JSON.toJSONString(json); + // JSONObject json = new JSONObject(); + // json.put("ConnectorStatusInfo", info); + String jsonString = JSON.toJSONString(info); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); diff --git a/jsowell-ui/src/views/pile/station/detail.vue b/jsowell-ui/src/views/pile/station/detail.vue index 8d0bee98f..d4a1dbd1a 100644 --- a/jsowell-ui/src/views/pile/station/detail.vue +++ b/jsowell-ui/src/views/pile/station/detail.vue @@ -69,6 +69,9 @@ 推送站点信息 + + 推送站点信息 + @@ -385,6 +388,11 @@ export default { }); }, + // 保存站点与第三方平台关系 + saveStationThirdParty() { + + }, + // 绑定站点与停车平台配置 saveParkingSetting(parkingId) { console.log("parkingId", parkingId, this.stationId); diff --git a/jsowell-ui/src/views/thirdparty/secret/detail.vue b/jsowell-ui/src/views/thirdparty/secret/detail.vue index d3a6aa45a..b313084f2 100644 --- a/jsowell-ui/src/views/thirdparty/secret/detail.vue +++ b/jsowell-ui/src/views/thirdparty/secret/detail.vue @@ -85,13 +85,12 @@ @click="clickDrawer(item.stationId, item.stationName)">打开推送菜单 - {{ item.stationId }} - {{ item.stationName }} - + + {{ item.stationId }} + + + {{ item.stationName }} + @@ -402,4 +401,8 @@ export default { .getCard { margin-bottom: 0px; } + +.el-descriptions-item_label { + width: 100px; +}