|
@@ -9,10 +9,7 @@ import com.bootdo.datas.dao.GyUnitDao;
|
|
import com.bootdo.datas.domain.*;
|
|
import com.bootdo.datas.domain.*;
|
|
import com.bootdo.datas.dto.ExamineLogDTO;
|
|
import com.bootdo.datas.dto.ExamineLogDTO;
|
|
import com.bootdo.datas.dto.GyDataImportDTO;
|
|
import com.bootdo.datas.dto.GyDataImportDTO;
|
|
-import com.bootdo.datas.service.ExamineLogService;
|
|
|
|
-import com.bootdo.datas.service.GyDataService;
|
|
|
|
-import com.bootdo.datas.service.MessageHuNanService;
|
|
|
|
-import com.bootdo.datas.service.MessageService;
|
|
|
|
|
|
+import com.bootdo.datas.service.*;
|
|
import com.bootdo.datas.tools.ExcelUtils;
|
|
import com.bootdo.datas.tools.ExcelUtils;
|
|
import com.bootdo.datas.tools.gm.FileCryptTool;
|
|
import com.bootdo.datas.tools.gm.FileCryptTool;
|
|
import com.bootdo.system.domain.RoleDO;
|
|
import com.bootdo.system.domain.RoleDO;
|
|
@@ -35,6 +32,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.function.Function;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Transactional
|
|
@Transactional
|
|
@@ -65,6 +64,8 @@ public class GyDataServiceImpl implements GyDataService {
|
|
private RoleService roleService;
|
|
private RoleService roleService;
|
|
@Autowired
|
|
@Autowired
|
|
private MessageHuNanService messageHuNanService;
|
|
private MessageHuNanService messageHuNanService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private GyDataUnitService gyDataUnitService;
|
|
|
|
|
|
private static Logger log = LoggerFactory.getLogger(GyDataServiceImpl.class);
|
|
private static Logger log = LoggerFactory.getLogger(GyDataServiceImpl.class);
|
|
|
|
|
|
@@ -99,8 +100,45 @@ public class GyDataServiceImpl implements GyDataService {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ return this.dealDataWithCompany(gyDataDao.list(map));
|
|
|
|
+ }
|
|
|
|
|
|
- return gyDataDao.list(map);
|
|
|
|
|
|
+ /***
|
|
|
|
+ * 处理查询出来的数据绑定企业信息
|
|
|
|
+ * @param list
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ List<GyDataImportDTO> dealDataWithCompany(List<GyDataImportDTO> list){
|
|
|
|
+ // 使用Stream提取所有dataId
|
|
|
|
+ List<Long> dataIds = list.stream()
|
|
|
|
+ .map(GyDataImportDTO::getId)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ // 一次性获取所有关联的单位信息并转换为Map以提高查询效率
|
|
|
|
+ Map<Long, GyDataUnitDO> unitMap = gyDataUnitService.getByDataIds(dataIds).stream()
|
|
|
|
+ .collect(Collectors.toMap(GyDataUnitDO::getDataId, Function.identity()));
|
|
|
|
+
|
|
|
|
+ // 遍历DTO列表,设置单位信息
|
|
|
|
+ list.forEach(dto -> {
|
|
|
|
+ GyDataUnitDO unitDO = unitMap.get(dto.getId());
|
|
|
|
+ if (unitDO != null) {
|
|
|
|
+ dto.setReporterUnit(unitDO.getReporterUnit());
|
|
|
|
+ dto.setCreditCode(unitDO.getCreditCode());
|
|
|
|
+ dto.setSupervisoryOrg(unitDO.getSupervisoryOrg());
|
|
|
|
+ dto.setUnitCharacter(unitDO.getUnitCharacter());
|
|
|
|
+ dto.setIndustryTypeOne(unitDO.getIndustryTypeOne());
|
|
|
|
+ dto.setIndustryTypeTwo(unitDO.getIndustryTypeTwo());
|
|
|
|
+ dto.setUnitProvince(unitDO.getUnitProvince());
|
|
|
|
+ dto.setUnitCity(unitDO.getUnitCity());
|
|
|
|
+ dto.setUnitMan(unitDO.getUnitMan());
|
|
|
|
+ dto.setUnitOffice(unitDO.getUnitOffice());
|
|
|
|
+ dto.setDataSecurityMan(unitDO.getDataSecurityMan());
|
|
|
|
+ dto.setDataSecurityOffice(unitDO.getDataSecurityOffice());
|
|
|
|
+ dto.setDataSecurityWay(unitDO.getDataSecurityWay());
|
|
|
|
+ dto.setUpdateTime(unitDO.getUpdateTime());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -293,19 +331,19 @@ public class GyDataServiceImpl implements GyDataService {
|
|
}
|
|
}
|
|
log.info("===========4============="+i);
|
|
log.info("===========4============="+i);
|
|
//所属省份
|
|
//所属省份
|
|
- String dataProvince = row.getCell(18).getStringCellValue();
|
|
|
|
- String dataCity = row.getCell(19).getStringCellValue();
|
|
|
|
|
|
+ String dataProvince = this.getCellValue_String(row,18);
|
|
|
|
+ String dataCity = this.getCellValue_String(row,19);
|
|
|
|
|
|
// 当非管理员导入的数据为非本省的数据的时候 跳过当前数据 并记录
|
|
// 当非管理员导入的数据为非本省的数据的时候 跳过当前数据 并记录
|
|
if (StringUtils.isEmpty(dataProvince) || (!StringUtils.isEmpty(userProvince)) && !dataProvince.equals(userProvince)) {
|
|
if (StringUtils.isEmpty(dataProvince) || (!StringUtils.isEmpty(userProvince)) && !dataProvince.equals(userProvince)) {
|
|
- log.info("当前用户省份: {}, 当前数据省份: {}, 数据名称: {}", userProvince, dataProvince, row.getCell(1).getStringCellValue());
|
|
|
|
|
|
+ log.info("当前用户省份: {}, 当前数据省份: {}, 数据名称: {}", userProvince, dataProvince, this.getCellValue_String(row,1));
|
|
otherProvince++;
|
|
otherProvince++;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
log.info("===========5============="+i);
|
|
log.info("===========5============="+i);
|
|
|
|
|
|
if (StringUtils.isEmpty(dataCity) || (!StringUtils.isEmpty(userCity)) && !dataCity.equals(userCity)) {
|
|
if (StringUtils.isEmpty(dataCity) || (!StringUtils.isEmpty(userCity)) && !dataCity.equals(userCity)) {
|
|
- log.info("当前用户地市: {}, 当前数据地市: {}, 数据名称: {}", userCity, dataCity, row.getCell(1).getStringCellValue());
|
|
|
|
|
|
+ log.info("当前用户地市: {}, 当前数据地市: {}, 数据名称: {}", userCity, dataCity, this.getCellValue_String(row,1));
|
|
otherCity++;
|
|
otherCity++;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -351,7 +389,7 @@ public class GyDataServiceImpl implements GyDataService {
|
|
|
|
|
|
log.info("===========9============="+i);
|
|
log.info("===========9============="+i);
|
|
//无数据导出
|
|
//无数据导出
|
|
- if ("/".equals(this.getCellValue_String(row,1)) && this.getCellValue_String(row,16) !=null && !"/".equals(row.getCell(16).getStringCellValue())) {
|
|
|
|
|
|
+ if ("/".equals(this.getCellValue_String(row,1)) && this.getCellValue_String(row,16) !=null && !"/".equals(this.getCellValue_String(row,16))) {
|
|
|
|
|
|
log.info("===========10============="+i);
|
|
log.info("===========10============="+i);
|
|
int count = gyUnitDao.getGyUnit(this.createGyUnitDO(gyUnitDO,row));
|
|
int count = gyUnitDao.getGyUnit(this.createGyUnitDO(gyUnitDO,row));
|
|
@@ -780,6 +818,7 @@ public class GyDataServiceImpl implements GyDataService {
|
|
return gyDataDao.countRecover(map);
|
|
return gyDataDao.countRecover(map);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
@Override
|
|
@Override
|
|
public int recover(Long id) {
|
|
public int recover(Long id) {
|
|
GyDataImportDTO gyDataImportDTO = gyDataDao.getRecoverData(id);
|
|
GyDataImportDTO gyDataImportDTO = gyDataDao.getRecoverData(id);
|
|
@@ -811,8 +850,9 @@ public class GyDataServiceImpl implements GyDataService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- return gyDataDao.recover(id, auditStage);
|
|
|
|
|
|
+ int result = gyDataDao.recover(id, auditStage);
|
|
|
|
+ gyDataUnitService.deleteByDataId(id);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -871,7 +911,7 @@ public class GyDataServiceImpl implements GyDataService {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- return gyDataDao.list(map);
|
|
|
|
|
|
+ return this.dealDataWithCompany(gyDataDao.list(map));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|