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
6a2b08fd
Commit
6a2b08fd
authored
Oct 23, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Plain Diff
11111
parents
c5a1308b
6a4acfae
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
282 additions
and
233 deletions
+282
-233
NonStandardApplyController.java
...ement/business/controller/NonStandardApplyController.java
+3
-3
NormProductionController.java
.../cement/business/controller/NormProductionController.java
+4
-3
ReportController.java
.../wise/sc/cement/business/controller/ReportController.java
+3
-2
WeiXinController.java
.../wise/sc/cement/business/controller/WeiXinController.java
+105
-65
NonStandardApplyMapper.java
...ise/sc/cement/business/mapper/NonStandardApplyMapper.java
+1
-1
NonStandardApplyMapper.xml
.../sc/cement/business/mapper/xml/NonStandardApplyMapper.xml
+1
-0
SampleCheckMapper.xml
.../wise/sc/cement/business/mapper/xml/SampleCheckMapper.xml
+4
-5
IndustrialReport.java
...va/cn/wise/sc/cement/business/model/IndustrialReport.java
+1
-1
SixElementReport.java
...va/cn/wise/sc/cement/business/model/SixElementReport.java
+1
-1
INonStandardApplyService.java
.../sc/cement/business/service/INonStandardApplyService.java
+1
-1
INormProductionService.java
...se/sc/cement/business/service/INormProductionService.java
+1
-1
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+2
-2
NonStandardApplyServiceImpl.java
...nt/business/service/impl/NonStandardApplyServiceImpl.java
+4
-4
NormProductionServiceImpl.java
...ment/business/service/impl/NormProductionServiceImpl.java
+11
-6
QualityApplyServiceImpl.java
...cement/business/service/impl/QualityApplyServiceImpl.java
+3
-4
WeiXinService.java
...n/wise/sc/cement/business/service/impl/WeiXinService.java
+135
-131
FastDFSUtils.java
...ava/cn/wise/sc/cement/business/util/dfs/FastDFSUtils.java
+0
-3
Global.java
...n/java/cn/wise/sc/cement/business/util/weixin/Global.java
+2
-0
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/NonStandardApplyController.java
View file @
6a2b08fd
...
...
@@ -59,11 +59,11 @@ public class NonStandardApplyController {
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"获取
所有
非标产值申请"
)
@ApiOperation
(
value
=
"获取
当前用户所有的
非标产值申请"
)
@GetMapping
(
"/getList"
)
public
BaseResponse
getList
()
{
public
BaseResponse
getList
(
Integer
userId
)
{
try
{
return
iNonStandardApplyService
.
getList
();
return
iNonStandardApplyService
.
getList
(
userId
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取所有的非标产值申请{}"
,
e
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/NormProductionController.java
View file @
6a2b08fd
...
...
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PutMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -225,16 +226,16 @@ public class NormProductionController {
@GetMapping
(
"/workload/statistics"
)
@ApiOperation
(
"工作量统计"
)
public
BaseResponse
<
List
<
WorkloadStatisticsVo
>>
workloadStatistics
(
String
start
,
String
end
)
{
public
BaseResponse
<
List
<
WorkloadStatisticsVo
>>
workloadStatistics
(
String
start
,
String
end
,
Integer
userId
)
{
Date
startTime
=
null
;
Date
endTime
=
DateUtil
.
date
();
if
(
StrUtil
.
isNotBlank
(
start
)
&&
StrUtil
.
isNotBlank
(
end
)){
if
(
StrUtil
.
isNotBlank
(
start
)
&&
StrUtil
.
isNotBlank
(
end
))
{
startTime
=
DateUtil
.
parseDate
(
start
);
endTime
=
DateUtil
.
parseDate
(
end
);
}
return
BaseResponse
.
okData
(
iNormProductionService
.
workloadStatistics
(
startTime
,
endTime
));
return
BaseResponse
.
okData
(
iNormProductionService
.
workloadStatistics
(
startTime
,
endTime
,
userId
));
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/ReportController.java
View file @
6a2b08fd
...
...
@@ -107,6 +107,7 @@ public class ReportController {
//六元素导出
List
<
SixElementReport
>
list
=
iEntrustService
.
getSampleSixElementCheck
(
entrustId
);
list
.
forEach
(
this
::
initMapStr2AlongPro
);
List
<
SixElementReport
>
al2o3AndTio2List
=
list
.
stream
()
.
filter
(
arg
->
!
"-"
.
equals
(
arg
.
getAl2o3AndTio2
()))
...
...
@@ -135,7 +136,7 @@ public class ReportController {
*/
private
void
initMapStr2AlongPro
(
SixElementReport
sixElement
)
{
String
countResult
=
sixElement
.
getCountResult
();
String
countResult
=
sixElement
.
getCountResult
s
();
HashMap
<
String
,
String
>
countResultMap
=
JSON
.
parseObject
(
countResult
,
HashMap
.
class
);
sixElement
.
setAl2o3
(
"-"
);
...
...
@@ -159,7 +160,7 @@ public class ReportController {
}
private
void
initMapStr2AlongPro
(
IndustrialReport
industrialReport
){
String
countResult
=
industrialReport
.
getCountResult
();
String
countResult
=
industrialReport
.
getCountResult
s
();
HashMap
<
String
,
String
>
countResultMap
=
JSON
.
parseObject
(
countResult
,
HashMap
.
class
);
industrialReport
.
setAad
(
countResultMap
.
getOrDefault
(
IndustrialElementKey
.
Aad
.
getKey
(),
"0"
));
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/WeiXinController.java
View file @
6a2b08fd
package
cn
.
wise
.
sc
.
cement
.
business
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.service.impl.WeiXinService
;
import
cn.wise.sc.cement.business.wrapper.WrapMapper
;
import
cn.wise.sc.cement.business.wrapper.Wrapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -13,7 +13,11 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
@Api
(
tags
=
"微信接口"
)
@RestController
...
...
@@ -27,62 +31,98 @@ public class WeiXinController {
@ApiOperation
(
value
=
"获取登录token-小程序端"
)
@GetMapping
(
"/getToken"
)
public
BaseResponse
getToken
(
String
code
){
public
BaseResponse
getToken
(
String
code
)
{
log
.
debug
(
"============================================"
);
log
.
debug
(
"code: {}"
,
code
);
log
.
debug
(
"============================================="
);
try
{
return
weiXinService
.
getToken
(
code
,
"APP"
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
return
weiXinService
.
getToken
(
code
,
"APP"
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"获取登录token-管理端"
)
@GetMapping
(
"/getPCToken"
)
public
BaseResponse
getPCToken
(
String
code
)
{
public
BaseResponse
getPCToken
(
String
code
)
{
try
{
return
weiXinService
.
getToken
(
code
,
"PC"
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取登录token{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"获取accessToken信息-小程序端
"
)
@GetMapping
(
"/getAccessToken
"
)
public
BaseResponse
getAccessToken
()
{
@ApiOperation
(
value
=
"当前登录用户
"
)
@GetMapping
(
"/getLoginUser
"
)
public
BaseResponse
getLoginUser
()
{
try
{
String
accessToken
=
weiXinService
.
getAccessToken
();
return
BaseResponse
.
okData
(
accessToken
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"获取accessToken信息-小程序端{}"
,
e
);
return
weiXinService
.
getLoginUser
(
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"当前登录用户{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"获取accessToken信息-管理端"
)
@GetMapping
(
"/getPCAccessToken"
)
public
BaseResponse
getPCAccessToken
(){
try
{
String
accessToken
=
weiXinService
.
getPCAccessToken
();
return
BaseResponse
.
okData
(
accessToken
);
}
catch
(
Exception
e
){
log
.
debug
(
"获取accessToken信息-管理端{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
@GetMapping
(
"/jsapiTicket"
)
@ApiOperation
(
"获取jsapi_ticket"
)
public
BaseResponse
<
Map
>
getAccessToken
()
{
String
accessToken
=
weiXinService
.
getJsapiTicket
();
Map
<
String
,
String
>
rts
=
new
HashMap
<>(
5
);
rts
.
put
(
"jsapi_ticket"
,
accessToken
);
rts
.
put
(
"timestamp"
,
(
new
Date
()).
getTime
()
/
1000
+
""
);
rts
.
put
(
"noncestr"
,
"Wm3WZYTPz0wzccnW"
);
rts
.
put
(
"app_id"
,
"ww348f91b2573c1867"
);
rts
.
put
(
"jsApiList"
,
"['scanQRCode']"
);
return
BaseResponse
.
okData
(
rts
);
}
@GetMapping
(
"/signature"
)
@ApiOperation
(
"获取accessToken"
)
public
BaseResponse
<
String
>
signature
(
String
param
)
{
MessageDigest
md
;
String
tmpStr
=
null
;
@ApiOperation
(
value
=
"当前登录用户"
)
@GetMapping
(
"/getLoginUser"
)
public
BaseResponse
getLoginUser
(){
try
{
return
weiXinService
.
getLoginUser
();
}
catch
(
Exception
e
){
log
.
debug
(
"当前登录用户{}"
,
e
);
md
=
MessageDigest
.
getInstance
(
"SHA-1"
);
byte
[]
digest
=
md
.
digest
(
param
.
getBytes
());
tmpStr
=
byteToStr
(
digest
);
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
return
BaseResponse
.
okData
(
StrUtil
.
swapCase
(
tmpStr
)
);
}
/**
* 将字节数组转换为十六进制字符串
*
* @param byteArray
* @return
*/
private
static
String
byteToStr
(
byte
[]
byteArray
)
{
String
strDigest
=
""
;
for
(
int
i
=
0
;
i
<
byteArray
.
length
;
i
++)
{
strDigest
+=
byteToHexStr
(
byteArray
[
i
]);
}
return
strDigest
;
}
/**
* 将字节转换为十六进制字符串
*
* @param mByte
* @return
*/
private
static
String
byteToHexStr
(
byte
mByte
)
{
char
[]
Digit
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
char
[]
tempArr
=
new
char
[
2
];
tempArr
[
0
]
=
Digit
[(
mByte
>>>
4
)
&
0X0F
];
tempArr
[
1
]
=
Digit
[
mByte
&
0X0F
];
String
s
=
new
String
(
tempArr
);
return
s
;
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/NonStandardApplyMapper.java
View file @
6a2b08fd
...
...
@@ -24,7 +24,7 @@ public interface NonStandardApplyMapper extends BaseMapper<NonStandardApply> {
List
<
NonStandardApplyVo
>
getById
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
List
<
NonStandardApplyVo
>
getList
(
QueryWrapper
<
NonStandardApply
>
qw
);
List
<
NonStandardApplyVo
>
getList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
List
<
Map
<
String
,
Object
>>
exportList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/NonStandardApplyMapper.xml
View file @
6a2b08fd
...
...
@@ -28,6 +28,7 @@
select na.*,su.name as name,su.username as account
from nonstandard_apply na
LEFT JOIN sys_user su ON su.id = na.user_id
<include
refid=
"where"
/>
order by na.id asc
</select>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/SampleCheckMapper.xml
View file @
6a2b08fd
...
...
@@ -4,7 +4,7 @@
<select
id=
"getSampleSixElementCheck"
resultType=
"cn.wise.sc.cement.business.model.SixElementReport"
>
SELECT * FROM (SELECT count_result,entrust_id,team_group_name,sct.sample_id FROM sample_check sc
SELECT * FROM (SELECT count_result
s
,entrust_id,team_group_name,sct.sample_id FROM sample_check sc
LEFT JOIN
(SELECT check_id,sample_id FROM sample_check_team) sct
ON sct.check_id = sc.id
...
...
@@ -14,12 +14,12 @@
(SELECT cement_code,sample_code,sample_form,`name` as sample_name,weight,id
FROM sample) s
ON s.id = sscct.sample_id AND entrust_id = #{entrustId}
WHERE count_result IS NOT NULL;
WHERE count_result
s
IS NOT NULL;
</select>
<select
id=
"getSampleIndustrialCheck"
resultType=
"cn.wise.sc.cement.business.model.IndustrialReport"
>
SELECT * FROM (SELECT count_result,entrust_id,team_group_name,sct.sample_id FROM sample_check sc
SELECT * FROM (SELECT count_result
s
,entrust_id,team_group_name,sct.sample_id FROM sample_check sc
LEFT JOIN
(SELECT check_id,sample_id FROM sample_check_team) sct
ON sct.check_id = sc.id
...
...
@@ -29,7 +29,6 @@
(SELECT cement_code,sample_code,sample_form,`name` as sample_name,weight,id
FROM sample) s
ON s.id = sscct.sample_id AND entrust_id = #{entrustId}
WHERE count_result IS NOT NULL;
WHERE count_results IS NOT NULL;
</select>
</mapper>
cement-business/src/main/java/cn/wise/sc/cement/business/model/IndustrialReport.java
View file @
6a2b08fd
...
...
@@ -41,7 +41,7 @@ public class IndustrialReport implements Serializable {
/**
* 校核数据
*/
private
String
countResult
;
private
String
countResult
s
;
//下面是工业特性得检测项
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/SixElementReport.java
View file @
6a2b08fd
...
...
@@ -42,7 +42,7 @@ public class SixElementReport implements Serializable {
/**
* 校核数据
*/
private
String
countResult
;
private
String
countResult
s
;
//下面为六元素
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/INonStandardApplyService.java
View file @
6a2b08fd
...
...
@@ -34,7 +34,7 @@ public interface INonStandardApplyService extends IService<NonStandardApply> {
*
* @return List
*/
BaseResponse
<
List
<
NonStandardApplyVo
>>
getList
();
BaseResponse
<
List
<
NonStandardApplyVo
>>
getList
(
Integer
userId
);
/**
* 通过id查询非标产值申请信息
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/INormProductionService.java
View file @
6a2b08fd
...
...
@@ -121,5 +121,5 @@ public interface INormProductionService extends IService<NormProduction> {
* @param endTime 结束时间
* @return 统计对象
*/
List
<
WorkloadStatisticsVo
>
workloadStatistics
(
Date
startTime
,
Date
endTime
);
List
<
WorkloadStatisticsVo
>
workloadStatistics
(
Date
startTime
,
Date
endTime
,
Integer
userId
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
6a2b08fd
...
...
@@ -476,7 +476,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
for
(
String
teamId
:
teamIdS
)
{
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
&&
"1"
.
equals
(
team
.
getQualifications
()
))
{
if
(
team
!=
null
&&
1
==
team
.
getQualifications
(
))
{
team
.
getName
();
teamName
=
teamName
.
equals
(
""
)
?
team
.
getName
()
:
(
teamName
+
"、"
+
team
.
getName
());
}
...
...
@@ -2277,7 +2277,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
for
(
String
idStr
:
teamSplit
)
{
int
id
=
Integer
.
parseInt
(
idStr
);
teams
.
forEach
(
opt
->
{
if
(
opt
.
getId
()
==
id
&&
"1"
.
equals
(
opt
.
getQualifications
()
))
{
if
(
opt
.
getId
()
==
id
&&
1
==
opt
.
getQualifications
(
))
{
if
(
StrUtil
.
isBlank
(
arg
.
getTeamName
()))
{
arg
.
setTeamName
(
opt
.
getName
());
}
else
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/NonStandardApplyServiceImpl.java
View file @
6a2b08fd
...
...
@@ -52,10 +52,10 @@ public class NonStandardApplyServiceImpl extends ServiceImpl<NonStandardApplyMap
}
@Override
public
BaseResponse
<
List
<
NonStandardApplyVo
>>
getList
()
{
QueryWrapper
<
NonStandardApply
>
qw
=
new
QueryWrapper
<>();
qw
.
ge
(
"status"
,
0
);
List
<
NonStandardApplyVo
>
list
=
nonStandardApplyMapper
.
getList
(
qw
);
public
BaseResponse
<
List
<
NonStandardApplyVo
>>
getList
(
Integer
userId
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
List
<
NonStandardApplyVo
>
list
=
nonStandardApplyMapper
.
getList
(
params
);
return
BaseResponse
.
okData
(
list
);
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/NormProductionServiceImpl.java
View file @
6a2b08fd
...
...
@@ -592,7 +592,7 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
}
@Override
public
List
<
WorkloadStatisticsVo
>
workloadStatistics
(
Date
startTime
,
Date
endTime
)
{
public
List
<
WorkloadStatisticsVo
>
workloadStatistics
(
Date
startTime
,
Date
endTime
,
Integer
userId
)
{
long
start
=
getDefaultStart
(
startTime
==
null
?
0
:
startTime
.
getTime
());
long
end
=
getDefaultEnd
(
endTime
.
getTime
());
...
...
@@ -601,18 +601,23 @@ public class NormProductionServiceImpl extends ServiceImpl<NormProductionMapper,
QueryWrapper
<
SampleDistribution
>
qw
=
new
QueryWrapper
<>();
if
(
startTime
!=
null
)
{
qw
.
ge
(
"finish_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
start
),
"yyyy-MM-dd"
));
qw
.
ge
(
"finish_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
start
),
"yyyy-MM-dd"
));
}
qw
.
le
(
"finish_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
end
),
"yyyy-MM-dd"
));
if
(
userId
!=
null
&&
userId
!=
0
)
{
qw
.
eq
(
"user_id"
,
userId
);
}
qw
.
le
(
"finish_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
end
),
"yyyy-MM-dd"
));
qw
.
eq
(
"status"
,
2
);
List
<
SampleDistribution
>
sampleDistributions
=
iSampleDistributionService
.
list
(
qw
);
//脾气比能力大 蠢货
QueryWrapper
<
NonStandardApply
>
qwA
=
new
QueryWrapper
<>();
if
(
startTime
!=
null
)
{
qwA
.
ge
(
"start_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
start
),
"yyyy-MM-dd"
));
qwA
.
ge
(
"start_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
start
),
"yyyy-MM-dd"
));
}
if
(
userId
!=
null
&&
userId
!=
0
)
{
qwA
.
eq
(
"user_id"
,
userId
);
}
qwA
.
le
(
"start_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
end
),
"yyyy-MM-dd"
));
qwA
.
le
(
"start_time"
,
DateUtil
.
format
(
DateUtil
.
date
(
end
),
"yyyy-MM-dd"
));
qwA
.
eq
(
"status"
,
2
);
List
<
NonStandardApply
>
nonStandardApplies
=
iNonStandardApplyService
.
list
(
qwA
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/QualityApplyServiceImpl.java
View file @
6a2b08fd
...
...
@@ -77,7 +77,6 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua
List
<
QualityApply
>
list
=
this
.
list
(
qw
);
//找到所有项目id归类
Set
<
Integer
>
projectIds
=
list
.
stream
().
map
(
QualityApply:
:
getProjectId
).
collect
(
Collectors
.
toSet
());
String
[]
headers
=
null
;
List
<
Object
[]>
datas
=
new
ArrayList
<>();
//关联部门名字
Set
<
Integer
>
userIds
=
list
.
stream
()
...
...
@@ -124,8 +123,8 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua
&&
arg
.
getProjectId
().
intValue
()
==
projectId
)
.
collect
(
Collectors
.
toList
());
//以样品归类
Set
<
Integer
>
sampleIds
=
samples
.
stream
().
map
(
QualityApply:
:
getTeamGroupId
)
.
collect
(
Collectors
.
toSet
());
//
Set<Integer> sampleIds = samples.stream().map(QualityApply::getTeamGroupId)
//
.collect(Collectors.toSet());
//写每个样品的表头
list
.
stream
()
...
...
@@ -181,7 +180,7 @@ public class QualityApplyServiceImpl extends ServiceImpl<QualityApplyMapper, Qua
}
}
ExcelUtil
.
excelExport
(
"qualityApply"
,
headers
,
datas
,
response
);
ExcelUtil
.
excelExport
(
"qualityApply"
,
null
,
datas
,
response
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/WeiXinService.java
View file @
6a2b08fd
...
...
@@ -36,13 +36,17 @@ public class WeiXinService {
@Autowired
RedisUtil
redisUtil
;
final
static
String
ACCESS_TOKEN
=
"ACCESS_TOKEN"
;
final
static
String
JSAPITICKET
=
"JSAPITICKET"
;
/**
* 获取登录token
*
* @param code
* @param type PC管理端 APP小程序端
* @return
*/
public
BaseResponse
<
String
>
getToken
(
String
code
,
String
type
)
{
public
BaseResponse
<
String
>
getToken
(
String
code
,
String
type
)
{
if
(
StrUtil
.
isEmpty
(
code
))
{
return
BaseResponse
.
errorMsg
(
"code为必填项!"
);
}
...
...
@@ -71,20 +75,20 @@ public class WeiXinService {
// wrapper.eq("phone", userJson.get("mobile"));
wrapper
.
eq
(
"phone"
,
code
);
//暂时用手机号代替code
SysUser
sysUser
=
userService
.
getOne
(
wrapper
);
if
(
sysUser
==
null
)
{
if
(
sysUser
==
null
)
{
return
BaseResponse
.
errorMsg
(
"非系统用户不允许登录!"
);
}
if
(
sysUser
.
getStatus
()==
0
)
{
if
(
sysUser
.
getStatus
()
==
0
)
{
return
BaseResponse
.
errorMsg
(
"用户被禁用!"
);
}
if
(
sysUser
.
getIsDelete
()==
0
)
{
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
);
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
return
BaseResponse
.
okData
(
token
);
}
catch
(
Exception
e
)
{
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
...
...
@@ -106,6 +110,37 @@ public class WeiXinService {
}
}
//获取accessToken信息
public
String
getJsapiTicket
()
{
try
{
String
accessToken
;
String
jsapiTicket
;
if
(!
redisUtil
.
existsKey
(
ACCESS_TOKEN
))
{
String
param
=
"corpid=%s&corpsecret=%s"
;
param
=
String
.
format
(
param
,
corpid
,
corpsecret
);
JSONObject
jsonObject
=
WeixinInterfaceUtil
.
doGet
(
Global
.
ACCESSTOKENURL
,
param
);
accessToken
=
jsonObject
.
getString
(
"access_token"
);
redisUtil
.
setString
(
ACCESS_TOKEN
,
accessToken
,
7200
);
}
accessToken
=
redisUtil
.
getString
(
ACCESS_TOKEN
)
+
""
;
System
.
out
.
println
(
"==================accessToken==================="
);
System
.
out
.
println
(
accessToken
);
if
(!
redisUtil
.
existsKey
(
JSAPITICKET
))
{
String
param3
=
"access_token=%s&type=agent_config"
;
param3
=
String
.
format
(
param3
,
accessToken
);
JSONObject
ticketJsonObject
=
WeixinInterfaceUtil
.
doGet
(
Global
.
userTicket
,
param3
);
jsapiTicket
=
ticketJsonObject
.
getString
(
"ticket"
);
redisUtil
.
setString
(
JSAPITICKET
,
jsapiTicket
,
7200
);
}
jsapiTicket
=
redisUtil
.
getString
(
JSAPITICKET
)
+
""
;
return
jsapiTicket
;
}
catch
(
Exception
e
)
{
return
null
;
}
}
public
String
getPCAccessToken
()
{
try
{
String
param
=
"corpid=%s&corpsecret=%s"
;
...
...
@@ -121,7 +156,6 @@ public class WeiXinService {
}
//获取用户信息
public
JSONObject
getUser
(
String
accessToken
,
String
userId
)
{
try
{
...
...
@@ -138,43 +172,13 @@ public class WeiXinService {
/**
* 当前登录用户
*
* @return
*/
public
BaseResponse
<
LoginUser
>
getLoginUser
()
{
LoginUser
loginUser
=
userService
.
getLoginUser
();
return
BaseResponse
.
okData
(
loginUser
);
}
/**
* 消息发送
*/
public
void
sendMessage
(){
WeixinInterfaceUtil
.
sendPostRequest
(
null
,
null
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/util/dfs/FastDFSUtils.java
View file @
6a2b08fd
package
cn
.
wise
.
sc
.
cement
.
business
.
util
.
dfs
;
import
org.apache.commons.io.FilenameUtils
;
import
org.csource.common.MyException
;
import
org.csource.common.NameValuePair
;
import
org.csource.fastdfs.*
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/weixin/Global.java
View file @
6a2b08fd
...
...
@@ -30,6 +30,7 @@ public interface Global {
*/
public
static
final
String
USERURL
=
"https://qyapi.weixin.qq.com/cgi-bin/user/get"
;
public
static
final
String
ticket
=
"https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket"
;
/**
* 微信公众平台,发送应用消息的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN
...
...
@@ -37,6 +38,7 @@ public interface Global {
public
static
final
String
SENDMESSAGE
=
"https://qyapi.weixin.qq.com/cgi-bin/message/send"
;
public
static
final
String
userTicket
=
"https://qyapi.weixin.qq.com/cgi-bin/ticket/get"
;
}
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