Commit 1998ce49 authored by wuqinghua's avatar wuqinghua

2022-3-8 吴卿华

parent a9ebcf55
package com.zehong.web.controller.supervise;
import com.zehong.common.core.controller.BaseController;
import com.zehong.system.domain.*;
import com.zehong.system.service.IPipeInterfaceService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -15,7 +17,7 @@ import java.util.List;
@Controller
@RestController
@RequestMapping("/pipe/pipe")
public class PipeInterfaceController {
public class PipeInterfaceController extends BaseController {
@Autowired
IPipeInterfaceService iPipeInterfaceService;
......@@ -579,4 +581,20 @@ public class PipeInterfaceController {
return deviceDataList;
}
/**
* 首页 场站/设备 感知设备信息列表查询接口
* @param devId
* @param relationDeviceType
* @return
*/
@RequestBody
@RequestMapping("/selectSensingDevice")
public List<TAssociatedEquipment> selectSensingDevice(@Param("devId") String devId,@Param("relationDeviceType") String relationDeviceType){
startPage();
//查询 场站/设备 列表信息方法
List<TAssociatedEquipment> tAssociatedEquipments = iPipeInterfaceService.selectSensingDevice(devId, relationDeviceType);
return tAssociatedEquipments;
}
}
package com.zehong.system.domain;
/**
* 首页感知设备详情封装类
*/
public class TAssociatedEquipment {
//设备编号
private String deviceCode;
//设备名称
private String deviceName;
//探测介质
private String detectionMedium;
//联系人
private String linkman;
//联系电话
private String phone;
//设备状态 0在线 1掉线
private String detectorStatus;
//预警时间
private String createTime;
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDetectionMedium() {
return detectionMedium;
}
public void setDetectionMedium(String detectionMedium) {
this.detectionMedium = detectionMedium;
}
public String getLinkman() {
return linkman;
}
public void setLinkman(String linkman) {
this.linkman = linkman;
}
public String getDetectorStatus() {
return detectorStatus;
}
public void setDetectorStatus(String detectorStatus) {
this.detectorStatus = detectorStatus;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "TAssociatedEquipment{" +
"deviceCode='" + deviceCode + '\'' +
", deviceName='" + deviceName + '\'' +
", detectionMedium='" + detectionMedium + '\'' +
", linkman='" + linkman + '\'' +
", phone='" + phone + '\'' +
", detectorStatus='" + detectorStatus + '\'' +
", createTime='" + createTime + '\'' +
'}';
}
}
......@@ -65,6 +65,17 @@ public class TEmployedPeopleInfo extends BaseEntity
@Excel(name = "备注")
private String remarks;
/** 头像地址 */
private String avatarAddress;
public String getAvatarAddress() {
return avatarAddress;
}
public void setAvatarAddress(String avatarAddress) {
this.avatarAddress = avatarAddress;
}
public void setEmployedPeopleId(Long employedPeopleId)
{
this.employedPeopleId = employedPeopleId;
......@@ -179,23 +190,20 @@ public class TEmployedPeopleInfo extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("employedPeopleId", getEmployedPeopleId())
.append("employedPeopleName", getEmployedPeopleName())
.append("idCard", getIdCard())
.append("certificateNum", getCertificateNum())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("beyondEnterpriseId", getBeyondEnterpriseId())
.append("registerExaminationType", getRegisterExaminationType())
.append("peopleOccupation", getPeopleOccupation())
.append("issueDate", getIssueDate())
.append("certificateChange", getCertificateChange())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
return "TEmployedPeopleInfo{" +
"employedPeopleId=" + employedPeopleId +
", employedPeopleName='" + employedPeopleName + '\'' +
", idCard='" + idCard + '\'' +
", certificateNum='" + certificateNum + '\'' +
", beyondEnterpriseName='" + beyondEnterpriseName + '\'' +
", beyondEnterpriseId=" + beyondEnterpriseId +
", registerExaminationType='" + registerExaminationType + '\'' +
", peopleOccupation='" + peopleOccupation + '\'' +
", issueDate='" + issueDate + '\'' +
", certificateChange='" + certificateChange + '\'' +
", isDel='" + isDel + '\'' +
", remarks='" + remarks + '\'' +
", avatarAddress='" + avatarAddress + '\'' +
'}';
}
}
......@@ -101,4 +101,12 @@ public interface PipeInterfaceMapper {
* @return
*/
int selectInAlarm(List<PressureFlow> pressureList);
/**
* 查询 场站/设备 列表信息方法
* @param devId
* @param relationDeviceType
* @return
*/
List<TAssociatedEquipment> selectSensingDevice(@Param("devId")String devId, @Param("relationDeviceType")String relationDeviceType);
}
......@@ -98,4 +98,12 @@ public interface IPipeInterfaceService {
* @return
*/
int selectInAlarm(List<PressureFlow> pressureList);
/**
* 查询 场站/设备 列表信息方法
* @param devId
* @param relationDeviceType
* @return
*/
List<TAssociatedEquipment> selectSensingDevice(String devId, String relationDeviceType);
}
......@@ -161,4 +161,16 @@ public class PipeInterfaceServiceImpl implements IPipeInterfaceService {
int i = pipeInterfaceMapper.selectInAlarm(pressureList);
return i;
}
/**
* 查询 场站/设备 列表信息方法
* @param devId
* @param relationDeviceType
* @return
*/
@Override
public List<TAssociatedEquipment> selectSensingDevice(String devId, String relationDeviceType) {
List<TAssociatedEquipment> tAssociatedEquipments = pipeInterfaceMapper.selectSensingDevice(devId, relationDeviceType);
return tAssociatedEquipments;
}
}
......@@ -83,6 +83,17 @@
<result property="enterpriseName" column="enterprise_name" />
</resultMap>
<!--感知设备列表-->
<resultMap type="TAssociatedEquipment" id="TAssociatedEquipmentResult">
<result property="deviceCode" column="device_code" />
<result property="deviceName" column="device_name" />
<result property="detectionMedium" column="detection_medium" />
<result property="linkman" column="linkman" />
<result property="phone" column="phone" />
<result property="detectorStatus" column="detector_status" />
<result property="createTime" column="alarm_time" />
</resultMap>
<!--查询管道数据列表-->
<select id="selectPipeData" parameterType="PipeDate" resultMap="PipeDateResult">
select beyond_enterprise_id,pipe_id,pipe_diameter,pipe_material,buried_depth,pipe_trend,build_date,pipe_addr,coordinates,remarks,build_unit,beyond_enterprise_name from t_pipe_info
......@@ -181,4 +192,13 @@
</foreach>
</select>
<!--查询 场站/设备 列表信息方法-->
<select id="selectSensingDevice" resultMap="TAssociatedEquipmentResult">
select a.device_code,a.device_name,b.detection_medium,a.linkman,a.phone,c.detector_status,c.alarm_time
from t_device_info a
left join t_relation_device_detail_info b on a.device_id=b.relation_device_id
left join t_detector_info c on b.iot_no=c.detector_code
where a.device_id=#{devId} and b.relation_device_type=#{relationDeviceType}
</select>
</mapper>
......@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="employedPeopleId" column="employed_people_id" />
<result property="employedPeopleName" column="employed_people_name" />
<result property="idCard" column="id_card" />
<result property="avatarAddress" column="avatar_address" />
<result property="certificateNum" column="certificate_num" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
......@@ -45,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectTEmployedPeopleInfoList" parameterType="TEmployedPeopleInfo" resultMap="TEmployedPeopleInfoResult">
select employed_people_id, employed_people_name, id_card, certificate_num, beyond_enterprise_name, beyond_enterprise_id, register_examination_type,(CASE people_occupation WHEN '1' THEN '主要负责人' WHEN '2' THEN '安全管理人员' WHEN '3' THEN '运行维护和抢修人员'end ) as people_occupation, issue_date, certificate_change, create_by, create_time, update_by, update_time, is_del, remarks from t_employed_people_info
select employed_people_id, employed_people_name,avatar_address, id_card, certificate_num, beyond_enterprise_name, beyond_enterprise_id, register_examination_type,(CASE people_occupation WHEN '1' THEN '主要负责人' WHEN '2' THEN '安全管理人员' WHEN '3' THEN '运行维护和抢修人员'end ) as people_occupation, issue_date, certificate_change, create_by, create_time, update_by, update_time, is_del, remarks from t_employed_people_info
<where>
1=1 and is_del='0'
<if test="employedPeopleName != null and employedPeopleName != ''"> and employed_people_name like concat('%', #{employedPeopleName}, '%')</if>
......@@ -78,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="avatarAddress != null">avatar_address,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="employedPeopleName != null">#{employedPeopleName},</if>
......@@ -95,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="avatarAddress != null">#{avatarAddress},</if>
</trim>
</insert>
......
......@@ -18,17 +18,11 @@ export function getInfo(employedPeopleId) {
}
// 新增从业人员信息
export function addInfo(file,form) {
export function addInfo(data) {
return request({
url: '/regulation/supervise',
method: 'post',
data: {
file:file,
tEmployedPeopleInfo:form,
},
headers: {
"Content-Type": "multipart/form-data"
},
data: data,
})
}
//传图片
......
<template>
<div class="upload-file">
<el-upload
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileArr"
:limit="1"
:list-type="listType"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:on-remove="handleRemove"
:on-preview="handleFileClick"
:on-change="fileChange"
:show-file-list="true"
:headers="headers"
class="upload-file-uploader"
:class="{ hide: fileArr.length>0 ||addShow }"
ref="upload"
>
<!-- 上传按钮 -->
<el-button plain type="primary">选取文件</el-button>
<!--<i class="el-icon-plus"></i>-->
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</template>
<template v-if="fileType">
格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
</template>
的文件,且不超过一个
</div>
</el-upload>
<el-image v-show="false"
id="img"
ref="previewImg"
:src="dialogImageUrl"
:preview-src-list="bigImageArr"
:z-index="9999999"
></el-image>
<!-- <el-dialog
:center="true"
width="50%"
:modal="modal"
:visible.sync="dialogVisible"
>
<img :src="dialogImageUrl" alt="" />
</el-dialog> -->
<!-- 文件列表 -->
<!-- <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list">
<el-link :href="file.url" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div>
</li>
</transition-group> -->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
props: {
// 值
value: [String, Object, Array],
listType: {
type: String,
defaule: "text",
},
// 大小限制(MB)
fileSize: {
type: Number,
default: 5,
},
fileArr: {
type: Array,
default: [],
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ['png', 'jpg', 'jpeg'],
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true,
},
},
data() {
return {
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
modal: false,
dialogVisible: false,
dialogImageUrl: "",
addShow: true,
};
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
// 列表
list() {
let temp = 1;
if (this.value) {
// 首先将值转为数组
const list = Array.isArray(this.value) ? this.value : [this.value];
// 然后将数组转为对象数组
return list.map((item) => {
if (typeof item === "string") {
item = { name: item, url: item };
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
bigImageArr() {
return [this.dialogImageUrl]
},
},
methods: {
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
if (this.fileType) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
const isTypeOk = this.fileType.some((type) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (!isTypeOk) {
this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
);
return false;
}
}
// 校检文件大小
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
return true;
},
// 文件个数超出
handleExceed() {
this.$message.error(`只允许上传单个文件`);
},
// 上传失败
handleUploadError(err) {
this.$message.error("上传失败, 请重试");
},
// 上传成功回调
handleUploadSuccess(res, file) {
this.$message.success("上传成功");
this.$emit("resFun", res);
},
// 文件列表移除文件
handleRemove(file, fileList) {
console.log("列表移除", file, fileList);
this.addShow = fileList.length > 0 ? true : false;
this.$emit("remove", file);
},
// 删除文件
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", "");
// let that = this,
// param;
// param = file.response ? file.response.fileName.replace(/\\/g, "%")
// : file.response.url.replace(/\\/g, "%").slice(9);
// $.ajax({
// type: "GET",
// url: process.env.VUE_APP_BASE_API + "/common/deleteFile",
// data: {savePath: param},
// dataType: "json",
// success: function(data){
// if (data) that.$message.success("删除成功");
// else return false;
// }
// });
},
handleFileClick(file, fileList) {
this.dialogImageUrl = file.response ? file.response.url : file.url;
// this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url;
// this.dialogVisible = true;
this.$refs.previewImg.showViewer = false;
console.log(file);
// console.log(file.response.url)
},
// 获取文件名称
getFileName(name) {
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
} else {
return "";
}
},
// 当改变列表改变时
fileChange(file, fileList) {
this.addShow = fileList.length > 0 ? true : false;
},
},
created() {
// this.fileList = this.list;
this.addShow = this.fileArr.length > 0 ? true : false;
},
};
</script>
<style scoped lang="scss">
img {
width: 100%;
}
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment