数据同步,新增电站
This commit is contained in:
@@ -146,11 +146,11 @@ public class TerminalBaseController extends BaseController {
|
||||
@ApiOperation("终端/母线/监测点同步操作")
|
||||
@OperateInfo(operateType = OperateType.ADD, info = LogEnum.BUSINESS_MEDIUM)
|
||||
@PostMapping("terminalSync")
|
||||
public HttpResult<Object> terminalSync(@Valid @RequestBody SyncTerminalParam syncTerminalParam) {
|
||||
public HttpResult<String> terminalSync(@Valid @RequestBody SyncTerminalParam syncTerminalParam) {
|
||||
String methodDescribe = getMethodDescribe("terminalSync");
|
||||
|
||||
terminalBaseService.terminalSync(syncTerminalParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
String subtation = terminalBaseService.terminalSync(syncTerminalParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subtation, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -242,5 +242,5 @@ public interface TerminalBaseService {
|
||||
* @Author: clam
|
||||
* @Date: 2024/5/29
|
||||
*/
|
||||
boolean terminalSync(SyncTerminalParam syncTerminalParam);
|
||||
String terminalSync(SyncTerminalParam syncTerminalParam);
|
||||
}
|
||||
|
||||
@@ -1812,7 +1812,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean terminalSync(SyncTerminalParam syncTerminalParam) {
|
||||
public String terminalSync(SyncTerminalParam syncTerminalParam) {
|
||||
String projectIndex = null;
|
||||
String provinceIndex = null;
|
||||
String gdIndex = null;
|
||||
@@ -1847,17 +1847,21 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
//变电站 todo 可能新建电站
|
||||
if (Objects.nonNull(syncTerminalParam.getSubStationParam())) {
|
||||
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
|
||||
Line subStation = assembleLine(syncTerminalParam.getSubStationParam().getName(), LineBaseEnum.SUB_LEVEL.getCode(), gdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex, syncTerminalParam.getSubStationParam().getSort());
|
||||
this.baseMapper.insert(subStation);
|
||||
subIndex = subStation.getId();
|
||||
Line substation = this.lambdaQuery().eq(Line::getName, syncTerminalParam.getSubStationParam().getName()).one();
|
||||
if(Objects.isNull(substation)){
|
||||
Line subStation = assembleLine(syncTerminalParam.getSubStationParam().getName(), LineBaseEnum.SUB_LEVEL.getCode(), gdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex, syncTerminalParam.getSubStationParam().getSort());
|
||||
this.baseMapper.insert(subStation);
|
||||
subIndex = subStation.getId();
|
||||
|
||||
//变电站下的经纬度入库
|
||||
Substation sub = new Substation();
|
||||
sub.setId(subIndex);
|
||||
sub.setScale(syncTerminalParam.getSubStationParam().getScale());
|
||||
sub.setLng(syncTerminalParam.getSubStationParam().getLng());
|
||||
sub.setLat(syncTerminalParam.getSubStationParam().getLat());
|
||||
substationMapper.insert(sub);
|
||||
}
|
||||
|
||||
//变电站下的经纬度入库
|
||||
Substation sub = new Substation();
|
||||
sub.setId(subIndex);
|
||||
sub.setScale(syncTerminalParam.getSubStationParam().getScale());
|
||||
sub.setLng(syncTerminalParam.getSubStationParam().getLng());
|
||||
sub.setLat(syncTerminalParam.getSubStationParam().getLat());
|
||||
substationMapper.insert(sub);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1977,7 +1981,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
deptLine.setLineId(line.getId());
|
||||
deptLineMapper.insert(deptLine);
|
||||
|
||||
return true;
|
||||
return subIndex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user