监测体系

站点管理
master
yangzhe123 2026-01-15 15:51:59 +08:00
parent 3c2af20542
commit 28fe2e8086
23 changed files with 702 additions and 88 deletions

View File

@ -17,7 +17,7 @@ import java.math.BigDecimal;
@Data @Data
@TableName("jcsk_gnss_b") @TableName("jcsk_gnss_b")
@IgnoreAutoMapperAndDao @IgnoreAutoMapperAndDao
public class JcskGnssB { public class JcskGnssB extends JcskNormalDto {
/** /**
* *
*/ */

View File

@ -0,0 +1,18 @@
package com.gunshi.project.ss.common.model;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class JcskNormal extends JcskNormalDto{
private String code;
private String dm;//断面编码
private BigDecimal lgtd;
private BigDecimal lttd;
}

View File

@ -0,0 +1,47 @@
package com.gunshi.project.ss.common.model;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class JcskNormalDto {
@TableField(exist = false)
private Integer type;//1 渗流 2渗压 3位移
@TableField("pipe_elevation")
@Schema(description = "管口高程m")
private BigDecimal pipeElevation;
@TableField("pipe_bottom_elevation")
@Schema(description = "管底高程m")
private BigDecimal pipeBottomElevation;
@TableField("data_collection")
@Schema(description = "数据收集方式")
private Integer dataCollection;//0自动 1手动
@TableField("station_status")
@Schema(description = "站点状态")
private Integer stationStatus;//0 无效 1 有效
@TableField("year")
@Schema(description = "年份")
private Integer year;
@TableField("build_unit")
@Schema(description = "承建单位")
private String buildUnit;
@TableField("address")
@Schema(description = "地址")
private String address;
@TableField("remark")
@Schema(description = "备注")
private String remark;
}

View File

@ -18,7 +18,7 @@ import java.time.LocalDateTime;
@Data @Data
@TableName("jcsk_sl_b") @TableName("jcsk_sl_b")
@IgnoreAutoMapperAndDao @IgnoreAutoMapperAndDao
public class JcskSlB { public class JcskSlB extends JcskNormalDto {
/** /**

View File

@ -18,7 +18,7 @@ import java.time.LocalDateTime;
@Data @Data
@TableName("jcsk_sy_b") @TableName("jcsk_sy_b")
@IgnoreAutoMapperAndDao @IgnoreAutoMapperAndDao
public class JcskSyB { public class JcskSyB extends JcskNormalDto {
/** /**
* *
*/ */

View File

@ -0,0 +1,22 @@
package com.gunshi.project.ss.common.model.page;
import com.baomidou.mybatisplus.annotation.TableField;
import com.gunshi.db.dto.PageSo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class JcskPageSo {
@Schema(description = "分页参数")
private PageSo pageSo;
private String code;//测点编号
private Integer type;//监测类型1 渗流 2 渗压 3位移
private String dm;
private Integer dataCollection;//0自动 1手动
private Integer stationStatus;//0 无效 1 有效
}

View File

@ -178,4 +178,33 @@ public class AttCctvBaseController {
} }
@Operation(summary = "视频区域集合")
@GetMapping("/menu/list")
public R<List<CctvBMenu>> menuList(){
List<CctvBMenu> tree = menuService.tree();
return R.ok(tree);
}
@Operation(summary = "视频区域-删除")
@GetMapping("/menu/del/{id}")
public R<Boolean> menuDel(@PathVariable("id") Long id) {
menuService.del(id);
return R.ok(true);
}
@Operation(summary = "视频区域-修改")
@PostMapping("/menu/update")
public R<CctvBMenu> menuUpdate(@RequestBody CctvBMenu menu) {
boolean flag = menuService.updateById(menu);
return flag == true?R.ok(menu):R.ok(null);
}
@Operation(summary = "视频区域-新增")
@PostMapping("/menu/insert")
public R<CctvBMenu> menuInsert(@RequestBody CctvBMenu menu) {
boolean flag = menuService.save(menu);
return flag == true?R.ok(menu):R.ok(null);
}
} }

View File

@ -44,17 +44,9 @@ public class AttDamProfileController extends AbstractCommonFileController{
@Operation(summary = "新增") @Operation(summary = "新增")
@PostMapping("/insert") @PostMapping("/insert")
public R<AttDamProfile> insert(@Validated(Insert.class) @RequestBody AttDamProfile dto) { public R<AttDamProfile> insert(@Validated(Insert.class) @RequestBody AttDamProfile dto) {
if (Objects.nonNull(service.getById(dto.getProfileCode()))) { if (service.lambdaQuery().eq(AttDamProfile::getProfileCode, dto.getProfileCode()).list().size() > 0) {
throw new IllegalArgumentException("当前编号已存在"); throw new IllegalArgumentException("当前编号已存在");
}else{
dto.setProfileCode(String.valueOf(IdWorker.getId()));
} }
if (StringUtils.isNotBlank(dto.getProfileName())){
if (service.lambdaQuery().eq(AttDamProfile::getProfileName,dto.getProfileName()).count() > 0) {
throw new IllegalArgumentException("当前名称已存在");
}
}
boolean result = service.save(dto); boolean result = service.save(dto);
if (result){ if (result){
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode()); fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
@ -65,17 +57,9 @@ public class AttDamProfileController extends AbstractCommonFileController{
@Operation(summary = "修改") @Operation(summary = "修改")
@PostMapping("/update") @PostMapping("/update")
public R<AttDamProfile> update(@Validated(Update.class) @RequestBody AttDamProfile dto) { public R<AttDamProfile> update(@Validated(Update.class) @RequestBody AttDamProfile dto) {
if (Objects.isNull(service.getById(dto.getProfileCode()))) { if (service.lambdaQuery().eq(AttDamProfile::getProfileCode, dto.getProfileCode()).list().size() > 0) {
throw new IllegalArgumentException("当前数据不存在"); throw new IllegalArgumentException("当前数据不存在");
} }
if (StringUtils.isNotBlank(dto.getProfileName())){
if (service.lambdaQuery().eq(AttDamProfile::getProfileName,dto.getProfileName())
.ne(AttDamProfile::getProfileCode,dto.getProfileCode())
.count() > 0) {
throw new IllegalArgumentException("当前名称已存在");
}
}
boolean result = service.updateById(dto); boolean result = service.updateById(dto);
if (result){ if (result){
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode()); fileService.saveFile(dto.getFiles(), getGroupId(), dto.getProfileCode());
@ -93,7 +77,7 @@ public class AttDamProfileController extends AbstractCommonFileController{
} }
@Operation(summary = "列表") @Operation(summary = "列表")
@PostMapping("/list") @GetMapping("/list")
public R<List<AttDamProfile>> list() { public R<List<AttDamProfile>> list() {
LambdaQueryWrapper<AttDamProfile> wq = new LambdaQueryWrapper(); LambdaQueryWrapper<AttDamProfile> wq = new LambdaQueryWrapper();

View File

@ -250,10 +250,10 @@ public class DebugController {
String jsonString = JSONObject.toJSONString(entity); String jsonString = JSONObject.toJSONString(entity);
esObjectDocument.setJsonStr(jsonString); esObjectDocument.setJsonStr(jsonString);
if(entity.getLgtd() != null){ if(entity.getLgtd() != null){
esObjectDocument.setLgtd(new BigDecimal(entity.getLgtd())); esObjectDocument.setLgtd(entity.getLgtd());
} }
if(entity.getLgtd() != null){ if(entity.getLgtd() != null){
esObjectDocument.setLttd(new BigDecimal(entity.getLttd())); esObjectDocument.setLttd(entity.getLttd());
} }
list.add(esObjectDocument); list.add(esObjectDocument);
} }

View File

@ -0,0 +1,38 @@
package com.gunshi.project.ss.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.ss.common.model.JcskNormal;
import com.gunshi.project.ss.common.model.page.JcskPageSo;
import com.gunshi.project.ss.service.JcskService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/jcskStation")
public class JcskController {
@Autowired
private JcskService jcskService;
@Operation(description = "分页")
@PostMapping("/page")
public R<Page<JcskNormal>> page(@RequestBody JcskPageSo pageSo){
Page<JcskNormal> page = jcskService.page(pageSo);
return R.ok(page);
}
@Operation(description = "修改")
@PostMapping("/update")
public R<JcskNormal> update(@RequestBody JcskNormal normal){
JcskNormal page = jcskService.update(normal);
return R.ok(page);
}
}

View File

@ -74,26 +74,15 @@ public class StZqrlBController {
@Operation(summary = "新增") @Operation(summary = "新增")
@PostMapping("/insert") @PostMapping("/insert")
public R<StZqrlB> insert(@Validated(Insert.class) @RequestBody StZqrlB dto) { public R<StZqrlB> insert(@Validated(Insert.class) @RequestBody StZqrlB dto) {
if (StringUtils.isNotBlank(dto.getResCode())){ List<AttResBase> list = resBaseService.list();
AttResBase one = resBaseService.list().get(0); AttResBase attResBase = list.get(0);
// if (Objects.isNull(one)){
// throw new IllegalArgumentException("水库编码不存在");
// }
if (StringUtils.isBlank(dto.getStcd())){
dto.setStcd(one.getStcd());
}
}
if (StringUtils.isNotBlank(dto.getStcd()) && Objects.isNull(stStbprpBService.getById(dto.getStcd()))){
throw new IllegalArgumentException("测站编码不存在");
}
if (service.lambdaQuery() if (service.lambdaQuery()
.eq(StZqrlB::getStcd, dto.getStcd())
.eq(StZqrlB::getZ, dto.getZ()) .eq(StZqrlB::getZ, dto.getZ())
.eq(StZqrlB::getQ, dto.getQ()) .eq(StZqrlB::getQ, dto.getQ())
.count() > 0) { .count() > 0) {
throw new IllegalArgumentException("当前数据已存在"); throw new IllegalArgumentException("当前数据已存在");
} }
dto.setStcd(attResBase.getStcd());
dto.setId(IdWorker.getId()); dto.setId(IdWorker.getId());
dto.setModitime(new Date()); dto.setModitime(new Date());
boolean result = service.save(dto); boolean result = service.save(dto);
@ -103,21 +92,13 @@ public class StZqrlBController {
@Operation(summary = "修改") @Operation(summary = "修改")
@PostMapping("/update") @PostMapping("/update")
public R<StZqrlB> update(@Validated(Update.class) @RequestBody StZqrlB dto) { public R<StZqrlB> update(@Validated(Update.class) @RequestBody StZqrlB dto) {
if (StringUtils.isNotBlank(dto.getStcd()) && Objects.isNull(stStbprpBService.getById(dto.getStcd()))){
throw new IllegalArgumentException("测站编码不存在");
}
if (service.lambdaQuery() if (service.lambdaQuery()
.eq(StZqrlB::getStcd, dto.getStcd())
.eq(StZqrlB::getZ, dto.getZ()) .eq(StZqrlB::getZ, dto.getZ())
.eq(StZqrlB::getQ, dto.getQ()) .eq(StZqrlB::getQ, dto.getQ())
.ne(StZqrlB::getId,dto.getId()) .ne(StZqrlB::getId,dto.getId())
.count() > 0) { .count() > 0) {
throw new IllegalArgumentException("当前数据已存在"); throw new IllegalArgumentException("当前数据已存在");
} }
boolean result = service.lambdaUpdate() boolean result = service.lambdaUpdate()
.set(StZqrlB::getZ, dto.getZ()) .set(StZqrlB::getZ, dto.getZ())
.set(StZqrlB::getQ, dto.getQ()) .set(StZqrlB::getQ, dto.getQ())
@ -127,18 +108,15 @@ public class StZqrlBController {
} }
@Operation(summary = "删除") @Operation(summary = "删除")
@PostMapping("/del") @GetMapping("/del/{id}")
public R<Boolean> del(@Validated(Delete.class) @RequestBody StZqrlB dto) { public R<Boolean> del(@PathVariable("id") Long id) {
if (StringUtils.isNotBlank(dto.getStcd()) && Objects.isNull(stStbprpBService.getById(dto.getStcd()))){
throw new IllegalArgumentException("测站编码不存在");
}
if (service.lambdaQuery() if (service.lambdaQuery()
.eq(StZqrlB::getId, dto.getId()) .eq(StZqrlB::getId, id)
.count() == 0) { .count() == 0) {
throw new IllegalArgumentException("当前数据不存在"); throw new IllegalArgumentException("当前数据不存在");
} }
return R.ok(service.lambdaUpdate() return R.ok(service.lambdaUpdate()
.eq(StZqrlB::getId, dto.getId()) .eq(StZqrlB::getId, id)
.remove() ); .remove() );
} }

View File

@ -16,10 +16,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -47,18 +44,8 @@ public class StZvarlBController {
@Operation(summary = "新增") @Operation(summary = "新增")
@PostMapping("/insert") @PostMapping("/insert")
public R<StZvarlB> insert(@Validated(Insert.class) @RequestBody StZvarlB dto) { public R<StZvarlB> insert(@Validated(Insert.class) @RequestBody StZvarlB dto) {
if (StringUtils.isNotBlank(dto.getResCode())){ AttResBase attResBase = resBaseService.list().get(0);
AttResBase one = resBaseService.lambdaQuery().eq(AttResBase::getResCode, dto.getResCode()).one(); dto.setStcd(attResBase.getStcd());
if (Objects.isNull(one)){
throw new IllegalArgumentException("水库编码不存在");
}
if (StringUtils.isBlank(dto.getStcd())){
dto.setStcd(one.getStcd());
}
}
if (StringUtils.isNotBlank(dto.getStcd()) && Objects.isNull(stStbprpBService.getById(dto.getStcd()))){
throw new IllegalArgumentException("测站编码不存在");
}
if (service.lambdaQuery() if (service.lambdaQuery()
.eq(StZvarlB::getStcd, dto.getStcd()) .eq(StZvarlB::getStcd, dto.getStcd())
.eq(StZvarlB::getRz, dto.getRz()) .eq(StZvarlB::getRz, dto.getRz())
@ -75,11 +62,8 @@ public class StZvarlBController {
@Operation(summary = "修改") @Operation(summary = "修改")
@PostMapping("/update") @PostMapping("/update")
public R<StZvarlB> update(@Validated(Update.class) @RequestBody StZvarlB dto) { public R<StZvarlB> update(@Validated(Update.class) @RequestBody StZvarlB dto) {
if (StringUtils.isNotBlank(dto.getStcd()) && Objects.isNull(stStbprpBService.getById(dto.getStcd()))){ AttResBase attResBase = resBaseService.list().get(0);
throw new IllegalArgumentException("测站编码不存在"); dto.setStcd(attResBase.getStcd());
}
if (service.lambdaQuery() if (service.lambdaQuery()
.eq(StZvarlB::getStcd, dto.getStcd()) .eq(StZvarlB::getStcd, dto.getStcd())
.eq(StZvarlB::getRz, dto.getRz()) .eq(StZvarlB::getRz, dto.getRz())
@ -89,7 +73,6 @@ public class StZvarlBController {
throw new IllegalArgumentException("当前数据已存在"); throw new IllegalArgumentException("当前数据已存在");
} }
boolean result = service.lambdaUpdate() boolean result = service.lambdaUpdate()
.set(StZvarlB::getRz, dto.getRz()) .set(StZvarlB::getRz, dto.getRz())
.set(StZvarlB::getW, dto.getW()) .set(StZvarlB::getW, dto.getW())
@ -100,15 +83,15 @@ public class StZvarlBController {
} }
@Operation(summary = "删除") @Operation(summary = "删除")
@PostMapping("/del") @GetMapping("/del/{id}")
public R<Boolean> del(@Validated(Delete.class) @RequestBody StZvarlB dto) { public R<Boolean> del(@PathVariable("id") Long id) {
if (service.lambdaQuery() if (service.lambdaQuery()
.eq(StZvarlB::getId, dto.getId()) .eq(StZvarlB::getId, id)
.count() == 0) { .count() == 0) {
throw new IllegalArgumentException("当前数据不存在"); throw new IllegalArgumentException("当前数据不存在");
} }
return R.ok(service.lambdaUpdate() return R.ok(service.lambdaUpdate()
.eq(StZvarlB::getId, dto.getId()) .eq(StZvarlB::getId, id)
.remove() ); .remove() );
} }

View File

@ -95,6 +95,7 @@ public class StationController {
public void handlerCCTVStauts(List<StationNormalVo> stationNormalVos){ public void handlerCCTVStauts(List<StationNormalVo> stationNormalVos){
for (StationNormalVo station : stationNormalVos) { for (StationNormalVo station : stationNormalVos) {
//建议自测的时候别用这个如果无法访问那个ip的话可能一个接口得调用十几分钟
String preview = attCctvBaseService.preview(station.getStcd()); String preview = attCctvBaseService.preview(station.getStcd());
if(preview == null || StringUtils.isBlank(preview) ||!preview.startsWith("ws")){ if(preview == null || StringUtils.isBlank(preview) ||!preview.startsWith("ws")){
station.setStatus(0); station.setStatus(0);

View File

@ -9,7 +9,7 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
import java.math.BigDecimal; import java.math.BigDecimal;
@Data @Data
@Document(indexName="ss_object") //@Document(indexName="ss_object")
public class EsObjectDocument { public class EsObjectDocument {
@Id // 必须添加这个注解 @Id // 必须添加这个注解
private String id; // 字段名可以是id或自定义 private String id; // 字段名可以是id或自定义

View File

@ -0,0 +1,17 @@
package com.gunshi.project.ss.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.ss.common.model.JcskNormal;
import com.gunshi.project.ss.common.model.page.JcskPageSo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface JcskMapper extends BaseMapper<JcskNormal> {
Page<JcskNormal> selectPage(Page<Object> page, @Param("dto") JcskPageSo pageSo);
}

View File

@ -18,6 +18,7 @@ import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -95,14 +96,14 @@ public class AttCctvBase implements Serializable {
*/ */
@TableField(value="lgtd") @TableField(value="lgtd")
@Schema(description="经度") @Schema(description="经度")
private String lgtd; private BigDecimal lgtd;
/** /**
* *
*/ */
@TableField(value="lttd") @TableField(value="lttd")
@Schema(description="纬度") @Schema(description="纬度")
private String lttd; private BigDecimal lttd;
/** /**
* menu_id * menu_id
@ -136,6 +137,7 @@ public class AttCctvBase implements Serializable {
@Schema(description = "状态 0 离线 1在线") @Schema(description = "状态 0 离线 1在线")
@TableField(exist = false)
private Integer status; private Integer status;

View File

@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import org.apache.http.auth.AUTH;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -26,10 +27,13 @@ public class AttDamProfile implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** /**
* *
*/ */
@TableId(value="profile_code", type= IdType.AUTO) @TableField(value="profile_code")
@Schema(description="断面编号") @Schema(description="断面编号")
@Size(max = 100,message = "断面编号最大长度要小于 100") @Size(max = 100,message = "断面编号最大长度要小于 100")
@NotBlank(message = "断面编号不能为空") @NotBlank(message = "断面编号不能为空")

View File

@ -34,7 +34,6 @@ public class CctvBMenu implements Serializable {
*/ */
@TableId(value="id", type= IdType.AUTO) @TableId(value="id", type= IdType.AUTO)
@Schema(description="id") @Schema(description="id")
@NotNull(message = "id不能为空")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;

View File

@ -1,10 +1,13 @@
package com.gunshi.project.ss.service; package com.gunshi.project.ss.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.ss.mapper.AttCctvBaseMapper;
import com.gunshi.project.ss.mapper.CctvBMenuMapper; import com.gunshi.project.ss.mapper.CctvBMenuMapper;
import com.gunshi.project.ss.model.AttCctvBase;
import com.gunshi.project.ss.model.CctvBMenu; import com.gunshi.project.ss.model.CctvBMenu;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -24,6 +27,9 @@ import java.util.stream.Collectors;
public class CctvBMenuService extends ServiceImpl<CctvBMenuMapper, CctvBMenu> public class CctvBMenuService extends ServiceImpl<CctvBMenuMapper, CctvBMenu>
{ {
@Autowired
private AttCctvBaseService attCctvBaseService;
public List<CctvBMenu> tree() { public List<CctvBMenu> tree() {
List<CctvBMenu> list = list(); List<CctvBMenu> list = list();
if (CollectionUtils.isEmpty(list)){ if (CollectionUtils.isEmpty(list)){
@ -52,6 +58,14 @@ public class CctvBMenuService extends ServiceImpl<CctvBMenuMapper, CctvBMenu>
return sorteds; return sorteds;
} }
public void del(Long id) {
List<AttCctvBase> list = attCctvBaseService.lambdaQuery().eq(AttCctvBase::getMenuId, id).list();
if(list.size() > 0){
throw new IllegalArgumentException("对不起,该区域下有视频点存在,无法删除");
}
this.removeById(id);
}
} }

View File

@ -0,0 +1,157 @@
package com.gunshi.project.ss.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.ss.common.model.JcskGnssB;
import com.gunshi.project.ss.common.model.JcskNormal;
import com.gunshi.project.ss.common.model.JcskSlB;
import com.gunshi.project.ss.common.model.JcskSyB;
import com.gunshi.project.ss.common.model.page.JcskPageSo;
import com.gunshi.project.ss.mapper.JcskMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@Service
@Transactional(rollbackFor = Exception.class)
public class JcskService {
@Autowired
private JcskSlBService jcskSlBService;
@Autowired
private JcskSyBService jcskSyBService;
@Autowired
private JcskGnssBService jcskGnssBService;
@Autowired
private JcskMapper jcskMapper;
public Page<JcskNormal> page(JcskPageSo pageSo) {
Page<JcskNormal> page = jcskMapper.selectPage(pageSo.getPageSo().toPage(),pageSo);
return page;
}
public JcskNormal update(JcskNormal normal) {
Integer type = normal.getType();
BigDecimal lgtd = normal.getLgtd();
BigDecimal lttd = normal.getLttd();
String dm = normal.getDm();
if(type==1){
//渗流
JcskSlB one = jcskSlBService.lambdaQuery()
.eq(JcskSlB::getDvcd, normal.getCode()).one();
if(one == null){
throw new IllegalArgumentException("对不起,该测点不存在");
}
one.setLgtd(lgtd);
one.setLttd(lttd);
if(normal.getAddress() != null){
one.setAddress(normal.getAddress());
}
if(normal.getBuildUnit() != null){
one.setBuildUnit(normal.getBuildUnit());
}
if(normal.getYear() != null){
one.setYear(normal.getYear());
}
if(normal.getStationStatus() != null){
one.setStationStatus(normal.getStationStatus());
}
if(normal.getRemark() != null){
one.setRemark(normal.getRemark());
}
if(normal.getPipeElevation() != null){
one.setPipeElevation(normal.getPipeElevation());
}
if(normal.getPipeBottomElevation() != null){
one.setPipeBottomElevation(normal.getPipeBottomElevation());
}
if(normal.getDataCollection() != null){
one.setDataCollection(normal.getDataCollection());
}
LambdaQueryWrapper<JcskSlB> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JcskSlB::getDvcd,normal.getCode());
jcskSlBService.update(one,queryWrapper);
}else if(type==2){
//渗压
JcskSyB one = jcskSyBService.lambdaQuery()
.eq(JcskSyB::getDvcd, normal.getCode()).one();
if(one == null){
throw new IllegalArgumentException("对不起,该测点不存在");
}
one.setLgtd(lgtd);
one.setLttd(lttd);
if(normal.getAddress() != null){
one.setAddress(normal.getAddress());
}
if(normal.getBuildUnit() != null){
one.setBuildUnit(normal.getBuildUnit());
}
if(normal.getYear() != null){
one.setYear(normal.getYear());
}
if(normal.getStationStatus() != null){
one.setStationStatus(normal.getStationStatus());
}
if(normal.getRemark() != null){
one.setRemark(normal.getRemark());
}
if(normal.getPipeElevation() != null){
one.setPipeElevation(normal.getPipeElevation());
}
if(normal.getPipeBottomElevation() != null){
one.setPipeBottomElevation(normal.getPipeBottomElevation());
}
if(normal.getDataCollection() != null){
one.setDataCollection(normal.getDataCollection());
}
LambdaQueryWrapper<JcskSyB> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JcskSyB::getDvcd, normal.getCode());
jcskSyBService.update(one,queryWrapper);
}else{
//位移
JcskGnssB one = jcskGnssBService.lambdaQuery()
.eq(JcskGnssB::getCdNm,normal.getCode())
.one();
if(one == null){
throw new IllegalArgumentException("对不起,该测点不存在");
}
one.setLgtd(lgtd);
one.setLttd(lttd);
if(normal.getAddress() != null){
one.setAddress(normal.getAddress());
}
if(normal.getBuildUnit() != null){
one.setBuildUnit(normal.getBuildUnit());
}
if(normal.getYear() != null){
one.setYear(normal.getYear());
}
if(normal.getStationStatus() != null){
one.setStationStatus(normal.getStationStatus());
}
if(normal.getRemark() != null){
one.setRemark(normal.getRemark());
}
if(normal.getPipeElevation() != null){
one.setPipeElevation(normal.getPipeElevation());
}
if(normal.getPipeBottomElevation() != null){
one.setPipeBottomElevation(normal.getPipeBottomElevation());
}
if(normal.getDataCollection() != null){
one.setDataCollection(normal.getDataCollection());
}
LambdaQueryWrapper<JcskGnssB> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JcskGnssB::getCdNm,normal.getCode());
jcskGnssBService.update(one,queryWrapper);
}
return normal;
}
}

View File

@ -179,10 +179,10 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
aiWarningVo.setWarningTime(iscaiEvent.getStartTime()); aiWarningVo.setWarningTime(iscaiEvent.getStartTime());
aiWarningVo.setStnm(attCctvBase.getName()); aiWarningVo.setStnm(attCctvBase.getName());
if(attCctvBase.getLgtd() !=null){ if(attCctvBase.getLgtd() !=null){
aiWarningVo.setLgtd(new BigDecimal(attCctvBase.getLgtd())); aiWarningVo.setLgtd(attCctvBase.getLgtd());
} }
if(attCctvBase.getLttd() != null){ if(attCctvBase.getLttd() != null){
aiWarningVo.setLttd(new BigDecimal(attCctvBase.getLttd())); aiWarningVo.setLttd(attCctvBase.getLttd());
} }
aiWarningVos.add(aiWarningVo); aiWarningVos.add(aiWarningVo);

View File

@ -127,8 +127,8 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
for (AttCctvBase attCctvBase : attCctvBases) { for (AttCctvBase attCctvBase : attCctvBases) {
StStatusVo stStatusVo = new StStatusVo(); StStatusVo stStatusVo = new StStatusVo();
stStatusVo.setStnm(attCctvBase.getName()); stStatusVo.setStnm(attCctvBase.getName());
stStatusVo.setLgtd(attCctvBase.getLgtd() == null?null:new BigDecimal(attCctvBase.getLgtd())); stStatusVo.setLgtd(attCctvBase.getLgtd() == null?null:attCctvBase.getLgtd());
stStatusVo.setLttd(attCctvBase.getLttd() == null?null:new BigDecimal(attCctvBase.getLttd())); stStatusVo.setLttd(attCctvBase.getLttd() == null?null:attCctvBase.getLttd());
String preview = attCctvBaseService.preview(attCctvBase.getIndexCode()); String preview = attCctvBaseService.preview(attCctvBase.getIndexCode());
if(preview == null || StringUtils.isBlank(preview) ||!preview.startsWith("ws")){ if(preview == null || StringUtils.isBlank(preview) ||!preview.startsWith("ws")){
stStatusVo.setStatus(0); stStatusVo.setStatus(0);

View File

@ -0,0 +1,321 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gunshi.project.ss.mapper.JcskMapper">
<select id="selectPage" resultType="com.gunshi.project.ss.common.model.JcskNormal">
<choose>
<!-- 当type=1时只查询渗流表 -->
<when test="dto.type == 1">
SELECT
dvcd as code,
dm,
lgtd,
lttd,
pipe_elevation,
pipe_bottom_elevation,
data_collection,
station_status,
year,
build_unit,
address,
remark,
1 as type
FROM jcsk_sl_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</when>
<!-- 当type=2时只查询渗压表 -->
<when test="dto.type == 2">
SELECT
dvcd as code,
dm,
lgtd,
lttd,
pipe_elevation,
pipe_bottom_elevation,
data_collection,
station_status,
year,
build_unit,
address,
remark,
2 as type
FROM jcsk_sy_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</when>
<!-- 当type=3时只查询位移表 -->
<when test="dto.type == 3">
SELECT
cdnm as code,
ch as dm,
lgtd,
lttd,
pipe_elevation,
pipe_bottom_elevation,
data_collection,
station_status,
year,
build_unit,
address,
remark,
3 as type
FROM jcsk_gnss_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND cd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND ch LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</when>
<!-- 当type为空、null或其他值时查询所有表 -->
<otherwise>
SELECT
dvcd as code,
dm,
lgtd,
lttd,
pipe_elevation,
pipe_bottom_elevation,
data_collection,
station_status,
year,
build_unit,
address,
remark,
1 as type
FROM jcsk_sl_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
UNION ALL
SELECT
dvcd as code,
dm,
lgtd,
lttd,
pipe_elevation,
pipe_bottom_elevation,
data_collection,
station_status,
year,
build_unit,
address,
remark,
2 as type
FROM jcsk_sy_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
UNION ALL
SELECT
cd_nm as code,
ch as dm,
lgtd,
lttd,
pipe_elevation,
pipe_bottom_elevation,
data_collection,
station_status,
year,
build_unit,
address,
remark,
3 as type
FROM jcsk_gnss_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND cd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND ch LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</otherwise>
</choose>
<!-- 添加排序 -->
ORDER BY type asc
</select>
<select id="selectPageCount" resultType="long">
<choose>
<!-- 当type=1时只统计渗流表 -->
<when test="dto.type == 1">
SELECT COUNT(*)
FROM jcsk_sl_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</when>
<!-- 当type=2时只统计渗压表 -->
<when test="dto.type == 2">
SELECT COUNT(*)
FROM jcsk_sy_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</when>
<!-- 当type=3时只统计位移表 -->
<when test="dto.type == 3">
SELECT COUNT(*)
FROM jcsk_gnss_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND cd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND ch LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
</when>
<!-- 当type为空、null或其他值时统计所有表 -->
<otherwise>
SELECT COUNT(*) FROM (
SELECT dvcd
FROM jcsk_sl_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
UNION ALL
SELECT dvcd
FROM jcsk_sy_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND dvcd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND dm LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
UNION ALL
SELECT cd
FROM jcsk_gnss_b
WHERE 1=1
<if test="dto.code != null and dto.code != ''">
AND cd LIKE '%' || #{dto.code} || '%'
</if>
<if test="dto.dm != null and dto.dm != ''">
AND ch LIKE '%' || #{dto.dm} || '%'
</if>
<if test="dto.dataCollection != null">
AND data_collection = #{dto.dataCollection}
</if>
<if test="dto.stationStatus != null">
AND station_status = #{dto.stationStatus}
</if>
) AS total
</otherwise>
</choose>
</select>
</mapper>