diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java index d911d9027..a676cf177 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java @@ -153,4 +153,10 @@ public interface PileBasicInfoMapper { List getPileListByStationId(@Param("stationId") String stationId); List queryPileDetailList(@Param("stationIdList") List stationIdList); + + /** + * 批量修改充电桩运营商 + * @param oldMerchantId + */ + void updatePileMerchantBatch(@Param("oldMerchantId") String oldMerchantId, @Param("newMerchantId") String newMerchantId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBasicInfoService.java index d3d45e80b..9d60204de 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileBasicInfoService.java @@ -10,6 +10,7 @@ import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO; import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO; import com.jsowell.pile.vo.web.IndexGeneralSituationVO; import com.jsowell.pile.vo.web.PileDetailVO; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -164,4 +165,10 @@ public interface IPileBasicInfoService { List getPileListByStationId(String stationId); List queryPileDetailList(List stationIdList); + + /** + * 批量修改充电桩运营商 + * @param oldMerchantId + */ + void updatePileMerchantBatch(String oldMerchantId, String newMerchantId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 3d6735f0a..123e5d6af 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -40,6 +40,7 @@ import com.jsowell.pile.vo.web.PileModelInfoVO; import com.jsowell.pile.vo.web.SimCardVO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -658,4 +659,13 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService { public List queryPileDetailList(List stationIdList) { return pileBasicInfoMapper.queryPileDetailList(stationIdList); } + + /** + * 批量修改充电桩运营商 + * @param oldMerchantId + */ + @Override + public void updatePileMerchantBatch(String oldMerchantId, String newMerchantId) { + pileBasicInfoMapper.updatePileMerchantBatch(oldMerchantId, newMerchantId); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index f7dfcab2a..f225e10e7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -13,6 +13,7 @@ import com.jsowell.common.util.DistanceUtils; import com.jsowell.common.util.SecurityUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.ip.AddressUtils; +import com.jsowell.pile.domain.PileBasicInfo; import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.dto.FastCreateStationDTO; import com.jsowell.pile.dto.QueryStationDTO; @@ -22,9 +23,11 @@ import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.base.StationInfoVO; import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails; +import com.jsowell.pile.vo.web.PileDetailVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.system.service.SysDeptService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -262,7 +265,15 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { pileStationInfo.setUpdateBy(SecurityUtils.getUsername()); pileStationInfo.setUpdateTime(DateUtils.getNowDate()); int i = pileStationInfoMapper.updatePileStationInfo(pileStationInfo); - + // 若修改运营商,则将此站点下所有桩对应的运营商也进行修改 + if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getMerchantId()))) { + // 先查出桩基本信息 + List pileInfoList = pileBasicInfoService.getPileListByStationId(String.valueOf(pileStationInfo.getId())); + if (CollectionUtils.isNotEmpty(pileInfoList)) { + // 修改桩基本信息 + pileBasicInfoService.updatePileMerchantBatch(String.valueOf(pileInfoList.get(0).getMerchantId()), String.valueOf(pileStationInfo.getMerchantId())); + } + } // 同步组织中的名称,联系人,电话 SysDept sysDept = sysDeptService.selectDeptById(Long.parseLong(pileStationInfo.getDeptId())); if (sysDept != null) { diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml index 41abb4f02..332df82b9 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml @@ -396,4 +396,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item,jdbcType=VARCHAR} + + + update + pile_basic_info + set + merchant_id = #{newMerchantId,jdbcType=VARCHAR} + where + merchant_id = #{oldMerchantId,jdbcType=VARCHAR} + \ No newline at end of file