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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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<String> thirdPartyTypes;
|
||||
}
|
||||
@@ -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<StationInfoVO> selectStationList(String thirdPlatformType);
|
||||
|
||||
List<ThirdPartyStationRelation> selectRelationListByStationId(String stationId);
|
||||
|
||||
int insertOrUpdateSelective(ThirdPartyStationRelation thirdPartyStationRelation);
|
||||
|
||||
int batchInsert(List<ThirdPartyStationRelation> list);
|
||||
}
|
||||
|
||||
@@ -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<ThirdPartyStationRelation> selectThirdPartyStationRelationList(ThirdPartyStationRelation thirdPartyStationRelation);
|
||||
|
||||
List<ThirdPartyStationRelation> selectRelationListByStationId(String stationId);
|
||||
|
||||
List<ThirdPartyStationRelation> 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);
|
||||
|
||||
/**
|
||||
* 批量删除站点、第三方推送平台配置对应
|
||||
|
||||
@@ -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<ThirdPartyStationRelation> selectRelationListByStationId(String stationId) {
|
||||
return thirdPartyStationRelationMapper.selectRelationListByStationId(stationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThirdPartyStationRelation> 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<String> thirdPartyTypes = dto.getThirdPartyTypes();
|
||||
if (StringUtils.isBlank(stationId) || CollectionUtils.isEmpty(thirdPartyTypes)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
// 删除现有的所有站点与第三方平台的活跃关系
|
||||
thirdPartyStationRelationMapper.deleteThirdPartyStationRelationByStationId(stationId);
|
||||
List<ThirdPartyStationRelation> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,19 +15,6 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectThirdPartyStationRelationVo">
|
||||
select id,
|
||||
station_id,
|
||||
third_party_type,
|
||||
start_mode,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
del_flag
|
||||
from thirdparty_station_relation
|
||||
</sql>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
station_id,
|
||||
@@ -40,6 +27,11 @@
|
||||
del_flag
|
||||
</sql>
|
||||
|
||||
<sql id="selectThirdPartyStationRelationVo">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from thirdparty_station_relation
|
||||
</sql>
|
||||
|
||||
<select id="selectThirdPartyStationRelationList" parameterType="com.jsowell.pile.domain.ThirdPartyStationRelation"
|
||||
resultMap="ThirdPartyStationRelationResult">
|
||||
<include refid="selectThirdPartyStationRelationVo"/>
|
||||
@@ -159,6 +151,25 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteThirdPartyStationRelationByStationId">
|
||||
delete
|
||||
from thirdparty_station_relation
|
||||
where station_id = #{stationId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into thirdparty_station_relation
|
||||
(station_id, third_party_type, start_mode, create_time, create_by, update_time, update_by,
|
||||
del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.stationId,jdbcType=INTEGER}, #{item.thirdPartyType,jdbcType=VARCHAR}, #{item.startMode,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateBy,jdbcType=VARCHAR}, #{item.delFlag,jdbcType=CHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectRelationInfo" resultType="com.jsowell.pile.vo.base.ThirdPartyStationRelationVO">
|
||||
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}
|
||||
</select>
|
||||
|
||||
<select id="selectRelationListByStationId" resultMap="ThirdPartyStationRelationResult">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from thirdparty_station_relation
|
||||
where station_id = #{stationId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ThirdPartyStationRelation" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into thirdparty_station_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
station_id,
|
||||
</if>
|
||||
<if test="thirdPartyType != null">
|
||||
third_party_type,
|
||||
</if>
|
||||
<if test="startMode != null">
|
||||
start_mode,
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag,
|
||||
</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
#{stationId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="thirdPartyType != null">
|
||||
#{thirdPartyType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="startMode != null">
|
||||
#{startMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
#{delFlag,jdbcType=CHAR},
|
||||
</if>
|
||||
</trim>
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="stationId != null">
|
||||
station_id = #{stationId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="thirdPartyType != null">
|
||||
third_party_type = #{thirdPartyType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="startMode != null">
|
||||
start_mode = #{startMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user