fix:1.探测器页面bug修复2.Web模块页面bug修复
This commit is contained in:
parent
e4b802ce95
commit
4e2313945a
|
@ -12,6 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -22,14 +23,14 @@ public class GardsDetectors implements Serializable {
|
||||||
* 探测器id
|
* 探测器id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "DETECTOR_ID")
|
@TableId(value = "DETECTOR_ID")
|
||||||
@NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
@NotNull(message = "The detector id cannot be empty", groups = {InsertGroup.class, UpdateGroup.class})
|
||||||
private Integer detectorId;
|
private Integer detectorId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 探测器编码
|
* 探测器编码
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DETECTOR_CODE")
|
@TableField(value = "DETECTOR_CODE")
|
||||||
@NotBlank(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
@NotBlank(message = "The detector code cannot be empty", groups = {InsertGroup.class, UpdateGroup.class})
|
||||||
private String detectorCode;
|
private String detectorCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +101,6 @@ public class GardsDetectors implements Serializable {
|
||||||
* 操作时间
|
* 操作时间
|
||||||
*/
|
*/
|
||||||
@TableField(value = "MODDATE")
|
@TableField(value = "MODDATE")
|
||||||
@NotNull(message = "不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date moddate;
|
private Date moddate;
|
||||||
|
@ -110,5 +110,4 @@ public class GardsDetectors implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "STATION_ID")
|
@TableField(value = "STATION_ID")
|
||||||
private Integer stationId;
|
private Integer stationId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package org.jeecg.modules.base.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DetectorStatus {
|
||||||
|
ON("Operating"), OFF("Unoperating");
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
}
|
|
@ -71,4 +71,8 @@ public class GardsDetectorsController {
|
||||||
return gardsDetectorsService.findStationDetectors(stationIds);
|
return gardsDetectorsService.findStationDetectors(stationIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("duplicateCheck")
|
||||||
|
public Result<?> duplicateCheck(String field, String value){
|
||||||
|
return gardsDetectorsService.duplicateCheck(field, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,4 @@ public interface GardsDetectorsMapper extends BaseMapper<GardsDetectorsSystem> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> findType();
|
List<String> findType();
|
||||||
|
|
||||||
List<GardsDetectorsSystem> list(Integer stationId, String status);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,30 +23,19 @@
|
||||||
CONFIGURATION.GARDS_DETECTORS
|
CONFIGURATION.GARDS_DETECTORS
|
||||||
<where>
|
<where>
|
||||||
<if test="gardsDetectors.detectorCode != '' and gardsDetectors.detectorCode != null">
|
<if test="gardsDetectors.detectorCode != '' and gardsDetectors.detectorCode != null">
|
||||||
and DETECTOR_CODE like CONCAT('%',#{gardsDetectors.detectorCode},'%')
|
DETECTOR_CODE LIKE CONCAT(CONCAT('%', #{gardsDetectors.detectorCode}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="gardsDetectors.type != '' and gardsDetectors.type != null">
|
<if test="gardsDetectors.type != '' and gardsDetectors.type != null">
|
||||||
and TYPE = #{gardsDetectors.type}
|
AND TYPE = #{gardsDetectors.type}
|
||||||
</if>
|
</if>
|
||||||
<if test="gardsDetectors.status != '' and gardsDetectors.status != null">
|
<if test="gardsDetectors.status != '' and gardsDetectors.status != null">
|
||||||
and RTRIM(STATUS, ' ') = #{gardsDetectors.status}
|
AND RTRIM(STATUS, ' ') = #{gardsDetectors.status}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by DETECTOR_ID asc
|
Order By DETECTOR_ID ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findType" resultType="java.lang.String">
|
<select id="findType" resultType="java.lang.String">
|
||||||
SELECT DISTINCT TYPE FROM CONFIGURATION.GARDS_DETECTORS
|
SELECT DISTINCT TYPE FROM CONFIGURATION.GARDS_DETECTORS
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultType="org.jeecg.modules.system.entity.GardsDetectorsSystem">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
CONFIGURATION.GARDS_DETECTORS det
|
|
||||||
<where>
|
|
||||||
det.STATION_ID = #{stationId} AND TRIM(det.STATUS) = #{status}
|
|
||||||
</where>
|
|
||||||
ORDER BY det.DETECTOR_ID ASC
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -36,14 +36,14 @@ public interface IGardsDetectorsService extends IService<GardsDetectorsSystem> {
|
||||||
* @param gardsDetectors
|
* @param gardsDetectors
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Result create(GardsDetectorsSystem gardsDetectors);
|
Result<?> create(GardsDetectorsSystem gardsDetectors);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改监测器信息
|
* 修改监测器信息
|
||||||
* @param gardsDetectors
|
* @param gardsDetectors
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Result update(GardsDetectorsSystem gardsDetectors);
|
Result<?> update(GardsDetectorsSystem gardsDetectors);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除监测器信息
|
* 删除监测器信息
|
||||||
|
@ -65,4 +65,5 @@ public interface IGardsDetectorsService extends IService<GardsDetectorsSystem> {
|
||||||
*/
|
*/
|
||||||
Map<String, List<GardsDetectorsSystem>> findStationDetectors(List<String> stationIds);
|
Map<String, List<GardsDetectorsSystem>> findStationDetectors(List<String> stationIds);
|
||||||
|
|
||||||
|
Result<?> duplicateCheck(String field, String value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.Prompt;
|
import org.jeecg.common.constant.Prompt;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
|
||||||
|
import org.jeecg.modules.base.enums.DetectorStatus;
|
||||||
import org.jeecg.modules.system.entity.GardsDetectorsSystem;
|
import org.jeecg.modules.system.entity.GardsDetectorsSystem;
|
||||||
import org.jeecg.modules.system.mapper.GardsDetectorsMapper;
|
import org.jeecg.modules.system.mapper.GardsDetectorsMapper;
|
||||||
import org.jeecg.modules.system.service.IGardsDetectorsService;
|
import org.jeecg.modules.system.service.IGardsDetectorsService;
|
||||||
|
@ -31,6 +32,7 @@ import java.util.stream.Collectors;
|
||||||
@Service("gardsDetectorsService")
|
@Service("gardsDetectorsService")
|
||||||
@DS("ora")
|
@DS("ora")
|
||||||
public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper, GardsDetectorsSystem> implements IGardsDetectorsService {
|
public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper, GardsDetectorsSystem> implements IGardsDetectorsService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@ -76,25 +78,23 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> findType() {
|
public List<String> findType() {
|
||||||
List<String> type = this.baseMapper.findType();
|
return this.baseMapper.findType();
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Result<?> create(GardsDetectorsSystem detector) {
|
public Result<?> create(GardsDetectorsSystem detector) {
|
||||||
Integer detectorId = detector.getDetectorId();
|
|
||||||
String detectorCode = detector.getDetectorCode();
|
|
||||||
LambdaQueryWrapper<GardsDetectorsSystem> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(GardsDetectors::getDetectorId, detectorId);
|
|
||||||
wrapper.or().eq(GardsDetectors::getDetectorCode, detectorCode);
|
|
||||||
if (CollUtil.isNotEmpty(this.list(wrapper)))
|
|
||||||
return Result.error("The detector id or code cannot be repeated");
|
|
||||||
Integer stationId = detector.getStationId();
|
Integer stationId = detector.getStationId();
|
||||||
if (ObjectUtil.isNull(stationId))
|
if (ObjectUtil.isNull(stationId))
|
||||||
return Result.error("Station id of the detector cannot be empty");
|
return Result.error("Station Id Of The Detector Cannot Be Empty");
|
||||||
// 查询相同台站下所有工作的探测器 按照探测器Id升序排序
|
// 查询相同台站下所有工作的探测器 按照探测器Id升序排序
|
||||||
List<GardsDetectorsSystem> detectors = this.baseMapper.list(stationId, "Operating");
|
LambdaQueryWrapper<GardsDetectorsSystem> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(GardsDetectors::getStationId, stationId);
|
||||||
|
List<GardsDetectorsSystem> detectors = this.list(wrapper);
|
||||||
|
detectors = detectors.stream()
|
||||||
|
.filter(item -> StrUtil.equals(StrUtil.trim(item.getStatus()), DetectorStatus.ON.getValue()))
|
||||||
|
.sorted(Comparator.comparingInt(GardsDetectorsSystem::getDetectorId))
|
||||||
|
.collect(Collectors.toList());
|
||||||
// 如果相同台站下没有工作探测器
|
// 如果相同台站下没有工作探测器
|
||||||
if (CollUtil.isEmpty(detectors)){
|
if (CollUtil.isEmpty(detectors)){
|
||||||
boolean success = this.save(detector);
|
boolean success = this.save(detector);
|
||||||
|
@ -106,7 +106,7 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
}
|
}
|
||||||
// 如果相同台站下有工作探测器 将Id最小的探测器状态置为 Unoperating
|
// 如果相同台站下有工作探测器 将Id最小的探测器状态置为 Unoperating
|
||||||
GardsDetectorsSystem detectorMin = detectors.get(0);
|
GardsDetectorsSystem detectorMin = detectors.get(0);
|
||||||
detectorMin.setStatus("Unoperating");
|
detectorMin.setStatus(DetectorStatus.OFF.getValue());
|
||||||
detectors = ListUtil.toList(detectorMin, detector);
|
detectors = ListUtil.toList(detectorMin, detector);
|
||||||
boolean success = this.saveOrUpdateBatch(detectors);
|
boolean success = this.saveOrUpdateBatch(detectors);
|
||||||
if (success){
|
if (success){
|
||||||
|
@ -117,41 +117,23 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result update(GardsDetectorsSystem gardsDetectors) {
|
public Result<?> update(GardsDetectorsSystem detector) {
|
||||||
Result result = new Result();
|
boolean success = this.updateById(detector);
|
||||||
LambdaQueryWrapper<GardsDetectorsSystem> wrapper = new LambdaQueryWrapper<>();
|
if (success){
|
||||||
wrapper.eq(GardsDetectorsSystem::getDetectorId, gardsDetectors.getDetectorId());
|
|
||||||
GardsDetectorsSystem stations = this.baseMapper.selectOne(wrapper);
|
|
||||||
if (Objects.isNull(stations)) {
|
|
||||||
result.error500("The current data does not exist,Modification failure");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(gardsDetectors.getDetectorCode())){
|
|
||||||
LambdaQueryWrapper<GardsDetectorsSystem> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(GardsDetectorsSystem::getDetectorCode, gardsDetectors.getDetectorCode());
|
|
||||||
GardsDetectorsSystem detectors = this.baseMapper.selectOne(queryWrapper);
|
|
||||||
if (Objects.nonNull(detectors) && !detectors.getDetectorId().equals(gardsDetectors.getDetectorId())) {
|
|
||||||
result.error500("Current data "+gardsDetectors.getDetectorCode()+" Already exist,Modification failure!");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LambdaQueryWrapper<GardsDetectorsSystem> detectorsQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
detectorsQueryWrapper.eq(GardsDetectorsSystem::getDetectorId, gardsDetectors.getDetectorId());
|
|
||||||
this.baseMapper.update(gardsDetectors, detectorsQueryWrapper);
|
|
||||||
result.success("Modified successfully");
|
|
||||||
this.findDetectors();
|
this.findDetectors();
|
||||||
return result;
|
return Result.OK(Prompt.UPDATE_SUCC);
|
||||||
|
}
|
||||||
|
return Result.error(Prompt.UPDATE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result deleteById(Integer id) {
|
public Result<?> deleteById(Integer id) {
|
||||||
Result result = new Result();
|
boolean success = this.removeById(id);
|
||||||
LambdaQueryWrapper<GardsDetectorsSystem> queryWrapper = new LambdaQueryWrapper<>();
|
if (success){
|
||||||
queryWrapper.eq(GardsDetectorsSystem::getDetectorId, id);
|
|
||||||
this.baseMapper.delete(queryWrapper);
|
|
||||||
result.success("Successfully deleted");
|
|
||||||
this.findDetectors();
|
this.findDetectors();
|
||||||
return result;
|
return Result.OK(Prompt.DELETE_SUCC);
|
||||||
|
}
|
||||||
|
return Result.error(Prompt.DELETE_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -180,4 +162,17 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> duplicateCheck(String field, String value) {
|
||||||
|
LambdaQueryWrapper<GardsDetectorsSystem> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StrUtil.equals(field, "DETECTOR_ID")){
|
||||||
|
wrapper.eq(GardsDetectors::getDetectorId, value);
|
||||||
|
return this.list(wrapper).isEmpty() ? Result.OK() : Result.error("Id Cannot Be Repeated");
|
||||||
|
}else if (StrUtil.equals(field, "DETECTOR_CODE")){
|
||||||
|
wrapper.eq(GardsDetectors::getDetectorCode, value);
|
||||||
|
return this.list(wrapper).isEmpty() ? Result.OK() : Result.error("Code Cannot Be Repeated");
|
||||||
|
}else {
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,8 @@
|
||||||
INNER JOIN RNMAN.GARDS_ANALYSES ana on ana.SAMPLE_ID = sam.SAMPLE_ID
|
INNER JOIN RNMAN.GARDS_ANALYSES ana on ana.SAMPLE_ID = sam.SAMPLE_ID
|
||||||
<where>
|
<where>
|
||||||
sam.COLLECT_START >= TO_DATE(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
sam.COLLECT_START >= TO_DATE(#{startDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||||
and sam.COLLECT_STOP <= TO_DATE(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
AND sam.COLLECT_STOP <= TO_DATE(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
|
||||||
|
AND ana.REPORT_PAHT IS NOT NULL
|
||||||
<if test="stationIdList.size ==0 and stationIdList != null">
|
<if test="stationIdList.size ==0 and stationIdList != null">
|
||||||
and sam.STATION_ID in ('')
|
and sam.STATION_ID in ('')
|
||||||
</if>
|
</if>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user