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
04283a27
Commit
04283a27
authored
Mar 02, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug优化
parent
969f8f9c
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
480 additions
and
114 deletions
+480
-114
DataStatisticsController.java
.../cement/business/controller/DataStatisticsController.java
+4
-5
WeiXinController.java
.../wise/sc/cement/business/controller/WeiXinController.java
+16
-2
Team.java
...src/main/java/cn/wise/sc/cement/business/entity/Team.java
+4
-0
DataStatisticsMapper.java
.../wise/sc/cement/business/mapper/DataStatisticsMapper.java
+3
-3
DataStatisticsMapper.xml
...se/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
+21
-3
CheckTeamResultVo.java
...n/wise/sc/cement/business/model/vo/CheckTeamResultVo.java
+3
-0
IDataStatisticsService.java
...se/sc/cement/business/service/IDataStatisticsService.java
+2
-2
CommonServiceImpl.java
...se/sc/cement/business/service/impl/CommonServiceImpl.java
+55
-7
DataStatisticsServiceImpl.java
...ment/business/service/impl/DataStatisticsServiceImpl.java
+20
-5
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+161
-47
WeiXinService.java
...n/wise/sc/cement/business/service/impl/WeiXinService.java
+150
-13
CheckCountUtil.java
.../java/cn/wise/sc/cement/business/util/CheckCountUtil.java
+24
-24
JwtUtil.java
...rc/main/java/cn/wise/sc/cement/business/util/JwtUtil.java
+1
-1
application.yml
cement-business/src/main/resources/application.yml
+16
-2
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/DataStatisticsController.java
View file @
04283a27
...
...
@@ -121,21 +121,20 @@ public class DataStatisticsController {
@ApiOperation
(
value
=
"统计概览-进行中任务数量统计"
)
@GetMapping
(
"/countTaskIng"
)
public
BaseResponse
countTaskIng
(
PageQuery
pageQuery
)
{
public
BaseResponse
countTaskIng
(
PageQuery
pageQuery
,
String
startDate
,
String
endDate
)
{
try
{
return
dataStatisticsService
.
countTaskIng
(
pageQuery
);
return
dataStatisticsService
.
countTaskIng
(
pageQuery
,
startDate
,
endDate
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"统计概览-进行中任务数量统计{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"统计概览-正在进行的检测项统计"
)
@GetMapping
(
"/countTeamIng"
)
public
BaseResponse
countTeamIng
()
{
public
BaseResponse
countTeamIng
(
String
startDate
,
String
endDate
)
{
try
{
return
dataStatisticsService
.
countTeamIng
();
return
dataStatisticsService
.
countTeamIng
(
startDate
,
endDate
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"统计概览-正在进行的检测项统计{}"
,
e
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/WeiXinController.java
View file @
04283a27
...
...
@@ -54,15 +54,29 @@ public class WeiXinController {
public
BaseResponse
getPCToken
(
String
code
)
{
try
{
//测试服务器
//
return weiXinService.getTestToken(code);
return
weiXinService
.
getTestToken
(
code
);
//正式服务器
return
weiXinService
.
getToken
(
code
,
"PC"
);
//
return weiXinService.getToken(code, "PC");
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"刷新token"
)
@GetMapping
(
"/getNewToken"
)
public
BaseResponse
getNewToken
(
String
refreshToken
)
{
try
{
return
weiXinService
.
getNewToken
(
refreshToken
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"刷新token{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"当前登录用户"
)
@GetMapping
(
"/getLoginUser"
)
public
BaseResponse
getLoginUser
()
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/entity/Team.java
View file @
04283a27
...
...
@@ -88,5 +88,9 @@ public class Team extends BaseEntity implements Serializable {
@ApiModelProperty
(
"是否需要派发(0否 样品处理完直接校核,1是样品处理完需要检测再校核)"
)
private
Integer
isPf
;
@ApiModelProperty
(
"小数位数(0保留整数,1保留1位小数...)"
)
private
Integer
retain
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/DataStatisticsMapper.java
View file @
04283a27
...
...
@@ -40,15 +40,15 @@ public interface DataStatisticsMapper {
List
<
Map
<
String
,
Object
>>
exportEntrustList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
IPage
<
DataStatisticsVo
>
countHandlePage
(
@Param
(
"page"
)
Page
page
);
IPage
<
DataStatisticsVo
>
countHandlePage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
Integer
countHandleWeek
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"weekType"
)
Integer
weekType
);
IPage
<
DataStatisticsVo
>
countDistributionPage
(
@Param
(
"page"
)
Page
page
);
IPage
<
DataStatisticsVo
>
countDistributionPage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
Integer
countDistributionWeek
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"weekType"
)
Integer
weekType
);
List
<
DataStatisticsVo
>
countTeamIng
();
List
<
DataStatisticsVo
>
countTeamIng
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
List
<
DataStatisticsVo
>
countTeam
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/DataStatisticsMapper.xml
View file @
04283a27
...
...
@@ -234,7 +234,13 @@
<select
id=
"countHandlePage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT su.id as id, su.name as name, count(*) as value FROM sample_handle sh
left join sys_user su on su.id = sh.user_id
where sh.status = 1 or sh.status = 5
where (sh.status = 1 or sh.status = 5)
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sh.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sh.create_time)
<
= #{params.endDate}
</if>
group by sh.user_id
</select>
...
...
@@ -259,7 +265,13 @@
<select
id=
"countDistributionPage"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT su.id as id, su.name as name, count(*) as value FROM sample_distribution sd
left join sys_user su on su.id = sd.user_id
where sd.status = 1 or sd.status = 5
where (sd.status = 1 or sd.status = 5)
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sh.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sh.create_time)
<
= #{params.endDate}
</if>
group by sd.user_id
</select>
...
...
@@ -286,7 +298,13 @@
<select
id=
"countTeamIng"
resultType=
"cn.wise.sc.cement.business.model.vo.DataStatisticsVo"
>
SELECT t.name as name, count(*) as value FROM sample_distribution sd
left join team t on t.id = sd.team_id
where sd.status = 1 or sd.status = 5
where (sd.status = 1 or sd.status = 5)
<if
test=
"params.startDate != null and params.startDate != ''"
>
and DATE(sd.create_time)
>
= #{params.startDate}
</if>
<if
test=
"params.endDate != null and params.endDate != ''"
>
and DATE(sd.create_time)
<
= #{params.endDate}
</if>
group by sd.team_id
</select>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/CheckTeamResultVo.java
View file @
04283a27
...
...
@@ -25,6 +25,9 @@ public class CheckTeamResultVo {
@ApiModelProperty
(
"检测项名称"
)
private
String
teamName
;
@ApiModelProperty
(
"小数位数(0保留整数,1保留1位小数...)"
)
private
Integer
retain
;
@ApiModelProperty
(
"本组序号 12345"
)
private
Integer
sortNo
;
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/IDataStatisticsService.java
View file @
04283a27
...
...
@@ -39,9 +39,9 @@ public interface IDataStatisticsService {
void
exportEntrustList
(
Integer
cycle
,
String
startDate
,
String
endDate
,
Integer
clientId
,
String
clientName
,
String
fileName
,
HttpServletResponse
response
);
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
);
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
,
String
startDate
,
String
endDate
);
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamIng
();
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamIng
(
String
startDate
,
String
endDate
);
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamDetail
(
Integer
cycle
,
String
startDate
,
String
endDate
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/CommonServiceImpl.java
View file @
04283a27
...
...
@@ -190,7 +190,57 @@ public class CommonServiceImpl {
JSONArray
jsonArr
=
JSON
.
parseArray
(
teamGroup
.
getCheckElement
());
Map
<
String
,
String
>
teamgroupMap
=
jSONArrayToMap
(
jsonArr
);
if
(
teamgroupMap
.
containsKey
(
"TSiO<sub>2</sub>"
)){
for
(
int
i
=
0
;
i
<
jsonArr
.
size
();
i
++){
JSONObject
jsonObject
=
jsonArr
.
getJSONObject
(
i
);
if
(
jsonObject
.
containsKey
(
"TSiO<sub>2</sub>"
)){
if
(
map
.
containsKey
(
"TSiO<sub>2</sub>"
)){
jsonObject
.
put
(
"TSiO<sub>2</sub>"
,
map
.
get
(
"TSiO<sub>2</sub>"
));
}
}
if
(
jsonObject
.
containsKey
(
"TAl<sub>2</sub>O<sub>3</sub>"
)){
if
(
map
.
containsKey
(
"TAl<sub>2</sub>O<sub>3</sub>"
)){
jsonObject
.
put
(
"TAl<sub>2</sub>O<sub>3</sub>"
,
map
.
get
(
"TAl<sub>2</sub>O<sub>3</sub>"
));
}
}
if
(
jsonObject
.
containsKey
(
"TFe<sub>2</sub>O<sub>3</sub>"
)){
if
(
map
.
containsKey
(
"TFe<sub>2</sub>O<sub>3</sub>"
)){
jsonObject
.
put
(
"TFe<sub>2</sub>O<sub>3</sub>"
,
map
.
get
(
"TFe<sub>2</sub>O<sub>3</sub>"
));
}
}
if
(
jsonObject
.
containsKey
(
"TMgO"
)){
if
(
map
.
containsKey
(
"TMgO"
)){
jsonObject
.
put
(
"TMgO"
,
map
.
get
(
"TMgO"
));
}
}
if
(
jsonObject
.
containsKey
(
"TTiO<sub>2</sub>"
)){
if
(
map
.
containsKey
(
"TTiO<sub>2</sub>"
)){
jsonObject
.
put
(
"TTiO<sub>2</sub>"
,
map
.
get
(
"TTiO<sub>2</sub>"
));
}
}
if
(
jsonObject
.
containsKey
(
"TAl<sub>2</sub>O<sub>3</sub>"
)){
if
(
map
.
containsKey
(
"TAl<sub>2</sub>O<sub>3</sub>"
)){
jsonObject
.
put
(
"TAl<sub>2</sub>O<sub>3</sub>"
,
map
.
get
(
"TAl<sub>2</sub>O<sub>3</sub>"
));
}
}
if
(
jsonObject
.
containsKey
(
"TTiO<sub>2</sub>"
)){
if
(
map
.
containsKey
(
"TTiO<sub>2</sub>"
)){
jsonObject
.
put
(
"TTiO<sub>2</sub>"
,
map
.
get
(
"TTiO<sub>2</sub>"
));
}
}
if
(
jsonObject
.
containsKey
(
"TCaO"
)){
if
(
map
.
containsKey
(
"TCaO"
)){
jsonObject
.
put
(
"TCaO"
,
map
.
get
(
"TCaO"
));
}
}
}
/*if(teamgroupMap.containsKey("TSiO<sub>2</sub>")){
if(map.containsKey("TSiO<sub>2</sub>")){
teamgroupMap.put("TSiO<sub>2</sub>",map.get("TSiO<sub>2</sub>"));
}
...
...
@@ -229,11 +279,11 @@ public class CommonServiceImpl {
if(map.containsKey("TCaO")){
teamgroupMap.put("TCaO",map.get("TCaO"));
}
}
}
*/
JSONArray
checkElementArray
=
mapToJSONArray
(
teamgroupMap
);
//
JSONArray checkElementArray = mapToJSONArray(teamgroupMap);
String
checkElement
=
JSON
.
toJSON
(
checkElementArray
).
toString
();
String
checkElement
=
JSON
.
toJSON
(
jsonArr
).
toString
();
teamGroup
.
setCheckElement
(
checkElement
);
teamGroupMapper
.
updateById
(
teamGroup
);
}
...
...
@@ -248,7 +298,7 @@ public class CommonServiceImpl {
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++){
//获取每一个JsonObject对象
JSONObject
jObject
=
jsonArray
.
getJSONObject
(
i
);
map
.
put
(
jObject
.
getString
(
"name"
),
jObject
.
getString
(
"value"
));
map
.
put
(
jObject
.
getString
(
"name"
),
jObject
.
getString
(
"value"
)
+
","
+
jObject
.
getString
(
"retain"
)
);
}
return
map
;
}
...
...
@@ -489,6 +539,4 @@ public class CommonServiceImpl {
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/DataStatisticsServiceImpl.java
View file @
04283a27
...
...
@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
io.swagger.models.auth.In
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -359,23 +360,31 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
* @return
*/
@Override
public
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
){
public
BaseResponse
<
Map
<
String
,
Object
>>
countTaskIng
(
PageQuery
pageQuery
,
String
startDate
,
String
endDate
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//样品处理任务数量
QueryWrapper
<
SampleHandle
>
handleQw
=
new
QueryWrapper
<>();
handleQw
.
ge
(
"create_time"
,
startDate
);
handleQw
.
le
(
"create_time"
,
endDate
);
handleQw
.
eq
(
"status"
,
0
).
or
().
eq
(
"status"
,
1
);
Integer
handle_counts
=
sampleHandleService
.
count
(
handleQw
);
map
.
put
(
"handleCounts"
,
handle_counts
);
//样品检测任务数量
QueryWrapper
<
SampleDistribution
>
distributionQw
=
new
QueryWrapper
<>();
distributionQw
.
ge
(
"create_time"
,
startDate
);
distributionQw
.
le
(
"create_time"
,
endDate
);
distributionQw
.
eq
(
"status"
,
0
).
or
().
eq
(
"status"
,
1
);
Integer
distribution_counts
=
sampleDistributionService
.
count
(
distributionQw
);
map
.
put
(
"distributionCounts"
,
distribution_counts
);
//样品处理按人分组统计任务数量
Map
<
String
,
Object
>
paramsHan
=
new
HashMap
<>();
paramsHan
.
put
(
"startDate"
,
startDate
);
paramsHan
.
put
(
"endDate"
,
endDate
);
Page
<
EntrustVo
>
pageHan
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
DataStatisticsVo
>
pagesHandle
=
dataStatisticsMapper
.
countHandlePage
(
pageHan
);
IPage
<
DataStatisticsVo
>
pagesHandle
=
dataStatisticsMapper
.
countHandlePage
(
pageHan
,
paramsHan
);
List
<
DataStatisticsVo
>
listHandle
=
pagesHandle
.
getRecords
();
List
<
DataStatisticsVo
>
handleList
=
new
ArrayList
<>();
if
(
listHandle
!=
null
&&
listHandle
.
size
()
>
0
)
{
...
...
@@ -420,8 +429,11 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
//样品检测按人分组统计任务数量
Map
<
String
,
Object
>
paramsDis
=
new
HashMap
<>();
paramsDis
.
put
(
"startDate"
,
startDate
);
paramsDis
.
put
(
"endDate"
,
endDate
);
Page
<
EntrustVo
>
pageDis
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
DataStatisticsVo
>
pagesDistribution
=
dataStatisticsMapper
.
countDistributionPage
(
pageDis
);
IPage
<
DataStatisticsVo
>
pagesDistribution
=
dataStatisticsMapper
.
countDistributionPage
(
pageDis
,
paramsDis
);
List
<
DataStatisticsVo
>
listDistribution
=
pagesDistribution
.
getRecords
();
List
<
DataStatisticsVo
>
distributionList
=
new
ArrayList
<>();
if
(
listDistribution
!=
null
&&
listDistribution
.
size
()
>
0
)
{
...
...
@@ -473,8 +485,11 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
* @return
*/
@Override
public
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamIng
(){
List
<
DataStatisticsVo
>
list
=
dataStatisticsMapper
.
countTeamIng
();
public
BaseResponse
<
List
<
DataStatisticsVo
>>
countTeamIng
(
String
startDate
,
String
endDate
){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"startDate"
,
startDate
);
params
.
put
(
"endDate"
,
endDate
);
List
<
DataStatisticsVo
>
list
=
dataStatisticsMapper
.
countTeamIng
(
params
);
return
BaseResponse
.
okData
(
list
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
04283a27
...
...
@@ -373,12 +373,13 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
}
//发送企业微信消息内容
Integer
notice
=
(
int
)(
1
+
Math
.
random
()*(
10
-
1
+
1
));
String
URL
=
"https://lab.wisenergy.cn/lab-bangye?id="
+
entrust
.
getId
()+
"&path=/blanche/entrustdetail¬ice="
+
notice
;
String
systemUrL
=
systemUrl
.
replace
(
"U_R_L"
,
URLUtil
.
encodeAll
(
URL
));
//
Integer notice = (int)(1+Math.random()*(10-1+1));
//
String URL = "https://lab.wisenergy.cn/lab-bangye?id="+entrust.getId()+"&path=/blanche/entrustdetail¬ice="+notice;
//
String systemUrL = systemUrl.replace("U_R_L", URLUtil.encodeAll(URL));
String
content
=
"你好!"
+
loginUser
.
getName
()+
"向您申请了一条委托,请前往\n"
+
systemUrl
+
"进行评审。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/entrustdetail"
);
String
content
=
"你好!"
+
loginUser
.
getName
()+
"向您申请了一条新委托,请前往\n"
+
systemUrL
+
"进行评审。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
...
...
@@ -546,6 +547,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//如果是委托人修改的
if
(
entrust
.
getUserId
()
==
loginUser
.
getId
()){
//委托人员修改委托,提示评审人员查看
String
userIds
=
""
;
for
(
Integer
approvalId
:
approvalIdList
){
SysUser
approvalUser
=
userService
.
getById
(
approvalId
);
...
...
@@ -561,13 +563,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
}
//发送企业微信消息内容
String
content
=
"你好!"
+
loginUser
.
getName
()+
"向您申请了一条委托,请前往\n"
+
systemUrl
+
"进行评审。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/entrustdetail"
);
String
content
=
"你好!"
+
loginUser
.
getName
()+
"向您修改了一条委托,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行评审。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
else
if
(
approvalIdList
.
contains
(
loginUser
.
getId
())){
//如果是评审人员修改
//评审人员修改委托,提示委托人查看
SysUser
createUser
=
userService
.
getById
(
entrust
.
getUserId
());
if
(
createUser
==
null
){
return
BaseResponse
.
errorMsg
(
"委托人信息错误"
);
...
...
@@ -578,8 +582,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
wrapper
;
}
//发送企业微信消息内容
String
content
=
"你好!"
+
loginUser
.
getName
()+
"修改了您的一条委托,请前往\n"
+
systemUrl
+
"进行确认。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/entrustdetail"
);
String
content
=
"你好!"
+
loginUser
.
getName
()+
"修改了您的一条委托,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行查看。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userId
,
content
);
...
...
@@ -1398,14 +1403,29 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setFinishDate
(
query
.
getFinishDate
());
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"发送样品处理任务"
,
null
);
//评审人员通过委托,提醒处理人员查看
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品处理任务,请前往\n"
+
systemUrl
+
"进行接受。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/wtdetail"
);
String
content
=
"你好!您有新的样品处理任务,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行接查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
else
if
(
query
.
getIsAgree
()
==
2
)
{
//驳回
entrust
.
setStatus
(
2
);
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"修改评审状态为“驳回”"
,
null
);
//评审人员驳回委托,提醒委托人员查看
//发送企业微信消息内容
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/wtdetail"
);
String
userIds
=
""
;
SysUser
createUser
=
userService
.
getById
(
entrust
.
getUserId
());
if
(
createUser
!=
null
&&
createUser
.
getWxId
()!=
null
){
userIds
=
createUser
.
getWxId
();
}
String
content
=
"你好!您有委托被驳回,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行接查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
else
{
return
BaseResponse
.
errorMsg
(
"请选择正确按钮"
);
}
...
...
@@ -1529,8 +1549,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setStatus
(
3
);
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"同意委托修改"
,
null
);
//委托人确认修改信息,提醒处理人员查看
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品处理任务,请前往\n"
+
systemUrl
+
"进行接受。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/wtdetail"
);
String
content
=
"你好!您有新的样品处理任务,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行接查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
else
if
(
query
.
getIsAgree
()
==
2
)
{
//拒绝
...
...
@@ -1558,6 +1580,26 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List
<
Sample
>
sampleList
=
new
ArrayList
<>();
String
maxCementCode
=
""
;
//最大本所编号对应的平行样编号
Integer
integerMaxCode
=
commonService
.
getIntegerCode
(
redisMaxCementCode
);
//除了主样还需要的编号数量
//前端传入的最后一个样品的本所编号 后续的本所编号在这个基础上进行追加
String
lastCementCode
=
sampleQueryList
.
get
(
sampleQueryList
.
size
()-
1
).
getCementCode
();
Integer
integerLastCode
=
commonService
.
getIntegerCode
(
lastCementCode
);
if
(
integerLastCode
<=
integerMaxCode
)
{
return
BaseResponse
.
errorMsg
(
"本所编号必须大于最大值"
);
}
//当前本所编号 截取的年份
String
yearStr
=
commonService
.
getIntegerYear
(
lastCementCode
);
//平行样的集合(乱序)
Set
<
String
>
parallelSet
=
new
HashSet
<>();
for
(
SampleQuery
sq
:
sampleQueryList
){
if
(
sq
.
getIsParallel
()
>=
2
){
integerLastCode
=
integerLastCode
+
1
;
lastCementCode
=
yearStr
+
"-"
+
commonService
.
getCementCode
(
integerLastCode
);
parallelSet
.
add
(
lastCementCode
);
}
}
for
(
SampleQuery
sampleQuery
:
sampleQueryList
)
{
if
(
StringUtils
.
isEmpty
(
sampleQuery
.
getCementCode
()))
{
return
BaseResponse
.
errorMsg
(
"本所编号不能为空"
);
...
...
@@ -1574,43 +1616,47 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
sampleQuery
.
getIsParallel
()
==
null
){
return
BaseResponse
.
errorMsg
(
"请选择是否需要平行样"
);
}
if
(
sampleQuery
.
getIsParallel
()
==
0
)
{
//非平行样
maxCementCode
=
sampleQuery
.
getCementCode
();
Sample
sample
=
new
Sample
();
BeanUtils
.
copyProperties
(
sampleQuery
,
sample
);
sample
.
setId
(
null
)
.
setSampleId
(
sampleQuery
.
getId
())
.
setStatus
(
0
)
//样品状态为未领用状态
.
setCreateTime
(
LocalDateTime
.
now
())
.
setIsHandle
(
0
)
//样品处理未完成状态
.
setIsDistribution
(
0
)
//任务派发未完成状态
.
setIsCheck
(
0
)
//样品校核未完成状态
.
setOutputValue
(
sample
.
getCharge
())
//产值不用评审人员修改
.
setParallelCode
(
sampleQuery
.
getCementCode
());
sampleList
.
add
(
sample
);
}
else
{
//是平行样
//先添加主样
maxCementCode
=
sampleQuery
.
getCementCode
();
Sample
sample
=
new
Sample
();
BeanUtils
.
copyProperties
(
sampleQuery
,
sample
);
sample
.
setId
(
null
)
.
setSampleId
(
sampleQuery
.
getId
())
.
setStatus
(
0
)
//样品状态为未领用状态
.
setCreateTime
(
LocalDateTime
.
now
())
.
setIsHandle
(
0
)
//样品处理未完成状态
.
setIsDistribution
(
0
)
//任务派发未完成状态
.
setIsCheck
(
0
)
//样品校核未完成状态
.
setOutputValue
(
sample
.
getCharge
())
//产值不用评审人员修改
.
setParallelCode
(
sampleQuery
.
getCementCode
());
sampleList
.
add
(
sample
);
//添加平行样integerMaxCode + sampleQueryLIst.size() integerMaxCode + sampleQueryLIst.size()+num
if
(
sampleQuery
.
getIsParallel
()
>=
2
)
{
//非平行样
if
(
sampleQuery
.
getIsParallel
()
<
2
){
return
BaseResponse
.
errorMsg
(
"平行样数量至少2条"
);
}
if
(
sampleQuery
.
getIsParallel
()
>
4
){
return
BaseResponse
.
errorMsg
(
"平行样数量最多4条"
);
}
for
(
int
i
=
0
;
i
<
sampleQuery
.
getIsParallel
();
i
++){
integerMaxCode
=
cementCodeInteger
>
integerMaxCode
?
cementCodeInteger
:
integerMaxCode
+
1
;
String
yearStr
=
commonService
.
getIntegerYear
(
sampleQuery
.
getCementCode
());
maxCementCode
=
yearStr
+
"-"
+
commonService
.
getCementCode
(
integerMaxCode
);
Sample
sample
=
new
Sample
();
BeanUtils
.
copyProperties
(
sampleQuery
,
sample
);
sample
.
setId
(
null
)
for
(
int
i
=
1
;
i
<
sampleQuery
.
getIsParallel
();
i
++){
//
integerMaxCode = cementCodeInteger > integerMaxCode ? cementCodeInteger : integerMaxCode+1;
//
String yearStr = commonService.getIntegerYear(sampleQuery.getCementCode());
//
maxCementCode = yearStr + "-" + commonService.getCementCode(integerMaxCode);
Sample
sample
P
=
new
Sample
();
BeanUtils
.
copyProperties
(
sampleQuery
,
sample
P
);
sample
P
.
setId
(
null
)
.
setSampleId
(
sampleQuery
.
getId
())
.
setStatus
(
0
)
//样品状态为未领用状态
.
setCreateTime
(
LocalDateTime
.
now
())
.
setIsHandle
(
0
)
//样品处理未完成状态
.
setIsDistribution
(
0
)
//任务派发未完成状态
.
setIsCheck
(
0
)
//样品校核未完成状态
.
setOutputValue
(
sample
.
getCharge
())
//产值不用评审人员修改
.
setParallelCode
(
maxCementCode
);
sampleList
.
add
(
sample
);
.
setOutputValue
(
sampleP
.
getCharge
())
//产值不用评审人员修改
.
setParallelCode
(
parallelSet
.
iterator
().
next
());
sampleList
.
add
(
sampleP
);
parallelSet
.
remove
(
sampleP
.
getParallelCode
());
}
}
}
...
...
@@ -2041,6 +2087,32 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//记录委托单日志
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"退回样品处理任务"
,
null
);
//样品处理人退回样品处理任务,提醒评审人员查看
List
<
Integer
>
approvalIdList
=
sysApprovalMapper
.
getApprovalId
(
"委托评审"
);
if
(
approvalIdList
==
null
)
{
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
String
userIds
=
""
;
for
(
Integer
approvalId
:
approvalIdList
){
SysUser
approvalUser
=
userService
.
getById
(
approvalId
);
if
(
approvalUser
==
null
){
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
BaseResponse
wrapper
=
userMessageService
.
sendMessage
(
approvalId
,
"您有一条被退回的检测任务"
,
entrust
.
getId
(),
SysUserMessage
.
MessageType
.
ENTRUST
);
if
(
wrapper
.
getCode
()
!=
200
){
return
wrapper
;
}
if
(
StringUtils
.
isNotBlank
(
approvalUser
.
getWxId
())){
userIds
=
userIds
.
equals
(
""
)?
approvalUser
.
getWxId
():
userIds
+
"|"
+
approvalUser
.
getWxId
();
}
}
//发送企业微信消息内容
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/blancherecive"
);
String
content
=
"你好!您有样品处理任务被退回,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行接查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
return
BaseResponse
.
okMsg
(
"已退回样品处理任务"
);
}
...
...
@@ -2129,8 +2201,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
wrapper
;
}
//重新派发样品处理任务,提醒样品处理人查看
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品处理任务,请前往\n"
+
systemUrl
+
"进行接受。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/sampledetail"
);
String
content
=
"你好!您有一条新的样品处理任务,请前往\n"
+
systemUrL
+
"进行查看。"
;
SysUser
handleUser
=
userService
.
getById
(
sampleHandle
.
getUserId
());
if
(
handleUser
==
null
||
StringUtils
.
isEmpty
(
handleUser
.
getWxId
())){
return
BaseResponse
.
errorMsg
(
"样品处理人信息错误"
);
...
...
@@ -2281,7 +2355,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
BaseResponse
.
errorMsg
(
"联系管理员.配置检测组名称为"
+
teamGroup
.
getName
()+
"产值信息!"
);
}
//消息推送
BaseResponse
wrapper
=
userMessageService
.
sendMessage
(
distributionTeamQuery
.
getUserId
(),
"您有一条样品检测信息等待
接受
"
,
entrust
.
getId
(),
SysUserMessage
.
MessageType
.
ENTRUST
);
BaseResponse
wrapper
=
userMessageService
.
sendMessage
(
distributionTeamQuery
.
getUserId
(),
"您有一条样品检测信息等待
检测
"
,
entrust
.
getId
(),
SysUserMessage
.
MessageType
.
ENTRUST
);
if
(
wrapper
.
getCode
()
!=
200
){
return
wrapper
;
}
...
...
@@ -2310,9 +2384,11 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
entrust
.
setStatus
(
5
).
setIsDistribution
(
1
);
entrustMapper
.
updateById
(
entrust
);
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"派发检测项目任务"
,
null
);
//派发样品样品检测任务,提醒检测人员查看
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品检测任务,请前往\n"
+
systemUrl
+
"进行接受
。"
;
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/recivedetail"
);
String
content
=
"你好!您有新的样品检测任务,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行接查看
。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
return
BaseResponse
.
okMsg
(
"已派发检测项目任务"
);
}
...
...
@@ -2757,6 +2833,30 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
}
//检测人退回样品检测任务,提醒评审人员查看
List
<
Integer
>
approvalIdList
=
sysApprovalMapper
.
getApprovalId
(
"委托评审"
);
if
(
approvalIdList
==
null
)
{
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
String
userIds
=
""
;
for
(
Integer
approvalId
:
approvalIdList
){
SysUser
approvalUser
=
userService
.
getById
(
approvalId
);
if
(
approvalUser
==
null
){
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
BaseResponse
wrapper
=
userMessageService
.
sendMessage
(
approvalId
,
"您有一条被退回的检测任务"
,
entrust
.
getId
(),
SysUserMessage
.
MessageType
.
ENTRUST
);
if
(
wrapper
.
getCode
()
!=
200
){
return
wrapper
;
}
if
(
StringUtils
.
isNotBlank
(
approvalUser
.
getWxId
())){
userIds
=
userIds
.
equals
(
""
)?
approvalUser
.
getWxId
():
userIds
+
"|"
+
approvalUser
.
getWxId
();
}
}
//发送企业微信消息内容
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/blancherecive"
);
String
content
=
"你好!您有样品检测任务被退回,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
//记录委托单日志
logsService
.
saveLog
(
SysLogs
.
ObjType
.
ENTRUST_LOG
,
entrust
.
getId
(),
"退回样品处理任务"
,
null
);
return
BaseResponse
.
okMsg
(
"已退回样品处理任务"
);
...
...
@@ -2846,8 +2946,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
wrapper
;
}
//发送企业微信消息内容
String
content
=
"你好!您有一条新的样品检测任务,请前往\n"
+
systemUrl
+
"进行接受。"
;
//重新派发样品检测 提醒检测新的人员查看
// 发送企业微信消息内容
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/recivedetail"
);
String
content
=
"你好!您有新的样品检测任务,"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"请前往\n"
+
systemUrL
+
"进行查看。"
;
SysUser
handleUser
=
userService
.
getById
(
sampleDistribution
.
getUserId
());
if
(
handleUser
==
null
||
StringUtils
.
isEmpty
(
handleUser
.
getWxId
())){
return
BaseResponse
.
errorMsg
(
"样品检测人信息错误"
);
...
...
@@ -3183,6 +3285,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
checkTeamResultVo
.
setTeamId
(
sampleDistribution
.
getTeamId
());
Team
team
=
teamMapper
.
selectById
(
sampleDistribution
.
getTeamId
());
checkTeamResultVo
.
setTeamName
(
team
.
getName
());
checkTeamResultVo
.
setRetain
(
team
.
getRetain
());
checkTeamResultVo
.
setStatus
(
sampleDistribution
.
getStatus
());
String
statusValue
=
sampleDistribution
.
getStatus
()==
0
?
"未接受"
:
sampleDistribution
.
getStatus
()==
1
?
"接受"
...
...
@@ -3471,7 +3574,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
entrust
.
setStatus
(
8
);
//校核完成之后 ,提醒评审人员查看
//校核完成之后 ,提醒评审人员
,和委托人员
查看
List
<
Integer
>
approvalIdList
=
sysApprovalMapper
.
getApprovalId
(
"委托评审"
);
if
(
approvalIdList
==
null
)
{
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
...
...
@@ -3495,14 +3598,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
}
//发送企业微信消息内容
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/recivedetail"
);
String
content
=
"你好!"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"已校核完成,请前往\n"
+
systemUr
l
+
"进行查看。"
;
systemUr
L
+
"进行查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
}
else
if
(
query
.
getIsAgree
()
==
2
){
//退回
...
...
@@ -3534,6 +3635,19 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
distributionMapper
.
updateById
(
dis
);
}
//校核退回 提醒检测人员查看
String
userIds
=
""
;
SysUser
checkUser
=
userService
.
getById
(
checkinput
.
getUserId
());
if
(
checkUser
!=
null
&&
checkUser
.
getWxId
()!=
null
){
userIds
=
checkUser
.
getWxId
();
}
//发送企业微信消息内容
String
systemUrL
=
weiXinService
.
createMessage
(
entrust
.
getId
(),
"/blanche/recivedetail"
);
String
content
=
"你好!"
+
"委托单号"
+
entrust
.
getEntrustCode
()+
"校核退回,请前往\n"
+
systemUrL
+
"进行查看。"
;
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/WeiXinService.java
View file @
04283a27
...
...
@@ -2,6 +2,7 @@ package cn.wise.sc.cement.business.service.impl;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.wise.sc.cement.business.entity.SysUser
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.LoginUser
;
...
...
@@ -29,7 +30,9 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
WeiXinService
{
...
...
@@ -57,13 +60,20 @@ public class WeiXinService {
final
static
String
ACCESS_TOKEN_APP
=
"ACCESS_TOKEN_APP"
;
final
static
String
JSAPITICKET
=
"JSAPITICKET"
;
@Value
(
"${weixin.systemUrl}"
)
private
String
systemUrl
;
@Value
(
"${weixin.backOrcUrl}"
)
private
String
backOrcUrl
;
/**
* 获取登录token 测试服务器部署
*
* @param code
* @return
*/
public
BaseResponse
<
String
>
getTestToken
(
String
code
)
{
public
BaseResponse
<
Map
<
String
,
String
>
>
getTestToken
(
String
code
)
{
if
(
StrUtil
.
isEmpty
(
code
))
{
return
BaseResponse
.
errorMsg
(
"code为必填项!"
);
}
...
...
@@ -82,12 +92,13 @@ public class WeiXinService {
if
(
sysUser
.
getIsDelete
()
==
0
)
{
return
BaseResponse
.
errorMsg
(
"用户被删除!"
);
}
Map
<
String
,
String
>
map
=
getDoubleToken
(
sysUser
);
//生成token,存入redis
String
token
=
JwtUtil
.
createToken
(
sysUser
.
getId
(),
sysUser
.
getUsername
(),
sysUser
.
getName
(),
sysUser
.
getPhone
());
System
.
out
.
println
(
token
);
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
return
BaseResponse
.
okData
(
token
);
//
String token = JwtUtil.createToken(sysUser.getId(), sysUser.getUsername(),
//
sysUser.getName(), sysUser.getPhone());
//
System.out.println(token);
//
redisUtil.setString(sysUser.getId().toString(), token, 3600);
return
BaseResponse
.
okData
(
map
);
}
catch
(
Exception
e
)
{
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
}
...
...
@@ -100,7 +111,7 @@ public class WeiXinService {
* @param type PC管理端 APP小程序端
* @return
*/
public
BaseResponse
<
String
>
getToken
(
String
code
,
String
type
)
{
public
BaseResponse
<
Map
<
String
,
String
>
>
getToken
(
String
code
,
String
type
)
{
if
(
StrUtil
.
isEmpty
(
code
))
{
return
BaseResponse
.
errorMsg
(
"code为必填项!"
);
}
...
...
@@ -166,17 +177,98 @@ public class WeiXinService {
if
(
sysUser
.
getIsDelete
()
==
0
)
{
return
BaseResponse
.
errorMsg
(
"用户被删除!"
);
}
//生成token,存入redis
String
token
=
JwtUtil
.
createToken
(
sysUser
.
getId
(),
sysUser
.
getUsername
(),
sysUser
.
getName
(),
sysUser
.
getPhone
());
System
.
out
.
println
(
token
);
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
return
BaseResponse
.
okData
(
token
);
Map
<
String
,
String
>
map
=
getDoubleToken
(
sysUser
);
// //生成token,存入redis
// String token = JwtUtil.createToken(sysUser.getId(), sysUser.getUsername(),
// sysUser.getName(), sysUser.getPhone());
// redisUtil.setString(sysUser.getId().toString(), token, 3600);
//
// //生成刷新token,设置为永不过期,用于生成新的token
// String refreshToken = JwtUtil.createToken(sysUser.getId(), sysUser.getUsername(),
// sysUser.getName(), sysUser.getPhone());
// redisUtil.setString("REFUSH_"+sysUser.getId().toString(), refreshToken, -1);
//
// Map<String,String> map = new HashMap();
// map.put("token", token);
// map.put("refreshToken", refreshToken);
return
BaseResponse
.
okData
(
map
);
}
catch
(
Exception
e
)
{
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
}
}
/**
* 生成登录token和刷新token
* @param sysUser
* @return
*/
private
Map
<
String
,
String
>
getDoubleToken
(
SysUser
sysUser
){
//生成token,存入redis
String
token
=
JwtUtil
.
createToken
(
sysUser
.
getId
(),
sysUser
.
getUsername
(),
sysUser
.
getName
(),
sysUser
.
getPhone
());
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
//生成刷新token,设置为永不过期,用于生成新的token
String
refreshToken
=
JwtUtil
.
createToken
(
sysUser
.
getId
(),
sysUser
.
getUsername
(),
sysUser
.
getName
(),
sysUser
.
getPhone
());
redisUtil
.
setString
(
"REFUSH_"
+
sysUser
.
getId
(),
refreshToken
);
Map
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"token"
,
token
);
map
.
put
(
"refreshToken"
,
refreshToken
);
return
map
;
}
/**
* 刷新token
* @param refreshToken
* @return
*/
public
BaseResponse
<
Map
<
String
,
String
>>
getNewToken
(
String
refreshToken
){
String
userId
=
JwtUtil
.
getUserIdByToken
(
refreshToken
);
if
(
userId
==
null
){
return
BaseResponse
.
errorMsg
(
"token信息有误!"
);
}
SysUser
sysUser
=
userService
.
getById
(
Integer
.
valueOf
(
userId
));
if
(
sysUser
==
null
){
return
BaseResponse
.
errorMsg
(
"用户信息有误!"
);
}
//判断前端的刷新token 和数据库中的刷新token是否匹配
String
redisFushToken
=
redisUtil
.
getString
(
"REFUSH_"
+
sysUser
.
getId
()).
toString
();
if
(
redisFushToken
==
null
){
return
BaseResponse
.
errorMsg
(
"token失效!"
);
}
if
(!
redisFushToken
.
equals
(
refreshToken
)){
return
BaseResponse
.
errorMsg
(
"token不匹配!"
);
}
//生成token,存入redis
String
token
=
JwtUtil
.
createToken
(
sysUser
.
getId
(),
sysUser
.
getUsername
(),
sysUser
.
getName
(),
sysUser
.
getPhone
());
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
//生成刷新token,设置为永不过期,用于生成新的token
refreshToken
=
JwtUtil
.
createToken
(
sysUser
.
getId
(),
sysUser
.
getUsername
(),
sysUser
.
getName
(),
sysUser
.
getPhone
());
redisUtil
.
setString
(
"REFUSH_"
+
sysUser
.
getId
(),
refreshToken
);
Map
<
String
,
String
>
map
=
new
HashMap
();
map
.
put
(
"token"
,
token
);
map
.
put
(
"refreshToken"
,
refreshToken
);
return
BaseResponse
.
okData
(
map
);
}
//获取accessToken信息 =======小程序
...
...
@@ -336,6 +428,51 @@ public class WeiXinService {
BigDecimal
bigDecimal
=
NumberUtil
.
toBigDecimal
(
StrUtil
.
trim
(
"111 "
));
}
/**
* 消息访问链接生成
* @param entrustId
* @param accessType
* @return
*
* 1、新增委托 评审人的通知
* path:/blanche/entrustdetail
* id:委托单id
*
* 2、评审驳回、评审修改后的通知
* path:/blanche/wtdetail
* id:委托单id
*
* 3、评审通过后样品处理任务 重新派发样品处理任务 通知
* path:/blanche/sampledetail
* id:委托单id
*
* 4、样品处理任务退回和样品检测任务退回后的通知
* path:/blanche/blancherecive
*
* 5、派发任务后 重新派发样品检测任务 的样品检测任务通知
* path:/blanche/recivedetail
* id:委托单id
*
*
* 6、校核退回 消息推送检测人
* path: '/blanche/recivedetail
* id: 委托单id
*
* 7、校核通过 消息推送委托人
* path: '/blanche/checkdetail',
* id: 委托单id
*
*/
public
String
createMessage
(
Integer
entrustId
,
String
accessType
){
Integer
notice
=
(
int
)(
1
+
Math
.
random
()*(
10
-
1
+
1
));
//https://lab.wisenergy.cn/lab-bangye
String
URL
=
backOrcUrl
+
"?id="
+
entrustId
+
"&path="
+
accessType
+
"¬ice="
+
notice
;
String
systemUrL
=
systemUrl
.
replace
(
"U_R_L"
,
URLUtil
.
encodeAll
(
URL
));
System
.
out
.
println
(
systemUrL
);
return
systemUrL
;
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/CheckCountUtil.java
View file @
04283a27
...
...
@@ -233,7 +233,7 @@ public class CheckCountUtil {
BigDecimal
m
=
getBigDecimal
(
resultMap
.
get
(
"样重m"
).
trim
());
//计算的核心公式结果
BigDecimal
countResult
=
m2
.
subtract
(
m1
).
subtract
(
m3
).
divide
(
m
,
4
).
multiply
(
new
BigDecimal
(
0.343
));
endResult
=
countResult
.
multiply
(
param100
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
);
endResult
=
countResult
.
multiply
(
param100
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
else
if
(
name
.
equals
(
"K<sub>2</sub>O"
)){
if
(
StringUtils
.
isNotBlank
(
resultMap
.
get
(
"CK<sub>2</sub>O"
))
&&
...
...
@@ -328,7 +328,7 @@ public class CheckCountUtil {
BigDecimal
SZ_M1
=
getBigDecimal
(
resultMap
.
get
(
"烧重M1"
).
trim
());
//计算的核心公式结果
BigDecimal
countResult
=
YZ_M1
.
add
(
MZ_M1
).
subtract
(
SZ_M1
).
divide
(
YZ_M1
,
4
);
endResult
=
countResult
.
multiply
(
param100
);
endResult
=
countResult
.
multiply
(
param100
)
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
)
;
}
}
else
if
(
name
.
equals
(
"Mad2"
)){
if
(
StringUtils
.
isNotBlank
(
resultMap
.
get
(
"样重M2"
))
&&
...
...
@@ -340,7 +340,7 @@ public class CheckCountUtil {
BigDecimal
SZ_M2
=
getBigDecimal
(
resultMap
.
get
(
"烧重M2"
).
trim
());
//计算的核心公式结果
BigDecimal
countResult
=
YZ_M2
.
add
(
MZ_M2
).
subtract
(
SZ_M2
).
divide
(
YZ_M2
,
4
);
endResult
=
countResult
.
multiply
(
param100
);
endResult
=
countResult
.
multiply
(
param100
)
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
)
;
}
}
else
if
(
name
.
equals
(
"Aad1"
)){
...
...
@@ -353,7 +353,7 @@ public class CheckCountUtil {
BigDecimal
YZ_A1
=
getBigDecimal
(
resultMap
.
get
(
"样重A1"
).
trim
());
//计算的核心公式结果
BigDecimal
countResult
=
SZ_A1
.
subtract
(
MZ_A1
).
divide
(
YZ_A1
,
4
);
endResult
=
countResult
.
multiply
(
param100
);
endResult
=
countResult
.
multiply
(
param100
)
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
)
;
}
}
else
if
(
name
.
equals
(
"Aad2"
)){
...
...
@@ -366,7 +366,7 @@ public class CheckCountUtil {
BigDecimal
YZ_A2
=
getBigDecimal
(
resultMap
.
get
(
"样重A2"
).
trim
());
//计算的核心公式结果
BigDecimal
countResult
=
SZ_A2
.
subtract
(
MZ_A2
).
divide
(
YZ_A2
,
4
);
endResult
=
countResult
.
multiply
(
param100
);
endResult
=
countResult
.
multiply
(
param100
)
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
)
;
}
}
else
if
(
name
.
equals
(
"焦渣"
)){
...
...
@@ -395,11 +395,11 @@ public class CheckCountUtil {
*/
public
static
String
countSO3
(
Map
<
String
,
String
>
resultMap
,
Map
<
String
,
String
>
countMap
)
{
BigDecimal
count
=
null
;
if
(
StringUtils
.
isNotBlank
(
resultMap
.
get
(
"重量法SO<sub>2
</sub>"
))
&&
if
(
StringUtils
.
isNotBlank
(
countMap
.
get
(
"重量法SO<sub>3
</sub>"
))
&&
StringUtils
.
isNotBlank
(
resultMap
.
get
(
"显示值"
))&&
StringUtils
.
isNotBlank
(
resultMap
.
get
(
"样重SO<sub>3</sub>"
))
){
BigDecimal
weightSO3
=
getBigDecimal
(
countMap
.
get
(
"重量法SO<sub>
2
</sub>"
));
BigDecimal
weightSO3
=
getBigDecimal
(
countMap
.
get
(
"重量法SO<sub>
3
</sub>"
));
BigDecimal
displaySO3
=
getBigDecimal
(
resultMap
.
get
(
"显示值"
).
trim
());
BigDecimal
mSO3
=
getBigDecimal
(
resultMap
.
get
(
"样重SO<sub>3</sub>"
).
trim
());
BigDecimal
elseResult
=
displaySO3
.
multiply
(
new
BigDecimal
(
2.5
));
...
...
@@ -410,11 +410,11 @@ public class CheckCountUtil {
if
((
resultInt1
&
1
)
==
1
){
//如果结果为奇数
BigDecimal
jsResult
=
weightSO3
.
compareTo
(
new
BigDecimal
(
0
))==
1
?
weightSO3:
elseResult
.
multiply
(
mSO3
).
divide
(
mSO3
,
4
);
count
=
jsResult
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
);
count
=
jsResult
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
else
{
BigDecimal
osResult
=
weightSO3
.
compareTo
(
new
BigDecimal
(
0
))==
1
?
weightSO3:
elseResult
.
multiply
(
mSO3
).
divide
(
mSO3
,
4
);
count
=
osResult
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
);
count
=
osResult
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
return
count
==
null
?
""
:
count
.
toString
();
...
...
@@ -443,7 +443,7 @@ public class CheckCountUtil {
for
(
String
s:
list
)
{
count
=
count
.
add
(
new
BigDecimal
(
s
));
}
return
count
.
toString
();
return
count
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -464,7 +464,7 @@ public class CheckCountUtil {
BigDecimal
SiO2
=
getBigDecimal
(
countMap
.
get
(
"SiO<sub>2</sub>"
));
KH
=
CaO
.
subtract
(
new
BigDecimal
(
1.65
).
multiply
(
Al2O3_TiO2
)).
subtract
(
new
BigDecimal
(
0.35
).
multiply
(
Fe2O3
)).
divide
(
new
BigDecimal
(
2.8
),
4
).
divide
(
SiO2
,
4
);
}
return
KH
==
null
?
""
:
KH
.
toString
();
return
KH
==
null
?
""
:
KH
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -483,7 +483,7 @@ public class CheckCountUtil {
BigDecimal
Fe2O3
=
getBigDecimal
(
countMap
.
get
(
"Fe<sub>2</sub>O<sub>3</sub>"
));
SM
=
SiO2
.
divide
(
Al2O3_TiO2
.
add
(
Fe2O3
),
4
);
}
return
SM
==
null
?
""
:
SM
.
toString
();
return
SM
==
null
?
""
:
SM
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -500,7 +500,7 @@ public class CheckCountUtil {
BigDecimal
Fe2O3
=
getBigDecimal
(
countMap
.
get
(
"Fe<sub>2</sub>O<sub>3</sub>"
));
AM
=
Al2O3_TiO2
.
divide
(
Fe2O3
,
4
);
}
return
AM
==
null
?
""
:
AM
.
toString
();
return
AM
==
null
?
""
:
AM
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -554,7 +554,7 @@ public class CheckCountUtil {
BC_Mad
=
Mad1
.
add
(
Mad2
).
divide
(
new
BigDecimal
(
2
),
4
);
}
return
BC_Mad
==
null
?
""
:
BC_Mad
.
toString
();
return
BC_Mad
==
null
?
""
:
BC_Mad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -577,7 +577,7 @@ public class CheckCountUtil {
Mad
=
BC_Mad
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
return
Mad
==
null
?
""
:
Mad
.
toString
();
return
Mad
==
null
?
""
:
Mad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -596,7 +596,7 @@ public class CheckCountUtil {
BC_Aad
=
Aad1
.
add
(
Aad2
).
divide
(
new
BigDecimal
(
2
),
4
);
}
return
BC_Aad
==
null
?
""
:
BC_Aad
.
toString
();
return
BC_Aad
==
null
?
""
:
BC_Aad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -618,7 +618,7 @@ public class CheckCountUtil {
Aad
=
BC_Aad
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
return
Aad
==
null
?
""
:
Aad
.
toString
();
return
Aad
==
null
?
""
:
Aad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -644,7 +644,7 @@ public class CheckCountUtil {
}
return
count
==
null
?
""
:
count
.
toString
();
return
count
==
null
?
""
:
count
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -668,7 +668,7 @@ public class CheckCountUtil {
BigDecimal
countResult
=
YZ_V2
.
add
(
MZ_V2
).
subtract
(
SZ_V2
).
divide
(
YZ_V2
,
4
);
count
=
countResult
.
multiply
(
param100
).
subtract
(
BC_Mad
);
}
return
count
==
null
?
""
:
count
.
toString
();
return
count
==
null
?
""
:
count
.
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -686,7 +686,7 @@ public class CheckCountUtil {
//计算Vad1 和 Vad2 的平均值
BC_Vad
=
Vad1
.
add
(
Vad2
).
divide
(
new
BigDecimal
(
2
),
4
);
}
return
BC_Vad
==
null
?
""
:
BC_Vad
.
toString
();
return
BC_Vad
==
null
?
""
:
BC_Vad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -709,7 +709,7 @@ public class CheckCountUtil {
Vad
=
BC_Vad
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
return
Vad
==
null
?
""
:
Vad
.
toString
();
return
Vad
==
null
?
""
:
Vad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -732,7 +732,7 @@ public class CheckCountUtil {
}
/**
* 求
Vdaf Vad *100/(100-Mad-Aad)
* 求
K1,
* @param countMap
* @return
*/
...
...
@@ -751,7 +751,7 @@ public class CheckCountUtil {
))));
}
return
K1_
==
null
?
""
:
K1_
.
toString
();
return
K1_
==
null
?
""
:
K1_
.
setScale
(
1
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
@@ -988,7 +988,7 @@ public class CheckCountUtil {
count
=
value
.
multiply
(
new
BigDecimal
(
4.1816
)).
divide
(
param1000
,
4
);
}
return
count
==
null
?
""
:
count
.
toString
();
return
count
==
null
?
""
:
count
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
}
/**
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/JwtUtil.java
View file @
04283a27
...
...
@@ -148,7 +148,7 @@ public class JwtUtil {
try
{
claims
=
Jwts
.
parser
().
setSigningKey
(
getKey
(
SECRET_KEY
,
DEFAULTSIGN
.
getJcaName
())).
parseClaimsJws
(
token
)
.
getBody
();
userid
=
(
String
)
claims
.
get
(
"id"
);
userid
=
claims
.
get
(
"id"
).
toString
(
);
}
catch
(
Exception
e
)
{
LOGGER
.
info
(
"解密userId失败:"
+
token
);
return
userid
;
...
...
cement-business/src/main/resources/application.yml
View file @
04283a27
...
...
@@ -48,7 +48,11 @@ weixin:
agentId
:
1000150
agentSecret
:
zWIO_kt36d1jta3R76s6WmKFdfs2TuJ1wTQu1IXO0Fc
backUrl
:
https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system
systemUrl
:
'
<a
href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwc7ae84e6af6ba921&redirect_uri=https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
backOrcUrl
:
https://fccdcmtl.sinoma-tianjin.com/lab-system
systemUrl
:
'
<a
href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwc7ae84e6af6ba921&redirect_uri=U_R_L&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
# 原始链接备份
# systemUrl: '<a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwc7ae84e6af6ba921&redirect_uri=https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
#测试服务器
...
...
@@ -59,10 +63,20 @@ weixin:
# agentSecret: gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o
# agentSecretPC: itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A
# backUrl: https%3a%2f%2flab.wisenergy.cn%2flab-bangye
# backOrcUrl: https://lab.wisenergy.cn/lab-bangye
# systemUrl: '<a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww348f91b2573c1867&redirect_uri=U_R_L&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
#邦业服务器
#weixin:
# corpId: ww348f91b2573c1867
# agentId: 1000004
# agentIdPC: 1000005
# agentSecret: flISLojPiE1_ieO9bPgyZ4g_4O-Rr-FKzs7e7p3HEtA
# agentSecretPC: ABagJNftdn1uOYsDLrhlCIM8jZdcTgEA9DyX6kn_-hY
# backUrl: https%3a%2f%2flab.wisenergy.cn%2flab-bangye
# backOrcUrl: https://lab.wisenergy.cn/lab-bangye
# systemUrl: '<a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww348f91b2573c1867&redirect_uri=U_R_L&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
...
...
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