1. 图片上传七牛云
2. 植物识别日志 3. 植物解析日志 4. 保存定时器的同时请求onenet保存参数
This commit is contained in:
parent
f53ffaf24c
commit
927471c61f
|
@ -6,7 +6,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.common.utils.qiniu.QiNiuUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -22,7 +24,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
|
@ -41,7 +43,7 @@ public class CommonController
|
|||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
|
@ -163,4 +165,13 @@ public class CommonController
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取七牛云上传信息")
|
||||
@GetMapping("/qiniu/uploadInfo")
|
||||
public AjaxResult getQiNiuToken() {
|
||||
AjaxResult ajax = AjaxResult.success("操作成功");
|
||||
ajax.put("token", QiNiuUtils.getToken());
|
||||
ajax.put("domain", QiNiuUtils.DOMAIN);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,10 @@ spring:
|
|||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
# master:
|
||||
# url: jdbc:mysql://localhost:3306/autosprout?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: 123456
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/autosprout?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
|
|
|
@ -186,4 +186,15 @@ aliyun:
|
|||
signName: 创特物联
|
||||
# 验证码模版id
|
||||
templateCode: SMS_465342434
|
||||
|
||||
# 七牛云配置
|
||||
qiniu:
|
||||
# 七牛云key
|
||||
accessKey: MI4PDg9LYWXJyahzx5ec6-Ih0YNwQhew_BQUhttS
|
||||
# 七牛云密钥
|
||||
secretKey: Lk3fHHEnJuf0jD_Zte1xhtv7BTvjvmaWVCKd7O0J
|
||||
# 七牛云命名空间
|
||||
bucket: autosprout
|
||||
# 过期时间(秒)
|
||||
expireSeconds: 600
|
||||
# 七牛云GET请求域名
|
||||
domain: https://lxnapi.ccttiot.com
|
||||
|
|
|
@ -17,6 +17,13 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- 七牛云上传 -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>[7.13.0, 7.13.99]</version>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯云短信-->
|
||||
<!-- https://mvnrepository.com/artifact/com.tencentcloudapi/tencentcloud-sdk-java -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
package com.ruoyi.common.core.domain.onenet;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
package com.ruoyi.common.core.domain.onenet;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
@ -6,7 +6,7 @@ import lombok.Data;
|
|||
@Data
|
||||
public class DataPointRes {
|
||||
private int code;
|
||||
private com.ruoyi.quartz.domain.Data data;
|
||||
private com.ruoyi.common.core.domain.onenet.Data data;
|
||||
private String msg;
|
||||
@JSONField(name = "request_id")
|
||||
private String requestId;
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
package com.ruoyi.common.core.domain.onenet;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.ruoyi.common.core.domain.onenet;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DatapointValue {
|
||||
|
||||
private List<Ds> dsArray;
|
||||
private int jiaoshui_qiangdu;
|
||||
private nextDs next_ds;
|
||||
private Mc mc;
|
||||
private Set set;
|
||||
private Tr tr;
|
||||
private int turan_show;
|
||||
|
||||
|
||||
// 内部类 Ds
|
||||
@Data
|
||||
public static class Ds {
|
||||
private int hour;//时
|
||||
private int min;//分
|
||||
private Boolean once; //是否单次,false为循环浇水,true为单次
|
||||
private int sec;//秒
|
||||
private Boolean sw;// 开关
|
||||
private int week;//周转成二进制 bit0位开始为周一 0110 (week&1<<0) 1<<1 1<<2 00000110
|
||||
|
||||
}
|
||||
|
||||
// 内部类 Mc 脉冲
|
||||
@Data
|
||||
public static class Mc {
|
||||
private int jg_sec;//间隔时间
|
||||
private int js_sec;//启动时间
|
||||
private Boolean kaiguan; //开关 普通模式情况下获取的是ds.js_sec的时间
|
||||
|
||||
}
|
||||
|
||||
// 内部类 Set 设置
|
||||
@Data
|
||||
public static class Set {
|
||||
private Boolean kaiguan;
|
||||
private int xp_min;
|
||||
}
|
||||
|
||||
// 内部类 Tr 土壤
|
||||
@Data
|
||||
public static class Tr {
|
||||
private int end_sd;
|
||||
private Boolean kaiguan;
|
||||
private int start_sd;
|
||||
|
||||
}
|
||||
|
||||
//下次浇水时间
|
||||
@Data
|
||||
private class nextDs {
|
||||
private int hour;
|
||||
private int min;
|
||||
private int sec;
|
||||
private Boolean sw;//开关
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
package com.ruoyi.common.core.domain.onenet;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
@Data
|
||||
public class Datastream {
|
||||
|
||||
private List<Object> datapoints;
|
||||
private List<Datapoint> datapoints;
|
||||
|
||||
private String id;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.common.utils.qiniu;
|
||||
|
||||
import com.qiniu.util.Auth;
|
||||
import com.qiniu.util.StringMap;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
|
||||
/**
|
||||
* 七牛云工具类
|
||||
* @author wjh
|
||||
* 2024/3/26
|
||||
*/
|
||||
public class QiNiuUtils {
|
||||
|
||||
public static final String ACCESS_KEY = SpringUtils.getRequiredProperty("qiniu.accessKey");
|
||||
public static final String SECRET_KEY = SpringUtils.getRequiredProperty("qiniu.secretKey");
|
||||
public static final String BUCKET = SpringUtils.getRequiredProperty("qiniu.bucket");
|
||||
public static final Long EXPIRE_SECONDS = Long.parseLong(SpringUtils.getRequiredProperty("qiniu.expireSeconds")); // 过期时间(秒)
|
||||
public static final String DOMAIN = SpringUtils.getRequiredProperty("qiniu.domain"); // 域名
|
||||
|
||||
/**
|
||||
* 获取文件上传的token
|
||||
* @return token
|
||||
*/
|
||||
public static String getToken() {
|
||||
StringMap putPolicy = new StringMap();
|
||||
Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
|
||||
return auth.uploadToken(BUCKET,null, EXPIRE_SECONDS, putPolicy);
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// StringMap putPolicy = new StringMap();
|
||||
// Auth auth = Auth.create("MI4PDg9LYWXJyahzx5ec6-Ih0YNwQhew_BQUhttS", "Lk3fHHEnJuf0jD_Zte1xhtv7BTvjvmaWVCKd7O0J");
|
||||
// String s = auth.uploadToken("autosprout", null, 600L, putPolicy);
|
||||
// System.out.println(s);
|
||||
// }
|
||||
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DatapointValue {
|
||||
|
||||
private Ds ds;
|
||||
private int jiaoshui_qiangdu;
|
||||
private Mc mc;
|
||||
private Set set;
|
||||
private Tr tr;
|
||||
private int turan_show;
|
||||
|
||||
|
||||
public Ds getDs() {
|
||||
return ds;
|
||||
}
|
||||
|
||||
public void setDs(Ds ds) {
|
||||
this.ds = ds;
|
||||
}
|
||||
|
||||
public int getJiaoshui_qiangdu() {
|
||||
return jiaoshui_qiangdu;
|
||||
}
|
||||
|
||||
public void setJiaoshui_qiangdu(int jiaoshui_qiangdu) {
|
||||
this.jiaoshui_qiangdu = jiaoshui_qiangdu;
|
||||
}
|
||||
|
||||
public Mc getMc() {
|
||||
return mc;
|
||||
}
|
||||
|
||||
public void setMc(Mc mc) {
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
public Set getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public void setSet(Set set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
public Tr getTr() {
|
||||
return tr;
|
||||
}
|
||||
|
||||
public void setTr(Tr tr) {
|
||||
this.tr = tr;
|
||||
}
|
||||
|
||||
public int getTuran_show() {
|
||||
return turan_show;
|
||||
}
|
||||
|
||||
public void setTuran_show(int turan_show) {
|
||||
this.turan_show = turan_show;
|
||||
}
|
||||
|
||||
// 内部类 Ds
|
||||
public static class Ds {
|
||||
private int js_sec;
|
||||
private boolean kaiguan;
|
||||
private int start_hour;
|
||||
private int start_min;
|
||||
|
||||
// getters and setters
|
||||
|
||||
@JSONField(name = "js_sec")
|
||||
public int getJs_sec() {
|
||||
return js_sec;
|
||||
}
|
||||
|
||||
@JSONField(name = "js_sec")
|
||||
public void setJs_sec(int js_sec) {
|
||||
this.js_sec = js_sec;
|
||||
}
|
||||
|
||||
public boolean getKaiguan() {
|
||||
return kaiguan;
|
||||
}
|
||||
|
||||
public void setKaiguan(boolean kaiguan) {
|
||||
this.kaiguan = kaiguan;
|
||||
}
|
||||
|
||||
@JSONField(name = "start_hour")
|
||||
public int getStart_hour() {
|
||||
return start_hour;
|
||||
}
|
||||
|
||||
@JSONField(name = "start_hour")
|
||||
public void setStart_hour(int start_hour) {
|
||||
this.start_hour = start_hour;
|
||||
}
|
||||
|
||||
@JSONField(name = "start_min")
|
||||
public int getStart_min() {
|
||||
return start_min;
|
||||
}
|
||||
|
||||
@JSONField(name = "start_min")
|
||||
public void setStart_min(int start_min) {
|
||||
this.start_min = start_min;
|
||||
}
|
||||
}
|
||||
|
||||
// 内部类 Mc
|
||||
public static class Mc {
|
||||
private int jg_sec;
|
||||
private int js_sec;
|
||||
private boolean kaiguan;
|
||||
|
||||
// getters and setters
|
||||
|
||||
@JSONField(name = "jg_sec")
|
||||
public int getJg_sec() {
|
||||
return jg_sec;
|
||||
}
|
||||
|
||||
@JSONField(name = "jg_sec")
|
||||
public void setJg_sec(int jg_sec) {
|
||||
this.jg_sec = jg_sec;
|
||||
}
|
||||
|
||||
@JSONField(name = "js_sec")
|
||||
public int getJs_sec() {
|
||||
return js_sec;
|
||||
}
|
||||
|
||||
@JSONField(name = "js_sec")
|
||||
public void setJs_sec(int js_sec) {
|
||||
this.js_sec = js_sec;
|
||||
}
|
||||
|
||||
public boolean getKaiguan() {
|
||||
return kaiguan;
|
||||
}
|
||||
|
||||
public void setKaiguan(boolean kaiguan) {
|
||||
this.kaiguan = kaiguan;
|
||||
}
|
||||
}
|
||||
|
||||
// 内部类 Set
|
||||
public static class Set {
|
||||
private boolean kaiguan;
|
||||
private int xp_min;
|
||||
|
||||
// getters and setters
|
||||
|
||||
public boolean getKaiguan() {
|
||||
return kaiguan;
|
||||
}
|
||||
|
||||
public void setKaiguan(boolean kaiguan) {
|
||||
this.kaiguan = kaiguan;
|
||||
}
|
||||
|
||||
@JSONField(name = "xp_min")
|
||||
public int getXp_min() {
|
||||
return xp_min;
|
||||
}
|
||||
|
||||
@JSONField(name = "xp_min")
|
||||
public void setXp_min(int xp_min) {
|
||||
this.xp_min = xp_min;
|
||||
}
|
||||
}
|
||||
|
||||
// 内部类 Tr
|
||||
public static class Tr {
|
||||
private int end_sd;
|
||||
private boolean kaiguan;
|
||||
private int start_sd;
|
||||
|
||||
// getters and setters
|
||||
|
||||
@JSONField(name = "end_sd")
|
||||
public int getEnd_sd() {
|
||||
return end_sd;
|
||||
}
|
||||
|
||||
@JSONField(name = "end_sd")
|
||||
public void setEnd_sd(int end_sd) {
|
||||
this.end_sd = end_sd;
|
||||
}
|
||||
|
||||
public boolean getKaiguan() {
|
||||
return kaiguan;
|
||||
}
|
||||
|
||||
public void setKaiguan(boolean kaiguan) {
|
||||
this.kaiguan = kaiguan;
|
||||
}
|
||||
|
||||
@JSONField(name = "start_sd")
|
||||
public int getStart_sd() {
|
||||
return start_sd;
|
||||
}
|
||||
|
||||
@JSONField(name = "start_sd")
|
||||
public void setStart_sd(int start_sd) {
|
||||
this.start_sd = start_sd;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.quartz.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.onenet.DatapointValue;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.quartz.task;
|
|||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.constant.IotConstants;
|
||||
import com.ruoyi.common.core.domain.onenet.Datapoint;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.utils.onenet.Token;
|
||||
|
@ -9,9 +10,9 @@ import com.ruoyi.device.domain.AsDevice;
|
|||
import com.ruoyi.device.domain.AsWateringRecord;
|
||||
import com.ruoyi.device.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.device.mapper.AsWateringRecordMapper;
|
||||
import com.ruoyi.quartz.domain.Data;
|
||||
import com.ruoyi.quartz.domain.DataPointRes;
|
||||
import com.ruoyi.quartz.domain.Datastream;
|
||||
import com.ruoyi.common.core.domain.onenet.Data;
|
||||
import com.ruoyi.common.core.domain.onenet.DataPointRes;
|
||||
import com.ruoyi.common.core.domain.onenet.Datastream;
|
||||
import com.ruoyi.quartz.domain.WateringLog;
|
||||
import lombok.SneakyThrows;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -67,7 +68,7 @@ public class IotLogTask {
|
|||
|
||||
for (Datastream datastream: datastreams) {
|
||||
if(datastream.getId().equals("jj")){
|
||||
List<Object> datapoints = datastream.getDatapoints();
|
||||
List<Datapoint> datapoints = datastream.getDatapoints();
|
||||
for (Object obj:datapoints) {
|
||||
// String s = JSON.toJSONString(obj);
|
||||
// Datapoint datapoint = JSONObject.parseObject(s, Datapoint.class);
|
||||
|
|
44
AutoSprout-ui/src/api/plant/log.js
Normal file
44
AutoSprout-ui/src/api/plant/log.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询植物识别日志列表
|
||||
export function listLog(query) {
|
||||
return request({
|
||||
url: '/plant/identify/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询植物识别日志详细
|
||||
export function getLog(id) {
|
||||
return request({
|
||||
url: '/plant/identify/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增植物识别日志
|
||||
export function addLog(data) {
|
||||
return request({
|
||||
url: '/plant/identify',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改植物识别日志
|
||||
export function updateLog(data) {
|
||||
return request({
|
||||
url: '/plant/identify',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除植物识别日志
|
||||
export function delLog(id) {
|
||||
return request({
|
||||
url: '/plant/identify/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
245
AutoSprout-ui/src/views/plant/log/index.vue
Normal file
245
AutoSprout-ui/src/views/plant/log/index.vue
Normal file
|
@ -0,0 +1,245 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- <el-row :gutter="10" class="mb8">-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-plus"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleAdd"-->
|
||||
<!-- v-hasPermi="['device:log:add']"-->
|
||||
<!-- >新增</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="single"-->
|
||||
<!-- @click="handleUpdate"-->
|
||||
<!-- v-hasPermi="['device:log:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="multiple"-->
|
||||
<!-- @click="handleDelete"-->
|
||||
<!-- v-hasPermi="['device:log:remove']"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="warning"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-download"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleExport"-->
|
||||
<!-- v-hasPermi="['device:log:export']"-->
|
||||
<!-- >导出</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
||||
<!-- </el-row>-->
|
||||
|
||||
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" />
|
||||
<el-table-column label="用户ID" align="center" prop="userId" />
|
||||
<el-table-column label="url" align="center" prop="url" />
|
||||
<el-table-column label="百度识别返回" align="center" prop="response" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="消息" align="center" prop="msg" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- @click="handleUpdate(scope.row)"-->
|
||||
<!-- v-hasPermi="['device:log:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- @click="handleDelete(scope.row)"-->
|
||||
<!-- v-hasPermi="['device:log:remove']"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改植物识别日志对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listLog, getLog, delLog, addLog, updateLog } from "@/api/plant/log";
|
||||
|
||||
export default {
|
||||
name: "Log",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 植物识别日志表格数据
|
||||
logList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询植物识别日志列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listLog(this.queryParams).then(response => {
|
||||
this.logList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
userId: null,
|
||||
plantName: null,
|
||||
response: null,
|
||||
msg: null,
|
||||
createTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加植物识别日志";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getLog(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改植物识别日志";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateLog(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addLog(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除植物识别日志编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delLog(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('device/log/export', {
|
||||
...this.queryParams
|
||||
}, `log_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -116,7 +116,7 @@
|
|||
<dict-tag :options="dict.type.as_sprout_cycle" :value="scope.row.sproutCycle"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="介绍" align="center" prop="introduce" />
|
||||
<el-table-column label="介绍" align="center" show-overflow-tooltip="true" prop="introduce" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
@ -146,7 +146,7 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改植物对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="名称" prop="plantName">
|
||||
<el-input v-model="form.plantName" placeholder="请输入名称" />
|
||||
|
@ -197,6 +197,25 @@
|
|||
<el-form-item label="介绍" prop="introduce">
|
||||
<el-input v-model="form.introduce" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="难易程度" prop="complexity">
|
||||
<el-select v-model="form.complexity" placeholder="请选择难易程度">
|
||||
<el-option
|
||||
v-for="dict in dict.type.as_plant_complexity"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="功能" prop="func">
|
||||
<el-input v-model="form.func" type="textarea" placeholder="请输入功能" />
|
||||
</el-form-item>
|
||||
<el-form-item label="适合的空间" prop="fitSpace">
|
||||
<el-input v-model="form.fitSpace" type="textarea" placeholder="请输入适合的空间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="养护重点" prop="maintenanceFocus">
|
||||
<el-input v-model="form.maintenanceFocus" type="textarea" placeholder="请输入适合的空间" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
|
@ -212,7 +231,7 @@ import {listClassify} from "@/api/plant/classify";
|
|||
|
||||
export default {
|
||||
name: "Plant",
|
||||
dicts: ['as_watering_cycle', 'as_beam', 'as_sprout_cycle'],
|
||||
dicts: ['as_watering_cycle', 'as_beam', 'as_sprout_cycle','as_plant_complexity'],
|
||||
data() {
|
||||
return {
|
||||
//分类列表
|
||||
|
|
|
@ -50,9 +50,28 @@ public class AppController extends BaseController
|
|||
@Autowired
|
||||
private IAsPlantService asPlantService;
|
||||
|
||||
@Autowired
|
||||
private IAsArticleService asArticleService;
|
||||
|
||||
@Autowired
|
||||
private IAsPlantIdentifyLogService asPlantIdentifyLogService;
|
||||
|
||||
@Autowired
|
||||
private IAsPlantAnalysisLogService asPlantAnalysisLogService;
|
||||
|
||||
@Value(value = "${baidu.identifyUrl}")
|
||||
private String identifyUrl;
|
||||
|
||||
/**
|
||||
* 查询文章列表
|
||||
*/
|
||||
@GetMapping("/article/list")
|
||||
public TableDataInfo list(AsArticle asArticle)
|
||||
{
|
||||
startPage();
|
||||
List<AsArticle> list = asArticleService.selectAsArticleList(asArticle);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -154,12 +173,12 @@ public class AppController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 植物识别
|
||||
*
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Log(title = "植物识别", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/plant/identify")
|
||||
public AjaxResult plant(String url)
|
||||
public AjaxResult plant(String url,String userId)
|
||||
{
|
||||
/** 请求百度获取token*/
|
||||
if(ObjectUtils.isEmpty(url)){
|
||||
|
@ -168,10 +187,18 @@ public class AppController extends BaseController
|
|||
String token = GetToken.getAccessToken();
|
||||
String param = "url="+ URLEncoder.encode(url,"UTF-8");
|
||||
String post = HttpUtils.sendPost2(identifyUrl + "?access_token=" + token, param);
|
||||
logger.info("百度植物识别返回-----"+ JSON.toJSONString(post));
|
||||
logger.info("百度植物识别返回-----"+ post);
|
||||
/** 根据名字查询自己的植物库中是否有该植物,没有则返回 没有该植物信息 ,
|
||||
* 有则返回该植物的详情 */
|
||||
IdentifyRes identifyRes = JSONObject.parseObject(post, IdentifyRes.class);
|
||||
AsPlantIdentifyLog asPlantIdentifyLog = new AsPlantIdentifyLog();
|
||||
asPlantIdentifyLog.setUserId(Long.parseLong(userId));
|
||||
asPlantIdentifyLog.setUrl(url);
|
||||
asPlantIdentifyLog.setResponse(post);
|
||||
int i = asPlantIdentifyLogService.insertAsPlantIdentifyLog(asPlantIdentifyLog);
|
||||
if(i>0){
|
||||
logger.info("植物识别记录日志成功");
|
||||
}
|
||||
List<IdentifyRes.PlantItem> plantList = identifyRes.getResult();
|
||||
for (IdentifyRes.PlantItem plantItem : plantList) {
|
||||
String name = plantItem.getName();
|
||||
|
@ -181,6 +208,16 @@ public class AppController extends BaseController
|
|||
if(ObjectUtils.isEmpty(asPlant)){
|
||||
plantItem.setPlantId(null);
|
||||
plantItem.setMsg("没有该植物信息");
|
||||
/** 记录植物库中没有该植物,用于后期补充植物库*/
|
||||
AsPlantAnalysisLog asPlantAnalysisLog = AsPlantAnalysisLog.builder()
|
||||
.plantName(name)
|
||||
.identifyId(asPlantIdentifyLog.getId())
|
||||
.msg("没有该植物信息")
|
||||
.build();
|
||||
int i1 = asPlantAnalysisLogService.insertAsPlantAnalysisLog(asPlantAnalysisLog);
|
||||
if(i1>0){
|
||||
logger.info("植物识别记录日志成功");
|
||||
}
|
||||
}else{
|
||||
plantItem.setPlantId(asPlant.getPlantId());
|
||||
plantItem.setUrl(asPlant.getPicture());
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.device.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.device.domain.AsPlantAnalysisLog;
|
||||
import com.ruoyi.device.service.IAsPlantAnalysisLogService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 植物解析日志Controller
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/plant/analysis")
|
||||
public class AsPlantAnalysisLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAsPlantAnalysisLogService asPlantAnalysisLogService;
|
||||
|
||||
/**
|
||||
* 查询植物解析日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
startPage();
|
||||
List<AsPlantAnalysisLog> list = asPlantAnalysisLogService.selectAsPlantAnalysisLogList(asPlantAnalysisLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出植物解析日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:export')")
|
||||
@Log(title = "植物解析日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
List<AsPlantAnalysisLog> list = asPlantAnalysisLogService.selectAsPlantAnalysisLogList(asPlantAnalysisLog);
|
||||
ExcelUtil<AsPlantAnalysisLog> util = new ExcelUtil<AsPlantAnalysisLog>(AsPlantAnalysisLog.class);
|
||||
util.exportExcel(response, list, "植物解析日志数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取植物解析日志详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(asPlantAnalysisLogService.selectAsPlantAnalysisLogById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增植物解析日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:add')")
|
||||
@Log(title = "植物解析日志", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
return toAjax(asPlantAnalysisLogService.insertAsPlantAnalysisLog(asPlantAnalysisLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改植物解析日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:edit')")
|
||||
@Log(title = "植物解析日志", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
return toAjax(asPlantAnalysisLogService.updateAsPlantAnalysisLog(asPlantAnalysisLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除植物解析日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:remove')")
|
||||
@Log(title = "植物解析日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(asPlantAnalysisLogService.deleteAsPlantAnalysisLogByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.device.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.device.domain.AsPlantIdentifyLog;
|
||||
import com.ruoyi.device.service.IAsPlantIdentifyLogService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 植物识别日志Controller
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/plant/identify")
|
||||
public class AsPlantIdentifyLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAsPlantIdentifyLogService asPlantIdentifyLogService;
|
||||
|
||||
/**
|
||||
* 查询植物识别日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
startPage();
|
||||
List<AsPlantIdentifyLog> list = asPlantIdentifyLogService.selectAsPlantIdentifyLogList(asPlantIdentifyLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出植物识别日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:export')")
|
||||
@Log(title = "植物识别日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
List<AsPlantIdentifyLog> list = asPlantIdentifyLogService.selectAsPlantIdentifyLogList(asPlantIdentifyLog);
|
||||
ExcelUtil<AsPlantIdentifyLog> util = new ExcelUtil<AsPlantIdentifyLog>(AsPlantIdentifyLog.class);
|
||||
util.exportExcel(response, list, "植物识别日志数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取植物识别日志详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(asPlantIdentifyLogService.selectAsPlantIdentifyLogById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增植物识别日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:add')")
|
||||
@Log(title = "植物识别日志", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
return toAjax(asPlantIdentifyLogService.insertAsPlantIdentifyLog(asPlantIdentifyLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改植物识别日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:edit')")
|
||||
@Log(title = "植物识别日志", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
return toAjax(asPlantIdentifyLogService.updateAsPlantIdentifyLog(asPlantIdentifyLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除植物识别日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:log:remove')")
|
||||
@Log(title = "植物识别日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(asPlantIdentifyLogService.deleteAsPlantIdentifyLogByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.device.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 植物解析日志对象 as_plant_analysis_log
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-31
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "as_plant_analysis_log")
|
||||
@Builder
|
||||
public class AsPlantAnalysisLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 日志id */
|
||||
@Excel(name = "日志id")
|
||||
private Long id;
|
||||
|
||||
/** 识别日志id */
|
||||
@Excel(name = "识别日志id")
|
||||
private Long identifyId;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String plantName;
|
||||
|
||||
/** 消息 */
|
||||
@Excel(name = "消息")
|
||||
private String msg;
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.ruoyi.device.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 植物识别日志对象 as_plant_identify_log
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-30
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "as_plant_identify_log")
|
||||
public class AsPlantIdentifyLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 日志id */
|
||||
@Excel(name = "日志id")
|
||||
private Long id;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String plantName;
|
||||
|
||||
/** url */
|
||||
@Excel(name = "url")
|
||||
private String url;
|
||||
|
||||
/** 百度识别返回 */
|
||||
@Excel(name = "百度识别返回")
|
||||
private String response;
|
||||
|
||||
/** 消息 */
|
||||
@Excel(name = "消息")
|
||||
private String msg;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.domain.AsPlantAnalysisLog;
|
||||
|
||||
/**
|
||||
* 植物解析日志Mapper接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-31
|
||||
*/
|
||||
public interface AsPlantAnalysisLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询植物解析日志
|
||||
*
|
||||
* @param id 植物解析日志主键
|
||||
* @return 植物解析日志
|
||||
*/
|
||||
public AsPlantAnalysisLog selectAsPlantAnalysisLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询植物解析日志列表
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 植物解析日志集合
|
||||
*/
|
||||
public List<AsPlantAnalysisLog> selectAsPlantAnalysisLogList(AsPlantAnalysisLog asPlantAnalysisLog);
|
||||
|
||||
/**
|
||||
* 新增植物解析日志
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsPlantAnalysisLog(AsPlantAnalysisLog asPlantAnalysisLog);
|
||||
|
||||
/**
|
||||
* 修改植物解析日志
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsPlantAnalysisLog(AsPlantAnalysisLog asPlantAnalysisLog);
|
||||
|
||||
/**
|
||||
* 删除植物解析日志
|
||||
*
|
||||
* @param id 植物解析日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantAnalysisLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除植物解析日志
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantAnalysisLogByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.domain.AsPlantIdentifyLog;
|
||||
|
||||
/**
|
||||
* 植物识别日志Mapper接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-30
|
||||
*/
|
||||
public interface AsPlantIdentifyLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询植物识别日志
|
||||
*
|
||||
* @param id 植物识别日志主键
|
||||
* @return 植物识别日志
|
||||
*/
|
||||
public AsPlantIdentifyLog selectAsPlantIdentifyLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询植物识别日志列表
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 植物识别日志集合
|
||||
*/
|
||||
public List<AsPlantIdentifyLog> selectAsPlantIdentifyLogList(AsPlantIdentifyLog asPlantIdentifyLog);
|
||||
|
||||
/**
|
||||
* 新增植物识别日志
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsPlantIdentifyLog(AsPlantIdentifyLog asPlantIdentifyLog);
|
||||
|
||||
/**
|
||||
* 修改植物识别日志
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsPlantIdentifyLog(AsPlantIdentifyLog asPlantIdentifyLog);
|
||||
|
||||
/**
|
||||
* 删除植物识别日志
|
||||
*
|
||||
* @param id 植物识别日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantIdentifyLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除植物识别日志
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantIdentifyLogByIds(Long[] ids);
|
||||
}
|
|
@ -23,7 +23,7 @@ public interface IAsArticleService
|
|||
/**
|
||||
* 查询文章列表
|
||||
*
|
||||
* @param AsArticle 文章
|
||||
* @param asArticle 文章
|
||||
* @return 文章集合
|
||||
*/
|
||||
public List<AsArticle> selectAsArticleList(AsArticle asArticle);
|
||||
|
@ -31,7 +31,7 @@ public interface IAsArticleService
|
|||
/**
|
||||
* 新增文章
|
||||
*
|
||||
* @param AsArticle 文章
|
||||
* @param asArticle 文章
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsArticle(AsArticle asArticle);
|
||||
|
@ -39,7 +39,7 @@ public interface IAsArticleService
|
|||
/**
|
||||
* 修改文章
|
||||
*
|
||||
* @param AsArticle 文章
|
||||
* @param asArticle 文章
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsArticle(AsArticle asArticle);
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.device.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.domain.AsPlantAnalysisLog;
|
||||
|
||||
/**
|
||||
* 植物解析日志Service接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-31
|
||||
*/
|
||||
public interface IAsPlantAnalysisLogService
|
||||
{
|
||||
/**
|
||||
* 查询植物解析日志
|
||||
*
|
||||
* @param id 植物解析日志主键
|
||||
* @return 植物解析日志
|
||||
*/
|
||||
public AsPlantAnalysisLog selectAsPlantAnalysisLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询植物解析日志列表
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 植物解析日志集合
|
||||
*/
|
||||
public List<AsPlantAnalysisLog> selectAsPlantAnalysisLogList(AsPlantAnalysisLog asPlantAnalysisLog);
|
||||
|
||||
/**
|
||||
* 新增植物解析日志
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsPlantAnalysisLog(AsPlantAnalysisLog asPlantAnalysisLog);
|
||||
|
||||
/**
|
||||
* 修改植物解析日志
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsPlantAnalysisLog(AsPlantAnalysisLog asPlantAnalysisLog);
|
||||
|
||||
/**
|
||||
* 批量删除植物解析日志
|
||||
*
|
||||
* @param ids 需要删除的植物解析日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantAnalysisLogByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除植物解析日志信息
|
||||
*
|
||||
* @param id 植物解析日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantAnalysisLogById(Long id);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.device.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.domain.AsPlantIdentifyLog;
|
||||
|
||||
/**
|
||||
* 植物识别日志Service接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-30
|
||||
*/
|
||||
public interface IAsPlantIdentifyLogService
|
||||
{
|
||||
/**
|
||||
* 查询植物识别日志
|
||||
*
|
||||
* @param id 植物识别日志主键
|
||||
* @return 植物识别日志
|
||||
*/
|
||||
public AsPlantIdentifyLog selectAsPlantIdentifyLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询植物识别日志列表
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 植物识别日志集合
|
||||
*/
|
||||
public List<AsPlantIdentifyLog> selectAsPlantIdentifyLogList(AsPlantIdentifyLog asPlantIdentifyLog);
|
||||
|
||||
/**
|
||||
* 新增植物识别日志
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAsPlantIdentifyLog(AsPlantIdentifyLog asPlantIdentifyLog);
|
||||
|
||||
/**
|
||||
* 修改植物识别日志
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsPlantIdentifyLog(AsPlantIdentifyLog asPlantIdentifyLog);
|
||||
|
||||
/**
|
||||
* 批量删除植物识别日志
|
||||
*
|
||||
* @param ids 需要删除的植物识别日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantIdentifyLogByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除植物识别日志信息
|
||||
*
|
||||
* @param id 植物识别日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAsPlantIdentifyLogById(Long id);
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.mapper.AsPlantAnalysisLogMapper;
|
||||
import com.ruoyi.device.domain.AsPlantAnalysisLog;
|
||||
import com.ruoyi.device.service.IAsPlantAnalysisLogService;
|
||||
|
||||
/**
|
||||
* 植物解析日志Service业务层处理
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-31
|
||||
*/
|
||||
@Service
|
||||
public class AsPlantAnalysisLogServiceImpl implements IAsPlantAnalysisLogService
|
||||
{
|
||||
@Autowired
|
||||
private AsPlantAnalysisLogMapper asPlantAnalysisLogMapper;
|
||||
|
||||
/**
|
||||
* 查询植物解析日志
|
||||
*
|
||||
* @param id 植物解析日志主键
|
||||
* @return 植物解析日志
|
||||
*/
|
||||
@Override
|
||||
public AsPlantAnalysisLog selectAsPlantAnalysisLogById(Long id)
|
||||
{
|
||||
return asPlantAnalysisLogMapper.selectAsPlantAnalysisLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询植物解析日志列表
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 植物解析日志
|
||||
*/
|
||||
@Override
|
||||
public List<AsPlantAnalysisLog> selectAsPlantAnalysisLogList(AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
return asPlantAnalysisLogMapper.selectAsPlantAnalysisLogList(asPlantAnalysisLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增植物解析日志
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAsPlantAnalysisLog(AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
asPlantAnalysisLog.setCreateTime(DateUtils.getNowDate());
|
||||
return asPlantAnalysisLogMapper.insertAsPlantAnalysisLog(asPlantAnalysisLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改植物解析日志
|
||||
*
|
||||
* @param asPlantAnalysisLog 植物解析日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAsPlantAnalysisLog(AsPlantAnalysisLog asPlantAnalysisLog)
|
||||
{
|
||||
return asPlantAnalysisLogMapper.updateAsPlantAnalysisLog(asPlantAnalysisLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除植物解析日志
|
||||
*
|
||||
* @param ids 需要删除的植物解析日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsPlantAnalysisLogByIds(Long[] ids)
|
||||
{
|
||||
return asPlantAnalysisLogMapper.deleteAsPlantAnalysisLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除植物解析日志信息
|
||||
*
|
||||
* @param id 植物解析日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsPlantAnalysisLogById(Long id)
|
||||
{
|
||||
return asPlantAnalysisLogMapper.deleteAsPlantAnalysisLogById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.mapper.AsPlantIdentifyLogMapper;
|
||||
import com.ruoyi.device.domain.AsPlantIdentifyLog;
|
||||
import com.ruoyi.device.service.IAsPlantIdentifyLogService;
|
||||
|
||||
/**
|
||||
* 植物识别日志Service业务层处理
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-03-30
|
||||
*/
|
||||
@Service
|
||||
public class AsPlantIdentifyLogServiceImpl implements IAsPlantIdentifyLogService
|
||||
{
|
||||
@Autowired
|
||||
private AsPlantIdentifyLogMapper asPlantIdentifyLogMapper;
|
||||
|
||||
/**
|
||||
* 查询植物识别日志
|
||||
*
|
||||
* @param id 植物识别日志主键
|
||||
* @return 植物识别日志
|
||||
*/
|
||||
@Override
|
||||
public AsPlantIdentifyLog selectAsPlantIdentifyLogById(Long id)
|
||||
{
|
||||
return asPlantIdentifyLogMapper.selectAsPlantIdentifyLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询植物识别日志列表
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 植物识别日志
|
||||
*/
|
||||
@Override
|
||||
public List<AsPlantIdentifyLog> selectAsPlantIdentifyLogList(AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
return asPlantIdentifyLogMapper.selectAsPlantIdentifyLogList(asPlantIdentifyLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增植物识别日志
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAsPlantIdentifyLog(AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
asPlantIdentifyLog.setCreateTime(DateUtils.getNowDate());
|
||||
return asPlantIdentifyLogMapper.insertAsPlantIdentifyLog(asPlantIdentifyLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改植物识别日志
|
||||
*
|
||||
* @param asPlantIdentifyLog 植物识别日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAsPlantIdentifyLog(AsPlantIdentifyLog asPlantIdentifyLog)
|
||||
{
|
||||
return asPlantIdentifyLogMapper.updateAsPlantIdentifyLog(asPlantIdentifyLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除植物识别日志
|
||||
*
|
||||
* @param ids 需要删除的植物识别日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsPlantIdentifyLogByIds(Long[] ids)
|
||||
{
|
||||
return asPlantIdentifyLogMapper.deleteAsPlantIdentifyLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除植物识别日志信息
|
||||
*
|
||||
* @param id 植物识别日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAsPlantIdentifyLogById(Long id)
|
||||
{
|
||||
return asPlantIdentifyLogMapper.deleteAsPlantIdentifyLogById(id);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,9 @@ import java.security.InvalidKeyException;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,12 +15,14 @@ import com.alibaba.fastjson2.JSON;
|
|||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.constant.IotConstants;
|
||||
import com.ruoyi.common.core.domain.onenet.*;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.utils.onenet.IotUtil;
|
||||
import com.ruoyi.common.utils.onenet.Token;
|
||||
import com.ruoyi.device.domain.AsDevice;
|
||||
import com.ruoyi.device.domain.AsWateringRecord;
|
||||
import com.ruoyi.device.service.IAsDeviceService;
|
||||
import lombok.SneakyThrows;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -101,80 +106,95 @@ public class AsTimerServiceImpl implements IAsTimerService
|
|||
Time sqlTime = new Time(timeFormat.parse(asTimer.getStartTimeStr()).getTime());
|
||||
asTimer.setStartTime(sqlTime);
|
||||
asTimer.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
|
||||
//
|
||||
// Long deviceId = asTimer.getDeviceId();
|
||||
// AsDevice device = asDeviceService.selectAsDeviceByDeviceId(deviceId);
|
||||
//
|
||||
// /**1.请求onenet获取到该设备的定时器信息*/
|
||||
// String param = "device_name=" + device.getMac() + "&product_id=" + productId;
|
||||
// String sendUrl = iotUrl+ IotConstants.ADDS_HISTORY_DATAPOINTS + "?"+param;
|
||||
//
|
||||
// String token = Token.getToken();
|
||||
// logger.info("IOT获取到Authorization:【{}】",token);
|
||||
// String result = HttpUtils.sendGetWithToken(sendUrl, null, token);
|
||||
//
|
||||
// logger.info("IOT返回的结果【{}】",result);
|
||||
// /**2.处理返回的参数*/
|
||||
// DataPointRes dataPointRes = JSONObject.parseObject(result, DataPointRes.class);
|
||||
// Data data = dataPointRes.getData();
|
||||
// List<Datastream> datastreams = data.getDatastreams();
|
||||
// List<DatapointValue.Ds> dsArray = null;
|
||||
// for (Datastream datastream: datastreams) {
|
||||
// if(datastream.getId().equals("jj")){
|
||||
// List<Datapoint> datapoints = datastream.getDatapoints();
|
||||
// for (Datapoint obj:datapoints) {
|
||||
// DatapointValue value = obj.getValue();
|
||||
// dsArray = value.getDsArray();
|
||||
// DatapointValue.Ds ds = new DatapointValue.Ds();
|
||||
// //将week(二进制)转成十进制
|
||||
// String week = asTimer.getWeek();
|
||||
// ds.setWeek(Integer.parseInt(week, 2));
|
||||
// //将startTimeStr(HH:mm)转成time提取小时、分钟、秒
|
||||
// Date parse = timeFormat.parse(asTimer.getStartTimeStr());
|
||||
// Instant instant = parse.toInstant();
|
||||
// LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
// //time提取出小时,分钟,秒
|
||||
// ds.setHour(localDateTime.getHour());
|
||||
// ds.setMin(localDateTime.getMinute());
|
||||
// ds.setSec(localDateTime.getSecond());
|
||||
// String mode = asTimer.getMode();
|
||||
// ds.setOnce("1".equals(mode)?true:false);
|
||||
// ds.setSw(asTimer.getIsSwitch());
|
||||
// dsArray.add(ds);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /** 向onenet发送编辑指令 更新设备定时器*/
|
||||
// /** 1.获取参数*/
|
||||
// String command = getTimerCommand(asTimer,device);
|
||||
// String command = getTimerCommand(dsArray);
|
||||
// logger.info("IOT获取到下发命令:【{}】",command);
|
||||
//
|
||||
// /** 2.发送请求*/
|
||||
// String deviceName = device.getMac();//mac地址就是产品名称
|
||||
// String param = "device_name=" + deviceName + "&product_id=" + productId +"&timeout=" + timeout;
|
||||
// String sendUrl = iotUrl+ IotConstants.ADDS_COMMAND + "?"+param;
|
||||
// String param2 = "device_name=" + deviceName + "&product_id=" + productId +"&timeout=" + timeout;
|
||||
// String sendUrl2 = iotUrl+ IotConstants.ADDS_COMMAND + "?"+param2;
|
||||
//
|
||||
// String token = null;
|
||||
// token = Token.getToken();
|
||||
// logger.info("IOT获取到Authorization:【{}】",token);
|
||||
//
|
||||
// String result = HttpUtils.sendPostWithToken(sendUrl, command, token);
|
||||
// String result2 = HttpUtils.sendPostWithToken(sendUrl2, command, token);
|
||||
//
|
||||
// /** 2.返回结果处理*/
|
||||
// JSONObject paramsObj = JSON.parseObject(result);
|
||||
// JSONObject paramsObj = JSON.parseObject(result2);
|
||||
// String code = paramsObj.getString("code");
|
||||
// if (!HttpStatus.IOT_SUCCESS.equals(code))
|
||||
// {
|
||||
// throw new ServiceException(code+"-----"+ IotUtil.formatMsg(code));
|
||||
// }
|
||||
// logger.info("IOT请求调用结果:【{}】",result);
|
||||
// logger.info("IOT请求调用结果:【{}】",result2);
|
||||
return asTimerMapper.insertAsTimer(asTimer);
|
||||
}
|
||||
|
||||
private String getTimerCommand(AsTimer asTimer) {
|
||||
// asTimer
|
||||
//拼接定时器命令
|
||||
private String getTimerCommand(List<DatapointValue.Ds> dsArray) {
|
||||
if (dsArray == null || dsArray.size() == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
StringBuilder command = null;
|
||||
for (int i = 0; i < dsArray.size(); i++) {
|
||||
DatapointValue.Ds ds = dsArray.get(i);
|
||||
command = new StringBuilder()
|
||||
.append("sds").append(i).append(IotConstants.COMMAND_SEPARATOR)
|
||||
.append("once").append(ds.getOnce()?"1":"0").append(IotConstants.COMMAND_SEPARATOR)
|
||||
.append("sw").append(ds.getSw()?"1":"0").append(IotConstants.COMMAND_SEPARATOR)
|
||||
.append("week").append(ds.getWeek()).append(IotConstants.COMMAND_SEPARATOR)
|
||||
.append("hour").append(ds.getHour()).append(IotConstants.COMMAND_SEPARATOR)
|
||||
.append("min").append(ds.getMin()).append(IotConstants.COMMAND_SEPARATOR)
|
||||
.append("sec").append(ds.getSec()).append(IotConstants.COMMAND_SEPARATOR);
|
||||
|
||||
|
||||
// String regularWateringSwitch = "true".equals(asDevice.getRegularWatering()) ? "1" : "0";//定时浇水开关
|
||||
//
|
||||
// JSONObject regularWateringJsonObj = JSON.parseObject(asDevice.getRegularWateringJson());
|
||||
// String startHour = regularWateringJsonObj.getString("startHour");//启动时间-小时
|
||||
// String startMin = regularWateringJsonObj.getString("startMin");//启动时间-分钟
|
||||
// String sprayTime = regularWateringJsonObj.getString("sprayTime");//喷洒时间
|
||||
//
|
||||
// String soilMoistureSwitch = "true".equals(asDevice.getSoilMoisture()) ? "1" : "0";//土壤湿度开关
|
||||
// Integer soilMoistureOpen = asDevice.getSoilMoistureOpen();//启动土壤湿度
|
||||
// Integer soilMoistureClose = asDevice.getSoilMoistureClose();//关闭土壤湿度
|
||||
//
|
||||
// String pulseModeSwitch = "true".equals(asDevice.getPulseMode()) ? "1" : "0";//脉冲模式开关
|
||||
// JSONObject pulseModeParamObj = JSON.parseObject(asDevice.getPulseModeParam());
|
||||
// String sprayTime1 = pulseModeParamObj.getString("sprayTime");//喷洒时间
|
||||
// String intervalTime = pulseModeParamObj.getString("intervalTime");//间隔时间
|
||||
//
|
||||
// Integer waterIntensity = asDevice.getWaterIntensity();
|
||||
//
|
||||
// String min = asDevice.getScreenRestTime().replace("min", "");//息屏时间转换成分钟数
|
||||
// Integer minNum = Integer.parseInt(min.replace("hour", "")) * 60;
|
||||
// String screenRestTime = min.contains("hour") ? minNum.toString() : min;
|
||||
// String screenRestTimeSwitch = "99".equals(asDevice.getScreenRestTime()) ? "0" : "1";//息屏开关
|
||||
|
||||
// StringBuilder command = new StringBuilder()
|
||||
// .append("sds").append(i).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("dskaiguan").append(regularWateringSwitch).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("dsstart_hour").append(startHour).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("dsstart_min").append(startMin).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("jiaoshui_qiangdu").append(waterIntensity).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("mckaiguan").append(pulseModeSwitch).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("mcjg_sec").append(intervalTime).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("mcjs_sec").append(sprayTime1).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("setkaiguan").append(screenRestTimeSwitch).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("setxp_min").append(screenRestTime).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("trkaiguan").append(soilMoistureSwitch).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("trstart_sd").append(soilMoistureOpen).append(IotConstants.COMMAND_SEPARATOR)
|
||||
// .append("trend_sd").append(soilMoistureClose).append(IotConstants.COMMAND_SEPARATOR);
|
||||
// command.toString()
|
||||
return "";
|
||||
}
|
||||
return command.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectAsArticleList" parameterType="AsArticle" resultMap="AsArticleResult">
|
||||
select article_id, classify, dynamic_classify, title, logo, master_picture, tag,is_hot, introduction, author, create_by, create_time, update_by, update_time, remark from as_article
|
||||
select article_id, classify, dynamic_classify, title, logo, master_picture, tag,is_hot, introduction, content, author, create_by, create_time, update_by, update_time, remark from as_article
|
||||
<where>
|
||||
<if test="classify != null and classify != ''"> and classify = #{classify}</if>
|
||||
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<?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.ruoyi.device.mapper.AsPlantAnalysisLogMapper">
|
||||
|
||||
<resultMap type="AsPlantAnalysisLog" id="AsPlantAnalysisLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="identifyId" column="identify_id" />
|
||||
<result property="plantName" column="plant_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="msg" column="msg" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAsPlantAnalysisLogVo">
|
||||
select id, identify_id, plant_name, create_time, msg from as_plant_analysis_log
|
||||
</sql>
|
||||
|
||||
<select id="selectAsPlantAnalysisLogList" parameterType="AsPlantAnalysisLog" resultMap="AsPlantAnalysisLogResult">
|
||||
<include refid="selectAsPlantAnalysisLogVo"/>
|
||||
<where>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAsPlantAnalysisLogById" parameterType="Long" resultMap="AsPlantAnalysisLogResult">
|
||||
<include refid="selectAsPlantAnalysisLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAsPlantAnalysisLog" parameterType="AsPlantAnalysisLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into as_plant_analysis_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="identifyId != null">identify_id,</if>
|
||||
<if test="plantName != null">plant_name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="msg != null">msg,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="identifyId != null">#{identifyId},</if>
|
||||
<if test="plantName != null">#{plantName},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="msg != null">#{msg},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAsPlantAnalysisLog" parameterType="AsPlantAnalysisLog">
|
||||
update as_plant_analysis_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="identifyId != null">identify_id = #{identifyId},</if>
|
||||
<if test="plantName != null">plant_name = #{plantName},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="msg != null">msg = #{msg},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAsPlantAnalysisLogById" parameterType="Long">
|
||||
delete from as_plant_analysis_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAsPlantAnalysisLogByIds" parameterType="String">
|
||||
delete from as_plant_analysis_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,74 @@
|
|||
<?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.ruoyi.device.mapper.AsPlantIdentifyLogMapper">
|
||||
|
||||
<resultMap type="AsPlantIdentifyLog" id="AsPlantIdentifyLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="plantName" column="plant_name" />
|
||||
<result property="response" column="response" />
|
||||
<result property="msg" column="msg" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAsPlantIdentifyLogVo">
|
||||
select id, user_id, plant_name, url, response, msg, create_time from as_plant_identify_log
|
||||
</sql>
|
||||
|
||||
<select id="selectAsPlantIdentifyLogList" parameterType="AsPlantIdentifyLog" resultMap="AsPlantIdentifyLogResult">
|
||||
<include refid="selectAsPlantIdentifyLogVo"/>
|
||||
<where>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAsPlantIdentifyLogById" parameterType="Long" resultMap="AsPlantIdentifyLogResult">
|
||||
<include refid="selectAsPlantIdentifyLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAsPlantIdentifyLog" parameterType="AsPlantIdentifyLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into as_plant_identify_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="plantName != null">plant_name,</if>
|
||||
<if test="url != null">url,</if>
|
||||
<if test="response != null">response,</if>
|
||||
<if test="msg != null">msg,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="plantName != null">#{plantName},</if>
|
||||
<if test="url != null">#{url},</if>
|
||||
<if test="response != null">#{response},</if>
|
||||
<if test="msg != null">#{msg},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAsPlantIdentifyLog" parameterType="AsPlantIdentifyLog">
|
||||
update as_plant_identify_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="plantName != null">plant_name = #{plantName},</if>
|
||||
<if test="url != null">url = #{url},</if>
|
||||
<if test="response != null">response = #{response},</if>
|
||||
<if test="msg != null">msg = #{msg},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAsPlantIdentifyLogById" parameterType="Long">
|
||||
delete from as_plant_identify_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAsPlantIdentifyLogByIds" parameterType="String">
|
||||
delete from as_plant_identify_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user