Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit df7adda4
authored
Jun 19, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add] 添加同步销帮帮合同文件定时任务和接口
1 parent
6976245f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
38 additions
and
20 deletions
pom.xml
src/main/java/vion/advice/LogAspect.java
src/main/java/vion/advice/ResBodyAdvice.java
src/main/java/vion/controller/ContractController.java
src/main/java/vion/cron/ContractRunner.java
src/main/java/vion/cron/LogPushRunner.java
src/main/java/vion/model/Contract.java
src/main/java/vion/service/IContractService.java
src/main/java/vion/service/impl/ContractServiceImpl.java
src/main/java/vion/service/impl/TaskServiceImpl.java
src/main/java/vion/service/impl/UserServiceImpl.java
pom.xml
View file @
df7adda
...
...
@@ -8,7 +8,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
3.
2.3
</version>
<version>
3.
3.0
</version>
</parent>
<artifactId>
Vion-DevOps
</artifactId>
...
...
@@ -17,7 +17,7 @@
<pg.version>
42.7.0
</pg.version>
<sqlserver.version>
12.2.0.jre8
</sqlserver.version>
<lombok.version>
1.18.30
</lombok.version>
<hutool.version>
6.0.0-M1
1
</hutool.version>
<hutool.version>
6.0.0-M1
3
</hutool.version>
<redisson.verion>
3.27.1
</redisson.verion>
<mapstruct-plus.version>
1.3.5
</mapstruct-plus.version>
<mp.version>
3.5.5
</mp.version>
...
...
src/main/java/vion/advice/LogAspect.java
View file @
df7adda
...
...
@@ -13,7 +13,7 @@ import org.aspectj.lang.annotation.Pointcut;
import
org.dromara.hutool.core.lang.Opt
;
import
org.dromara.hutool.core.text.StrUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.dromara.hutool.http.server.servlet.
Jakarta
ServletUtil
;
import
org.dromara.hutool.http.server.servlet.ServletUtil
;
import
org.slf4j.MDC
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
...
...
@@ -56,10 +56,10 @@ public class LogAspect {
log
.
info
(
"Request URL:{}, Method:{}, IP:{}, Operator:{}, Args:{}, Body:{}"
,
request
.
getRequestURI
(),
request
.
getMethod
(),
Jakarta
ServletUtil
.
getClientIP
(
request
),
ServletUtil
.
getClientIP
(
request
),
username
,
objectMapper
.
writeValueAsString
(
request
.
getParameterMap
()),
StrUtil
.
replaceChars
(
Jakarta
ServletUtil
.
getBody
(
request
),
" \r\n"
,
""
)
StrUtil
.
replaceChars
(
ServletUtil
.
getBody
(
request
),
" \r\n"
,
""
)
);
}
...
...
src/main/java/vion/advice/ResBodyAdvice.java
View file @
df7adda
...
...
@@ -2,10 +2,10 @@ package vion.advice;
import
cn.dev33.satoken.exception.NotLoginException
;
import
cn.dev33.satoken.exception.NotPermissionException
;
import
cn.hutool.core.util.ObjUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.io.Resource
;
import
org.springframework.http.MediaType
;
...
...
src/main/java/vion/controller/ContractController.java
View file @
df7adda
...
...
@@ -73,7 +73,7 @@ public class ContractController {
@PostMapping
(
"/contract/{id}"
)
@SaCheckPermission
(
value
=
"contract:edit"
,
orRole
=
"admin"
)
public
String
updateById
(
@PathVariable
Long
id
,
ContractDTO
dto
)
{
public
String
updateById
(
@PathVariable
Long
id
,
@RequestBody
ContractDTO
dto
)
{
return
contractService
.
updateById
(
id
,
null
,
dto
);
}
...
...
@@ -198,4 +198,10 @@ public class ContractController {
throw
new
RuntimeException
(
e
);
}
}
@GetMapping
(
"/contract/fileSync"
)
@SaCheckPermission
(
value
=
"contract:fileSync"
,
orRole
=
"admin"
)
public
String
fileSync
(
String
[]
contractNoList
)
{
return
contractService
.
syncContractFile
(
contractNoList
);
}
}
src/main/java/vion/cron/ContractRunner.java
View file @
df7adda
...
...
@@ -54,7 +54,7 @@ public class ContractRunner {
@Value
(
"${xbongbong.token}"
)
private
String
token
;
@Value
(
"${xbongbong.corpid}"
)
private
String
corp
i
d
;
private
String
corp
I
d
;
// @Scheduled(cron = "0 0 * * * *")
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -302,7 +302,7 @@ public class ContractRunner {
public
void
contractSync1
()
{
Long
modifyTime
=
Opt
.
ofNullable
((
Long
)
redissonClient
.
getBucket
(
RedisKeyEnum
.
CONTRACT_SYNC_NEW_TIME
.
getVal
()).
get
()).
orElse
(
0L
);
// 只同步2024-05-07号(含)之后的合同
// 只同步
申请日期(原CRM中的签订日期)
2024-05-07号(含)之后的合同
var
json
=
JSONUtil
.
ofObj
()
.
set
(
"sortMap"
,
JSONUtil
.
ofObj
()
.
set
(
"field"
,
"updateTime"
)
...
...
@@ -317,7 +317,7 @@ public class ContractRunner {
.
set
(
"symbol"
,
"greatethan"
)
.
set
(
"value"
,
new
String
[]{
String
.
valueOf
(
modifyTime
/
1000
)}))
)
.
set
(
"corpid"
,
corp
i
d
)
.
set
(
"corpid"
,
corp
I
d
)
.
set
(
"formId"
,
8429903
)
.
set
(
"pageSize"
,
100
);
var
res
=
Request
.
of
(
"https://proapi.xbongbong.com/pro/v2/api/contract/list"
)
...
...
@@ -347,18 +347,22 @@ public class ContractRunner {
.
set
(
"order"
,
"desc"
))
.
set
(
"conditions"
,
JSONUtil
.
ofArray
()
.
put
(
JSONUtil
.
ofObj
()
.
set
(
"attr"
,
"date_3"
)
.
set
(
"symbol"
,
"greaterequal"
)
.
set
(
"value"
,
new
String
[]{
"1715356800"
}))
.
put
(
JSONUtil
.
ofObj
()
.
set
(
"attr"
,
"updateTime"
)
.
set
(
"fieldType"
,
"10015"
)
.
set
(
"symbol"
,
"greatethan"
)
.
set
(
"value"
,
new
String
[]{
String
.
valueOf
(
modifyTime
)}))
)
.
set
(
"corpid"
,
corp
i
d
)
.
set
(
"corpid"
,
corp
I
d
)
.
set
(
"formId"
,
8429903
)
.
set
(
"page"
,
i
)
.
set
(
"pageSize"
,
100
);
var
resR
=
Request
.
of
(
"https://proapi.xbongbong.com/pro/v2/api/contract/list"
)
.
header
(
"sign"
,
SecureUtil
.
sha256
(
jsonR
.
toString
()
+
token
))
.
body
(
json
.
toString
())
.
body
(
json
R
.
toString
())
.
method
(
Method
.
POST
)
.
send
();
var
jobR
=
JSONUtil
.
parseObj
(
resR
.
bodyStr
());
...
...
@@ -378,7 +382,7 @@ public class ContractRunner {
}
dataIdSet
.
forEach
(
dataId
->
{
var
json1
=
JSONUtil
.
ofObj
()
.
set
(
"corpid"
,
corp
i
d
)
.
set
(
"corpid"
,
corp
I
d
)
.
set
(
"dataId"
,
dataId
);
var
res1
=
Request
.
of
(
"https://proapi.xbongbong.com/pro/v2/api/contract/detail"
)
.
header
(
"sign"
,
SecureUtil
.
sha256
(
json1
.
toString
()
+
token
))
...
...
@@ -633,7 +637,7 @@ public class ContractRunner {
public
List
<
JSONObject
>
getProductList
()
{
List
<
JSONObject
>
resList
=
new
ArrayList
<>();
var
json
=
JSONUtil
.
ofObj
()
.
set
(
"corpid"
,
corp
i
d
)
.
set
(
"corpid"
,
corp
I
d
)
.
set
(
"page"
,
1
)
.
set
(
"pageSize"
,
100
);
...
...
@@ -654,7 +658,7 @@ public class ContractRunner {
for
(
int
i
=
2
;
i
<=
totalPage
;
i
++)
{
var
json1
=
JSONUtil
.
ofObj
()
.
set
(
"corpid"
,
corp
i
d
)
.
set
(
"corpid"
,
corp
I
d
)
.
set
(
"page"
,
i
)
.
set
(
"pageSize"
,
100
);
var
res1
=
Request
.
of
(
"https://proapi.xbongbong.com/pro/v2/api/product/list"
)
...
...
@@ -680,4 +684,9 @@ public class ContractRunner {
storeService
.
calMaintainStatus
(
ListUtil
.
empty
());
log
.
info
(
"【结束】计算门店维保状态"
);
}
@Scheduled
(
cron
=
"0 10 * ? * *"
)
public
void
syncContractFile
()
{
contractService
.
syncContractFile
(
null
);
}
}
src/main/java/vion/cron/LogPushRunner.java
View file @
df7adda
package
vion
.
cron
;
import
cn.hutool.core.lang.Opt
;
import
cn.hutool.core.util.ObjUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.lang.Opt
;
import
org.dromara.hutool.core.text.StrUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.dromara.hutool.cron.CronUtil
;
import
org.dromara.hutool.cron.task.Task
;
import
org.dromara.hutool.json.JSONObject
;
...
...
src/main/java/vion/model/Contract.java
View file @
df7adda
...
...
@@ -67,6 +67,8 @@ public class Contract {
/**
* 合同总金额
* <p>
* 更新合同时,合同相关金额计算是由合同收款记录计算的,不能通过更新接口自己修改
*/
@TableField
(
value
=
"total_amount"
)
@ReverseAutoMapping
(
targetClass
=
ContractDTO
.
class
,
ignore
=
true
)
...
...
src/main/java/vion/service/IContractService.java
View file @
df7adda
...
...
@@ -49,4 +49,5 @@ public interface IContractService extends MPJBaseService<Contract> {
JSONObject
getCRMProduct
(
String
name
,
String
code
,
Integer
page
,
Integer
pageSize
);
String
syncContractFile
(
String
[]
contractNoList
);
}
\ No newline at end of file
src/main/java/vion/service/impl/ContractServiceImpl.java
View file @
df7adda
This diff is collapsed.
Click to expand it.
src/main/java/vion/service/impl/TaskServiceImpl.java
View file @
df7adda
package
vion
.
service
.
impl
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.hutool.core.util.DesensitizedUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
com.github.yulichang.wrapper.MPJLambdaWrapper
;
...
...
@@ -12,6 +11,7 @@ import org.dromara.hutool.core.array.ArrayUtil;
import
org.dromara.hutool.core.collection.CollUtil
;
import
org.dromara.hutool.core.collection.ListUtil
;
import
org.dromara.hutool.core.collection.set.SetUtil
;
import
org.dromara.hutool.core.data.MaskingUtil
;
import
org.dromara.hutool.core.data.id.IdUtil
;
import
org.dromara.hutool.core.date.DateUtil
;
import
org.dromara.hutool.core.io.file.FileNameUtil
;
...
...
@@ -325,7 +325,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
.
build
();
List
<
WxMpTemplateData
>
wxMpTemplateDataList
=
ListUtil
.
of
(
new
WxMpTemplateData
(
"character_string21"
,
existTask
.
getUuid
()),
new
WxMpTemplateData
(
"thing12"
,
Desensitized
Util
.
chineseName
(
user
.
getUsername
())),
new
WxMpTemplateData
(
"thing12"
,
Masking
Util
.
chineseName
(
user
.
getUsername
())),
new
WxMpTemplateData
(
"time11"
,
DateUtil
.
formatDateTime
(
new
Date
())),
new
WxMpTemplateData
(
"thing20"
,
existTask
.
getFaultDescription
().
length
()
>
20
?
StrUtil
.
sub
(
existTask
.
getFaultDescription
(),
0
,
17
)
+
"..."
:
existTask
.
getFaultDescription
()),
new
WxMpTemplateData
(
"phrase25"
,
statusMap
.
get
(
existTask
.
getStatus
())));
...
...
src/main/java/vion/service/impl/UserServiceImpl.java
View file @
df7adda
package
vion
.
service
.
impl
;
import
cn.hutool.core.util.ObjUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.yulichang.base.MPJBaseServiceImpl
;
import
com.github.yulichang.wrapper.MPJLambdaWrapper
;
...
...
@@ -12,6 +11,7 @@ import org.dromara.hutool.core.lang.Opt;
import
org.dromara.hutool.core.tree.MapTree
;
import
org.dromara.hutool.core.tree.TreeNode
;
import
org.dromara.hutool.core.tree.TreeUtil
;
import
org.dromara.hutool.core.util.ObjUtil
;
import
org.springframework.stereotype.Service
;
import
vion.dto.UserDTO
;
import
vion.mapper.UserMapper
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment