| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements ISiteService { |
| | | |
| | | @Resource |
| | | private TChargingGunService chargingGunService; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置站点计费策略 |
| | | * @param id 站点id |
| | | * @param accountingStrategyId 计费策略id |
| | | */ |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public void setAccountingStrategy(Integer id, Integer accountingStrategyId) { |
| | | Site site = this.getById(id); |
| | | site.setAccountingStrategyId(accountingStrategyId); |
| | | this.updateById(site); |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, id).eq(TChargingGun::getDelFlag, 0)); |
| | | for (TChargingGun tChargingGun : list) { |
| | | tChargingGun.setChargingPileId(accountingStrategyId); |
| | | } |
| | | chargingGunService.updateBatchById(list); |
| | | } |
| | | } |