update 修改站点运营商时将此站点下所有桩的运营商也进行修改

This commit is contained in:
Lemon
2023-07-04 16:38:45 +08:00
parent 3ea5589592
commit 196f412473
5 changed files with 44 additions and 1 deletions

View File

@@ -153,4 +153,10 @@ public interface PileBasicInfoMapper {
List<PileBasicInfo> getPileListByStationId(@Param("stationId") String stationId);
List<PileInfoVO> queryPileDetailList(@Param("stationIdList") List<String> stationIdList);
/**
* 批量修改充电桩运营商
* @param oldMerchantId
*/
void updatePileMerchantBatch(@Param("oldMerchantId") String oldMerchantId, @Param("newMerchantId") String newMerchantId);
}

View File

@@ -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<PileBasicInfo> getPileListByStationId(String stationId);
List<PileInfoVO> queryPileDetailList(List<String> stationIdList);
/**
* 批量修改充电桩运营商
* @param oldMerchantId
*/
void updatePileMerchantBatch(String oldMerchantId, String newMerchantId);
}

View File

@@ -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<PileInfoVO> queryPileDetailList(List<String> stationIdList) {
return pileBasicInfoMapper.queryPileDetailList(stationIdList);
}
/**
* 批量修改充电桩运营商
* @param oldMerchantId
*/
@Override
public void updatePileMerchantBatch(String oldMerchantId, String newMerchantId) {
pileBasicInfoMapper.updatePileMerchantBatch(oldMerchantId, newMerchantId);
}
}

View File

@@ -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<PileBasicInfo> 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) {