Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
precision-effect
Project
Project
Details
Activity
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
耿迪迪
precision-effect
Commits
0a171e31
Commit
0a171e31
authored
Jun 16, 2023
by
lizhichao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
51ca873b
0de62006
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
589 additions
and
130 deletions
+589
-130
SysUserController.java
...a/com/zehong/web/controller/system/SysUserController.java
+13
-0
TBorrowingApplyForController.java
.../controller/transaction/TBorrowingApplyForController.java
+1
-0
TTradeProjectController.java
...g/web/controller/transaction/TTradeProjectController.java
+1
-1
pom.xml
precision-effect-framework/pom.xml
+5
-0
SecurityConfig.java
...main/java/com/zehong/framework/config/SecurityConfig.java
+1
-1
WebSocketConfig.java
...ain/java/com/zehong/framework/config/WebSocketConfig.java
+18
-0
WebSocketBean.java
...com/zehong/framework/web/domain/server/WebSocketBean.java
+56
-0
WebSocketServer.java
...ava/com/zehong/framework/web/service/WebSocketServer.java
+160
-0
SysNotice.java
...tem/src/main/java/com/zehong/system/domain/SysNotice.java
+33
-21
SysNoticeMapper.xml
...stem/src/main/resources/mapper/system/SysNoticeMapper.xml
+71
-64
user.js
precision-effect-web/src/api/system/user.js
+9
-0
Message.vue
...sion-effect-web/src/layout/components/Message/Message.vue
+91
-0
Navbar.vue
precision-effect-web/src/layout/components/Navbar.vue
+6
-3
main.js
precision-effect-web/src/main.js
+3
-0
websocket.js
precision-effect-web/src/utils/websocket.js
+83
-0
index.vue
precision-effect-web/src/views/for/index.vue
+38
-40
No files found.
precision-effect-admin/src/main/java/com/zehong/web/controller/system/SysUserController.java
View file @
0a171e31
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
java.util.stream.Collectors
;
import
com.zehong.framework.systemsetting.SystemSetting
;
import
org.apache.catalina.User
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -212,6 +213,18 @@ public class SysUserController extends BaseController
}
/**
* 查询当前部门名下人员
* @return
*/
@GetMapping
(
"/selectPersonnel"
)
public
TableDataInfo
selectPersonnel
(){
SysUser
usern
=
tokenService
.
getLoginUser
(
ServletUtils
.
getRequest
()).
getUser
();
SysUser
user
=
new
SysUser
();
user
.
setDeptId
(
usern
.
getDeptId
());
List
<
SysUser
>
list
=
userService
.
selectUserList
(
user
);
return
getDataTable
(
list
);
}
}
precision-effect-admin/src/main/java/com/zehong/web/controller/transaction/TBorrowingApplyForController.java
View file @
0a171e31
...
...
@@ -90,6 +90,7 @@ public class TBorrowingApplyForController extends BaseController
if
(
StringUtils
.
isNotNull
(
user
))
{
tBorrowingApplyFor
.
setHandledByUserId
(
user
.
getUserId
());
}
tBorrowingApplyFor
.
setRegistrationDate
(
new
Date
());
return
toAjax
(
tBorrowingApplyForService
.
insertTBorrowingApplyFor
(
tBorrowingApplyFor
));
}
...
...
precision-effect-admin/src/main/java/com/zehong/web/controller/transaction/TTradeProjectController.java
View file @
0a171e31
...
...
@@ -16,7 +16,7 @@ import java.util.List;
/**
* 交易项目Controller
*
*
* @author zehong
* @date 2023-06-08
*/
...
...
precision-effect-framework/pom.xml
View file @
0a171e31
...
...
@@ -59,6 +59,11 @@
<artifactId>
precision-effect-system
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
precision-effect-framework/src/main/java/com/zehong/framework/config/SecurityConfig.java
View file @
0a171e31
...
...
@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.
authorizeRequests
()
// 对于登录login 验证码captchaImage 允许匿名访问
.
antMatchers
(
"/login"
,
"/captchaImage"
).
anonymous
()
.
antMatchers
(
"/login"
,
"/captchaImage"
,
"/webSocket/**"
).
anonymous
()
.
antMatchers
(
HttpMethod
.
GET
,
"/*.html"
,
...
...
precision-effect-framework/src/main/java/com/zehong/framework/config/WebSocketConfig.java
0 → 100644
View file @
0a171e31
package
com
.
zehong
.
framework
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.socket.server.standard.ServerEndpointExporter
;
/**
* @author geng
* webScocket
*/
@Configuration
public
class
WebSocketConfig
{
@Bean
public
ServerEndpointExporter
serverEndpointExporter
()
{
return
new
ServerEndpointExporter
();
}
}
precision-effect-framework/src/main/java/com/zehong/framework/web/domain/server/WebSocketBean.java
0 → 100644
View file @
0a171e31
package
com
.
zehong
.
framework
.
web
.
domain
.
server
;
import
javax.websocket.Session
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* <websocket信息对象>
* <用于存储secket连接信息>
* @author wzh
* @version 2018-07-08 18:49
* @see [相关类/方法] (可选)
**/
public
class
WebSocketBean
{
/**
* 连接session对象
*/
private
Session
session
;
/**
* 用户id
*/
private
Long
userId
;
/**
* 连接错误次数
*/
private
AtomicInteger
erroerLinkCount
=
new
AtomicInteger
(
0
);
public
int
getErroerLinkCount
()
{
// 线程安全,以原子方式将当前值加1,注意:这里返回的是自增前的值
return
erroerLinkCount
.
getAndIncrement
();
}
public
void
cleanErrorNum
()
{
// 清空计数
erroerLinkCount
=
new
AtomicInteger
(
0
);
}
public
Session
getSession
()
{
return
session
;
}
public
void
setSession
(
Session
session
)
{
this
.
session
=
session
;
}
public
Long
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
}
\ No newline at end of file
precision-effect-framework/src/main/java/com/zehong/framework/web/service/WebSocketServer.java
0 → 100644
View file @
0a171e31
package
com
.
zehong
.
framework
.
web
.
service
;
import
com.alibaba.fastjson.JSONArray
;
import
com.zehong.common.utils.spring.SpringUtils
;
import
com.zehong.framework.web.domain.server.WebSocketBean
;
import
com.zehong.system.domain.SysNotice
;
import
com.zehong.system.service.ISysNoticeService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.websocket.*
;
import
javax.websocket.server.PathParam
;
import
javax.websocket.server.ServerEndpoint
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
/**
* @author geng
* webSocket工具类
*/
@Component
@ServerEndpoint
(
"/webSocket/{roles}/{userId}"
)
public
class
WebSocketServer
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
WebSocketServer
.
class
);
/**
* 错误最大重试次数
*/
private
static
final
int
MAX_ERROR_NUM
=
10
;
/**
* 用来存放每个客户端对应的webSocket对象。
*/
private
static
Map
<
String
,
List
<
WebSocketBean
>>
webSocketInfo
;
static
{
// concurrent包的线程安全map
webSocketInfo
=
new
ConcurrentHashMap
<>();
}
@OnOpen
public
void
onOpen
(
Session
session
,
@PathParam
(
"roles"
)
String
roles
,
@PathParam
(
"userId"
)
String
userId
)
{
for
(
String
role
:
roles
.
split
(
","
)){
WebSocketBean
bean
=
new
WebSocketBean
();
bean
.
setSession
(
session
);
bean
.
setUserId
(
Long
.
valueOf
(
userId
));
if
(
webSocketInfo
.
containsKey
(
role
)){
List
<
WebSocketBean
>
beans
=
webSocketInfo
.
get
(
role
);
// 连接成功当前对象放入webSocket对象集合
beans
.
add
(
bean
);
sendMessage
(
bean
,
initNotice
(
userId
));
return
;
}
List
<
WebSocketBean
>
beans
=
new
ArrayList
<>();
beans
.
add
(
bean
);
webSocketInfo
.
put
(
role
,
beans
);
sendMessage
(
bean
,
initNotice
(
userId
));
}
log
.
info
(
"客户端连接服务器session id :"
+
session
.
getId
()+
",当前连接数:"
+
webSocketInfo
.
size
());
}
private
String
initNotice
(
String
userId
){
SysNotice
notice
=
new
SysNotice
();
notice
.
setUserId
(
Long
.
valueOf
(
userId
));
ISysNoticeService
sysNoticeService
=
SpringUtils
.
getBean
(
ISysNoticeService
.
class
);
List
<
SysNotice
>
notices
=
sysNoticeService
.
selectNoticeList
(
notice
);
if
(
CollectionUtils
.
isEmpty
(
notices
)){
return
""
;
}
return
JSONArray
.
toJSONString
(
notices
);
}
@OnClose
public
void
onClose
(
Session
session
)
{
// 客户端断开连接移除websocket对象
for
(
Map
.
Entry
<
String
,
List
<
WebSocketBean
>>
entry
:
webSocketInfo
.
entrySet
())
{
List
<
WebSocketBean
>
beans
=
entry
.
getValue
().
stream
().
filter
(
item
->
item
.
getSession
().
getId
().
equals
(
session
.
getId
())).
collect
(
Collectors
.
toList
());
entry
.
getValue
().
removeAll
(
beans
);
}
log
.
info
(
"客户端断开连接,当前连接数:"
+
webSocketInfo
.
size
());
}
@OnMessage
public
void
onMessage
(
Session
session
,
String
message
)
{
log
.
info
(
"客户端 session id: "
+
session
.
getId
()+
",消息:"
+
message
);
// 此方法为客户端给服务器发送消息后进行的处理,可以根据业务自己处理,这里返回页面
//sendMessage(session, "服务端返回" + message);
}
@OnError
public
void
onError
(
Session
session
,
Throwable
throwable
)
{
log
.
error
(
"发生错误"
+
throwable
.
getMessage
(),
throwable
);
}
/**
* 查找发送消息用户
* @param role 角色
* @param userId 用户id
* @param message 消息体
*/
public
void
findMessageUser
(
String
role
,
Long
userId
,
String
message
)
{
List
<
WebSocketBean
>
beans
=
webSocketInfo
.
get
(
role
);
if
(!
CollectionUtils
.
isEmpty
(
beans
)){
//发送给指定角色
if
(
null
==
userId
){
beans
.
forEach
(
item
->{
sendMessage
(
item
,
message
);
});
return
;
}
//发送给指定用户
List
<
WebSocketBean
>
userBean
=
beans
.
stream
().
filter
(
item
->
item
.
getUserId
().
equals
(
userId
)).
collect
(
Collectors
.
toList
());
userBean
.
stream
().
forEach
(
item
->
{
sendMessage
(
item
,
message
);
});
}
}
/**
* 发送消息
* @param bean webSocket对象
* @param message 消息体
*/
private
void
sendMessage
(
WebSocketBean
bean
,
String
message
)
{
try
{
// 发送消息
bean
.
getSession
().
getBasicRemote
().
sendText
(
message
);
// 清空错误计数
bean
.
cleanErrorNum
();
}
catch
(
Exception
e
){
log
.
error
(
"发送消息失败"
+
e
.
getMessage
(),
e
);
int
errorNum
=
bean
.
getErroerLinkCount
();
// 小于最大重试次数重发
if
(
errorNum
<=
MAX_ERROR_NUM
){
sendMessage
(
bean
,
message
);
}
else
{
log
.
error
(
"发送消息失败超过最大次数"
);
// 清空错误计数
bean
.
cleanErrorNum
();
}
}
}
}
precision-effect-system/src/main/java/com/zehong/system/domain/SysNotice.java
View file @
0a171e31
package
com
.
zehong
.
system
.
domain
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Size
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.zehong.common.annotation.Excel
;
import
com.zehong.common.core.domain.BaseEntity
;
/**
* 通知公告
表
sys_notice
* 通知公告
对象
sys_notice
*
* @author zehong
* @date 2023-06-16
*/
public
class
SysNotice
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 公告ID */
private
Long
noticeId
;
private
Integer
noticeId
;
/** 公告标题 */
@Excel
(
name
=
"公告标题"
)
private
String
noticeTitle
;
/** 公告类型(1通知 2公告) */
@Excel
(
name
=
"公告类型"
,
readConverterExp
=
"1=通知,2=公告"
)
private
String
noticeType
;
/** 公告内容 */
@Excel
(
name
=
"公告内容"
)
private
String
noticeContent
;
/** 用户id */
@Excel
(
name
=
"用户id"
)
private
Long
userId
;
/** 公告状态(0正常 1关闭) */
@Excel
(
name
=
"公告状态"
,
readConverterExp
=
"0=正常,1=关闭"
)
private
String
status
;
public
Long
getNoticeId
()
public
void
setNoticeId
(
Integer
noticeId
)
{
return
noticeId
;
this
.
noticeId
=
noticeId
;
}
public
void
setNoticeId
(
Long
noticeId
)
public
Integer
getNoticeId
()
{
this
.
noticeId
=
noticeId
;
return
noticeId
;
}
public
void
setNoticeTitle
(
String
noticeTitle
)
public
void
setNoticeTitle
(
String
noticeTitle
)
{
this
.
noticeTitle
=
noticeTitle
;
}
@NotBlank
(
message
=
"公告标题不能为空"
)
@Size
(
min
=
0
,
max
=
50
,
message
=
"公告标题不能超过50个字符"
)
public
String
getNoticeTitle
()
public
String
getNoticeTitle
()
{
return
noticeTitle
;
}
public
void
setNoticeType
(
String
noticeType
)
public
void
setNoticeType
(
String
noticeType
)
{
this
.
noticeType
=
noticeType
;
}
public
String
getNoticeType
()
public
String
getNoticeType
()
{
return
noticeType
;
}
public
void
setNoticeContent
(
String
noticeContent
)
public
void
setNoticeContent
(
String
noticeContent
)
{
this
.
noticeContent
=
noticeContent
;
}
public
String
getNoticeContent
()
public
String
getNoticeContent
()
{
return
noticeContent
;
}
public
void
setUserId
(
Long
userId
)
{
this
.
userId
=
userId
;
}
public
void
setStatus
(
String
status
)
public
Long
getUserId
()
{
return
userId
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatus
()
public
String
getStatus
()
{
return
status
;
}
...
...
@@ -89,6 +100,7 @@ public class SysNotice extends BaseEntity
.
append
(
"noticeTitle"
,
getNoticeTitle
())
.
append
(
"noticeType"
,
getNoticeType
())
.
append
(
"noticeContent"
,
getNoticeContent
())
.
append
(
"userId"
,
getUserId
())
.
append
(
"status"
,
getStatus
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
...
...
precision-effect-system/src/main/resources/mapper/system/SysNoticeMapper.xml
View file @
0a171e31
...
...
@@ -5,85 +5,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper
namespace=
"com.zehong.system.mapper.SysNoticeMapper"
>
<resultMap
type=
"SysNotice"
id=
"SysNoticeResult"
>
<result
property=
"noticeId"
column=
"notice_id"
/>
<result
property=
"noticeId"
column=
"notice_id"
/>
<result
property=
"noticeTitle"
column=
"notice_title"
/>
<result
property=
"noticeType"
column=
"notice_type"
/>
<result
property=
"noticeContent"
column=
"notice_content"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"noticeType"
column=
"notice_type"
/>
<result
property=
"noticeContent"
column=
"notice_content"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<sql
id=
"selectNoticeVo"
>
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
<sql
id=
"selectSysNoticeVo"
>
select notice_id, notice_title, notice_type, notice_content, user_id, status, create_by, create_time, update_by, update_time, remark from sys_notice
</sql>
<select
id=
"selectNoticeById"
parameterType=
"Long"
resultMap=
"SysNoticeResult"
>
<include
refid=
"selectNoticeVo"
/>
where notice_id = #{noticeId}
</select>
<select
id=
"selectNoticeList"
parameterType=
"SysNotice"
resultMap=
"SysNoticeResult"
>
<include
refid=
"selectNoticeVo"
/>
<where>
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
AND notice_type = #{noticeType}
</if>
<if
test=
"createBy != null and createBy != ''"
>
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
<include
refid=
"selectSysNoticeVo"
/>
<where>
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
and notice_title = #{noticeTitle}
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
and notice_type = #{noticeType}
</if>
<if
test=
"noticeContent != null and noticeContent != ''"
>
and notice_content = #{noticeContent}
</if>
<if
test=
"userId != null "
>
and user_id = #{userId}
</if>
<if
test=
"status != null and status != ''"
>
and status = #{status}
</if>
</where>
</select>
<insert
id=
"insertNotice"
parameterType=
"SysNotice"
>
insert into sys_notice (
<if
test=
"noticeTitle != null and noticeTitle != '' "
>
notice_title,
</if>
<if
test=
"noticeType != null and noticeType != '' "
>
notice_type,
</if>
<if
test=
"noticeContent != null and noticeContent != '' "
>
notice_content,
</if>
<if
test=
"status != null and status != '' "
>
status,
</if>
<if
test=
"remark != null and remark != ''"
>
remark,
</if>
<if
test=
"createBy != null and createBy != ''"
>
create_by,
</if>
create_time
)values(
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
#{noticeTitle},
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
#{noticeType},
</if>
<if
test=
"noticeContent != null and noticeContent != ''"
>
#{noticeContent},
</if>
<if
test=
"status != null and status != ''"
>
#{status},
</if>
<if
test=
"remark != null and remark != ''"
>
#{remark},
</if>
<if
test=
"createBy != null and createBy != ''"
>
#{createBy},
</if>
sysdate()
)
<select
id=
"selectNoticeById"
parameterType=
"Integer"
resultMap=
"SysNoticeResult"
>
<include
refid=
"selectSysNoticeVo"
/>
where notice_id = #{noticeId}
</select>
<insert
id=
"insertNotice"
parameterType=
"SysNotice"
useGeneratedKeys=
"true"
keyProperty=
"noticeId"
>
insert into sys_notice
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
notice_title,
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
notice_type,
</if>
<if
test=
"noticeContent != null"
>
notice_content,
</if>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
#{noticeTitle},
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
#{noticeType},
</if>
<if
test=
"noticeContent != null"
>
#{noticeContent},
</if>
<if
test=
"userId != null"
>
#{userId},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
</trim>
</insert>
<update
id=
"updateNotice"
parameterType=
"SysNotice"
>
update sys_notice
<set>
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
notice_title = #{noticeTitle},
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
notice_type = #{noticeType},
</if>
<if
test=
"noticeContent != null"
>
notice_content = #{noticeContent},
</if>
<if
test=
"status != null and status != ''"
>
status = #{status},
</if>
<if
test=
"updateBy != null and updateBy != ''"
>
update_by = #{updateBy},
</if>
update_time = sysdate()
</set>
update sys_notice
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"noticeTitle != null and noticeTitle != ''"
>
notice_title = #{noticeTitle},
</if>
<if
test=
"noticeType != null and noticeType != ''"
>
notice_type = #{noticeType},
</if>
<if
test=
"noticeContent != null"
>
notice_content = #{noticeContent},
</if>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
</trim>
where notice_id = #{noticeId}
</update>
<delete
id=
"deleteNoticeById"
parameterType=
"
Long
"
>
<delete
id=
"deleteNoticeById"
parameterType=
"
Integer
"
>
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete
id=
"deleteNoticeByIds"
parameterType=
"
Lo
ng"
>
<delete
id=
"deleteNoticeByIds"
parameterType=
"
Stri
ng"
>
delete from sys_notice where notice_id in
<foreach
item=
"noticeId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{noticeId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
precision-effect-web/src/api/system/user.js
View file @
0a171e31
...
...
@@ -10,6 +10,15 @@ export function listUser(query) {
})
}
// 查询用户列表 (下拉)
export
function
listpersonnel
()
{
return
request
({
url
:
'/system/user/selectPersonnel'
,
method
:
'get'
,
})
}
// 查询用户详细
export
function
getUser
(
userId
)
{
return
request
({
...
...
precision-effect-web/src/layout/components/Message/Message.vue
0 → 100644
View file @
0a171e31
<
template
>
<div
class=
"instantMessage"
>
<el-dropdown
trigger=
"click"
:popper-append-to-body=
"false"
style=
"height: 30px"
>
<div>
<el-badge
:value=
"this.msgInfo.length"
:max=
"99"
class=
"messageMark"
>
<!--
<i
class=
"el-icon-chat-dot-round"
/>
-->
<i
class=
"el-icon-message-solid messageDing"
/>
</el-badge>
</div>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
v-if=
"this.msgInfo.length == 0"
>
<span>
暂无消息
</span>
</el-dropdown-item>
<div
v-if=
"this.msgInfo.length >= 0"
>
<el-row>
<el-col
:span=
"12"
>
<el-dropdown-item>
标题
</el-dropdown-item>
</el-col>
<el-col
:span=
"12"
>
<el-dropdown-item>
类型
</el-dropdown-item>
</el-col>
</el-row>
<el-row
v-for=
"item in msgInfo"
>
<el-col
:span=
"12"
>
<el-dropdown-item
class=
"region-item-style"
>
{{
item
.
noticeTitle
}}
</el-dropdown-item>
</el-col>
<el-col
:span=
"12"
>
<el-dropdown-item
v-if=
"item.noticeType == '1'"
>
通知
</el-dropdown-item>
<el-dropdown-item
v-if=
"item.noticeType == '2'"
>
公告
</el-dropdown-item>
</el-col>
</el-row>
</div>
</el-dropdown-menu>
</el-dropdown>
</div>
</
template
>
<
script
>
export
default
{
name
:
"message"
,
data
(){
return
{
msgInfo
:
{}
}
},
created
(){
//登录成功后创建websocket
this
.
$websocket
.
initWebSocket
(
"ws://localhost:8668/precisionEffect/webSocket/"
+
this
.
$store
.
state
.
user
.
roles
.
join
(
","
)
+
"/"
+
this
.
$store
.
state
.
user
.
userId
);
this
.
$websocket
.
addEvent
(
"onmessage"
,(
msg
)
=>
{
console
.
log
(
"您有新的消息请注意接收:"
,
JSON
.
parse
(
msg
.
data
));
this
.
msgInfo
=
JSON
.
parse
(
msg
.
data
);
console
})
},
methods
:{
}
}
</
script
>
<
style
>
.region-item-style
{
max-width
:
200px
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
</
style
>
<
style
scoped
lang=
"scss"
>
.instantMessage
{
display
:
inline
;
.messageMark
{
width
:
25px
;
height
:
60px
;
margin-right
:
9px
;
}
.messageDing
{
font-size
:
28px
;
color
:
#5a5e66
;
position
:
relative
;
top
:
-5px
;
}
}
</
style
>
precision-effect-web/src/layout/components/Navbar.vue
View file @
0a171e31
...
...
@@ -16,7 +16,7 @@
<!--
</el-tooltip>
-->
</
template
>
<Message/>
<el-dropdown
class=
"avatar-container right-menu-item hover-effect"
trigger=
"click"
>
<div
class=
"avatar-wrapper"
>
<!-- <img :src="avatar" class="user-avatar">-->
...
...
@@ -48,7 +48,7 @@ import Hamburger from '@/components/Hamburger'
import
Screenfull
from
'@/components/Screenfull'
import
SizeSelect
from
'@/components/SizeSelect'
import
Search
from
'@/components/HeaderSearch'
import
Message
from
"./Message/Message"
;
export
default
{
components
:
{
Breadcrumb
,
...
...
@@ -56,7 +56,8 @@ export default {
Hamburger
,
Screenfull
,
SizeSelect
,
Search
Search
,
Message
},
computed
:
{
...
mapGetters
([
...
...
@@ -94,6 +95,8 @@ export default {
type
:
'warning'
}).
then
(()
=>
{
this
.
$store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
//关闭websocket
this
.
$websocket
.
close
();
location
.
href
=
'/index'
;
})
}).
catch
(()
=>
{});
...
...
precision-effect-web/src/main.js
View file @
0a171e31
...
...
@@ -71,3 +71,6 @@ new Vue({
store
,
render
:
h
=>
h
(
App
)
})
import
websocket
from
"@/utils/websocket.js"
;
Vue
.
prototype
.
$websocket
=
websocket
;
precision-effect-web/src/utils/websocket.js
0 → 100644
View file @
0a171e31
import
ElementUI
from
'element-ui'
;
let
lockReconnect
=
false
;
let
socket
;
let
timer
;
let
count
=
10
;
let
wsUrl
;
function
initWebSocket
(
wsUri
)
{
wsUrl
=
wsUri
;
//这里面的this都指向vue
socket
=
new
WebSocket
(
wsUri
);
socket
.
onerror
=
webSocketOnError
;
socket
.
onclose
=
closeWebsocket
;
socket
.
onopen
=
openWebsocket
;
}
//错误事件监听
function
webSocketOnError
(
e
)
{
ElementUI
.
Notification
({
title
:
''
,
message
:
"WebSocket连接发生错误"
+
e
,
type
:
'error'
,
duration
:
0
,
});
}
// websocket关闭监听事件
function
closeWebsocket
()
{
reconnect
();
}
//开始事件
function
openWebsocket
()
{
if
(
timer
){
clearInterval
(
timer
);
}
}
// 关闭 websocket
function
close
()
{
lockReconnect
=
true
;
socket
.
close
();
}
//消息发送
function
webSocketSend
(
agentData
)
{
socket
.
send
(
agentData
);
}
//重连机制
function
reconnect
(){
if
(
lockReconnect
){
return
}
lockReconnect
=
true
;
//没连接上会一直重连,设置延迟避免请求过多
timer
=
setTimeout
(
function
(){
count
--
;
initWebSocket
(
wsUrl
);
this
.
lockReconnect
=
false
if
(
count
==
0
){
clearInterval
(
timer
);
}
},
2000
)
}
//监听事件添加
function
addEvent
(
type
,
event
){
if
(
type
==
"onopen"
){
socket
.
onopen
=
event
;
}
else
if
(
type
==
"onmessage"
){
socket
.
onmessage
=
event
;
}
else
if
(
type
==
"onclose"
){
socket
.
onclose
=
event
;
}
else
if
(
type
==
"onerror"
){
socket
.
onerror
=
event
;
}
else
{
socket
.
addEventListener
(
type
,
event
);
}
}
export
default
{
initWebSocket
,
close
,
addEvent
}
precision-effect-web/src/views/for/index.vue
View file @
0a171e31
...
...
@@ -133,57 +133,55 @@
<
el
-
input
v
-
model
=
"form.feeName"
placeholder
=
"请输入费用名称"
/>
<
/el-form-item
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"
借支部门"
prop
=
"borrowingDept
Id"
>
<
treeselect
v
-
model
=
"form.borrowingDeptId
"
:
options
=
"formDeptOptions
"
:
show
-
count
=
"tru
e"
placeholder
=
"请选择部门"
/
>
<
el
-
form
-
item
label
=
"
使用人"
prop
=
"user
Id"
>
<
el
-
select
v
-
model
=
"form.userId"
placeholder
=
"请选择使用人"
style
=
"width: 100%"
>
<
el
-
option
v
-
for
=
"item in transactorList
"
:
key
=
"item.userId
"
:
label
=
"item.nickNam
e"
:
value
=
"item.userId"
/>
<
/el-select
>
<
/el-form-item
>
<
/el-col
>
<!--
<
el
-
col
:
span
=
"12"
>-->
<!--
<
el
-
form
-
item
label
=
"借支部门"
prop
=
"borrowingDeptId"
>-->
<!--
<
treeselect
-->
<!--
v
-
model
=
"form.borrowingDeptId"
-->
<!--
:
options
=
"formDeptOptions"
-->
<!--
:
show
-
count
=
"true"
-->
<!--
placeholder
=
"请选择部门"
-->
<!--
/>--
>
<!--
<
/el-form-item>--
>
<!--
<
/el-col>--
>
<
/el-row
>
<
el
-
row
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"使用人"
prop
=
"userId"
>
<
el
-
select
v
-
model
=
"form.userId"
placeholder
=
"请选择使用人"
style
=
"width: 100%"
>
<
el
-
option
v
-
for
=
"item in transactorList"
:
key
=
"item.userId"
:
label
=
"item.nickName"
:
value
=
"item.userId"
/>
<
/el-select
>
<
/el-form-item
>
<
/el-col
>
<!--
<
el
-
col
:
span
=
"12"
>-->
<!--
<
el
-
form
-
item
label
=
"登记日期"
prop
=
"registrationDate"
>-->
<!--
<
el
-
date
-
picker
clearable
-->
<!--
v
-
model
=
"form.registrationDate"
-->
<!--
type
=
"date"
-->
<!--
value
-
format
=
"yyyy-MM-dd"
-->
<!--
placeholder
=
"选择登记日期"
-->
<!--
style
=
"width: 100%;"
>-->
<!--
<
/el-date-picker>--
>
<!--
<
/el-form-item>--
>
<!--
<
/el-col>--
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"登记日期"
prop
=
"registrationDate"
>
<
el
-
date
-
picker
clearable
v
-
model
=
"form.registrationDate"
type
=
"date"
value
-
format
=
"yyyy-MM-dd"
placeholder
=
"选择登记日期"
style
=
"width: 100%;"
>
<
/el-date-picker
>
<
el
-
col
:
span
=
"24"
>
<
el
-
form
-
item
label
=
"小写合计"
prop
=
"totalFigures"
>
<
el
-
input
v
-
model
=
"form.totalFigures"
placeholder
=
"请输入小写合计"
/>
<
/el-form-item
>
<
/el-col
>
<
/el-row
>
<
el
-
row
>
<!--
<
el
-
row
>--
>
<!--
<
el
-
col
:
span
=
"12"
>-->
<!--
<
el
-
form
-
item
label
=
"大写合计"
prop
=
"totalWords"
>-->
<!--
<
el
-
input
v
-
model
=
"form.totalWords"
placeholder
=
"请输入大写合计"
/>-->
<!--
<
/el-form-item>--
>
<!--
<
/el-col>--
>
<
el
-
col
:
span
=
"24"
>
<
el
-
form
-
item
label
=
"小写合计"
prop
=
"totalFigures"
>
<
el
-
input
v
-
model
=
"form.totalFigures"
placeholder
=
"请输入小写合计"
/>
<
/el-form-item
>
<
/el-col
>
<
/el-row
>
<!--
<
/el-row>--
>
...
...
@@ -257,7 +255,7 @@
<
script
>
import
{
listFor
,
getFor
,
delFor
,
addFor
,
updateFor
,
exportFor
}
from
"@/api/system/for"
;
import
{
selectTransactorByDeptId
,
listUser
}
from
"@/api/system/user"
;
import
{
selectTransactorByDeptId
,
listUser
,
listpersonnel
}
from
"@/api/system/user"
;
import
Treeselect
from
"@riophae/vue-treeselect"
;
import
{
treeselect
}
from
"@/api/system/dept"
;
import
FileUpload
from
"@/components/FileUpload"
;
...
...
@@ -373,14 +371,14 @@ export default {
}
,
getTransactor
()
{
this
.
form
.
tradeTransactor
=
null
;
if
(
this
.
form
.
borrowingDeptId
&&
this
.
form
.
borrowingDeptId
!=
null
)
{
this
.
form
.
deptId
=
this
.
form
.
borrowingDeptId
;
listUser
(
this
.
form
).
then
(
//
if (this.form.borrowingDeptId && this.form.borrowingDeptId != null)
{
//
this.form.deptId=this.form.borrowingDeptId;
listpersonnel
(
).
then
(
(
res
)
=>
{
this
.
transactorList
=
res
.
rows
;
}
);
}
//
}
}
,
/** 查询借支申请列表 */
getList
()
{
...
...
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