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
f635f02d
Commit
f635f02d
authored
Oct 28, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
审批管理每个检测项可以增加多个人员
parent
be2dfeca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
156 additions
and
64 deletions
+156
-64
TJCementApplication.java
.../java/cn/wise/sc/cement/business/TJCementApplication.java
+2
-0
EquipmentController.java
...se/sc/cement/business/controller/EquipmentController.java
+15
-0
SysUserMessage.java
...ava/cn/wise/sc/cement/business/entity/SysUserMessage.java
+2
-1
SysApprovalMapper.java
.../cn/wise/sc/cement/business/mapper/SysApprovalMapper.java
+2
-1
SysApprovalMapper.xml
.../wise/sc/cement/business/mapper/xml/SysApprovalMapper.xml
+1
-0
IEquipmentService.java
...cn/wise/sc/cement/business/service/IEquipmentService.java
+2
-0
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+65
-50
EquipmentServiceImpl.java
...sc/cement/business/service/impl/EquipmentServiceImpl.java
+56
-1
SysApprovalServiceImpl.java
.../cement/business/service/impl/SysApprovalServiceImpl.java
+4
-4
WeiXinService.java
...n/wise/sc/cement/business/service/impl/WeiXinService.java
+6
-6
Global.java
...n/java/cn/wise/sc/cement/business/util/weixin/Global.java
+1
-1
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/TJCementApplication.java
View file @
f635f02d
...
@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
...
@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.TimeZone
;
import
java.util.TimeZone
;
...
@@ -14,6 +15,7 @@ import java.util.TimeZone;
...
@@ -14,6 +15,7 @@ import java.util.TimeZone;
* @author zhutianwei
* @author zhutianwei
*/
*/
@SpringBootApplication
@SpringBootApplication
@EnableScheduling
@MapperScan
(
"cn.wise.sc.cement.business.mapper"
)
@MapperScan
(
"cn.wise.sc.cement.business.mapper"
)
public
class
TJCementApplication
{
public
class
TJCementApplication
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/EquipmentController.java
View file @
f635f02d
...
@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
...
@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -69,6 +70,20 @@ public class EquipmentController {
...
@@ -69,6 +70,20 @@ public class EquipmentController {
return
BaseResponse
.
errorMsg
(
"失败!"
);
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
}
//设备检定是否到期 定时任务 每天上午6点提醒
@ApiOperation
(
value
=
"设备检定是否到期"
)
@PostMapping
(
"/checktestDate"
)
public
BaseResponse
checktestDate
()
{
try
{
return
equipmentService
.
checktestDate
();
}
catch
(
Exception
e
)
{
log
.
debug
(
"设备检定是否到期{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"设备检定历史"
)
@ApiOperation
(
value
=
"设备检定历史"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"equipmentId"
,
value
=
"设备表id"
,
paramType
=
"query"
,
dataType
=
"Integer"
)
@ApiImplicitParam
(
name
=
"equipmentId"
,
value
=
"设备表id"
,
paramType
=
"query"
,
dataType
=
"Integer"
)
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/entity/SysUserMessage.java
View file @
f635f02d
...
@@ -72,7 +72,8 @@ public class SysUserMessage implements Serializable {
...
@@ -72,7 +72,8 @@ public class SysUserMessage implements Serializable {
private
Integer
isDeal
;
private
Integer
isDeal
;
public
interface
MessageType
{
public
interface
MessageType
{
int
ENTRUST
=
1
;
int
ENTRUST
=
1
;
//委托
int
EQUIPMENT
=
2
;
//设备检定
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SysApprovalMapper.java
View file @
f635f02d
...
@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
...
@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Select
;
import
javax.websocket.server.ServerEndpoint
;
import
javax.websocket.server.ServerEndpoint
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -24,6 +25,6 @@ public interface SysApprovalMapper extends BaseMapper<SysApproval> {
...
@@ -24,6 +25,6 @@ public interface SysApprovalMapper extends BaseMapper<SysApproval> {
IPage
<
ApprovalVo
>
getPage
(
@Param
(
"page"
)
Page
page
);
IPage
<
ApprovalVo
>
getPage
(
@Param
(
"page"
)
Page
page
);
@Select
(
"select user_id from sys_approval where name=#{name} and status=1 "
)
@Select
(
"select user_id from sys_approval where name=#{name} and status=1 "
)
Integer
getApprovalId
(
String
name
);
List
<
Integer
>
getApprovalId
(
String
name
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/SysApprovalMapper.xml
View file @
f635f02d
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
select sa.*, su.name as userName
select sa.*, su.name as userName
from sys_approval sa
from sys_approval sa
left join sys_user su on su.id = sa.user_id
left join sys_user su on su.id = sa.user_id
order by sa.name
</select>
</select>
</mapper>
</mapper>
cement-business/src/main/java/cn/wise/sc/cement/business/service/IEquipmentService.java
View file @
f635f02d
...
@@ -34,6 +34,8 @@ public interface IEquipmentService extends IService<Equipment> {
...
@@ -34,6 +34,8 @@ public interface IEquipmentService extends IService<Equipment> {
BaseResponse
<
String
>
test
(
EquipmentTestQuery
query
);
BaseResponse
<
String
>
test
(
EquipmentTestQuery
query
);
BaseResponse
<
String
>
checktestDate
();
BaseResponse
<
IPage
<
EquipmentTestVo
>>
getTestPage
(
PageQuery
pageQuery
,
Integer
equipmentId
);
BaseResponse
<
IPage
<
EquipmentTestVo
>>
getTestPage
(
PageQuery
pageQuery
,
Integer
equipmentId
);
BaseResponse
<
EquipmentTestVo
>
getTestDetail
(
Integer
id
);
BaseResponse
<
EquipmentTestVo
>
getTestDetail
(
Integer
id
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
f635f02d
This diff is collapsed.
Click to expand it.
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EquipmentServiceImpl.java
View file @
f635f02d
...
@@ -7,8 +7,10 @@ import cn.wise.sc.cement.business.model.PageQuery;
...
@@ -7,8 +7,10 @@ import cn.wise.sc.cement.business.model.PageQuery;
import
cn.wise.sc.cement.business.model.query.*
;
import
cn.wise.sc.cement.business.model.query.*
;
import
cn.wise.sc.cement.business.model.vo.*
;
import
cn.wise.sc.cement.business.model.vo.*
;
import
cn.wise.sc.cement.business.service.IEquipmentService
;
import
cn.wise.sc.cement.business.service.IEquipmentService
;
import
cn.wise.sc.cement.business.service.ISysUserMessageService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.util.ExcelUtil
;
import
cn.wise.sc.cement.business.util.ExcelUtil
;
import
cn.wise.sc.cement.business.util.weixin.Global
;
import
cn.wise.sc.cement.business.wrapper.page.Query
;
import
cn.wise.sc.cement.business.wrapper.page.Query
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -18,11 +20,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -18,11 +20,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -54,6 +58,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
...
@@ -54,6 +58,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
private
EquipmentScrapMapper
scrapMapper
;
private
EquipmentScrapMapper
scrapMapper
;
@Resource
@Resource
private
EquipmentUseMapper
useMapper
;
private
EquipmentUseMapper
useMapper
;
@Resource
private
SysApprovalMapper
sysApprovalMapper
;
@Autowired
private
ISysUserMessageService
userMessageService
;
@Autowired
private
WeiXinService
weiXinService
;
/**
/**
* 设备分页查询
* 设备分页查询
...
@@ -268,7 +278,52 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
...
@@ -268,7 +278,52 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
return
BaseResponse
.
okData
(
"检定完成"
);
return
BaseResponse
.
okData
(
"检定完成"
);
}
}
//TODO判断设备检定是否到期,如果到期,提醒检测人员
/**
* 判断设备检定是否到期,如果到期,提醒检定人员 每天早上6点
* @return
*/
@Override
@Scheduled
(
cron
=
"0 0 6 * * *"
)
public
BaseResponse
<
String
>
checktestDate
(){
//消息推送
List
<
Integer
>
approvalIdList
=
sysApprovalMapper
.
getApprovalId
(
"设备检定"
);
if
(
approvalIdList
==
null
)
{
return
BaseResponse
.
errorMsg
(
"设备检定信息错误"
);
}
String
userIds
=
""
;
for
(
Integer
testEQId
:
approvalIdList
){
SysUser
testEQUser
=
userService
.
getById
(
testEQId
);
if
(
testEQUser
==
null
){
return
BaseResponse
.
errorMsg
(
"设备检定信息错误"
);
}
if
(
StringUtils
.
isNotBlank
(
testEQUser
.
getWxId
())){
userIds
=
userIds
.
equals
(
""
)?
testEQUser
.
getWxId
():
userIds
+
"|"
+
testEQUser
.
getWxId
();
}
}
QueryWrapper
<
Equipment
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"status"
,
1
);
List
<
Equipment
>
equipmentList
=
equipmentMapper
.
selectList
(
qw
);
//当前日期
LocalDate
nowDate
=
LocalDate
.
now
();
for
(
Equipment
eq
:
equipmentList
){
//检定到期日期 = 上次检定日期+周期的值 - 7 (提前一周提醒)
if
(
eq
.
getTestDate
()
!=
null
&&
eq
.
getTestCycle
()
!=
null
){
LocalDate
expireDate
=
eq
.
getTestDate
().
plusYears
(
Long
.
valueOf
(
eq
.
getTestCycle
())).
minusWeeks
(
1
);
//如果当前日期等于检定到期日期 或者 当前日期大于检定到期日期,提示设备检定人员检定设备
if
(
expireDate
.
isEqual
(
nowDate
)
||
expireDate
.
isBefore
(
nowDate
)){
//发送企业微信消息内容
String
content
=
"你好!名称:"
+
eq
.
getName
()+
",编号:"
+
eq
.
getCode
()+
"的设备近期需要进行设备检定,如果已经检定完毕请前往\n"
+
Global
.
systemUrl
+
"更新检定记录。"
;
System
.
out
.
println
(
"**************************content**********************"
);
System
.
out
.
println
(
content
);
weiXinService
.
sendTextMessage
(
userIds
,
content
);
}
}
}
return
BaseResponse
.
okMsg
(
"成功"
);
}
/**
/**
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/SysApprovalServiceImpl.java
View file @
f635f02d
...
@@ -57,12 +57,12 @@ public class SysApprovalServiceImpl extends ServiceImpl<SysApprovalMapper, SysAp
...
@@ -57,12 +57,12 @@ public class SysApprovalServiceImpl extends ServiceImpl<SysApprovalMapper, SysAp
if
(
StringUtils
.
isEmpty
(
query
.
getName
()))
{
if
(
StringUtils
.
isEmpty
(
query
.
getName
()))
{
return
BaseResponse
.
errorMsg
(
"工作组名称不能为空!"
);
return
BaseResponse
.
errorMsg
(
"工作组名称不能为空!"
);
}
}
QueryWrapper
<
SysApproval
>
qw
=
new
QueryWrapper
<>();
/*
QueryWrapper<SysApproval> qw = new QueryWrapper<>();
qw.eq("name", query.getName());
qw.eq("name", query.getName());
int count = approvalMapper.selectCount(qw);
int count = approvalMapper.selectCount(qw);
if (count > 0) {
if (count > 0) {
return BaseResponse.errorMsg(query.getName() + "已存在");
return BaseResponse.errorMsg(query.getName() + "已存在");
}
}
*/
query
.
setStatus
(
1
);
query
.
setStatus
(
1
);
query
.
setCreateTime
(
LocalDateTime
.
now
());
query
.
setCreateTime
(
LocalDateTime
.
now
());
approvalMapper
.
insert
(
query
);
approvalMapper
.
insert
(
query
);
...
@@ -81,13 +81,13 @@ public class SysApprovalServiceImpl extends ServiceImpl<SysApprovalMapper, SysAp
...
@@ -81,13 +81,13 @@ public class SysApprovalServiceImpl extends ServiceImpl<SysApprovalMapper, SysAp
if
(
StringUtils
.
isEmpty
(
query
.
getName
()))
{
if
(
StringUtils
.
isEmpty
(
query
.
getName
()))
{
return
BaseResponse
.
errorMsg
(
"工作组名称不能为空!"
);
return
BaseResponse
.
errorMsg
(
"工作组名称不能为空!"
);
}
}
QueryWrapper
<
SysApproval
>
qw
=
new
QueryWrapper
<>();
/*
QueryWrapper<SysApproval> qw = new QueryWrapper<>();
qw.eq("name", query.getName());
qw.eq("name", query.getName());
qw.ne("id", query.getId());
qw.ne("id", query.getId());
int count = approvalMapper.selectCount(qw);
int count = approvalMapper.selectCount(qw);
if (count > 0) {
if (count > 0) {
return BaseResponse.errorMsg(query.getName() + "已存在");
return BaseResponse.errorMsg(query.getName() + "已存在");
}
}
*/
approvalMapper
.
updateById
(
query
);
approvalMapper
.
updateById
(
query
);
return
BaseResponse
.
okData
(
query
);
return
BaseResponse
.
okData
(
query
);
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/WeiXinService.java
View file @
f635f02d
...
@@ -47,7 +47,7 @@ public class WeiXinService {
...
@@ -47,7 +47,7 @@ public class WeiXinService {
System
.
out
.
println
(
"==================code==================="
);
System
.
out
.
println
(
"==================code==================="
);
System
.
out
.
println
(
code
);
System
.
out
.
println
(
code
);
try
{
try
{
/*
String accessToken = null;
String
accessToken
=
null
;
if
(
type
.
equals
(
"PC"
))
{
if
(
type
.
equals
(
"PC"
))
{
accessToken
=
getAccessToken
();
accessToken
=
getAccessToken
();
}
else
if
(
type
.
equals
(
"APP"
))
{
}
else
if
(
type
.
equals
(
"APP"
))
{
...
@@ -64,10 +64,10 @@ public class WeiXinService {
...
@@ -64,10 +64,10 @@ public class WeiXinService {
String
UserId
=
jsonObject
.
getString
(
"UserId"
);
String
UserId
=
jsonObject
.
getString
(
"UserId"
);
System
.
out
.
println
(
"==================UserId==================="
);
System
.
out
.
println
(
"==================UserId==================="
);
System
.
out
.
println
(
UserId
);
System
.
out
.
println
(
UserId
);
JSONObject userJson = getUser(accessToken, UserId);
*/
JSONObject
userJson
=
getUser
(
accessToken
,
UserId
);
QueryWrapper
<
SysUser
>
wrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
SysUser
>
wrapper
=
new
QueryWrapper
<>();
//
wrapper.eq("phone", userJson.get("mobile"));
wrapper
.
eq
(
"phone"
,
userJson
.
get
(
"mobile"
));
wrapper
.
eq
(
"phone"
,
code
);
//暂时用手机号代替code
//
wrapper.eq("phone", code); //暂时用手机号代替code
SysUser
sysUser
=
userService
.
getOne
(
wrapper
);
SysUser
sysUser
=
userService
.
getOne
(
wrapper
);
if
(
sysUser
==
null
)
{
if
(
sysUser
==
null
)
{
return
BaseResponse
.
errorMsg
(
"非系统用户不允许登录!"
);
return
BaseResponse
.
errorMsg
(
"非系统用户不允许登录!"
);
...
@@ -83,8 +83,8 @@ public class WeiXinService {
...
@@ -83,8 +83,8 @@ public class WeiXinService {
sysUser
.
getName
(),
sysUser
.
getPhone
());
sysUser
.
getName
(),
sysUser
.
getPhone
());
System
.
out
.
println
(
token
);
System
.
out
.
println
(
token
);
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
redisUtil
.
setString
(
sysUser
.
getId
().
toString
(),
token
,
3600
);
//
sysUser.setWxId(UserId);
sysUser
.
setWxId
(
UserId
);
//
userService.updateById(sysUser);
userService
.
updateById
(
sysUser
);
return
BaseResponse
.
okData
(
token
);
return
BaseResponse
.
okData
(
token
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/weixin/Global.java
View file @
f635f02d
...
@@ -22,7 +22,7 @@ public interface Global {
...
@@ -22,7 +22,7 @@ public interface Global {
//编译后的回调地址
//编译后的回调地址
public
final
static
String
backUrl
=
"https%3a%2f%2fprogram.oxogroup.com%2flab-system"
;
public
final
static
String
backUrl
=
"https%3a%2f%2fprogram.oxogroup.com%2flab-system"
;
//实验室管理系统链接
//实验室管理系统链接
public
final
static
String
systemUrl
=
"<a href=\"
+https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
corpId
+
"&redirect_uri="
+
backUrl
+
"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">天津院实验室管理系统
</a>,"
;
public
final
static
String
systemUrl
=
"<a href=\"
https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
corpId
+
"&redirect_uri="
+
backUrl
+
"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">天津院实验室管理系统"
+
"
</a>,"
;
//应用的凭证密钥PC
//应用的凭证密钥PC
public
final
static
String
agentSecretPC
=
"itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A"
;
public
final
static
String
agentSecretPC
=
"itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A"
;
...
...
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