闸阀及闸阀检修相关接口
parent
a007b72a66
commit
285f33d8ab
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateHistoryInfoVo;
|
||||||
|
import com.gunshi.project.xyt.model.StWaterQualityR;
|
||||||
|
import com.gunshi.project.xyt.service.GateService;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateInfoVo;
|
||||||
|
import com.gunshi.project.xyt.so.GateHistoryPageSo;
|
||||||
|
import com.gunshi.project.xyt.so.WaterQualityPageSo;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀接口
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "闸阀接口-controller", description = "闸阀接口")
|
||||||
|
@Data
|
||||||
|
@RequestMapping("/gate")
|
||||||
|
public class GateController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GateService gateService;
|
||||||
|
|
||||||
|
@Operation(summary = "闸阀列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public R<List<GateInfoVo>> list() {
|
||||||
|
return R.ok(gateService.queryGateList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "闸阀开关历史分页查询")
|
||||||
|
@PostMapping("/page")
|
||||||
|
public R<Page<GateHistoryInfoVo>> page(@Validated({QueryPage.class, QueryTimeRange.class}) @RequestBody(required = true)
|
||||||
|
GateHistoryPageSo gateHistoryPageSo) {
|
||||||
|
return R.ok(gateService.page(gateHistoryPageSo));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.addressbook.entity.so.UamsOrgPageSo;
|
||||||
|
import com.gunshi.addressbook.entity.vo.UamsOrgFullInfoVo;
|
||||||
|
import com.gunshi.addressbook.model.UamsOrgB;
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StGateRepairRecordDto;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairDetailVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairRecordVo;
|
||||||
|
import com.gunshi.project.xyt.service.GateRepairRecordService;
|
||||||
|
import com.gunshi.project.xyt.so.GateRepairRecordPageSo;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀检修接口
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "闸阀检修接口-controller", description = "闸阀检修接口")
|
||||||
|
@Data
|
||||||
|
@RequestMapping("/gate/repair")
|
||||||
|
public class GateRepairRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GateRepairRecordService gateRepairRecordService;
|
||||||
|
|
||||||
|
@Operation(summary = "新增检修记录")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<String> add(@Validated(Insert.class) @RequestBody StGateRepairRecordDto stGateRepairRecordDto) {
|
||||||
|
return R.ok(gateRepairRecordService.addRecord(stGateRepairRecordDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新检修记录")
|
||||||
|
@PostMapping("/update")
|
||||||
|
public R<String> update(@RequestBody @Validated(Update.class) StGateRepairRecordDto stGateRepairRecordDto) {
|
||||||
|
return R.ok(gateRepairRecordService.updateRecord(stGateRepairRecordDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "检修记录详情")
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<GateRepairDetailVo> detail(@RequestParam("recordId") Long recordId) {
|
||||||
|
return R.ok(gateRepairRecordService.detail(recordId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据recordId删除检修记录")
|
||||||
|
@Parameter(name = "recordId", description = "检修记录id")
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
public R<String> delete(@RequestParam("recordId") Long recordId){
|
||||||
|
return R.ok(gateRepairRecordService.deleteRecord(recordId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "分页查询")
|
||||||
|
@PostMapping("/page")
|
||||||
|
public R<Page<GateRepairRecordVo>> page(@RequestBody @Validated GateRepairRecordPageSo gateRepairRecordPageSo) {
|
||||||
|
return R.ok(gateRepairRecordService.page(gateRepairRecordPageSo));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.gunshi.project.xyt.entity.dto;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairDetail;
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairRecord;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StGateRepairRecordDto extends StGateRepairRecord {
|
||||||
|
|
||||||
|
@Schema(description="维修情况")
|
||||||
|
private List<StGateRepairDetail> repairDetails;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StGateBHistory;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸门开关历史信息
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GateHistoryInfoVo extends StGateBHistory {
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "闸阀名称")
|
||||||
|
private String gateNm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸门详细信息
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GateInfoVo {
|
||||||
|
|
||||||
|
@Schema(description = "闸阀ID")
|
||||||
|
private Long gateId;
|
||||||
|
|
||||||
|
@Schema(description = "闸阀名称")
|
||||||
|
private String gateNm;
|
||||||
|
|
||||||
|
@Schema(description = "开关状态 1:全开 2:50%开 3:关")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description="数据采集时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairDetail;
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairRecord;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸门检修详细信息
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GateRepairDetailVo extends StGateRepairRecord {
|
||||||
|
|
||||||
|
@Schema(description = "详细信息")
|
||||||
|
private List<StGateRepairDetail> details;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairRecord;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸门详细信息
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GateRepairRecordVo extends StGateRepairRecord {
|
||||||
|
|
||||||
|
@Schema(description = "闸阀名称")
|
||||||
|
private String gateNm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,21 @@
|
||||||
package com.gunshi.project.xyt.mapper;
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.db.dao.IMapper;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateHistoryInfoVo;
|
||||||
import com.gunshi.project.xyt.model.StGateB;
|
import com.gunshi.project.xyt.model.StGateB;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateInfoVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface StGateBMapper extends BaseMapper<StGateB> {
|
public interface StGateBMapper extends IMapper<StGateB> {
|
||||||
int batchInsert(@Param("list") List<StGateB> list);
|
int batchInsert(@Param("list") List<StGateB> list);
|
||||||
|
|
||||||
|
|
||||||
|
List<GateInfoVo> queryGateList();
|
||||||
|
|
||||||
|
Page<GateHistoryInfoVo> gateHistory(Page<Object> page,@Param("gateId") Long gateId,@Param("startTime") String startTime,@Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.db.dao.IMapper;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateHistoryInfoVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateInfoVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairRecordVo;
|
||||||
|
import com.gunshi.project.xyt.model.StGateB;
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairRecord;
|
||||||
|
import com.gunshi.project.xyt.so.GateRepairRecordPageSo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface StGateRepairRecordMapper extends IMapper<StGateRepairRecord> {
|
||||||
|
Page<GateRepairRecordVo> page(Page<Object> page,@Param("param") GateRepairRecordPageSo gateRepairRecordPageSo,@Param("startTime") String startTime,@Param("endTime") String endTime);
|
||||||
|
}
|
||||||
|
|
@ -7,5 +7,49 @@ package com.gunshi.project.xyt.model;
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @since 2024-01-25
|
* @since 2024-01-25
|
||||||
*/
|
*/
|
||||||
public class StFlowR {
|
|
||||||
|
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量计基本信息表
|
||||||
|
*/
|
||||||
|
@Schema(description="流量计基本信息表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "dbo.ST_FLOW_R")
|
||||||
|
public class StFlowR implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量计ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "FLOW_ID", type = IdType.INPUT)
|
||||||
|
@Schema(description="流量计ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long flowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量计名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "FLOW_NM")
|
||||||
|
@Schema(description="流量计名称")
|
||||||
|
private String flowNm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "TM")
|
||||||
|
@Schema(description="修改时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量数据
|
||||||
|
*
|
||||||
|
* @author lyf
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024-01-25
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量数据表
|
||||||
|
*/
|
||||||
|
@Schema(description="流量数据表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "dbo.ST_FLOW_R_REAL")
|
||||||
|
public class StFlowRReal implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量计ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "FLOW_ID", type = IdType.INPUT)
|
||||||
|
@Schema(description="流量计ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long flowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实时流量
|
||||||
|
*/
|
||||||
|
@TableField(value = "REAL_DATA")
|
||||||
|
@Schema(description="实时流量")
|
||||||
|
private Float realData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据采集时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "TM")
|
||||||
|
@Schema(description="数据采集时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀开关历史表
|
||||||
|
*/
|
||||||
|
@Schema(description="闸阀开关历史表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "dbo.ST_GATE_B_HISTORY")
|
||||||
|
public class StGateBHistory implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "HISTORY_ID", type = IdType.INPUT)
|
||||||
|
@Schema(description="历史ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long historyId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "GATE_ID")
|
||||||
|
@Schema(description="闸阀ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long gateId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关状态 1:全开 2:50%开 3:关
|
||||||
|
*/
|
||||||
|
@TableField(value = "[STATUS]")
|
||||||
|
@Schema(description="开关状态 1:全开 2:50%开 3:关")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据采集时间时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "TM")
|
||||||
|
@Schema(description="数据采集时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
|
public static final String COL_HISTORY_ID = "HISTORY_ID";
|
||||||
|
|
||||||
|
public static final String COL_GATE_ID = "GATE_ID";
|
||||||
|
|
||||||
|
public static final String COL_STATUS = "STATUS";
|
||||||
|
|
||||||
|
public static final String COL_TM = "TM";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀数据信息表
|
||||||
|
*/
|
||||||
|
@Schema(description="闸阀数据信息表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "dbo.ST_GATE_B_REAL")
|
||||||
|
public class StGateBReal implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "GATE_ID", type = IdType.INPUT)
|
||||||
|
@Schema(description="闸阀ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long gateId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关状态 1:全开 2:50%开 3:关
|
||||||
|
*/
|
||||||
|
@TableField(value = "[STATUS]")
|
||||||
|
@Schema(description="开关状态 1:全开 2:50%开 3:关")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据采集时间时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "TM")
|
||||||
|
@Schema(description="数据采集时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
|
public static final String COL_GATE_ID = "GATE_ID";
|
||||||
|
|
||||||
|
public static final String COL_STATUS = "STATUS";
|
||||||
|
|
||||||
|
public static final String COL_TM = "TM";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀维修详情表
|
||||||
|
*/
|
||||||
|
@Schema(description="闸阀维修详情表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "dbo.ST_GATE_REPAIR_DETAIL")
|
||||||
|
public class StGateRepairDetail implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修详情ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "DETAIL_ID", type = IdType.INPUT)
|
||||||
|
@Schema(description="维修详情ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long detailId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修记录ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "RECORD_ID")
|
||||||
|
@Schema(description="维修记录ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "GATE_ID")
|
||||||
|
@Schema(description="闸阀ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long gateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "GATE_NM")
|
||||||
|
@Schema(description="闸阀名称")
|
||||||
|
private String gateNm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检修内容
|
||||||
|
*/
|
||||||
|
@TableField(value = "REPAIR_CONTENT")
|
||||||
|
@Schema(description="检修内容")
|
||||||
|
private String repairContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存在的问题
|
||||||
|
*/
|
||||||
|
@TableField(value = "PROBLEM")
|
||||||
|
@Schema(description="存在的问题")
|
||||||
|
private String problem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因及意见
|
||||||
|
*/
|
||||||
|
@TableField(value = "REASON_AND_SUGGESTION")
|
||||||
|
@Schema(description="原因及意见")
|
||||||
|
private String reasonAndSuggestion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理结果
|
||||||
|
*/
|
||||||
|
@TableField(value = "DEAL_RESULT")
|
||||||
|
@Schema(description="处理结果")
|
||||||
|
private String dealResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下一次检修时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "NEXT_REPAIR_TM")
|
||||||
|
@Schema(description="下一次检修时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date nextRepairTm;
|
||||||
|
|
||||||
|
public static final String COL_DETAIL_ID = "DETAIL_ID";
|
||||||
|
|
||||||
|
public static final String COL_RECORD_ID = "RECORD_ID";
|
||||||
|
|
||||||
|
public static final String COL_GATE_ID = "GATE_ID";
|
||||||
|
|
||||||
|
public static final String COL_GATE_NM = "GATE_NM";
|
||||||
|
|
||||||
|
public static final String COL_REPAIR_CONTENT = "REPAIR_CONTENT";
|
||||||
|
|
||||||
|
public static final String COL_PROBLEM = "PROBLEM";
|
||||||
|
|
||||||
|
public static final String COL_REASON_AND_SUGGESTION = "REASON_AND_SUGGESTION";
|
||||||
|
|
||||||
|
public static final String COL_DEAL_RESULT = "DEAL_RESULT";
|
||||||
|
|
||||||
|
public static final String COL_NEXT_REPAIR_TM = "NEXT_REPAIR_TM";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀基本信息表
|
||||||
|
*/
|
||||||
|
@Schema(description="闸阀维修记录表")
|
||||||
|
@Data
|
||||||
|
@TableName(value = "dbo.ST_GATE_REPAIR_RECORD")
|
||||||
|
public class StGateRepairRecord implements Serializable {
|
||||||
|
/**
|
||||||
|
* 维修记录ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "RECORD_ID", type = IdType.INPUT)
|
||||||
|
@Schema(description="维修记录ID")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
@NotNull(message = "维修记录ID不能为空", groups = {Update.class})
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维修类型,0维修1养护
|
||||||
|
*/
|
||||||
|
@TableField(value = "REPAIR_TYPE")
|
||||||
|
@Schema(description="维修类型,0维修1养护")
|
||||||
|
@NotNull(message = "维修类型不能为空", groups = {Insert.class,Update.class})
|
||||||
|
private Integer repairType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录人ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "RECORD_USER_ID")
|
||||||
|
@Schema(description="记录人ID")
|
||||||
|
private Long recordUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录人
|
||||||
|
*/
|
||||||
|
@TableField(value = "RECORD_USER_NAME")
|
||||||
|
@Schema(description="记录人")
|
||||||
|
@NotEmpty(message = "记录人不能为空", groups = {Insert.class,Update.class})
|
||||||
|
private String recordUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检修时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "REPAIR_TM")
|
||||||
|
@Schema(description="检修时间")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
@NotNull(message = "检修时间不能为空", groups = {Insert.class,Update.class})
|
||||||
|
private Date repairTm;
|
||||||
|
|
||||||
|
public static final String COL_RECORD_ID = "RECORD_ID";
|
||||||
|
|
||||||
|
public static final String COL_REPAIR_TYPE = "REPAIR_TYPE";
|
||||||
|
|
||||||
|
public static final String COL_RECORD_USER_ID = "RECORD_USER_ID";
|
||||||
|
|
||||||
|
public static final String COL_RECORD_USER_NAME = "RECORD_USER_NAME";
|
||||||
|
|
||||||
|
public static final String COL_REPAIR_TM = "REPAIR_TM";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StGateRepairRecordDto;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairDetailVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairRecordVo;
|
||||||
|
import com.gunshi.project.xyt.so.GateRepairRecordPageSo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public interface GateRepairRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增检修记录
|
||||||
|
* @param stGateRepairRecordDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String addRecord(StGateRepairRecordDto stGateRepairRecordDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新检修记录
|
||||||
|
* @param stGateRepairRecordDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String updateRecord(StGateRepairRecordDto stGateRepairRecordDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据recordId删除检修记录
|
||||||
|
* @param recordId 检修记录id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String deleteRecord(Long recordId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param gateRepairRecordPageSo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<GateRepairRecordVo> page(GateRepairRecordPageSo gateRepairRecordPageSo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检修记录详情
|
||||||
|
* @param recordId 检修记录id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
GateRepairDetailVo detail(Long recordId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateHistoryInfoVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateInfoVo;
|
||||||
|
import com.gunshi.project.xyt.so.GateHistoryPageSo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public interface GateService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<GateInfoVo> queryGateList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀开关历史分页查询
|
||||||
|
* @param gateHistoryPageSo 查询参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<GateHistoryInfoVo> page(GateHistoryPageSo gateHistoryPageSo);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
package com.gunshi.project.xyt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||||
|
import com.gunshi.db.dao.BaseOrderDao;
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StGateRepairRecordDto;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairDetailVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateRepairRecordVo;
|
||||||
|
import com.gunshi.project.xyt.mapper.StGateRepairRecordMapper;
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairDetail;
|
||||||
|
import com.gunshi.project.xyt.model.StGateRepairRecord;
|
||||||
|
import com.gunshi.project.xyt.service.GateRepairRecordService;
|
||||||
|
import com.gunshi.project.xyt.so.GateRepairRecordPageSo;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Service
|
||||||
|
@Data
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Slf4j
|
||||||
|
public class GateRepairRecordServiceImpl extends BaseOrderDao<StGateRepairRecordMapper, StGateRepairRecord> implements GateRepairRecordService {
|
||||||
|
|
||||||
|
private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StGateRepairRecordMapper stGateRepairRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String addRecord(StGateRepairRecordDto stGateRepairRecordDto) {
|
||||||
|
StGateRepairRecord repairRecord = new StGateRepairRecord();
|
||||||
|
BeanUtils.copyProperties(stGateRepairRecordDto, repairRecord);
|
||||||
|
long id = IdWorker.getId();
|
||||||
|
repairRecord.setRecordId(id);
|
||||||
|
List<StGateRepairDetail> repairDetails = stGateRepairRecordDto.getRepairDetails();
|
||||||
|
Boolean relFlag = insertRecordDetail(id,repairDetails);
|
||||||
|
Boolean flag = super.save(repairRecord);
|
||||||
|
if (flag && relFlag) {
|
||||||
|
return "添加成功";
|
||||||
|
}
|
||||||
|
return "添加失败";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String updateRecord(StGateRepairRecordDto stGateRepairRecordDto) {
|
||||||
|
Long recordId = stGateRepairRecordDto.getRecordId();
|
||||||
|
StGateRepairRecord one = super.getById(recordId);
|
||||||
|
if (one == null) {
|
||||||
|
throw new IllegalArgumentException("不存在的检修记录");
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(stGateRepairRecordDto, one);
|
||||||
|
super.updateById(one);
|
||||||
|
//先删除检修记录详情
|
||||||
|
deleteRecordDetail(recordId);
|
||||||
|
insertRecordDetail(recordId,stGateRepairRecordDto.getRepairDetails());
|
||||||
|
return "更新成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String deleteRecord(Long recordId) {
|
||||||
|
StGateRepairRecord one = super.getById(recordId);
|
||||||
|
if (one == null) {
|
||||||
|
throw new IllegalArgumentException("不存在的检修记录");
|
||||||
|
}
|
||||||
|
deleteRecordDetail(recordId);
|
||||||
|
super.removeById(recordId);
|
||||||
|
return "删除成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<GateRepairRecordVo> page(GateRepairRecordPageSo gateRepairRecordPageSo) {
|
||||||
|
DateTimeRangeSo timeSo = gateRepairRecordPageSo.getTimeSo();
|
||||||
|
Date start = timeSo.getStart();
|
||||||
|
Date end = timeSo.getEnd();
|
||||||
|
String startTime = sdf.format(start);
|
||||||
|
String endTime = sdf.format(end);
|
||||||
|
return stGateRepairRecordMapper.page(gateRepairRecordPageSo.getPageSo().toPage(),gateRepairRecordPageSo,startTime,endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GateRepairDetailVo detail(Long recordId) {
|
||||||
|
GateRepairDetailVo vo = new GateRepairDetailVo();
|
||||||
|
StGateRepairRecord one = super.getById(recordId);
|
||||||
|
if (one == null) {
|
||||||
|
throw new IllegalArgumentException("不存在的检修记录");
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(one, vo);
|
||||||
|
vo.setDetails(queryRecordDetail(recordId));
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<StGateRepairDetail> queryRecordDetail(Long recordId) {
|
||||||
|
LambdaQueryWrapper<StGateRepairDetail> query = Wrappers.lambdaQuery(StGateRepairDetail.class)
|
||||||
|
.eq(StGateRepairDetail::getRecordId, recordId);
|
||||||
|
return Db.list(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteRecordDetail(Long recordId) {
|
||||||
|
LambdaQueryWrapper<StGateRepairDetail> query = Wrappers.lambdaQuery(StGateRepairDetail.class)
|
||||||
|
.eq(StGateRepairDetail::getRecordId, recordId);
|
||||||
|
Db.remove(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean insertRecordDetail(long id,List<StGateRepairDetail> repairDetails) {
|
||||||
|
if (CollectionUtils.isNotEmpty(repairDetails)) {
|
||||||
|
List<StGateRepairDetail> details = repairDetails.stream().map(detail -> {
|
||||||
|
detail.setRecordId(id);
|
||||||
|
return detail;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return Db.saveBatch(details);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.gunshi.project.xyt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.db.dao.BaseOrderDao;
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateHistoryInfoVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.GateInfoVo;
|
||||||
|
import com.gunshi.project.xyt.mapper.StGateBMapper;
|
||||||
|
import com.gunshi.project.xyt.model.StGateB;
|
||||||
|
import com.gunshi.project.xyt.service.GateService;
|
||||||
|
import com.gunshi.project.xyt.so.GateHistoryPageSo;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Service
|
||||||
|
@Data
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Slf4j
|
||||||
|
public class GateServiceImpl extends BaseOrderDao<StGateBMapper, StGateB> implements GateService {
|
||||||
|
|
||||||
|
private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StGateBMapper stGateBMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GateInfoVo> queryGateList() {
|
||||||
|
return stGateBMapper.queryGateList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<GateHistoryInfoVo> page(GateHistoryPageSo gateHistoryPageSo) {
|
||||||
|
|
||||||
|
DateTimeRangeSo timeSo = gateHistoryPageSo.getTimeSo();
|
||||||
|
Date start = timeSo.getStart();
|
||||||
|
Date end = timeSo.getEnd();
|
||||||
|
String startTime = sdf.format(start);
|
||||||
|
String endTime = sdf.format(end);
|
||||||
|
|
||||||
|
return stGateBMapper.gateHistory(gateHistoryPageSo.getPageSo().toPage(),gateHistoryPageSo.getGateId(),startTime,endTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.gunshi.project.xyt.so;
|
||||||
|
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀开关历史查询参数
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GateHistoryPageSo {
|
||||||
|
|
||||||
|
@Schema(description = "闸阀ID")
|
||||||
|
@NotNull(message = "闸阀ID不能为空")
|
||||||
|
private Long gateId;
|
||||||
|
|
||||||
|
@Schema(description = "分页参数")
|
||||||
|
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
||||||
|
private PageSo pageSo;
|
||||||
|
|
||||||
|
@Schema(description = "时间范围")
|
||||||
|
@NotNull(message = "时间范围不能为空", groups = {QueryTimeRange.class})
|
||||||
|
private DateTimeRangeSo timeSo;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.gunshi.project.xyt.so;
|
||||||
|
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.QueryPage;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闸阀开关历史查询参数
|
||||||
|
* Created by wanyan on 2024/1/26
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GateRepairRecordPageSo {
|
||||||
|
|
||||||
|
@Schema(description = "分页参数")
|
||||||
|
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
||||||
|
private PageSo pageSo;
|
||||||
|
|
||||||
|
@Schema(description = "闸阀名称")
|
||||||
|
private String gateNm;
|
||||||
|
|
||||||
|
@Schema(description = "时间范围")
|
||||||
|
@NotNull(message = "时间范围不能为空", groups = {QueryTimeRange.class})
|
||||||
|
private DateTimeRangeSo timeSo;
|
||||||
|
|
||||||
|
@Schema(description="维修类型,0维修1养护")
|
||||||
|
private Integer repairType;
|
||||||
|
}
|
||||||
|
|
@ -38,4 +38,22 @@
|
||||||
#{item.status,jdbcType=INTEGER}, #{item.tm,jdbcType=TIMESTAMP})
|
#{item.status,jdbcType=INTEGER}, #{item.tm,jdbcType=TIMESTAMP})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="queryGateList" resultType="com.gunshi.project.xyt.entity.vo.GateInfoVo">
|
||||||
|
select a.GATE_ID,a.GATE_NM,b.STATUS,b.TM from dbo.ST_GATE_B a
|
||||||
|
left join dbo.ST_GATE_B_REAL on a.GATE_ID = b.GATE_ID
|
||||||
|
where a.STATUS = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="gateHistory" resultType="com.gunshi.project.xyt.entity.vo.GateHistoryInfoVo">
|
||||||
|
select a.HISTORY_ID,a.GATE_ID,b.GATE_NM,a.STATUS,a.TM from dbo.ST_GATE_B_HISTORY a
|
||||||
|
left join dbo.ST_GATE_B on a.GATE_ID = b.GATE_ID
|
||||||
|
where a.GATE_ID = #{gateId}
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
and a.TM <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
and a.TM <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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.xyt.mapper.StGateRepairRecordMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="page" resultType="com.gunshi.project.xyt.entity.vo.GateRepairRecordVo">
|
||||||
|
select a.RECORD_ID,a.REPAIR_TYPE,a.RECORD_USER_NAME,a.REPAIR_TM,group_concat(b.GATE_NM) as gateNm
|
||||||
|
from ST_GATE_REPAIR_RECORD a left join ST_GATE_REPAIR_DETAIL b on a.RECORD_ID = b.RECORD_ID
|
||||||
|
<where>
|
||||||
|
<if test="param.gateNm != null and param.gateNm != ''">
|
||||||
|
and gateNm like concat('%',#{param.gateNm},'%')
|
||||||
|
</if>
|
||||||
|
<if test="param.repairType != null">
|
||||||
|
and a.REPAIR_TYPE = #{param.repairType}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
and a.REPAIR_TM <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
and a.REPAIR_TM <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue