longz
2026-07-23 cfbe78331f3f14b0c25991bddba2d3f821af52ad
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java
@@ -42,6 +42,7 @@
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.feignClient.SysUserRoleClient;
import com.ruoyi.system.api.model.SysUserRoleVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -64,8 +65,11 @@
 * @author zhibing.pu
 * @Date 2024/8/7 19:54
 */
@Slf4j
@Service
public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements ISiteService {
   static final int SITE_IMPORT_TITLE_ROWS = 1;
   
   @Resource
   private TChargingGunService chargingGunService;
@@ -182,10 +186,13 @@
      ExcelUtil<SiteExcelDTO> util = new ExcelUtil<>(SiteExcelDTO.class);
      List<SiteExcelDTO> rows;
      try (InputStream inputStream = file.getInputStream()) {
         rows = util.importExcel(inputStream, 0);
         rows = util.importExcel(inputStream, SITE_IMPORT_TITLE_ROWS);
      } catch (Exception e) {
         throw new ServiceException("Excel文件已损坏或格式不正确,请重新下载站点导入模板后填写")
         log.error("站点Excel解析失败,fileName={},size={}", file.getOriginalFilename(), file.getSize(), e);
         ServiceException exception = new ServiceException("Excel文件已损坏或格式不正确,请重新下载站点导入模板后填写")
               .setDetailMessage(e.getMessage());
         exception.initCause(e);
         throw exception;
      }
      if (rows == null || rows.isEmpty()) {
         throw new ServiceException("导入文件没有数据");
@@ -216,7 +223,7 @@
      Set<String> duplicateCodes = new LinkedHashSet<>();
      for (int i = 0; i < rows.size(); i++) {
         SiteExcelDTO row = rows.get(i);
         int rowNum = i + 2;
         int rowNum = i + SITE_IMPORT_TITLE_ROWS + 2;
         List<String> errors = validateSiteImportRow(row, partnerMap, strategyMap, regionByCode, regionById,
               roleType, objectId, fileCodes);
         String code = row == null ? null : normalizeImportValue(row.getCode());