Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
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
竹天卫
tianjin-cement
Commits
8e976220
Commit
8e976220
authored
Nov 21, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企業微信配置放在application.yml中
parent
19da2867
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
21 deletions
+82
-21
pom.xml
cement-business/pom.xml
+13
-3
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+8
-4
EquipmentServiceImpl.java
...sc/cement/business/service/impl/EquipmentServiceImpl.java
+4
-1
PlanConsumablesPurchaseServiceImpl.java
...ness/service/impl/PlanConsumablesPurchaseServiceImpl.java
+1
-1
StandardServiceImpl.java
.../sc/cement/business/service/impl/StandardServiceImpl.java
+5
-2
WeiXinService.java
...n/wise/sc/cement/business/service/impl/WeiXinService.java
+14
-2
WeiXinUtil.java
...va/cn/wise/sc/cement/business/util/weixin/WeiXinUtil.java
+8
-7
application.yml
cement-business/src/main/resources/application.yml
+28
-0
~$耗品采购计划.docx
cement-business/src/main/resources/~$耗品采购计划.docx
+0
-0
application.yml
config/application.yml
+1
-1
No files found.
cement-business/pom.xml
View file @
8e976220
...
...
@@ -150,6 +150,12 @@
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-base
</artifactId>
<version>
4.1.0
</version>
<exclusions>
<exclusion>
<groupId>
org.javassist
</groupId>
<artifactId>
javassist
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.jfree
</groupId>
...
...
@@ -196,10 +202,14 @@
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
<includes>
<!--
<includes>
<include>*.xlsx</include>
<include>
*
</include>
</includes>
<include>*.properties</include>
<include>*.xml</include>
</includes>-->
<excludes>
<exclude>
*.yml
</exclude>
</excludes>
</resource>
<resource>
<directory>
src/main/resources/templates
</directory>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
8e976220
...
...
@@ -34,6 +34,7 @@ import org.apache.commons.io.filefilter.FalseFileFilter;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -124,6 +125,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
private
IPrecipriceService
iPrecipriceService
;
@Resource
private
EntityEnclosureMapper
entityEnclosureMapper
;
@Value
(
"${weixin.systemUrl}"
)
private
static
String
systemUrl
;
/**
* 委托分页
*
...
...
@@ -345,7 +349,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
//发送企业微信消息内容
String
content
=
"你好!"
+
loginUser
.
getName
()+
"向您申请了一条委托,请前往\n"
+
Global
.
systemUrl
+
"进行评审。"
;
systemUrl
+
"进行评审。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
...
...
@@ -981,7 +985,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"发送样品处理任务"
,
null
);
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品处理任务,请前往\n"
+
Global
.
systemUrl
+
"进行接受。"
;
String
content
=
"你好!您有一条新的样品处理任务,请前往\n"
+
systemUrl
+
"进行接受。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
else
if
(
query
.
getIsAgree
()
==
2
)
{
//驳回
...
...
@@ -1493,7 +1497,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"派发检测项目任务"
,
null
);
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品检测任务,请前往\n"
+
Global
.
systemUrl
+
"进行接受。"
;
systemUrl
+
"进行接受。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
return
BaseResponse
.
okMsg
(
"已派发检测项目任务"
);
}
...
...
@@ -2312,7 +2316,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
//发送企业微信消息内容
String
content
=
"你好!"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"已校核完成,请前往\n"
+
Global
.
systemUrl
+
"进行查看。"
;
systemUrl
+
"进行查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EquipmentServiceImpl.java
View file @
8e976220
...
...
@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -64,6 +65,8 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private
ISysUserMessageService
userMessageService
;
@Autowired
private
WeiXinService
weiXinService
;
@Value
(
"${weixin.systemUrl}"
)
private
static
String
systemUrl
;
/**
* 设备分页查询
...
...
@@ -315,7 +318,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
if
(
expireDate
.
isEqual
(
nowDate
)
||
expireDate
.
isBefore
(
nowDate
)){
//发送企业微信消息内容
String
content
=
"你好!名称:"
+
eq
.
getName
()+
",编号:"
+
eq
.
getCode
()+
"的设备近期需要进行设备检定,如果已经检定完毕请前往\n"
+
Global
.
systemUrl
+
"更新检定记录。"
;
systemUrl
+
"更新检定记录。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/PlanConsumablesPurchaseServiceImpl.java
View file @
8e976220
...
...
@@ -203,7 +203,7 @@ public class PlanConsumablesPurchaseServiceImpl extends ServiceImpl<PlanConsumab
if
(
pep
==
null
)
{
return
BaseResponse
.
errorMsg
(
"数据错误!"
);
}
pep
.
set
TechnicalIndex
(
query
.
getImplementation
());
pep
.
set
Implementation
(
query
.
getImplementation
());
pep
.
setStatus
(
1
);
//采购完成
consumablesPurchaseMapper
.
updateById
(
pep
);
return
BaseResponse
.
okData
(
"采购完成"
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/StandardServiceImpl.java
View file @
8e976220
...
...
@@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -74,6 +75,8 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
private
SysApprovalMapper
sysApprovalMapper
;
@Autowired
private
WeiXinService
weiXinService
;
@Value
(
"${weixin.systemUrl}"
)
private
static
String
systemUrl
;
/**
...
...
@@ -416,7 +419,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
if
(
st
.
getStockNum
().
compareTo
(
st
.
getLeastNum
())<
1
){
//发送企业微信消息内容
String
content
=
"你好!标样名称:"
+
st
.
getName
()+
",代号:"
+
st
.
getCode
()+
"的标样数量小于设定的最小值,新增标样数量后请及时更新系统,如果已新增完毕请前往\n"
+
Global
.
systemUrl
+
"更新标样记录。"
;
systemUrl
+
"更新标样记录。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
...
...
@@ -427,7 +430,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
if
(
expireDate
.
isEqual
(
nowDate
)
||
expireDate
.
isBefore
(
nowDate
)){
//发送企业微信消息内容
String
content
=
"你好!标样名称:"
+
st
.
getName
()+
",代号:"
+
st
.
getCode
()+
"的标样即将过期,请尽快处理,如果已经处理,请前往\n"
+
Global
.
systemUrl
+
"更新标样记录。"
;
systemUrl
+
"更新标样记录。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/WeiXinService.java
View file @
8e976220
...
...
@@ -20,6 +20,7 @@ import com.google.gson.Gson;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
...
...
@@ -33,6 +34,17 @@ public class WeiXinService {
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${weixin.corpId}"
)
private
static
String
corpId
;
@Value
(
"${weixin.agentId}"
)
private
static
int
agentId
;
@Value
(
"${weixin.agentSecret}"
)
private
static
String
agentSecret
;
final
static
String
ACCESS_TOKEN
=
"ACCESS_TOKEN"
;
final
static
String
JSAPITICKET
=
"JSAPITICKET"
;
...
...
@@ -145,7 +157,7 @@ public class WeiXinService {
if
(!
redisUtil
.
existsKey
(
ACCESS_TOKEN
))
{
String
param
=
"corpid=%s&corpsecret=%s"
;
param
=
String
.
format
(
param
,
Global
.
corpId
,
Global
.
agentSecret
);
param
=
String
.
format
(
param
,
corpId
,
agentSecret
);
JSONObject
jsonObject
=
WeixinInterfaceUtil
.
doGet
(
Global
.
ACCESSTOKENURL
,
param
);
accessToken
=
jsonObject
.
getString
(
"access_token"
);
redisUtil
.
setString
(
ACCESS_TOKEN
,
accessToken
,
7100
);
...
...
@@ -226,7 +238,7 @@ public class WeiXinService {
//1.2必需
message
.
setMsgtype
(
"text"
);
message
.
setAgentid
(
Global
.
agentId
);
message
.
setAgentid
(
agentId
);
Text
text
=
new
Text
();
text
.
setContent
(
content
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/weixin/WeiXinUtil.java
View file @
8e976220
...
...
@@ -33,11 +33,12 @@ public class WeiXinUtil {
//获取jsapi_ticket的接口地址(GET) 限200(次/天)
public
final
static
String
jsapi_ticket_url
=
"https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=ACCESSTOKEN"
;
@Value
(
"${weixin.corpid}"
)
private
String
corpid
;
@Value
(
"${weixin.corpsecret}"
)
private
String
corpsecret
;
@Value
(
"${weixin.corpId}"
)
private
static
String
corpId
;
@Value
(
"${weixin.agentId}"
)
private
static
int
agentId
;
@Value
(
"${weixin.agentSecret}"
)
private
static
String
agentSecret
;
...
...
@@ -367,7 +368,7 @@ public class WeiXinUtil {
String
nonceStr
=
UUID
.
randomUUID
().
toString
();
// 必填,生成签名的随机串
//System.out.println("nonceStr:"+nonceStr);
String
accessToken
=
WeiXinUtil
.
getAccessToken
(
Global
.
corpId
,
Global
.
agentSecret
).
getToken
();
String
accessToken
=
WeiXinUtil
.
getAccessToken
(
corpId
,
agentSecret
).
getToken
();
String
jsapi_ticket
=
getJsapiTicket
(
accessToken
);
// 必填,生成签名的H5应用调用企业微信JS接口的临时票据
//System.out.println("jsapi_ticket:"+jsapi_ticket);
String
timestamp
=
Long
.
toString
(
System
.
currentTimeMillis
()
/
1000
);
// 必填,生成签名的时间戳
...
...
@@ -391,7 +392,7 @@ public class WeiXinUtil {
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
ret
.
put
(
"appId"
,
Global
.
corpId
);
ret
.
put
(
"appId"
,
corpId
);
ret
.
put
(
"timestamp"
,
timestamp
);
ret
.
put
(
"nonceStr"
,
nonceStr
);
ret
.
put
(
"signature"
,
signature
);
...
...
cement-business/src/main/resources/application.yml
View file @
8e976220
...
...
@@ -37,3 +37,31 @@ mybatis-plus:
check-config-location
:
true
type-aliases-package
:
cn.wise.sc.cement.business.entity.**
mapper-locations
:
classpath:/cn/wise/sc/cement/business/mapper/xml/*Mapper.xml
weixin
:
corpId
:
ww348f91b2573c1867
agentId
:
1000002
agentIdPC
:
1000003
agentSecret
:
gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o
agentSecretPC
:
itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A
backUrl
:
https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system
systemUrl
:
<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="ww348f91b2573c1867"&redirect_uri="https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程" + "</a>,
cement-business/src/main/resources/~$耗品采购计划.docx
0 → 100644
View file @
8e976220
File added
config/application.yml
View file @
8e976220
...
...
@@ -5,7 +5,7 @@ spring:
application
:
tianjin-cement
profiles
:
# 启动命令加上 -Dspring.config.location={文件路径}\config\application.yml
path
:
{
文件夹路径
}
/config
path
:
D:/idea_workspases/tianjin-cement
/config
active
:
dev
datasource
:
# 192.168.110.85 admin!@#123
...
...
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