Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kwell-mes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gavelinfo
kwell-mes
Commits
c30b95e5
Commit
c30b95e5
authored
Apr 02, 2022
by
yff
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.gavelinfo.com:gavelinfo/kwell-mes
parents
8f8a95a1
fc051672
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
40 deletions
+68
-40
UpointController.java
...ain/java/com/gavel/kwell/controller/UpointController.java
+12
-0
UpointService.java
.../src/main/java/com/gavel/kwell/service/UpointService.java
+2
-0
UpointServiceImpl.java
.../java/com/gavel/kwell/service/impl/UpointServiceImpl.java
+46
-37
PointTypeEnum.java
gavel/src/main/java/com/gavel/kwell/utils/PointTypeEnum.java
+1
-2
edit.html
...l/src/main/resources/templates/views/kmes/point/edit.html
+1
-1
index.html
.../src/main/resources/templates/views/kmes/point/index.html
+6
-0
No files found.
gavel/src/main/java/com/gavel/kwell/controller/UpointController.java
View file @
c30b95e5
...
...
@@ -108,6 +108,18 @@ public class UpointController extends BaseController {
return
buildReturnData
(
records
,
DataPointItem
.
class
);
}
/**
* 获取温度,湿度
* @param param
* @return
*/
@RequestMapping
(
value
=
"queryweatherpoint"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
queryweatherpoint
(
@RequestBody
JSONObject
param
)
{
List
<
DataPointItem
>
records
=
upointService
.
queryweatherpoint
();
return
buildReturnData
(
records
,
DataPointItem
.
class
);
}
@ResourcePermissions
(
SystemOperation
.
BottonResource
.
EXPORT
)
@RequestMapping
(
value
=
BaseURL
.
EXPORT
,
method
=
RequestMethod
.
POST
)
@ResponseBody
...
...
gavel/src/main/java/com/gavel/kwell/service/UpointService.java
View file @
c30b95e5
...
...
@@ -14,4 +14,6 @@ public interface UpointService extends BaseEditService {
public
RecordSet
<
UpointVO
>
query
(
UpointCondition
condition
);
public
List
<
DataPointItem
>
queryringpoint
();
public
List
<
DataPointItem
>
queryweatherpoint
();
}
gavel/src/main/java/com/gavel/kwell/service/impl/UpointServiceImpl.java
View file @
c30b95e5
package
com
.
gavel
.
kwell
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gavel.common.base.entity.BaseEntity
;
import
com.gavel.common.base.service.impl.BaseEditServiceImpl
;
import
com.gavel.common.utils.NumberUtils
;
import
com.gavel.common.utils.RedisConnection
;
import
com.gavel.common.utils.StringUtils
;
import
com.gavel.kwell.dao.UpointDao
;
import
com.gavel.kwell.persistent.Upoint
;
import
com.gavel.kwell.service.UpointService
;
...
...
@@ -49,37 +47,60 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
}
@Override
public
boolean
postValid
(
BaseEntity
entity
)
{
if
(
entity
!=
null
&&
entity
instanceof
Upoint
)
{
Upoint
uplcpoint
=
(
Upoint
)
entity
;
if
(
StringUtils
.
equals
(
uplcpoint
.
getType
(),
PointTypeEnum
.
WORK
.
getId
())){
if
(
StringUtils
.
isEmpty
(
uplcpoint
.
getSign
())){
throwReturnMessage
(
"当选择类型为生产点位,合格标志不能为空!"
);
return
false
;
}
public
List
<
DataPointItem
>
queryringpoint
()
{
try
{
List
<
Upoint
>
ponitList
=
upointDao
.
queryList
(
PointTypeEnum
.
RIGN
.
getId
());
if
(
ponitList
==
null
||
ponitList
.
size
()==
0
){
logger
.
error
(
"点位信息未配置,请检查!"
);
return
new
ArrayList
<>();
}
}
return
true
;
}
List
<
String
>
tagList
=
ponitList
.
stream
().
map
(
Upoint:
:
getCode
).
collect
(
Collectors
.
toList
());
@Override
public
void
beforePost
(
BaseEntity
entity
)
{
if
(
entity
!=
null
&&
entity
instanceof
Upoint
)
{
Upoint
uplcpoint
=
(
Upoint
)
entity
;
if
(!
StringUtils
.
equals
(
uplcpoint
.
getType
(),
PointTypeEnum
.
WORK
.
getId
())){
uplcpoint
.
setSign
(
""
);
Map
<
String
,
Object
>
valueMap
=
redisConnection
.
multiGet
(
tagList
);
if
(
valueMap
==
null
||
valueMap
.
size
()==
0
)
{
logger
.
error
(
"读取采集点信息失败!"
);
return
ponitList
.
stream
().
map
(
(
Upoint
p
)
->
new
DataPointItem
(
p
.
getCode
(),
p
.
getName
())).
collect
(
Collectors
.
toList
());
}
List
<
DataPointItem
>
dataPointItems
=
new
ArrayList
<
DataPointItem
>();
for
(
Upoint
uplcpoint
:
ponitList
){
DataPointItem
item
=
new
DataPointItem
(
uplcpoint
.
getCode
(),
uplcpoint
.
getName
());
if
(
valueMap
.
containsKey
(
uplcpoint
.
getCode
())){
String
jsonStr
=
(
String
)
valueMap
.
get
(
uplcpoint
.
getCode
());
try
{
JSONObject
json
=
JSONObject
.
parseObject
(
jsonStr
);
item
.
setTimestamp
(
json
.
getLong
(
"time"
));
int
quality
=
json
.
getInteger
(
"quality"
);
Integer
value
=
json
.
getInteger
(
"value"
);
if
(
NumberUtils
.
isZero
(
quality
)){
value
=-
1
;
}
item
.
setValue
(
value
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
()
+
": "
+
jsonStr
);
}
}
dataPointItems
.
add
(
item
);
}
return
dataPointItems
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"数据点采集出错!"
,
e
);
}
return
new
ArrayList
<>();
}
@Override
public
List
<
DataPointItem
>
queryringpoint
()
{
public
List
<
DataPointItem
>
queryweatherpoint
()
{
try
{
List
<
Upoint
>
ponitList
=
upointDao
.
queryList
(
PointTypeEnum
.
RIGN
.
getId
());
List
<
Upoint
>
ponitList
=
upointDao
.
queryList
(
PointTypeEnum
.
WEATHER
.
getId
());
if
(
ponitList
==
null
||
ponitList
.
size
()==
0
){
logger
.
error
(
"点位信息未配置,请检查!"
);
return
new
ArrayList
<>();
...
...
@@ -106,7 +127,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
int
quality
=
json
.
getInteger
(
"quality"
);
Integer
value
=
json
.
getInteger
(
"value"
);
if
(
NumberUtils
.
isZero
(
quality
)){
value
=-
1
;
value
=-
1
;
}
item
.
setValue
(
value
);
}
catch
(
Exception
e
)
{
...
...
@@ -121,17 +142,5 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
logger
.
error
(
"数据点采集出错!"
,
e
);
}
return
new
ArrayList
<>();
/* List<DataPointItem> dataPointItems = new ArrayList<DataPointItem>();
dataPointItems.add(new DataPointItem("R1",new Date().getTime(),1,"R1",0));
dataPointItems.add(new DataPointItem("R2",new Date().getTime(),1,"R2",0));
dataPointItems.add(new DataPointItem("R3",new Date().getTime(),1,"R3",0));
dataPointItems.add(new DataPointItem("R4",new Date().getTime(),1,"R4",1));
dataPointItems.add(new DataPointItem("R5",new Date().getTime(),1,"R5",1));
dataPointItems.add(new DataPointItem("R6",new Date().getTime(),1,"R6",1));
dataPointItems.add(new DataPointItem("R7",new Date().getTime(),1,"R7",-1));
dataPointItems.add(new DataPointItem("R8",new Date().getTime(),1,"R8",-1));
return dataPointItems;*/
}
}
gavel/src/main/java/com/gavel/kwell/utils/PointTypeEnum.java
View file @
c30b95e5
...
...
@@ -8,8 +8,7 @@ import java.util.List;
public
enum
PointTypeEnum
{
RIGN
(
"RIGN"
,
"手环点位"
),
WEATHER
(
"WEATHER"
,
"温湿度点位"
),
WORK
(
"WORK"
,
"生产点位"
);
WEATHER
(
"WEATHER"
,
"温湿度点位"
);
private
String
id
;
private
String
name
;
...
...
gavel/src/main/resources/templates/views/kmes/point/edit.html
View file @
c30b95e5
...
...
@@ -22,7 +22,7 @@
<div
class=
"gui-col-sm12"
>
<label
class=
"gui-form-label"
>
类型:
</label>
<div
class=
"gui-input-block"
>
<input
type=
"text"
name=
"type"
data-toggle=
"gui-textbox"
data-options=
""
readonly
>
<input
type=
"text"
name=
"type"
data-toggle=
"gui-textbox"
data-options=
""
>
</div>
</div>
</div>
...
...
gavel/src/main/resources/templates/views/kmes/point/index.html
View file @
c30b95e5
...
...
@@ -21,6 +21,12 @@
<input
type=
"text"
name=
"condition"
class=
"gui-textbox"
style=
"width: 100%"
>
</div>
</div>
<div
class=
"gui-col-sm3"
>
<label
class=
"gui-form-label"
>
类型:
</label>
<div
class=
"gui-input-block"
>
<input
type=
"text"
name=
"type"
class=
"gui-textbox"
style=
"width: 100%"
>
</div>
</div>
</li>
</ul>
<span
class=
"toolbar-search-span"
><a
class=
"toolbar-search"
href=
"javascript:void(0)"
></a></span>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment