mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-21 15:49:47 +08:00
update 移动充电桩到另一个站点 接口
This commit is contained in:
@@ -177,4 +177,6 @@ public interface PileBasicInfoMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PileDetailInfoVO> getPileDetailInfoList(String stationId);
|
List<PileDetailInfoVO> getPileDetailInfoList(String stationId);
|
||||||
|
|
||||||
|
int movePile2AnotherStation(ReplaceMerchantStationDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1324,17 +1324,23 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
String newStationId = dto.getNewStationId();
|
String newStationId = dto.getNewStationId();
|
||||||
String stationId = dto.getStationId();
|
String stationId = dto.getStationId();
|
||||||
List<String> pileSnList = dto.getPileSnList();
|
List<String> pileSnList = dto.getPileSnList();
|
||||||
|
if (StringUtils.isBlank(newStationId) || CollectionUtils.isEmpty(pileSnList)) {
|
||||||
|
log.error("移动桩到其他站点 参数不能为空");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// 查询新站点正在使用中的计费模板
|
// 查询新站点正在使用中的计费模板
|
||||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.queryUsedBillingTemplateForEV(newStationId);
|
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.queryUsedBillingTemplateForEV(newStationId);
|
||||||
// 对比传来的新站点id与现在桩的站点id是否相等
|
// 对比传来的新站点id与现在桩的站点id是否相等
|
||||||
if (StringUtils.equals(newStationId, stationId)) {
|
if (StringUtils.equals(newStationId, stationId)) {
|
||||||
// 相等,则不修改
|
// 相等,则不修改
|
||||||
|
log.info("移动桩到其他站点 新站点id 与旧站点id 相等,不作修改");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dto.setUpdateBy(SecurityUtils.getUsername());
|
dto.setUpdateBy(SecurityUtils.getUsername());
|
||||||
dto.setUpdateTime(DateUtils.getNowDate());
|
dto.setUpdateTime(DateUtils.getNowDate());
|
||||||
// 修改数据库中桩信息
|
// 修改数据库中桩信息
|
||||||
int num = pileBasicInfoMapper.replaceMerchantStationByPileIds(dto);
|
// int num = pileBasicInfoMapper.replaceMerchantStationByPileIds(dto);
|
||||||
|
int num = pileBasicInfoMapper.movePile2AnotherStation(dto);
|
||||||
// 异步向桩下发新站点的计费模板
|
// 异步向桩下发新站点的计费模板
|
||||||
for (String pileSn : pileSnList) {
|
for (String pileSn : pileSnList) {
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
|||||||
@@ -237,8 +237,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<update id="replaceMerchantStationByPileIds">
|
<update id="replaceMerchantStationByPileIds">
|
||||||
update pile_basic_info
|
update pile_basic_info
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="newMerchantId != null">merchant_id = #{newMerchantId},</if>
|
<if test="merchantId != null">merchant_id = #{merchantId},</if>
|
||||||
<if test="newStationId != null">station_id = #{newStationId},</if>
|
<if test="stationId != null">station_id = #{stationId},</if>
|
||||||
<if test="chargerPileType != null">
|
<if test="chargerPileType != null">
|
||||||
business_type = #{chargerPileType,jdbcType=VARCHAR},
|
business_type = #{chargerPileType,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@@ -476,4 +476,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
WHERE
|
WHERE
|
||||||
t1.station_id = #{stationId,jdbcType=VARCHAR}
|
t1.station_id = #{stationId,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="movePile2AnotherStation" resultType="int">
|
||||||
|
update pile_basic_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="newMerchantId != null">merchant_id = #{newMerchantId},</if>
|
||||||
|
<if test="newStationId != null">station_id = #{newStationId},</if>
|
||||||
|
<if test="chargerPileType != null">
|
||||||
|
business_type = #{chargerPileType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="chargerPileType == '1'.toString() "> secret_key = null,</if>
|
||||||
|
<if test="chargerPileType == '2'.toString() "> secret_key = substring(uuid(), 1, 8),</if>
|
||||||
|
<if test="modelId != null">model_id = #{modelId},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id in
|
||||||
|
<foreach collection="pileIdList" item="pileId" open="(" separator="," close=")">
|
||||||
|
#{pileId,jdbcType=BIGINT}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user