修改bug

This commit is contained in:
gongjiale 2024-12-23 12:10:59 +08:00
parent 161938f2d9
commit a7a623cb38
18 changed files with 204 additions and 78 deletions

View File

@ -34,14 +34,10 @@ public class EquTask {
@Autowired
private ThDeviceMapper thDeviceMapper;
/**
* 港口原有设备对接
* 港口原有设备对接-
*/
@Scheduled(fixedRate = 600000)
@Scheduled(fixedRate = 1200000)
public void equ(){
try {
System.out.println("=================================================");
String hash = "16EA8A305FB58BE0730DD67F04F022F4";
HttpResult httpResult = OkHttps.sync("http://10.201.35.30:8090/user/login").addBodyPara("userName", "admin")
@ -49,23 +45,25 @@ public class EquTask {
.bodyType("application/json")
.post();
JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class);
System.out.println("---------------------------------"+tokenByJson);
JSONObject dataByJson = tokenByJson.getJSONObject("data");
String token = dataByJson.getString("token");
ThDevice thDevice = new ThDevice();
// thDevice.setDeptId(5l);
// List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
// equLists.forEach(e->{
List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
equLists.forEach(e->{
HashMap<String, Object> map = new HashMap<>();
token = "28e73f2d211f3ac211313a1aa61dc0c5";
map.put("token",token);
HttpResult result = OkHttps.sync("http://10.205.51.190:30100/device/getGasDeviceList?token={token}")
System.out.println("开始获取数据");
map.put("sensorUId",e.getSn());
map.put("label",e.getName());
HttpResult result = OkHttps.sync("http://10.201.35.30:8090/enviSensor/select?" +
"page=1&pageSize=20&valid=0&type=5&sensorUId={sensorUId}&label={label}")
.addPathPara(map)
.addHeader("token", token)
.post();
.get();
JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
System.out.println("---------------------------------"+vocByJson);
JSONArray vocByArray = vocByJson.getJSONArray("data");
JSONObject vocDataByJson = vocByJson.getJSONObject("data");
JSONArray vocByArray = vocDataByJson.getJSONArray("array");
System.out.println(vocByArray.toString());
try {
Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
@ -73,11 +71,51 @@ public class EquTask {
jsonProcessingException.printStackTrace();
}
// });
}catch (Exception e){
e.printStackTrace();
}
});
}
/**
* 港口原有设备对接-
*/
// @Scheduled(fixedRate = 600000)
// public void equ(){
// try {
// System.out.println("=================================================");
// String hash = "16EA8A305FB58BE0730DD67F04F022F4";
//
// HttpResult httpResult = OkHttps.sync("http://10.201.35.30:8090/user/login").addBodyPara("userName", "admin")
// .addBodyPara("password", hash)
// .bodyType("application/json")
// .post();
// JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class);
// System.out.println("---------------------------------"+tokenByJson);
// JSONObject dataByJson = tokenByJson.getJSONObject("data");
// String token = dataByJson.getString("token");
// ThDevice thDevice = new ThDevice();
//// thDevice.setDeptId(5l);
//// List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
//// equLists.forEach(e->{
// HashMap<String, Object> map = new HashMap<>();
// token = "28e73f2d211f3ac211313a1aa61dc0c5";
// map.put("token",token);
// HttpResult result = OkHttps.sync("http://10.205.51.190:30100/device/getGasDeviceList?token={token}")
// .addPathPara(map)
// .addHeader("token", token)
// .post();
// JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
// System.out.println("---------------------------------"+vocByJson);
// JSONArray vocByArray = vocByJson.getJSONArray("data");
// System.out.println(vocByArray.toString());
// try {
// Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
// } catch (JsonProcessingException jsonProcessingException) {
// jsonProcessingException.printStackTrace();
// }
//
//// });
// }catch (Exception e){
// e.printStackTrace();
// }
// }
public void dateByDay(){
outSideService.monthTask("");
}

View File

@ -204,8 +204,8 @@ public class OilStatisticsController extends BaseController {
}
@GetMapping("/dailyData")
public AjaxResult dailyData(String day) {
List<Map<String, Object>> dailyReportDataOverview = oilThDeviceReportService.dailyReportDataOverview(day);
public AjaxResult dailyData(String day,Long deptId) {
List<Map<String, Object>> dailyReportDataOverview = oilThDeviceReportService.dailyReportDataOverview(day,deptId);
return success(dailyReportDataOverview);
}

View File

@ -73,7 +73,7 @@ public interface ThDeviceReportMapper {
* @param day 日期 2024-08-30
*/
@MapKey("day")
List<Map<String, Object>> dailyReportDataOverview(@Param("day") String day);
List<Map<String, Object>> dailyReportDataOverview(@Param("day") String day,@Param("deptId") Long deptId);
@MapKey("day")
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn);

View File

@ -10,7 +10,7 @@ public interface IOilThDeviceReportService {
List<Map<String, Object>> monthReportDataOverviewGangQuCompare(Long deptId, String month);
List<Map<String, Object>> dailyReportDataOverview(String day);
List<Map<String, Object>> dailyReportDataOverview(String day,Long deptId);
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn);

View File

@ -26,6 +26,7 @@ public class OilMonitorServiceImpl implements IOilMonitorService {
private OilMonitorMapper oilMonitorMapper;
@Override
@DataScope(deptAlias = "d",permission="4")
public List<OilMonitor> selectOilDeviceList(OilMonitor oilDevice) {
return oilMonitorMapper.selectOilDeviceList(oilDevice);
}

View File

@ -32,8 +32,8 @@ public class OilThDeviceReportService implements IOilThDeviceReportService {
}
@Override
public List<Map<String, Object>> dailyReportDataOverview(String day) {
return camelCaseMapListKey(thDeviceReportMapper.dailyReportDataOverview(day));
public List<Map<String, Object>> dailyReportDataOverview(String day,Long deptId) {
return camelCaseMapListKey(thDeviceReportMapper.dailyReportDataOverview(day,deptId));
}
@Override

View File

@ -5,10 +5,7 @@ import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.outside.service.OutSideService;
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;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/outside")
@ -38,10 +35,21 @@ public class OutSideController extends BaseController {
return AjaxResult.error();
}
}
// @PostMapping("/monthTask")
// public AjaxResult monthTask(@RequestBody String date) {
@PostMapping("/monthTask")
public AjaxResult monthTask(@RequestBody String date) {
try {
Integer succ=outSideService.monthTask(date);
return AjaxResult.success(succ);
} catch (Exception e) {
System.out.println(e);
return AjaxResult.error();
}
}
// @GetMapping("/updateData")
// public AjaxResult updateData(@RequestBody String date) {
// try {
// Integer succ=outSideService.monthTask(date);
// Integer succ=outSideService.updateData(date);
// return AjaxResult.success(succ);
// } catch (Exception e) {
// System.out.println(e);
@ -50,6 +58,5 @@ public class OutSideController extends BaseController {
//
// }
}

View File

@ -33,4 +33,6 @@ public interface OutSideMapper {
* @param reportTime
*/
void deleteSampleDevice(@Param("sn")String sn,@Param("reportTime") String reportTime);
Integer updateData(@Param("date") String date);
}

View File

@ -24,4 +24,6 @@ public interface OutSideService {
* @return
*/
Integer insertOldDeviceData(String data) throws JsonProcessingException;
Integer updateData(String date);
}

View File

@ -73,8 +73,13 @@ public class OutSideServiceImpl implements OutSideService {
String lastMonth = previousMonth.format(formatter);
List<SensorMonth> list = outSideMapper.queryMonth(lastMonth);
if(list.size()>0){
outSideMapper.insertMonth(list);
return 1;
}else{
return 0;
}
}
@Override
@ -98,6 +103,11 @@ public class OutSideServiceImpl implements OutSideService {
return 0;
}
@Override
public Integer updateData(String date) {
return outSideMapper.updateData(date);
}
private static SensorData insertOldData(JsonNode node) {
/**
* sn: equipmentUId
@ -105,8 +115,9 @@ public class OutSideServiceImpl implements OutSideService {
* report_time: vocTime
* zt: vocRtd > 4 ? '一级报警' : '正常'
*/
SensorData sensorData = new SensorData();
sensorData.setSn(node.get("equipmentUid").asText());
sensorData.setSn(node.get("equipmentUId").asText());
sensorData.setDs(node.get("vocRtd").asText());
sensorData.setDw("mg/m3");
// "vocTime":"2024-10-30T07:19:20.000+0000" 转为 yyyy-MM-dd HH:mm:ss

View File

@ -97,7 +97,19 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<if test="id != null and id != ''">and t.id=#{id}</if>
<if test="monitorName != null and monitorName != ''"> and t.name like concat(concat('%', #{monitorName}), '%') </if>
<if test="monitorNo != null and monitorNo != ''">and t.sn= #{monitorNo} </if>
<if test="deptId != null and deptId != ''">and t.dept_id= #{deptId} </if>
<if test="deptId != null and deptId != 228">
and t.sn IN (
SELECT td.sn
FROM th_device td
LEFT JOIN sys_dept p ON td.dept_id = p.dept_id
WHERE td.dept_id IN (
SELECT dept_id
FROM sys_dept
START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id
)
)
</if>
<if test="status != null ">and t.status= #{status} </if>
</where>
</select>
@ -485,6 +497,6 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea
<select id="countThDeviceDealByYear" parameterType="string" resultType="java.lang.Integer">
SELECT COUNT(1) FROM th_device_deal
WHERE to_char(create_time, 'yyyy') = #{year}
WHERE to_char(deal_time, 'yyyy') = #{year}
</select>
</mapper>

View File

@ -40,7 +40,7 @@
<if test="params.endTime != null and params.endTime != ''">
AND TRUNC(d.REPORT_TIME)&lt;= TO_DATE(#{params.endTime}, 'YYYY-MM-DD HH24:MI:SS')
</if>
ORDER BY d.report_time DESC
ORDER BY d.report_time
</select>
<select id="selectAvgDsByMonth" parameterType="map" resultType="map">
@ -181,6 +181,11 @@
LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id
LEFT JOIN sys_dept ppp ON pp.parent_id = ppp.dept_id
WHERE d.sn IN (SELECT d.sn FROM th_device d)
and p.dept_id IN (
SELECT dept_id
FROM sys_dept START WITH dept_id = #{deptId}
CONNECT BY PRIOR dept_id = parent_id
)
AND TO_CHAR(d.report_time, 'YYYY-MM-DD') = #{day}
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD'), ppp.dept_name, pp.dept_name, p.dept_name, d.sn, ppp.dept_id, td.name
ORDER BY ppp.dept_id ASC

View File

@ -68,4 +68,8 @@
<delete id="deleteSampleDevice">
delete from th_device_report where sn=#{sn} and report_time= TO_DATE(#{reportTime}, 'yyyy-mm-dd hh24:mi:ss')
</delete>
<update id="updateData">
${date}
</update>
</mapper>

View File

@ -183,6 +183,7 @@ export default {
},
data() {
return {
position : {},
detailParams: {},
isOpenDetail: false,
loading: false,
@ -334,7 +335,7 @@ export default {
lng: parseFloat(row.longitude),
lat: parseFloat(row.latitude),
};
this.mapDialogTitle = `读数:${row.ds}|低报值:${row.dbz}|高报值:${row.gbz}`;
this.mapDialogTitle = `读数:${row.ds}mg/m³`;
this.mapDialogVisible = true;
},
handleDeviceSelectChange(val) {

View File

@ -1,6 +1,9 @@
<template>
<div class="daily-data">
<el-row :gutter="10" class="tool-bar">
<el-row :gutter="14" class="tool-bar">
<el-col :span="6" >
<dept-tree @deptChange="handleDeptChange" :showQuickGroup="true" />
</el-col>
<el-col :span="6">
<el-date-picker
v-model="day"
@ -12,7 +15,7 @@
>
</el-date-picker>
</el-col>
<el-col :span="18">
<el-col :span="10">
<div class="export_btn">
<el-button
type="primary"
@ -92,13 +95,18 @@ export default {
name: "Daily",
data() {
return {
dept: null,
deptId:null,
day: "",
tableData: [],
};
},
created() {
},
mounted() {
this.day = moment().format("YYYY-MM-DD");
this.queryData();
this.queryData()
},
computed: {
pppList() {
@ -106,6 +114,11 @@ export default {
},
},
methods: {
handleDeptChange(value) {
this.deptId = value.deptId;
this.queryData();
},
tableRowClassName({ row, rowIndex }) {
const classNames = ["default-row", "success-row", "error-row", "warning-row", "info-row"];
const index = this.pppList.findIndex((item) => item === row.ppp);
@ -116,7 +129,11 @@ export default {
this.queryData();
},
queryData() {
getDailyData({ day: this.day }).then((res) => {
debugger
if (!this.deptId || !this.day) {
return;
}
getDailyData({ day: this.day, deptId: this.deptId, }).then((res) => {
if (res.code === 200) {
this.tableData = res.data.map((item) => {
return {
@ -192,15 +209,15 @@ export default {
<style>
.el-table .warning-row {
background: rgba(248,236,216,0.3);
background: rgba(201, 132, 22, 0.3);
}
.el-table .success-row {
background: rgba(225,243,216,0.3);
background: rgba(94, 158, 63, 0.3);
}
.el-table .error-row {
background: rgba(252,226,226,0.3);
background: rgba(197, 103, 103, 0.3);
}
.el-table .default-row {
@ -208,7 +225,7 @@ export default {
}
.el-table .info-row {
background: rgba(233,233,235,0.3);
background: rgba(105, 105, 228, 0.3);
}
</style>
<style scoped>

View File

@ -7,15 +7,8 @@
:inline="true"
label-width="100px"
>
<el-form-item label="部门" prop="deptId">
<treeselect
style="width: 300px"
v-model="queryParams.deptId"
:multiple="false"
:options="deptList"
:normalizer="normalizer"
placeholder="请选择组织部门"
/>
<el-form-item label="选择部门" prop="deptId">
<dept-tree @deptChange="handleDeptChange" style="width: 150px" />
</el-form-item>
<el-form-item label="设备编号" prop="monitorNo">
<el-input
@ -92,7 +85,7 @@
align="center"
prop="systemNo"
/>
<el-table-column label="唯一编码(原有)" align="center" prop="unitNo" />
<!-- <el-table-column label="唯一编码(原有)" align="center" prop="unitNo" /> -->
<el-table-column prop="status" label="设备状态" align="center">
<!-- 使用 scoped slot 来自定义显示 -->
<template slot-scope="scope">
@ -100,17 +93,17 @@
<span v-else-if="scope.row.status == '0'">停运</span>
</template>
</el-table-column>
<el-table-column label="上传时间" align="center" prop="createTime" />
<!-- <el-table-column label="上传时间" align="center" prop="createTime" />
<el-table-column
label="设备图片"
align="center"
prop="fileUrl"
width="100"
>
<template slot-scope="scope">
> -->
<!-- <template slot-scope="scope">
<image-preview :src="scope.row.fileUrl" :width="50" :height="50" />
</template>
</el-table-column>
</template> -->
<!-- </el-table-column> -->
<el-table-column label="经度" align="center" prop="longitude" />
<el-table-column label="纬度" align="center" prop="latitude" />
<el-table-column label="报警阈值" align="center" prop="bjyz" />
@ -134,8 +127,9 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
>
>删除</el-button>
<el-button size="mini" type="text" icon="el-icon-location-information"
@click="handleShowMap(scope.row)">查看位置</el-button>
</template>
</el-table-column>
</el-table>
@ -231,10 +225,22 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!--处理报警-->
<el-dialog title="查看位置" :visible.sync="mapDialogVisible" width="30%" append-to-body>
<div>
<baidu-map :center="position" :zoom="16" :scroll-wheel-zoom="true" style="width: auto; height: 40vh"
:map-type="currentMapType">
<bm-map-type :map-types="['BMAP_NORMAL_MAP', 'BMAP_HYBRID_MAP']" anchor="BMAP_ANCHOR_TOP_LEFT"></bm-map-type>
<bm-marker :position="position"></bm-marker>
</baidu-map>
</div>
</el-dialog>
</div>
</template>
<script>
import DeptTree from "@/components/DeptTree/index.vue";
import store from "@/store";
import bus from "@/utils/bus.js";
import {
@ -249,10 +255,13 @@ import { listDept } from "@/api/system/dept";
import UserSelect from "@/views/home/components/UserSelect.vue";
export default {
name: "MonitorDetail",
components: { Treeselect, UserSelect },
components: { Treeselect, UserSelect ,DeptTree},
dicts: [],
data() {
return {
currentMapType: 'BMAP_HYBRID_MAP',
position : {},
mapDialogVisible: false,
normalizer(node) {
return {
id: node.deptId,
@ -283,6 +292,7 @@ export default {
isOpenAdd: false, //
//
queryParams: {
factoryId:null,
pageNum: 1,
pageSize: 10,
monitorNo: null,
@ -298,7 +308,7 @@ export default {
};
},
created() {
// this.queryParams.factoryId = store.getters.user.factoryId;
bus.$on("toMonitorDetail", (val) => {
this.queryParams.monitorNo = val.monitorNo;
this.queryParams.id = val.id;
@ -310,6 +320,18 @@ export default {
this.getOrganizeTree();
},
methods: {
handleDeptChange(value) {
this.queryParams.deptId = value.deptId;
this.emitChange();
},
handleShowMap(row) {
this.position = {
lng: parseFloat(row.longitude),
lat: parseFloat(row.latitude),
};
// this.mapDialogTitle = `:${row.ds}mg/m³`;
this.mapDialogVisible = true;
},
getOrganizeTree() {
listDept({
deptName: undefined,

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container">
<el-form :inline="true" :model="queryParams" ref="form">
<el-form-item label="选择部门1" prop="factoryId">
<el-form-item label="选择部门" prop="factoryId">
<dept-tree @deptChange="handleDeptChange" style="width: 150px;" />
</el-form-item>

View File

@ -32,7 +32,7 @@
<div class="river-ships">
<div class="ship-describe">
<p>
<span>厂界在线监测设备在线</span>
<span>厂界监测设备在线</span>
<span class="num-class" >{{numTotal.onlineTotal}}</span><span></span>
</p>
</div>
@ -56,6 +56,8 @@
<third-title title="设备分布情况">
</third-title>
<div class="bottom-bottom">
<div style="font-size: 16px;
color: #fff; "> 监测设备共分布{{ factoryTotal}}家企业如下</div>
<div class="left-list">
<div class="left-list1">港区名称</div>
<div class="left-list22">企业名称</div>
@ -118,6 +120,7 @@ export default {
data() {
//
return {
factoryTotal:0,
time: '',
dateTimer: '',
//
@ -149,6 +152,7 @@ export default {
this.examList = []
queryDeviceByFactory(this.queryParams).then(response => {
this.examList = response.data
this.factoryTotal=response.data.length
});
},