Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
ce822374
Commit
ce822374
authored
Aug 02, 2023
by
陈子龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工单定时推送短信优化
parent
da1f6fa2
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
132 additions
and
174 deletions
+132
-174
go.mod
go.mod
+1
-0
go.sum
go.sum
+2
-0
src/bean/entity/work_order.go
src/bean/entity/work_order.go
+3
-1
src/main.go
src/main.go
+1
-17
src/pkg/beagle/constant/constant.go
src/pkg/beagle/constant/constant.go
+7
-0
src/router/workorderrouter.go
src/router/workorderrouter.go
+0
-1
src/service/cron/common.go
src/service/cron/common.go
+0
-2
src/service/work_order.go
src/service/work_order.go
+107
-153
src/util/serialize.go
src/util/serialize.go
+11
-0
No files found.
go.mod
View file @
ce822374
...
...
@@ -26,6 +26,7 @@ require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/prometheus/alertmanager v0.25.0
github.com/robfig/cron v1.2.0
github.com/robfig/cron/v3 v3.0.1
github.com/satori/go.uuid v1.2.0
github.com/spf13/cast v1.5.0
github.com/spf13/pflag v1.0.5
...
...
go.sum
View file @
ce822374
...
...
@@ -579,6 +579,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6O
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
...
...
src/bean/entity/work_order.go
View file @
ce822374
package
entity
import
"time"
import
(
"time"
)
type
WorkOrder
struct
{
Id
int
`json:"id" xorm:"pk autoincr" `
// id
...
...
src/main.go
View file @
ce822374
...
...
@@ -53,7 +53,7 @@ func main() {
//启动定时任务
cron
.
StartCron
()
service
.
PushWorkOrderMessage
()
service
.
CronPushWorkOrder
()
// server start...
conf
.
Logger
.
Info
(
"config info"
,
zap
.
Any
(
"options"
,
conf
.
Options
))
conf
.
Logger
.
Error
(
"server start err"
,
zap
.
Error
(
newServer
()
.
ListenAndServe
()))
...
...
@@ -151,12 +151,6 @@ func initAnsibleHosts() {
if
err
!=
nil
{
fmt
.
Println
(
err
.
Error
())
}
//else {
// _, err := f.Write([]byte("[web]\n"))
// if err != nil {
// fmt.Println(err.Error())
// }
//}
}
func
initTempDirPrefix
()
{
...
...
@@ -181,14 +175,4 @@ func initAnsibleSSH() {
fmt
.
Println
(
err
.
Error
())
}
}
//f2, err := os.CreateIndex("/root/.ssh/id_rsa.pub")
//defer f2.Close()
//if err != nil {
// fmt.Println(err.Error())
//} else {
// _, err := f.Write([]byte(conf.Options.PublicKeySSH))
// if err != nil {
// fmt.Println(err.Error())
// }
//}
}
src/pkg/beagle/constant/constant.go
View file @
ce822374
...
...
@@ -175,3 +175,10 @@ func DisposedStatusText(code int) string {
return
"未知状态"
}
}
// 工单定时类型
const
(
TimingClick
=
1
//手动下发
TimingWeekly
=
2
//按周
TimingCustom
=
3
//自定义时间
)
src/router/workorderrouter.go
View file @
ce822374
...
...
@@ -46,5 +46,4 @@ func InitWorkOrderRouter(e *gin.Engine) {
me
.
PUT
(
"/feedback"
,
controller
.
FeedbackWorkOrderMe
)
// 处置反馈
me
.
GET
(
"/list"
,
controller
.
ListWorkOrderMe
)
// 我的业务工单列表
}
//so.POST("/note_sg", controller.WorkOrderPushNoteMsg)
}
src/service/cron/common.go
View file @
ce822374
...
...
@@ -10,6 +10,4 @@ func StartCron() {
defer
c
.
Start
()
c
.
AddFunc
(
"0 0 0 * * *"
,
service
.
CronStatusDetection
)
// 每天凌晨0点状态检测
c
.
AddFunc
(
"0 0 0 * * *"
,
service
.
CronWorkOrderIssuance
)
// 每天凌晨0点扫描当天需下发工单
}
src/service/work_order.go
View file @
ce822374
This diff is collapsed.
Click to expand it.
src/util/serialize.go
View file @
ce822374
...
...
@@ -16,3 +16,14 @@ func ConvertToString(v interface{}) string {
}
return
string
(
jsonData
)
}
// IntsToStrings 将int切片转换为字符串切片
func
IntsToStrings
(
ints
[]
int
)
[]
string
{
strs
:=
make
([]
string
,
len
(
ints
))
for
i
,
v
:=
range
ints
{
strs
[
i
]
=
fmt
.
Sprint
(
v
)
}
return
strs
}
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