fix:
1.完成查询所有反应堆功能 2.优化导入解析的任务数据功能
This commit is contained in:
parent
e4fbc2fe69
commit
b865647b14
|
|
@ -32,4 +32,11 @@ public class StationDataController {
|
|||
return Result.OK(stationDataService.getAllNuclearfacility());
|
||||
}
|
||||
|
||||
@AutoLog(value = "查询所有反应堆")
|
||||
@Operation(summary = "查询所有反应堆")
|
||||
@GetMapping("getAllResearchReactors")
|
||||
public Result<?> getAllResearchReactors(){
|
||||
return Result.OK(stationDataService.getAllResearchReactors());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,10 @@ public interface StationDataService {
|
|||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getAllNuclearFacilitiesAndReactors();
|
||||
|
||||
/**
|
||||
* 查询所有反应堆
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getAllResearchReactors();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,9 @@ import org.jeecg.common.util.CoordinateTransformUtil;
|
|||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclearReactors;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclearfacility;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsResearchReactors;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsStations;
|
||||
import org.jeecg.modules.base.mapper.GardsNuclearReactorsMapper;
|
||||
import org.jeecg.modules.base.mapper.GardsNuclearfacilityMapper;
|
||||
import org.jeecg.modules.base.mapper.GardsStationsMapper;
|
||||
import org.jeecg.modules.base.mapper.GardsXeResultMapper;
|
||||
import org.jeecg.modules.base.mapper.*;
|
||||
import org.jeecg.service.StationDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -30,6 +28,7 @@ public class StationDataServiceImpl implements StationDataService {
|
|||
|
||||
private final GardsStationsMapper stationsMapper;
|
||||
private final GardsNuclearReactorsMapper nuclearReactorsMapper;
|
||||
private final GardsResearchReactorsMapper researchReactorsMapper;
|
||||
private final GardsXeResultMapper gardsXeResultMapper;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
|
@ -125,4 +124,33 @@ public class StationDataServiceImpl implements StationDataService {
|
|||
return stationsMapper.getAllNuclearFacilitiesAndReactors();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有反应堆
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getAllResearchReactors() {
|
||||
List<GardsResearchReactors> researchReactors;
|
||||
if(redisUtil.hasKey(CommonConstant.ALL_RESEARCH_REACTORS)){
|
||||
researchReactors = (List<GardsResearchReactors>) redisUtil.get(CommonConstant.ALL_RESEARCH_REACTORS);
|
||||
}else {
|
||||
researchReactors = researchReactorsMapper.selectList(new LambdaQueryWrapper<>());
|
||||
redisUtil.set(CommonConstant.ALL_RESEARCH_REACTORS,researchReactors);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(researchReactors)) {
|
||||
List<Map<String,Object>> result = new ArrayList<>();
|
||||
researchReactors.forEach(researchReactor -> {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("id",researchReactor.getId());
|
||||
map.put("unitName",researchReactor.getFacilityName());
|
||||
map.put("lonValue",researchReactor.getLongitude());
|
||||
map.put("latValue",researchReactor.getLatitude());
|
||||
result.add(map);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -846,19 +846,25 @@ public class TransportTaskServiceImpl extends ServiceImpl<TransportTaskMapper,Tr
|
|||
info.add("上传文件必须为.xlsx格式的excel文件");
|
||||
return info;
|
||||
}
|
||||
Workbook workBook = new XSSFWorkbook(file.getInputStream());
|
||||
//封装任务
|
||||
TransportTask transportTask = new TransportTask();
|
||||
this.handleTaskBaseInfo(transportTask,workBook,info);
|
||||
this.handleSiteReleaseInfo(transportTask,workBook,info);
|
||||
TransactionStatus transaction = transactionManager.getTransaction(transactionDefinition);
|
||||
Workbook workBook = null;
|
||||
TransactionStatus transactionStatus = null;
|
||||
try{
|
||||
workBook = new XSSFWorkbook(file.getInputStream());
|
||||
//封装任务
|
||||
TransportTask transportTask = new TransportTask();
|
||||
this.handleTaskBaseInfo(transportTask,workBook,info);
|
||||
this.handleSiteReleaseInfo(transportTask,workBook,info);
|
||||
//此处属于内部调用create函数的事务注解不会生效,所以用手动事务
|
||||
transactionStatus = transactionManager.getTransaction(transactionDefinition);
|
||||
this.cteate(transportTask);
|
||||
transactionManager.commit(transaction);
|
||||
transactionManager.commit(transactionStatus);
|
||||
}catch (Exception e){
|
||||
transactionManager.rollback(transaction);
|
||||
transactionManager.rollback(transactionStatus);
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if (Objects.nonNull(workBook)){
|
||||
workBook.close();
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user