Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_platformV2
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_platformV2
Commits
e8f1eb20
Commit
e8f1eb20
authored
Jan 26, 2024
by
李小惠
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.sothing.top/843502640/jyzb_platformV2
into develop-lxh
parents
cc7f65b8
a2f11920
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
111 行增加
和
5 行删除
+111
-5
WsCabinetReq.java
jyzb-api/src/main/java/com/junmp/jyzb/api/util/WsCabinetReq.java
+4
-0
CabinetWebSocketServer.java
jyzb-biz/src/main/java/com/junmp/jyzb/websocket/CabinetWebSocketServer.java
+43
-4
SysFormController.java
jyzb-process/src/main/java/com/junmp/junmpProcess/controller/SysFormController.java
+10
-1
ProcessTemplates.java
jyzb-process/src/main/java/com/junmp/junmpProcess/entity/ProcessTemplates.java
+1
-0
ISysFormService.java
jyzb-process/src/main/java/com/junmp/junmpProcess/service/ISysFormService.java
+12
-0
SysFormServiceImpl.java
jyzb-process/src/main/java/com/junmp/junmpProcess/service/impl/SysFormServiceImpl.java
+39
-0
TemplateGroupVo.java
jyzb-process/src/main/java/com/junmp/junmpProcess/vo/TemplateGroupVo.java
+1
-0
UpdateProcessVO.java
jyzb-process/src/main/java/com/junmp/junmpProcess/vo/UpdateProcessVO.java
+1
-0
没有找到文件。
jyzb-api/src/main/java/com/junmp/jyzb/api/util/WsCabinetReq.java
View file @
e8f1eb20
...
...
@@ -15,6 +15,7 @@ public class WsCabinetReq {
private
List
<
Box
>
boxList
;
@Data
// 内部类表示box
public
static
class
Box
{
@JsonProperty
(
"boxNum"
)
...
...
@@ -23,6 +24,8 @@ public class WsCabinetReq {
@JsonProperty
(
"state"
)
private
int
state
;
@JsonProperty
(
"errorMsg"
)
private
String
errorMsg
;
// getters and setters
}
}
\ No newline at end of file
jyzb-biz/src/main/java/com/junmp/jyzb/websocket/CabinetWebSocketServer.java
View file @
e8f1eb20
...
...
@@ -13,7 +13,9 @@ import com.junmp.iot.server.ws.impl.DefaultWebSocketServerProtocol;
import
com.junmp.jyzb.api.util.WsCabinetReq
;
import
com.junmp.jyzb.cache.OnlineRedisCache
;
import
com.junmp.jyzb.entity.Cabinet
;
import
com.junmp.jyzb.entity.CabinetBox
;
import
com.junmp.jyzb.entity.Temp.OnlineState
;
import
com.junmp.jyzb.service.CabinetBoxService
;
import
com.junmp.jyzb.service.CabinetService
;
import
com.junmp.jyzb.service.impl.CabinetServiceImpl
;
import
com.junmp.jyzb.utils.DateTimeUtil
;
...
...
@@ -41,14 +43,19 @@ import javax.websocket.server.PathParam;
import
javax.websocket.server.ServerEndpoint
;
import
java.io.IOException
;
import
java.time.Instant
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
@Component
@Slf4j
public
class
CabinetWebSocketServer
implements
WebSocketServerListener
{
@Resource
public
CabinetService
cabinetService
;
@Resource
public
CabinetBoxService
cabinetBoxService
;
@Override
public
String
uri
()
{
return
"/cabinet/ws"
;
...
...
@@ -57,18 +64,50 @@ public class CabinetWebSocketServer implements WebSocketServerListener {
@SneakyThrows
@Override
public
void
onText
(
DefaultWebSocketServerProtocol
protocol
)
{
try
{
String
text
=
protocol
.
readText
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
WsCabinetReq
boxData
=
objectMapper
.
readValue
(
text
,
WsCabinetReq
.
class
);
String
channel
=
protocol
.
requestMessage
().
getChannelId
();
String
channel
=
protocol
.
requestMessage
().
getChannelId
();
Cabinet
cabinet
=
cabinetService
.
getOne
(
new
LambdaQueryWrapper
<
Cabinet
>()
.
eq
(
Cabinet:
:
getCabinetNum
,
boxData
.
getSerialNum
()));
List
<
WsCabinetReq
.
Box
>
boxStateList
=
boxData
.
getBoxList
();
List
<
CabinetBox
>
boxlist
=
cabinetBoxService
.
list
(
new
LambdaQueryWrapper
<
CabinetBox
>()
.
eq
(
CabinetBox:
:
getCabinetId
,
cabinet
.
getId
()));
// 将 boxlist 转换为 Map,以 boxNum 为键
Map
<
Integer
,
CabinetBox
>
boxMap
=
boxlist
.
stream
()
.
collect
(
Collectors
.
toMap
(
CabinetBox:
:
getNum
,
box
->
box
));
List
<
CabinetBox
>
updateBoxlist
=
new
ArrayList
<>();
// 比较并修改
for
(
WsCabinetReq
.
Box
boxState
:
boxStateList
)
{
Integer
boxNum
=
Integer
.
valueOf
(
boxState
.
getBoxNum
());
CabinetBox
cabinetBox
=
boxMap
.
get
(
boxNum
);
if
(
cabinetBox
!=
null
)
{
// 根据 boxState 中的 state 字段修改 cabinetBox 中的状态
cabinetBox
.
setState
(
boxState
.
getState
());
cabinetBox
.
setErrorMsg
(
boxState
.
getErrorMsg
());
updateBoxlist
.
add
(
cabinetBox
);
// 可以选择更新其他字段
// cabinetBox.setOtherField(...);
}
}
cabinet
.
setOnlineState
(
1
);
cabinet
.
setUpdateTime
(
DateTimeUtil
.
getCurrentDateTime
());
cabinet
.
setChannelId
(
channel
);
cabinetService
.
updateById
(
cabinet
);
cabinetBoxService
.
updateBatchById
(
updateBoxlist
);
protocol
.
response
(
"true"
);
}
catch
(
Exception
e
)
{
protocol
.
response
(
"false"
);
}
}
@Override
...
...
jyzb-process/src/main/java/com/junmp/junmpProcess/controller/SysFormController.java
View file @
e8f1eb20
...
...
@@ -49,5 +49,14 @@ public class SysFormController {
public
ApiRes
<
PageResult
<
TemplateGroupVo
>>
GetFormList
(
@RequestBody
BaseRequest
br
)
{
return
ApiRes
.
success
(
SysFormService
.
getFormList
(
br
));
}
@ApiOperation
(
"检查配置是否可用"
)
@PostMapping
(
value
=
"CheckConfig"
)
public
ApiRes
<
Boolean
>
CheckConfig
(
@RequestBody
String
br
)
{
return
ApiRes
.
success
(
SysFormService
.
CheckConfig
(
br
));
}
@ApiOperation
(
"检查配置是否可用"
)
@PostMapping
(
value
=
"CheckConfig"
)
public
ApiRes
<
Boolean
>
DeleteFormList
(
@RequestBody
String
br
)
{
return
ApiRes
.
success
(
SysFormService
.
DeleteFrom
(
br
));
}
}
jyzb-process/src/main/java/com/junmp/junmpProcess/entity/ProcessTemplates.java
View file @
e8f1eb20
...
...
@@ -55,6 +55,7 @@ public class ProcessTemplates {
private
String
remark
;
private
String
notify
;
private
String
config
;
/**
* 是否已停用
...
...
jyzb-process/src/main/java/com/junmp/junmpProcess/service/ISysFormService.java
View file @
e8f1eb20
...
...
@@ -51,4 +51,16 @@ public interface ISysFormService {
*/
PageResult
<
TemplateGroupVo
>
getFormList
(
BaseRequest
br
);
/**
* 检查配置项
*
* @return
*/
Boolean
CheckConfig
(
String
br
);
/**
* 获取用户可见表单
*
* @return
*/
Boolean
DeleteFrom
(
String
fromId
);
}
jyzb-process/src/main/java/com/junmp/junmpProcess/service/impl/SysFormServiceImpl.java
View file @
e8f1eb20
...
...
@@ -136,9 +136,47 @@ public class SysFormServiceImpl extends ServiceImpl<ProcessTemplatesMapper, Proc
processTemplates
.
setFormName
(
process
.
getFormName
());
processTemplates
.
setRemark
(
process
.
getRemark
());
processTemplates
.
setUpdated
(
new
Date
());
processTemplates
.
setConfig
(
process
.
getConfig
());
// processTemplates.
return
processTemplateService
.
updateById
(
processTemplates
);
//更新表单明细表信息
}
public
Boolean
CheckConfig
(
String
config
)
{
ProcessTemplates
process
=
this
.
getOne
(
new
LambdaQueryWrapper
<
ProcessTemplates
>()
.
eq
(
ProcessTemplates:
:
getConfig
,
config
)
);
if
(
process
!=
null
)
{
return
false
;
}
else
{
return
true
;
}
}
public
Boolean
DeleteFrom
(
String
fromId
)
{
ProcessTemplates
process
=
this
.
getOne
(
new
LambdaQueryWrapper
<
ProcessTemplates
>()
.
eq
(
ProcessTemplates:
:
getFormId
,
fromId
)
);
if
(
process
!=
null
)
{
boolean
res
=
this
.
removeById
(
process
);
if
(
res
)
{
return
true
;
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
public
PageResult
<
TemplateGroupVo
>
getFormList
(
BaseRequest
br
)
{
Map
<
String
,
Object
>
params
=
br
.
getParams
();
...
...
@@ -178,6 +216,7 @@ public class SysFormServiceImpl extends ServiceImpl<ProcessTemplatesMapper, Proc
}
templates
.
add
(
TemplateGroupVo
.
builder
()
.
formId
(
v
.
getTemplateId
())
.
config
(
v
.
getConfig
())
.
remark
(
v
.
getRemark
())
.
formName
(
v
.
getFormName
())
.
orgId
(
String
.
valueOf
(
v
.
getOrgId
()))
...
...
jyzb-process/src/main/java/com/junmp/junmpProcess/vo/TemplateGroupVo.java
View file @
e8f1eb20
...
...
@@ -21,6 +21,7 @@ public class TemplateGroupVo {
private
String
processDefinitionId
;
private
String
formName
;
private
String
orgId
;
private
String
config
;
private
Boolean
isStop
;
private
String
remark
;
private
String
updated
;
...
...
jyzb-process/src/main/java/com/junmp/junmpProcess/vo/UpdateProcessVO.java
View file @
e8f1eb20
...
...
@@ -8,5 +8,6 @@ public class UpdateProcessVO {
private
String
formJson
;
private
String
formName
;
private
String
processJson
;
private
String
config
;
private
String
remark
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论