库容曲线查新增修改,水位流量关系曲线新增修改
parent
08d0350119
commit
f063205b94
|
|
@ -106,14 +106,15 @@ public class AttResBaseController extends AbstractCommonFileController {
|
|||
if (Objects.isNull(service.getById(dto.getResCode()))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
fileService.saveFile(dto.getFiles(), getGroupId() + "1", dto.getResCode());
|
||||
List<FileAssociations> files = dto.getFiles();
|
||||
fileService.saveFile(files, getGroupId(), dto.getResCode(),"1");
|
||||
return R.ok(dto);
|
||||
}
|
||||
|
||||
@Operation(summary = "设计图纸和资料列表")
|
||||
@GetMapping("/fileList/{resCode}")
|
||||
public R<List<FileAssociations>> list(@PathVariable("resCode") String resCode) {
|
||||
List<FileAssociations> files = fileService.getFiles(getGroupId() + "1", resCode);
|
||||
List<FileAssociations> files = fileService.getFiles(getGroupId(), resCode);
|
||||
if (CollectionUtils.isEmpty(files)){
|
||||
return R.ok(files);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.gunshi.project.xyt.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.model.AttResBase;
|
||||
import com.gunshi.project.xyt.model.StZqrlB;
|
||||
import com.gunshi.project.xyt.service.AttResBaseService;
|
||||
import com.gunshi.project.xyt.service.StStbprpBService;
|
||||
import com.gunshi.project.xyt.service.StZqrlBService;
|
||||
import com.gunshi.project.xyt.validate.markers.Delete;
|
||||
|
|
@ -34,21 +36,32 @@ public class StZqrlBController {
|
|||
@Autowired
|
||||
private StZqrlBService service;
|
||||
|
||||
@Autowired
|
||||
private AttResBaseService resBaseService;
|
||||
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<StZqrlB> insert(@Validated(Insert.class) @RequestBody StZqrlB dto) {
|
||||
if (StringUtils.isNotBlank(dto.getResCode())){
|
||||
AttResBase one = resBaseService.lambdaQuery().eq(AttResBase::getResCode, dto.getResCode()).one();
|
||||
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()
|
||||
.eq(StZqrlB::getStcd, dto.getStcd())
|
||||
.eq(StZqrlB::getLnnm, dto.getLnnm())
|
||||
.eq(StZqrlB::getBgtm, dto.getBgtm())
|
||||
.eq(StZqrlB::getPtno, dto.getPtno())
|
||||
.eq(StZqrlB::getZ, dto.getZ())
|
||||
.eq(StZqrlB::getQ, dto.getQ())
|
||||
.count() > 0) {
|
||||
throw new IllegalArgumentException("当前数据已存在");
|
||||
}
|
||||
|
|
@ -66,9 +79,9 @@ public class StZqrlBController {
|
|||
|
||||
if (service.lambdaQuery()
|
||||
.eq(StZqrlB::getStcd, dto.getStcd())
|
||||
.eq(StZqrlB::getLnnm, dto.getLnnm())
|
||||
.eq(StZqrlB::getBgtm, dto.getBgtm())
|
||||
.eq(StZqrlB::getPtno, dto.getPtno())
|
||||
.eq(StZqrlB::getZ, dto.getZ())
|
||||
.eq(StZqrlB::getQ, dto.getQ())
|
||||
.eq(StZqrlB::getModitime, dto.getModitime())
|
||||
.count() > 0) {
|
||||
throw new IllegalArgumentException("当前数据已存在");
|
||||
}
|
||||
|
|
@ -82,19 +95,22 @@ public class StZqrlBController {
|
|||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
public R<Boolean> del(@Validated(Delete.class) @RequestBody StZqrlB dto) {
|
||||
if (StringUtils.isNotBlank(dto.getStcd()) && Objects.isNull(stStbprpBService.getById(dto.getStcd()))){
|
||||
throw new IllegalArgumentException("测站编码不存在");
|
||||
}
|
||||
if (service.lambdaQuery()
|
||||
.eq(StZqrlB::getStcd, dto.getStcd())
|
||||
.eq(StZqrlB::getLnnm, dto.getLnnm())
|
||||
.eq(StZqrlB::getBgtm, dto.getBgtm())
|
||||
.eq(StZqrlB::getPtno, dto.getPtno())
|
||||
.eq(StZqrlB::getZ, dto.getZ())
|
||||
.eq(StZqrlB::getQ, dto.getQ())
|
||||
.eq(StZqrlB::getModitime, dto.getModitime())
|
||||
.count() != 1) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
return R.ok(service.lambdaUpdate()
|
||||
.eq(StZqrlB::getStcd, dto.getStcd())
|
||||
.eq(StZqrlB::getLnnm, dto.getLnnm())
|
||||
.eq(StZqrlB::getBgtm, dto.getBgtm())
|
||||
.eq(StZqrlB::getPtno, dto.getPtno())
|
||||
.eq(StZqrlB::getZ, dto.getZ())
|
||||
.eq(StZqrlB::getQ, dto.getQ())
|
||||
.eq(StZqrlB::getModitime, dto.getModitime())
|
||||
.remove() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.gunshi.project.xyt.controller;
|
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.model.AttResBase;
|
||||
import com.gunshi.project.xyt.model.StZvarlB;
|
||||
import com.gunshi.project.xyt.service.AttResBaseService;
|
||||
import com.gunshi.project.xyt.service.StStbprpBService;
|
||||
import com.gunshi.project.xyt.service.StZvarlBService;
|
||||
import com.gunshi.project.xyt.validate.markers.Delete;
|
||||
|
|
@ -35,20 +37,31 @@ public class StZvarlBController {
|
|||
@Autowired
|
||||
private StZvarlBService service;
|
||||
|
||||
@Autowired
|
||||
private AttResBaseService resBaseService;
|
||||
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<StZvarlB> insert(@Validated(Insert.class) @RequestBody StZvarlB dto) {
|
||||
if (StringUtils.isNotBlank(dto.getResCode())){
|
||||
AttResBase one = resBaseService.lambdaQuery().eq(AttResBase::getResCode, dto.getResCode()).one();
|
||||
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()
|
||||
.eq(StZvarlB::getStcd, dto.getStcd())
|
||||
.eq(StZvarlB::getMstm, dto.getMstm())
|
||||
.eq(StZvarlB::getPtno, dto.getPtno())
|
||||
.eq(StZvarlB::getRz, dto.getRz())
|
||||
.eq(StZvarlB::getW, dto.getW())
|
||||
.count() > 0) {
|
||||
throw new IllegalArgumentException("当前数据已存在");
|
||||
}
|
||||
|
|
@ -64,15 +77,13 @@ public class StZvarlBController {
|
|||
throw new IllegalArgumentException("测站编码不存在");
|
||||
}
|
||||
|
||||
if (service.lambdaQuery()
|
||||
boolean result = service.lambdaUpdate()
|
||||
.set(StZvarlB::getRz, dto.getRz())
|
||||
.set(StZvarlB::getW, dto.getW())
|
||||
.set(StZvarlB::getWsfa, dto.getWsfa())
|
||||
.eq(StZvarlB::getStcd, dto.getStcd())
|
||||
.eq(StZvarlB::getMstm, dto.getMstm())
|
||||
.eq(StZvarlB::getPtno, dto.getPtno())
|
||||
.count() > 0) {
|
||||
throw new IllegalArgumentException("当前数据已存在");
|
||||
}
|
||||
dto.setModitime(null);
|
||||
boolean result = service.updateById(dto);
|
||||
.eq(StZvarlB::getModitime, dto.getModitime())
|
||||
.update();
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
|
|
@ -80,16 +91,18 @@ public class StZvarlBController {
|
|||
@PostMapping("/del")
|
||||
public R<Boolean> del(@Validated(Delete.class) @RequestBody StZvarlB dto) {
|
||||
if (service.lambdaQuery()
|
||||
.eq(StZvarlB::getRz, dto.getRz())
|
||||
.eq(StZvarlB::getW, dto.getW())
|
||||
.eq(StZvarlB::getStcd, dto.getStcd())
|
||||
.eq(StZvarlB::getMstm, dto.getMstm())
|
||||
.eq(StZvarlB::getPtno, dto.getPtno())
|
||||
.eq(StZvarlB::getModitime, dto.getModitime())
|
||||
.count() != 1) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
return R.ok(service.lambdaUpdate()
|
||||
.eq(StZvarlB::getRz, dto.getRz())
|
||||
.eq(StZvarlB::getW, dto.getW())
|
||||
.eq(StZvarlB::getStcd, dto.getStcd())
|
||||
.eq(StZvarlB::getMstm, dto.getMstm())
|
||||
.eq(StZvarlB::getPtno, dto.getPtno())
|
||||
.eq(StZvarlB::getModitime, dto.getModitime())
|
||||
.remove() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,15 +22,16 @@ public interface IaCDanadMapper extends BaseMapper<IaCDanad> {
|
|||
<script>
|
||||
SELECT st.*, r1.adnm||r2.adnm adnm FROM ia_c_danad st
|
||||
LEFT JOIN st_addvcd_d r1 ON concat ( LEFT ( st.adcd, 6 ), '000000000' ) = r1.adcd
|
||||
LEFT JOIN st_addvcd_d r2 ON concat ( LEFT ( st.adcd, 9 ), '000000' ) = r1.adcd
|
||||
LEFT JOIN st_addvcd_d r2 ON concat ( LEFT ( st.adcd, 9 ), '000000' ) = r2.adcd
|
||||
</script>
|
||||
""")
|
||||
List<HomeIaCDanadVo> getDetailsAndMonitoringDataLis();
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
SELECT st.*,r.adnm FROM ia_c_danad st
|
||||
LEFT JOIN st_addvcd_d r ON st.adcd = r.adcd
|
||||
SELECT st.*, r1.adnm||r2.adnm adnm FROM ia_c_danad st
|
||||
LEFT JOIN st_addvcd_d r1 ON concat ( LEFT ( st.adcd, 6 ), '000000000' ) = r1.adcd
|
||||
LEFT JOIN st_addvcd_d r2 ON concat ( LEFT ( st.adcd, 9 ), '000000' ) = r2.adcd
|
||||
WHERE st.dand = #{id}
|
||||
</script>
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public interface IaCFlrvvlgMapper extends BaseMapper<IaCFlrvvlg> {
|
|||
<script>
|
||||
SELECT st.*,r1.adnm||r2.adnm adnm FROM ia_c_flrvvlg st
|
||||
LEFT JOIN st_addvcd_d r1 ON concat ( LEFT ( st.adcd, 6 ), '000000000' ) = r1.adcd
|
||||
LEFT JOIN st_addvcd_d r2 ON concat ( LEFT ( st.adcd, 9 ), '000000' ) = r1.adcd
|
||||
LEFT JOIN st_addvcd_d r2 ON concat ( LEFT ( st.adcd, 9 ), '000000' ) = r2.adcd
|
||||
WHERE st.adcd like '421181113%'
|
||||
</script>
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ public interface ShpPlacementMapper extends BaseMapper<ShpPlacement> {
|
|||
|
||||
@Select("""
|
||||
<script>
|
||||
SELECT st.*,r.adnm FROM shp_placement st
|
||||
LEFT JOIN st_addvcd_d r ON st.adcd = r.adcd
|
||||
SELECT st.*,r1.adnm||r2.adnm adnm FROM shp_placement st
|
||||
LEFT JOIN st_addvcd_d r1 ON concat ( LEFT ( st.adcd, 6 ), '000000000' ) = r1.adcd
|
||||
LEFT JOIN st_addvcd_d r2 ON concat ( LEFT ( st.adcd, 9 ), '000000' ) = r2.adcd
|
||||
</script>
|
||||
""")
|
||||
List<HomeShpPlacementVo> getDetailsAndMonitoringDataList();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class StZqrlB implements Serializable {
|
|||
@TableId(value="stcd", type= IdType.AUTO)
|
||||
@Schema(description="测站编码")
|
||||
@Size(max = 20,message = "测站编码最大长度要小于 8")
|
||||
@NotBlank(message = "测站编码不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
@NotBlank(message = "测站编码不能为空")
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +48,6 @@ public class StZqrlB implements Serializable {
|
|||
@TableField(value="lnnm")
|
||||
@Schema(description="曲线名称")
|
||||
@Size(max = 30,message = "曲线名称最大长度要小于 30")
|
||||
@NotBlank(message = "曲线名称不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private String lnnm;
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +56,6 @@ public class StZqrlB implements Serializable {
|
|||
@TableField(value="bgtm")
|
||||
@Schema(description="启用时间")
|
||||
// @Size(max = 0,message = "启用时间最大长度要小于 0")
|
||||
@NotNull(message = "启用时间不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date bgtm;
|
||||
|
||||
|
|
@ -67,7 +65,6 @@ public class StZqrlB implements Serializable {
|
|||
@TableField(value="ptno")
|
||||
@Schema(description="点序号")
|
||||
// @Size(max = 0,message = "点序号最大长度要小于 0")
|
||||
@NotNull(message = "点序号不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private Integer ptno;
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +73,7 @@ public class StZqrlB implements Serializable {
|
|||
@TableField(value="z")
|
||||
@Schema(description="水位")
|
||||
// @Size(max = 0,message = "水位最大长度要小于 0")
|
||||
@NotNull(message = "水位不能为空",groups = {Insert.class, Update.class})
|
||||
@NotNull(message = "水位不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private BigDecimal z;
|
||||
|
||||
/**
|
||||
|
|
@ -85,7 +82,7 @@ public class StZqrlB implements Serializable {
|
|||
@TableField(value="q")
|
||||
@Schema(description="流量")
|
||||
// @Size(max = 0,message = "流量最大长度要小于 0")
|
||||
@NotNull(message = "流量不能为空",groups = {Insert.class, Update.class})
|
||||
@NotNull(message = "流量不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private BigDecimal q;
|
||||
|
||||
/**
|
||||
|
|
@ -105,4 +102,8 @@ public class StZqrlB implements Serializable {
|
|||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date moditime;
|
||||
|
||||
|
||||
@Schema(description="水库代码")
|
||||
@TableField(exist = false)
|
||||
private String resCode;
|
||||
}
|
||||
|
|
@ -36,8 +36,7 @@ public class StZvarlB implements Serializable {
|
|||
*/
|
||||
@TableId(value="stcd")
|
||||
@Schema(description="测站编码")
|
||||
@Size(max = 20,message = "测站编码最大长度要小于 8",groups = {Insert.class, Update.class, Delete.class})
|
||||
@NotNull(message = "测站编码不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
@Size(max = 20,message = "测站编码最大长度要小于 8")
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +45,6 @@ public class StZvarlB implements Serializable {
|
|||
@TableField(value="mstm")
|
||||
@Schema(description="施测时间")
|
||||
// @Size(max = 0,message = "施测时间最大长度要小于 0")
|
||||
@NotNull(message = "施测时间不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date mstm;
|
||||
|
||||
|
|
@ -56,7 +54,6 @@ public class StZvarlB implements Serializable {
|
|||
@TableField(value="ptno")
|
||||
@Schema(description="点序号")
|
||||
// @Size(max = 0,message = "点序号最大长度要小于 0")
|
||||
@NotNull(message = "点序号不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private Integer ptno;
|
||||
|
||||
/**
|
||||
|
|
@ -64,7 +61,7 @@ public class StZvarlB implements Serializable {
|
|||
*/
|
||||
@TableField(value="rz")
|
||||
@Schema(description="库水位")
|
||||
@NotNull(message = "库水位不能为空",groups = {Insert.class, Update.class})
|
||||
@NotNull(message = "库水位不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private BigDecimal rz;
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +69,7 @@ public class StZvarlB implements Serializable {
|
|||
*/
|
||||
@TableField(value="w")
|
||||
@Schema(description="蓄水量")
|
||||
@NotNull(message = "蓄水量不能为空",groups = {Insert.class, Update.class})
|
||||
@NotNull(message = "蓄水量不能为空",groups = {Insert.class, Update.class, Delete.class})
|
||||
private BigDecimal w;
|
||||
|
||||
/**
|
||||
|
|
@ -100,4 +97,8 @@ public class StZvarlB implements Serializable {
|
|||
// @Size(max = 0,message = "库容(万m³)最大长度要小于 0")
|
||||
private BigDecimal totCap;
|
||||
|
||||
@Schema(description="水库代码")
|
||||
@TableField(exist = false)
|
||||
private String resCode;
|
||||
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class FileAssociationsService extends ServiceImpl<FileAssociationsMapper,
|
|||
|
||||
private static final String THIS_REDIS_KEY = REDIS_KEY + FileAssociations.thisTableName + ":";
|
||||
|
||||
@CacheEvict(value = THIS_REDIS_KEY, key = "#p0 +':*'", allEntries = true)
|
||||
@CacheEvict(value = THIS_REDIS_KEY, key = "#p1 +':*'", allEntries = true)
|
||||
public void saveFile(List<FileAssociations> files, String tableName, String businessId) {
|
||||
if (CollectionUtils.isEmpty(files)) {
|
||||
log.info("fileIds is null!");
|
||||
|
|
@ -82,6 +82,62 @@ public class FileAssociationsService extends ServiceImpl<FileAssociationsMapper,
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
@CacheEvict(value = THIS_REDIS_KEY, key = "#p1 +':*'", allEntries = true)
|
||||
public void saveFile(List<FileAssociations> files, String tableName, String businessId, String type) {
|
||||
if (CollectionUtils.isEmpty(files)) {
|
||||
log.info("fileIds is null!");
|
||||
}
|
||||
|
||||
// 查询是否添加
|
||||
List<FileAssociations> dbList = this.lambdaQuery()
|
||||
.eq(FileAssociations::getTableName, tableName)
|
||||
.eq(FileAssociations::getBusinessId, businessId)
|
||||
.eq(FileAssociations::getType, type)
|
||||
.eq(FileAssociations::getDel, REC)
|
||||
.list();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(dbList)) {
|
||||
Set<Long> fileIds = dbList.stream().map(FileAssociations::getFileId)
|
||||
.collect(Collectors.toSet());
|
||||
// 删除已添加数据, 删除重复数据 删除不成功即新数据
|
||||
files = files.stream()
|
||||
.filter(fileAssociations -> !fileIds.remove(fileAssociations.getFileId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// if (CollectionUtils.isNotEmpty(files)) {
|
||||
|
||||
// 删除
|
||||
if (this.lambdaUpdate()
|
||||
.set(FileAssociations::getDel, DEL)
|
||||
.eq(FileAssociations::getTableName, tableName)
|
||||
.eq(FileAssociations::getBusinessId, businessId)
|
||||
.eq(FileAssociations::getType, type)
|
||||
.in(FileAssociations::getFileId, fileIds)
|
||||
.update()) {
|
||||
log.info("delete file {} success!", fileIds);
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// 做新增
|
||||
if (CollectionUtils.isNotEmpty(files)) {
|
||||
|
||||
files.forEach(fileId -> {
|
||||
fileId.setId(IdWorker.getId());
|
||||
fileId.setTableName(tableName);
|
||||
fileId.setType(type);
|
||||
fileId.setBusinessId(businessId);
|
||||
});
|
||||
|
||||
if (!this.saveBatch(files)) {
|
||||
log.error("save file error!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@CacheEvict(value = THIS_REDIS_KEY, key = "#p0 +':*'", allEntries = true)
|
||||
|
|
|
|||
Loading…
Reference in New Issue