Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
王蔡翾
operation_platform
Commits
912bddfd
Commit
912bddfd
authored
Jan 14, 2026
by
王蔡翾
Browse files
优化
parent
213c1e71
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/example/operation_platform/controller/BsWorkController.java
View file @
912bddfd
...
...
@@ -38,6 +38,16 @@ public class BsWorkController extends BaseController {
bsWorkDTO
.
setLoginName
(
name
);
return
Result
.
data
(
bsWorkService
.
addWork
(
bsWorkDTO
));
}
@ApiOperation
(
"新增工单(自动获取处理人)"
)
@PostMapping
(
"/addByOperationTable"
)
public
Result
<
Boolean
>
addByOperationTable
(
@RequestBody
BsWorkDTO
bsWorkDTO
,
@RequestHeader
(
"Authorization"
)
String
token
)
{
String
name
=
jwtUtil
.
getUserNameFromToken
(
token
);
bsWorkDTO
.
setLoginName
(
name
);
return
Result
.
data
(
bsWorkService
.
addWorkByOperationTable
(
bsWorkDTO
));
}
@ApiOperation
(
"删除"
)
@DeleteMapping
(
"/delete"
)
public
Result
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
String
id
)
{
...
...
src/main/java/com/example/operation_platform/filter/JwtAuthFilter.java
View file @
912bddfd
...
...
@@ -36,7 +36,7 @@ public class JwtAuthFilter extends OncePerRequestFilter implements Ordered {
"/user/register"
,
"/role/list"
,
"/dept/list"
,
"/work/add"
"/work/add
ByOperationTable
"
);
@Override
...
...
src/main/java/com/example/operation_platform/mapper/ScheduleMapper.java
0 → 100644
View file @
912bddfd
package
com.example.operation_platform.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.example.operation_platform.model.entity.ScheduleEntity
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
@Mapper
public
interface
ScheduleMapper
extends
BaseMapper
<
ScheduleEntity
>
{
/**
* 查询本月运维人员
*
* @return ScheduleEntity
*/
ScheduleEntity
getUser
(
@Param
(
"startDate"
)
Date
startDate
,
@Param
(
"endDate"
)
Date
endDate
);
}
src/main/java/com/example/operation_platform/model/entity/ScheduleEntity.java
0 → 100644
View file @
912bddfd
package
com.example.operation_platform.model.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author wujipeng
* @version 1.0
* @create 2024-08-16 13:40
*/
@Data
@TableName
(
value
=
"schedule"
)
public
class
ScheduleEntity
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
@TableField
(
value
=
"user_id"
)
private
String
userId
;
private
String
email
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
time
;
private
String
phone
;
}
src/main/java/com/example/operation_platform/service/BsWorkService.java
View file @
912bddfd
...
...
@@ -18,6 +18,11 @@ public interface BsWorkService extends IService<BsWorkEntity> {
Boolean
addWork
(
BsWorkDTO
bsWorkDTO
);
/*
** 新增工单(自动默认当月运维人员)
*/
Boolean
addWorkByOperationTable
(
BsWorkDTO
bsWorkDTO
);
/*
** 处理工单
*/
...
...
src/main/java/com/example/operation_platform/service/ScheduleService.java
0 → 100644
View file @
912bddfd
package
com.example.operation_platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.example.operation_platform.model.entity.ScheduleEntity
;
import
java.util.Date
;
public
interface
ScheduleService
extends
IService
<
ScheduleEntity
>
{
/**
* 查询本月运维人员
*
* @return ScheduleEntity
*/
ScheduleEntity
getUser
();
}
src/main/java/com/example/operation_platform/service/impl/BsWorkServiceImpl.java
View file @
912bddfd
...
...
@@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.example.operation_platform.mapper.BsWorkMapper
;
import
com.example.operation_platform.model.dto.BsWorkDTO
;
import
com.example.operation_platform.model.entity.BsProjectEntity
;
import
com.example.operation_platform.model.entity.BsWorkEntity
;
import
com.example.operation_platform.model.entity.BsWorkOperationEntity
;
import
com.example.operation_platform.model.entity.UserEntity
;
import
com.example.operation_platform.model.entity.*
;
import
com.example.operation_platform.model.vo.BsWorkLevelVO
;
import
com.example.operation_platform.model.vo.BsWorkVO
;
import
com.example.operation_platform.service.*
;
...
...
@@ -42,6 +39,9 @@ public class BsWorkServiceImpl extends ServiceImpl <BsWorkMapper, BsWorkEntity>
@Resource
private
BsProjectService
bsProjectService
;
@Resource
private
ScheduleService
scheduleService
;
@Override
public
List
<
BsWorkVO
>
queryWorkList
(
BsWorkDTO
bsWorkDTO
){
// UserEntity userEntity = userService.getOne(new QueryWrapper<UserEntity>().eq("name", bsWorkDTO.getLoginName()));
...
...
@@ -82,7 +82,7 @@ public class BsWorkServiceImpl extends ServiceImpl <BsWorkMapper, BsWorkEntity>
}
/*
** 新增工单
** 新增工单
(可选处理人)
*/
@Override
public
Boolean
addWork
(
BsWorkDTO
bsWorkDTO
){
...
...
@@ -126,6 +126,55 @@ public class BsWorkServiceImpl extends ServiceImpl <BsWorkMapper, BsWorkEntity>
return
bsWorkOperationService
.
save
(
bsWorkOperationEntity
);
}
/*
** 新增工单(自动默认当月运维人员)
*/
@Override
public
Boolean
addWorkByOperationTable
(
BsWorkDTO
bsWorkDTO
){
BsWorkLevelVO
bsWorkLevelVO
=
bsWorkLevelService
.
queryByLevel
(
bsWorkDTO
.
getLevel
());
UserEntity
userEntity
=
userService
.
getOne
(
new
QueryWrapper
<
UserEntity
>().
eq
(
"name"
,
bsWorkDTO
.
getLoginName
()));
bsWorkDTO
.
setCreateBy
(
userEntity
.
getId
());
bsWorkDTO
.
setCreateTime
(
new
Date
());
bsWorkDTO
.
setStatus
(
"待处理"
);
//查询本月维护人的信息
ScheduleEntity
scheduleEntity
=
scheduleService
.
getUser
();
bsWorkDTO
.
setHandleBy
(
scheduleEntity
.
getUserId
());
//查找处理人电话
String
phone
=
scheduleEntity
.
getPhone
();
//获取处理时长
Integer
handleTime
=
bsWorkLevelVO
.
getHandleTime
();
//设置工单结束时间
if
(
handleTime
==
null
){
handleTime
=
0
;
}
long
endTimeMillis
=
bsWorkDTO
.
getCreateTime
().
getTime
()
+
handleTime
*
60
*
60
*
1000L
;
bsWorkDTO
.
setEndTime
(
new
java
.
util
.
Date
(
endTimeMillis
));
String
code
=
"T"
+
System
.
currentTimeMillis
()
%
10000000000L
;
bsWorkDTO
.
setCode
(
code
);
save
(
bsWorkDTO
);
//查询新增工单id
BsWorkEntity
bsWorkEntity
=
getOne
(
new
QueryWrapper
<
BsWorkEntity
>().
eq
(
"code"
,
bsWorkDTO
.
getCode
()));
//创建操作记录数据
BsWorkOperationEntity
bsWorkOperationEntity
=
new
BsWorkOperationEntity
();
bsWorkOperationEntity
.
setWorkId
(
bsWorkEntity
.
getId
());
bsWorkOperationEntity
.
setHandleTime
(
new
Date
());
bsWorkOperationEntity
.
setHandler
(
bsWorkDTO
.
getLoginName
());
bsWorkOperationEntity
.
setRemark
(
"新增工单"
);
bsWorkOperationEntity
.
setWorkId
(
bsWorkDTO
.
getId
());
// 构造短信参数
// 格式化 endTime
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
endTimeStr
=
sdf
.
format
(
bsWorkDTO
.
getEndTime
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
bsWorkDTO
.
getCode
());
map
.
put
(
"endTime"
,
endTimeStr
);
//发送工单处理提醒
smsSendUtils
.
sendMsg
(
phone
,
"SMS_500840272"
,
map
);
return
bsWorkOperationService
.
save
(
bsWorkOperationEntity
);
}
/*
** 处理工单
*/
...
...
src/main/java/com/example/operation_platform/service/impl/ScheduleServiceImpl.java
0 → 100644
View file @
912bddfd
package
com.example.operation_platform.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.example.operation_platform.mapper.ScheduleMapper
;
import
com.example.operation_platform.model.entity.ScheduleEntity
;
import
com.example.operation_platform.service.ScheduleService
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.Date
;
@Service
public
class
ScheduleServiceImpl
extends
ServiceImpl
<
ScheduleMapper
,
ScheduleEntity
>
implements
ScheduleService
{
@Override
public
ScheduleEntity
getUser
()
{
// 获取当前日期
LocalDate
today
=
LocalDate
.
now
();
// 获取本月第一天和最后一天
LocalDate
firstDate
=
today
.
withDayOfMonth
(
1
);
LocalDate
lastDate
=
today
.
withDayOfMonth
(
today
.
lengthOfMonth
());
// 将LocalDate转换为Date
Date
startDate
=
Date
.
from
(
firstDate
.
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
Date
endDate
=
Date
.
from
(
lastDate
.
atTime
(
23
,
59
,
59
).
atZone
(
ZoneId
.
systemDefault
()).
toInstant
());
return
baseMapper
.
getUser
(
startDate
,
endDate
);
}
}
src/main/resources/application.yml
View file @
912bddfd
...
...
@@ -7,12 +7,12 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
ruzhoukj@2022
url
:
jdbc:mysql://192.168.10.3:3307/pump_station_robot_business?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
# url: jdbc:mysql://p1.ruzhoukj.com:3306/operation_platform?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
# username: root
# password: Rzkj<2022>_0418
# password: ruzhoukj@2022
# url: jdbc:mysql://192.168.10.3:3307/pump_station_robot_business?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://p1.ruzhoukj.com:3306/operation_platform?useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username
:
root
password
:
Rzkj<2022>_0418
data
:
mongodb
:
database
:
pump_station_robot
...
...
src/main/resources/mapper/BsScheduleMapper.xml
0 → 100644
View file @
912bddfd
<?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.example.operation_platform.mapper.ScheduleMapper"
>
<select
id=
"getUser"
resultType=
"com.example.operation_platform.model.entity.ScheduleEntity"
>
select
id,
user_id,
email,
time,
phone
from
schedule
where
date_format(time,'%Y%M%d')
between
date_format(#{startDate},'%Y%M%d')
and
date_format(#{endDate},'%Y%M%d');
</select>
</mapper>
\ No newline at end of file
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