fix: 优化倾斜摄影逻辑
This commit is contained in:
parent
fd07f94f98
commit
7650d20e13
@ -2,6 +2,8 @@ package com.yfd.platform.qgc_base.domain;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.yfd.platform.annotation.UserIdField;
|
||||||
|
import com.yfd.platform.annotation.UserNameField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -63,6 +65,9 @@ public class SdOpinfoBH implements Serializable {
|
|||||||
|
|
||||||
private String hbrvcd;
|
private String hbrvcd;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String hbrvcdName;
|
||||||
|
|
||||||
private String rvcd;
|
private String rvcd;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ -195,9 +200,6 @@ public class SdOpinfoBH implements Serializable {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date vlsrTm;
|
private Date vlsrTm;
|
||||||
|
|
||||||
@TableField("RECORD_USER")
|
|
||||||
private String recordUser;
|
|
||||||
|
|
||||||
@TableField("RECORD_TIME")
|
@TableField("RECORD_TIME")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date recordTime;
|
private Date recordTime;
|
||||||
@ -226,4 +228,14 @@ public class SdOpinfoBH implements Serializable {
|
|||||||
/** 所属站类层级(非数据库字段) */
|
/** 所属站类层级(非数据库字段) */
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer sttpTreeLevel;
|
private Integer sttpTreeLevel;
|
||||||
|
|
||||||
|
/** 创建人 */
|
||||||
|
@TableField("RECORD_USER")
|
||||||
|
@UserIdField
|
||||||
|
private String recordUser;
|
||||||
|
|
||||||
|
/** 创建人名称(非数据库字段) */
|
||||||
|
@TableField(exist = false)
|
||||||
|
@UserNameField
|
||||||
|
private String recordUserName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.yfd.platform.qgc_base.service.impl;
|
package com.yfd.platform.qgc_base.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.yfd.platform.common.DataSourceRequest;
|
||||||
@ -64,6 +65,10 @@ public class SdVdinfoBServiceImpl extends ServiceImpl<SdVdinfoBMapper, SdVdinfoB
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean add(SdVdinfoB entity, String source) {
|
public boolean add(SdVdinfoB entity, String source) {
|
||||||
|
String mntp = entity.getMntp();
|
||||||
|
if (StrUtil.isBlank(mntp)) {
|
||||||
|
entity.setMntp("实时视频");
|
||||||
|
}
|
||||||
boolean result = this.save(entity);
|
boolean result = this.save(entity);
|
||||||
if (result) {
|
if (result) {
|
||||||
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); }
|
msOperationLogService.recordAddDetailLog(TABLE_NAME, entity, source); }
|
||||||
|
|||||||
@ -4,8 +4,9 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.common.exception.BizException;
|
import com.yfd.platform.common.exception.BizException;
|
||||||
|
import com.yfd.platform.common.utils.UserNameFillHelper;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.domain.MsObliqueImageB;
|
import com.yfd.platform.qgc_base.domain.SdOpinfoBH;
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.service.IMsObliqueImageBService;
|
import com.yfd.platform.qgc_sys.obliqueImage.service.IMsObliqueImageBService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 倾斜摄影管理控制器
|
* 倾斜摄影管理控制器
|
||||||
|
* <p>基于 SD_OPINFO_B_H 表,管理 STTP = 'OSGB' 的倾斜摄影数据</p>
|
||||||
*
|
*
|
||||||
* @author migration
|
* @author migration
|
||||||
*/
|
*/
|
||||||
@ -25,37 +27,40 @@ public class MsObliqueImageBController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IMsObliqueImageBService msObliqueImageBService;
|
private IMsObliqueImageBService msObliqueImageBService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserNameFillHelper userNameFillHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件过滤数据列表
|
* 条件过滤数据列表
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "条件过滤数据列表")
|
@Operation(summary = "条件过滤数据列表")
|
||||||
@PostMapping("/GetKendoListCust")
|
@PostMapping("/GetKendoListCust")
|
||||||
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
DataSourceResult<MsObliqueImageB> result = msObliqueImageBService.getKendoList(dataSourceRequest);
|
DataSourceResult<SdOpinfoBH> result = msObliqueImageBService.getKendoList(dataSourceRequest);
|
||||||
|
userNameFillHelper.fillUserNames(result.getData());
|
||||||
return ResponseResult.successData(result);
|
return ResponseResult.successData(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改
|
* 新增或修改
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "新增或修改")
|
@Operation(summary = "新增或修改")
|
||||||
@PostMapping("/addOrUpdate")
|
@PostMapping("/addOrUpdate")
|
||||||
public ResponseResult addOrUpdate(@RequestBody MsObliqueImageB msObliqueImageB) {
|
public ResponseResult addOrUpdate(@RequestBody SdOpinfoBH entity) {
|
||||||
msObliqueImageBService.addOrUpdate(msObliqueImageB);
|
msObliqueImageBService.addOrUpdate(entity);
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 逻辑删除(id 即 stcd)
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
@GetMapping("/delete")
|
@GetMapping("/delete")
|
||||||
public ResponseResult delete(@RequestParam("id") String id) {
|
public ResponseResult delete(@RequestParam("stcd") String stcd) {
|
||||||
if (StrUtil.isBlank(id)) {
|
if (StrUtil.isBlank(stcd)) {
|
||||||
throw new BizException("ID不能为空");
|
throw new BizException("ID不能为空");
|
||||||
}
|
}
|
||||||
msObliqueImageBService.delete(id);
|
msObliqueImageBService.delete(stcd);
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,152 +0,0 @@
|
|||||||
package com.yfd.platform.qgc_sys.obliqueImage.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 倾斜摄影管理实体类
|
|
||||||
*
|
|
||||||
* @author migration
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("MS_OBL_PHOTO")
|
|
||||||
@Schema(description = "倾斜摄影管理实体类")
|
|
||||||
public class MsObliqueImageB implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
/** 站码 */
|
|
||||||
@TableField("STCD")
|
|
||||||
private String stcd;
|
|
||||||
|
|
||||||
/** 站名 */
|
|
||||||
@TableField("STNM")
|
|
||||||
private String stnm;
|
|
||||||
|
|
||||||
/** 所属站类ID */
|
|
||||||
@TableField("STTP")
|
|
||||||
private String sttp;
|
|
||||||
|
|
||||||
/** 所属站类编码 */
|
|
||||||
@TableField("STTP_CODE")
|
|
||||||
private String sttpCode;
|
|
||||||
|
|
||||||
/** 所属站类名称 */
|
|
||||||
@TableField("STTP_NAME")
|
|
||||||
private String sttpName;
|
|
||||||
|
|
||||||
/** 所属站类全路径(非数据库字段) */
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String sttpFullPath;
|
|
||||||
|
|
||||||
/** 所属站类层级(非数据库字段) */
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer sttpTreeLevel;
|
|
||||||
|
|
||||||
/** 所属水电基地编码 */
|
|
||||||
@TableField("BASE_ID")
|
|
||||||
private String baseId;
|
|
||||||
|
|
||||||
/** 所属水电基地名称 */
|
|
||||||
@TableField("BASE_NAME")
|
|
||||||
private String baseName;
|
|
||||||
|
|
||||||
/** 所属流域编码 */
|
|
||||||
@TableField("HBRVCD")
|
|
||||||
private String hbrvcd;
|
|
||||||
|
|
||||||
/** 所属流域名称 */
|
|
||||||
@TableField("HBRVCD_NAME")
|
|
||||||
private String hbrvcdName;
|
|
||||||
|
|
||||||
/** 所属河段编码(非数据库字段,与HBRVCD同源) */
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String rvcd;
|
|
||||||
|
|
||||||
/** 所属河段名称(非数据库字段,与HBRVCD_NAME同源) */
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String rvcdName;
|
|
||||||
|
|
||||||
/** 在线地址 */
|
|
||||||
@TableField("URL")
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
/** 所属电站编码 */
|
|
||||||
@TableField("RSTCD")
|
|
||||||
private String rstcd;
|
|
||||||
|
|
||||||
/** 所属电站名称 */
|
|
||||||
@TableField("ENNM")
|
|
||||||
private String ennm;
|
|
||||||
|
|
||||||
/** 电站经度(非数据库字段) */
|
|
||||||
@TableField("LGTD")
|
|
||||||
private BigDecimal lgtd;
|
|
||||||
|
|
||||||
/** 电站纬度(非数据库字段) */
|
|
||||||
@TableField("LTTD")
|
|
||||||
private BigDecimal lttd;
|
|
||||||
|
|
||||||
/** 电站坐标JSON串 */
|
|
||||||
@TableField("LOCATION")
|
|
||||||
private String location;
|
|
||||||
|
|
||||||
/** 模型精度 */
|
|
||||||
@TableField("ACCURACY")
|
|
||||||
private Integer accuracy;
|
|
||||||
|
|
||||||
/** 边界范围 */
|
|
||||||
@TableField("BOUNDARY")
|
|
||||||
private String boundary;
|
|
||||||
|
|
||||||
/** 自定义高程 */
|
|
||||||
@TableField("HEIGHT")
|
|
||||||
private Integer height;
|
|
||||||
|
|
||||||
/** 备注 */
|
|
||||||
@TableField("COMMENTS")
|
|
||||||
private String comments;
|
|
||||||
|
|
||||||
/** 创建人 */
|
|
||||||
@TableField("RECORD_USER")
|
|
||||||
private String recordUser;
|
|
||||||
|
|
||||||
/** 创建人名称(非数据库字段) */
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String recordUserName;
|
|
||||||
|
|
||||||
/** 创建时间(非数据库字段) */
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Date recordTime;
|
|
||||||
|
|
||||||
/** 更新人 */
|
|
||||||
@TableField("MODIFY_USER")
|
|
||||||
private String modifyUser;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
|
||||||
@TableField("MODIFY_TIME")
|
|
||||||
private Date modifyTime;
|
|
||||||
|
|
||||||
/** 是否已删除:0=未删除 1=已删除 */
|
|
||||||
@TableField("IS_DELETED")
|
|
||||||
private Integer isDeleted;
|
|
||||||
|
|
||||||
/** 删除人 */
|
|
||||||
@TableField("DELETE_USER")
|
|
||||||
private String deleteUser;
|
|
||||||
|
|
||||||
/** 删除时间 */
|
|
||||||
@TableField("DELETE_TIME")
|
|
||||||
private Date deleteTime;
|
|
||||||
}
|
|
||||||
@ -1,11 +1,8 @@
|
|||||||
package com.yfd.platform.qgc_sys.obliqueImage.mapper;
|
package com.yfd.platform.qgc_sys.obliqueImage.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.domain.MsObliqueImageB;
|
import com.yfd.platform.qgc_base.domain.SdOpinfoBH;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Delete;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,11 +11,8 @@ import org.apache.ibatis.annotations.Select;
|
|||||||
* @author migration
|
* @author migration
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface MsObliqueImageBMapper extends BaseMapper<MsObliqueImageB> {
|
public interface MsObliqueImageBMapper extends BaseMapper<SdOpinfoBH> {
|
||||||
|
|
||||||
@Delete("DELETE FROM MS_OBL_PHOTO WHERE ID = #{id}")
|
@Select("SELECT STTP_CODE FROM SD_STTP_B WHERE STTP_CODE = 'OSGB' AND NVL(IS_DELETED, 0) = 0")
|
||||||
void deleteById(@Param("id") String id);
|
String getOpgbSttpId();
|
||||||
|
}
|
||||||
@Select("SELECT ID FROM SD_STTP_B WHERE STTP_CODE = 'OSGB'")
|
|
||||||
String getSttp();
|
|
||||||
}
|
|
||||||
|
|||||||
@ -3,34 +3,27 @@ package com.yfd.platform.qgc_sys.obliqueImage.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.domain.MsObliqueImageB;
|
import com.yfd.platform.qgc_base.domain.SdOpinfoBH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 倾斜摄影管理 Service 接口
|
* 倾斜摄影管理 Service 接口
|
||||||
*
|
*
|
||||||
* @author migration
|
* @author migration
|
||||||
*/
|
*/
|
||||||
public interface IMsObliqueImageBService extends IService<MsObliqueImageB> {
|
public interface IMsObliqueImageBService extends IService<SdOpinfoBH> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件过滤数据列表(Kendo 数据源)
|
* 条件过滤数据列表(Kendo 数据源)
|
||||||
*
|
|
||||||
* @param dataSourceRequest 数据源请求
|
|
||||||
* @return 数据源结果
|
|
||||||
*/
|
*/
|
||||||
DataSourceResult<MsObliqueImageB> getKendoList(DataSourceRequest dataSourceRequest);
|
DataSourceResult<SdOpinfoBH> getKendoList(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改
|
* 新增或修改
|
||||||
*
|
|
||||||
* @param msObliqueImageB 倾斜摄影实体
|
|
||||||
*/
|
*/
|
||||||
void addOrUpdate(MsObliqueImageB msObliqueImageB);
|
void addOrUpdate(SdOpinfoBH entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 逻辑删除
|
||||||
*
|
|
||||||
* @param id 主键ID
|
|
||||||
*/
|
*/
|
||||||
void delete(String id);
|
void delete(String stcd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,38 +1,37 @@
|
|||||||
package com.yfd.platform.qgc_sys.obliqueImage.service.impl;
|
package com.yfd.platform.qgc_sys.obliqueImage.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
import com.yfd.platform.common.DataSourceResult;
|
||||||
|
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||||
import com.yfd.platform.common.exception.BizException;
|
import com.yfd.platform.common.exception.BizException;
|
||||||
import com.yfd.platform.qgc_base.domain.SdEngInfoBH;
|
import com.yfd.platform.qgc_base.domain.SdEngInfoBH;
|
||||||
|
import com.yfd.platform.qgc_base.domain.SdOpinfoBH;
|
||||||
import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
|
import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.domain.MsObliqueImageB;
|
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.mapper.MsObliqueImageBMapper;
|
import com.yfd.platform.qgc_sys.obliqueImage.mapper.MsObliqueImageBMapper;
|
||||||
import com.yfd.platform.qgc_sys.obliqueImage.service.IMsObliqueImageBService;
|
import com.yfd.platform.qgc_sys.obliqueImage.service.IMsObliqueImageBService;
|
||||||
import com.yfd.platform.utils.DataSourceRequestUtil;
|
|
||||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||||
import com.yfd.platform.utils.QueryWrapperUtil;
|
|
||||||
import com.yfd.platform.utils.SecurityUtils;
|
import com.yfd.platform.utils.SecurityUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 倾斜摄影管理 Service 实现类
|
* 倾斜摄影管理 Service 实现类
|
||||||
|
* <p>基于 SD_OPINFO_B_H 表,STTP = 'OSGB' 的数据</p>
|
||||||
*
|
*
|
||||||
* @author migration
|
* @author migration
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MsObliqueImageBServiceImpl extends ServiceImpl<MsObliqueImageBMapper, MsObliqueImageB> implements IMsObliqueImageBService {
|
public class MsObliqueImageBServiceImpl extends ServiceImpl<MsObliqueImageBMapper, SdOpinfoBH> implements IMsObliqueImageBService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MsObliqueImageBMapper msObliqueImageBMapper;
|
private MsObliqueImageBMapper msObliqueImageBMapper;
|
||||||
@ -40,132 +39,213 @@ public class MsObliqueImageBServiceImpl extends ServiceImpl<MsObliqueImageBMappe
|
|||||||
@Resource
|
@Resource
|
||||||
private ISdEngInfoBHService engInfoBHService;
|
private ISdEngInfoBHService engInfoBHService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSourceResult<MsObliqueImageB> getKendoList(DataSourceRequest dataSourceRequest) {
|
public DataSourceResult<SdOpinfoBH> getKendoList(DataSourceRequest dataSourceRequest) {
|
||||||
// 1. 构建查询条件
|
|
||||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||||
|
|
||||||
QueryWrapper<MsObliqueImageB> wrapper = DataSourceRequestUtil.buildQueryWrapper(
|
String osgbSttpId = msObliqueImageBMapper.getOpgbSttpId();
|
||||||
dataSourceRequest, MsObliqueImageB.class);
|
if (StrUtil.isBlank(osgbSttpId)) {
|
||||||
|
DataSourceResult<SdOpinfoBH> empty = new DataSourceResult<>();
|
||||||
|
empty.setData(Collections.emptyList());
|
||||||
|
empty.setTotal(0L);
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
// 固定条件:STTP_CODE = 'OSGB' AND IS_DELETED = 0 AND RSTCD IS NOT NULL
|
StringBuilder sql = new StringBuilder();
|
||||||
wrapper.eq("STTP_CODE", "OSGB");
|
sql.append("SELECT a.STCD, a.STNM, a.STTP, a.LGTD, a.LTTD, a.ELEV, a.STLC, ")
|
||||||
wrapper.eq("IS_DELETED", 0);
|
.append("a.USFL, a.DTIN, a.ORDER_INDEX, a.RSTCD, a.BASE_ID, ")
|
||||||
wrapper.isNotNull("RSTCD");
|
.append("a.HBRVCD, a.RVCD, a.ADDVCD, a.URL, a.HEIGHT, a.BOUNDARY, ")
|
||||||
|
.append("a.LOCATION, a.ACCURACY, a.REMARK, a.RECORD_USER,a.RECORD_TIME, ")
|
||||||
|
.append("a.MODIFY_USER, a.MODIFY_TIME, a.IS_DELETED, ")
|
||||||
|
.append("eng.ENNM, eng.LGTD AS engLgtd, eng.LTTD AS engLttd, ")
|
||||||
|
.append("eng.BASE_ID AS engBaseId, eng.BASE_NAME, ")
|
||||||
|
.append("vsrd.RVNM AS hbrvcdName ")
|
||||||
|
.append("FROM SD_OPINFO_B_H a ")
|
||||||
|
.append("LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = a.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 ")
|
||||||
|
.append("LEFT JOIN SD_HBRV_DIC hbrv ON a.HBRVCD = hbrv.HBRVCD AND NVL(hbrv.IS_DELETED, 0) = 0 ")
|
||||||
|
.append("LEFT JOIN V_SD_RVCD_DIC_TREE vsrd ON eng.REACHCD = vsrd.RVCD AND NVL(hbrv.IS_DELETED, 0) = 0 ")
|
||||||
|
.append("WHERE a.IS_DELETED = 0 ")
|
||||||
|
.append("AND a.STTP = '").append(osgbSttpId).append("' ");
|
||||||
|
|
||||||
// 旧系统 rvcd 字段映射到 HBRVCD 列(前端传参保持 rvcd 不变)
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
if (loadOptions != null) {
|
String filterSql = buildFilterSql(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||||
String rvcd = QueryWrapperUtil.getFilterFieldValue(loadOptions, "rvcd");
|
if (StrUtil.isNotBlank(filterSql)) {
|
||||||
if (StrUtil.isNotBlank(rvcd)) {
|
sql.append(" AND ").append(filterSql);
|
||||||
wrapper.eq("HBRVCD", rvcd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认按修改时间倒序
|
// 默认按修改时间倒序
|
||||||
wrapper.orderByDesc("MODIFY_TIME");
|
sql.append(" ORDER BY a.MODIFY_TIME DESC NULLS LAST");
|
||||||
|
|
||||||
// 2. 分页参数处理
|
Page<?> page = loadOptions == null ? null
|
||||||
Page<MsObliqueImageB> page = loadOptions == null ? null
|
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||||
: (Page<MsObliqueImageB>) QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
List<SdOpinfoBH> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||||
|
page, sql.toString(), paramMap, SdOpinfoBH.class
|
||||||
|
);
|
||||||
|
|
||||||
// 3. 执行查询
|
DataSourceResult<SdOpinfoBH> result = new DataSourceResult<>();
|
||||||
Page<MsObliqueImageB> resultPage;
|
result.setData(list);
|
||||||
if (page != null) {
|
result.setTotal(page == null ? list.size() : page.getTotal());
|
||||||
resultPage = this.page(page, wrapper);
|
return result;
|
||||||
} else {
|
}
|
||||||
List<MsObliqueImageB> list = this.list(wrapper);
|
|
||||||
resultPage = new Page<>();
|
/**
|
||||||
resultPage.setRecords(list);
|
* 递归构建过滤 SQL
|
||||||
resultPage.setTotal(list.size());
|
*/
|
||||||
|
private String buildFilterSql(DataSourceRequest.FilterDescriptor filter,
|
||||||
|
Map<String, Object> paramMap, int[] indexHolder) {
|
||||||
|
if (filter == null) return "";
|
||||||
|
|
||||||
|
List<DataSourceRequest.FilterDescriptor> childFilters = filter.getFilters();
|
||||||
|
if (CollUtil.isNotEmpty(childFilters)) {
|
||||||
|
List<String> childConditions = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.FilterDescriptor child : childFilters) {
|
||||||
|
String childSql = buildFilterSql(child, paramMap, indexHolder);
|
||||||
|
if (StrUtil.isNotBlank(childSql)) {
|
||||||
|
childConditions.add(childSql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (childConditions.isEmpty()) return "";
|
||||||
|
String logic = StrUtil.isNotBlank(filter.getLogic()) ? filter.getLogic() : "and";
|
||||||
|
String connector = "and".equalsIgnoreCase(logic) ? " AND " : " OR ";
|
||||||
|
return "(" + String.join(connector, childConditions) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 构建结果
|
String field = filter.getField();
|
||||||
DataSourceResult<MsObliqueImageB> dataSourceResult = new DataSourceResult<>();
|
Object value = filter.getValue();
|
||||||
dataSourceResult.setData(resultPage.getRecords());
|
String operator = filter.getOperator();
|
||||||
dataSourceResult.setTotal(resultPage.getTotal());
|
|
||||||
return dataSourceResult;
|
if (StrUtil.isBlank(field)) return "";
|
||||||
|
|
||||||
|
String column = mapToColumn(field);
|
||||||
|
if (StrUtil.isBlank(column)) return "";
|
||||||
|
|
||||||
|
if ("isnull".equalsIgnoreCase(operator)) return column + " IS NULL";
|
||||||
|
if ("isnotnull".equalsIgnoreCase(operator)) return column + " IS NOT NULL";
|
||||||
|
if (value == null) return "";
|
||||||
|
|
||||||
|
String paramKey = "p" + indexHolder[0]++;
|
||||||
|
paramMap.put(paramKey, value);
|
||||||
|
|
||||||
|
if ("eq".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " = #{map." + paramKey + "}";
|
||||||
|
} else if ("neq".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " != #{map." + paramKey + "}";
|
||||||
|
} else if ("contains".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " LIKE '%' || #{map." + paramKey + "} || '%'";
|
||||||
|
} else if ("startswith".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " LIKE #{map." + paramKey + "} || '%'";
|
||||||
|
} else if ("endswith".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " LIKE '%' || #{map." + paramKey + "}";
|
||||||
|
} else if ("gt".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " > #{map." + paramKey + "}";
|
||||||
|
} else if ("gte".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " >= #{map." + paramKey + "}";
|
||||||
|
} else if ("lt".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " < #{map." + paramKey + "}";
|
||||||
|
} else if ("lte".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " <= #{map." + paramKey + "}";
|
||||||
|
} else if ("in".equalsIgnoreCase(operator)) {
|
||||||
|
return column + " IN (#{map." + paramKey + "})";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端字段名 -> SQL 列名映射
|
||||||
|
*/
|
||||||
|
private String mapToColumn(String field) {
|
||||||
|
if (StrUtil.isBlank(field)) return null;
|
||||||
|
return switch (field) {
|
||||||
|
case "stcd" -> "a.STCD";
|
||||||
|
case "stnm" -> "a.STNM";
|
||||||
|
case "rstcd" -> "a.RSTCD";
|
||||||
|
case "ennm" -> "eng.ENNM";
|
||||||
|
case "baseId" -> "a.BASE_ID";
|
||||||
|
case "baseName" -> "eng.BASE_NAME";
|
||||||
|
// 旧系统 rvcd 字段映射到 HBRVCD 列(保持兼容)
|
||||||
|
case "rvcd" -> "a.HBRVCD";
|
||||||
|
case "hbrvcd" -> "vsrd.RVCD";
|
||||||
|
case "url" -> "a.URL";
|
||||||
|
case "remark" -> "a.REMARK";
|
||||||
|
case "modifyTime" -> "a.MODIFY_TIME";
|
||||||
|
case "usfl" -> "a.USFL";
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOrUpdate(MsObliqueImageB msObliqueImageB) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
if (StrUtil.isNotBlank(msObliqueImageB.getRstcd())){
|
public void addOrUpdate(SdOpinfoBH entity) {
|
||||||
|
if (StrUtil.isBlank(entity.getRstcd())) {
|
||||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(StrUtil.isNotBlank(msObliqueImageB.getRstcd()), SdEngInfoBH::getStcd, msObliqueImageB.getRstcd())
|
|
||||||
.eq(SdEngInfoBH::getIsDeleted, 0)
|
|
||||||
.select(SdEngInfoBH::getLgtd, SdEngInfoBH::getLttd, SdEngInfoBH::getBaseId, SdEngInfoBH::getBaseName)
|
|
||||||
.orderByAsc(SdEngInfoBH::getBaseId, SdEngInfoBH::getOrderIndex);
|
|
||||||
SdEngInfoBH sdEngInfoBH = engInfoBHService.getOne(wrapper);
|
|
||||||
if (sdEngInfoBH.getLgtd() != null){
|
|
||||||
msObliqueImageB.setLgtd(sdEngInfoBH.getLgtd());
|
|
||||||
}
|
|
||||||
if (sdEngInfoBH.getLttd() != null){
|
|
||||||
msObliqueImageB.setLttd(sdEngInfoBH.getLttd());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(sdEngInfoBH.getBaseName())){
|
|
||||||
msObliqueImageB.setBaseName(sdEngInfoBH.getBaseName());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(sdEngInfoBH.getBaseId())){
|
|
||||||
msObliqueImageB.setBaseId(sdEngInfoBH.getBaseId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(msObliqueImageB.getId())) {
|
|
||||||
addMsObliqueImageB(msObliqueImageB);
|
|
||||||
} else {
|
|
||||||
updateMsObliqueImageB(msObliqueImageB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delete(String id) {
|
|
||||||
msObliqueImageBMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addMsObliqueImageB(MsObliqueImageB msObliqueImageB) {
|
|
||||||
// 查询新增的倾斜摄影是否已存在
|
|
||||||
String rstcd = msObliqueImageB.getRstcd();
|
|
||||||
if (StrUtil.isBlank(rstcd)) {
|
|
||||||
throw new BizException("电站不能为空");
|
throw new BizException("电站不能为空");
|
||||||
}
|
}
|
||||||
String id = "OSGB_" + rstcd;
|
|
||||||
MsObliqueImageB old = msObliqueImageBMapper.selectById(id);
|
// 查询电站信息补充经纬度和基地信息
|
||||||
if (old != null) {
|
SdEngInfoBH engInfo = engInfoBHService.lambdaQuery()
|
||||||
throw new BizException("该电站已存在倾斜摄影");
|
.eq(SdEngInfoBH::getStcd, entity.getRstcd())
|
||||||
|
.eq(SdEngInfoBH::getIsDeleted, 0)
|
||||||
|
.select(SdEngInfoBH::getLgtd, SdEngInfoBH::getLttd,
|
||||||
|
SdEngInfoBH::getBaseId, SdEngInfoBH::getBaseName)
|
||||||
|
.one();
|
||||||
|
if (engInfo == null) {
|
||||||
|
throw new BizException("电站不存在:" + entity.getRstcd());
|
||||||
}
|
}
|
||||||
msObliqueImageB.setSttpCode("OSGB");
|
if (engInfo.getLgtd() != null) {
|
||||||
msObliqueImageB.setSttpName("倾斜摄影");
|
entity.setLgtd(engInfo.getLgtd());
|
||||||
if (StrUtil.isBlank(msObliqueImageB.getRvcd())) {
|
|
||||||
msObliqueImageB.setRvcd(msObliqueImageB.getHbrvcd());
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(msObliqueImageB.getRvcdName())) {
|
if (engInfo.getLttd() != null) {
|
||||||
msObliqueImageB.setRvcdName(msObliqueImageB.getHbrvcdName());
|
entity.setLttd(engInfo.getLttd());
|
||||||
}
|
}
|
||||||
msObliqueImageB.setStcd("OSGB_" + msObliqueImageB.getRstcd());
|
if (StrUtil.isNotBlank(engInfo.getBaseId())) {
|
||||||
msObliqueImageB.setId("OSGB_" + msObliqueImageB.getRstcd());
|
entity.setBaseId(engInfo.getBaseId());
|
||||||
msObliqueImageB.setSttpFullPath("OSGB,");
|
}
|
||||||
msObliqueImageB.setSttpTreeLevel(1);
|
|
||||||
String sttp = msObliqueImageBMapper.getSttp();
|
// 获取 OSGB 对应的 STTP ID
|
||||||
if (StrUtil.isBlank(sttp)) {
|
String osgbSttpId = msObliqueImageBMapper.getOpgbSttpId();
|
||||||
|
if (StrUtil.isBlank(osgbSttpId)) {
|
||||||
throw new BizException("倾斜摄影对应的sttp在SD_STTP_B中找不到");
|
throw new BizException("倾斜摄影对应的sttp在SD_STTP_B中找不到");
|
||||||
}
|
}
|
||||||
msObliqueImageB.setSttp(sttp);
|
entity.setSttp(osgbSttpId);
|
||||||
// 设置通用字段
|
|
||||||
|
// 生成 ID 和 STCD
|
||||||
|
String stcd = "OSGB_" + entity.getRstcd();
|
||||||
|
entity.setStcd(stcd);
|
||||||
|
|
||||||
|
long count = this.count(new LambdaQueryWrapper<SdOpinfoBH>().eq(SdOpinfoBH::getStcd, stcd));
|
||||||
|
|
||||||
String userId = currentUserIdOrSystem();
|
String userId = currentUserIdOrSystem();
|
||||||
msObliqueImageB.setRecordUser(userId);
|
Date now = new Date();
|
||||||
Date now = new java.util.Date();
|
|
||||||
msObliqueImageB.setModifyTime(now);
|
if (count==0) {
|
||||||
msObliqueImageB.setModifyUser(userId);
|
entity.setRecordUser(userId);
|
||||||
msObliqueImageB.setIsDeleted(0);
|
entity.setRecordTime(now);
|
||||||
msObliqueImageBMapper.insert(msObliqueImageB);
|
entity.setModifyUser(userId);
|
||||||
|
entity.setModifyTime(now);
|
||||||
|
entity.setIsDeleted(0);
|
||||||
|
this.save(entity);
|
||||||
|
} else {
|
||||||
|
entity.setModifyUser(userId);
|
||||||
|
entity.setModifyTime(now);
|
||||||
|
this.updateById(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMsObliqueImageB(MsObliqueImageB msObliqueImageB) {
|
@Override
|
||||||
String userId = currentUserIdOrSystem();
|
@Transactional(rollbackFor = Exception.class)
|
||||||
msObliqueImageB.setModifyUser(userId);
|
public void delete(String stcd) {
|
||||||
msObliqueImageB.setModifyTime(new java.util.Date());
|
msObliqueImageBMapper.deleteById(stcd);
|
||||||
this.updateById(msObliqueImageB);
|
// id 即 stcd
|
||||||
|
// LambdaUpdateWrapper<SdOpinfoBH> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
// wrapper.eq(SdOpinfoBH::getStcd, stcd);
|
||||||
|
// wrapper.set(SdOpinfoBH::getIsDeleted, 1);
|
||||||
|
// wrapper.set(SdOpinfoBH::getDeleteUser, SecurityUtils.getCurrentUsername());
|
||||||
|
// wrapper.set(SdOpinfoBH::getDeleteTime, new Date());
|
||||||
|
// if (!this.update(wrapper)) {
|
||||||
|
// throw new BizException("删除失败:" + stcd);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private String currentUserIdOrSystem() {
|
private String currentUserIdOrSystem() {
|
||||||
@ -175,4 +255,4 @@ public class MsObliqueImageBServiceImpl extends ServiceImpl<MsObliqueImageBMappe
|
|||||||
return "system";
|
return "system";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user