Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
a32c8e94
Commit
a32c8e94
authored
Dec 06, 2023
by
H2T
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register
parents
fdaf6d97
50337b57
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
578 additions
and
516 deletions
+578
-516
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+105
-14
pom.xml
...t-module-tzspatrol/amos-boot-module-tzspatrol-api/pom.xml
+5
-0
CacheHelper.java
...a/com/yeejoin/amos/patrol/business/cache/CacheHelper.java
+33
-0
PlanTaskController.java
...n/amos/patrol/business/controller/PlanTaskController.java
+2
-2
CheckInputMapper.java
...oin/amos/patrol/business/dao/mapper/CheckInputMapper.java
+2
-0
CheckMapper.java
.../yeejoin/amos/patrol/business/dao/mapper/CheckMapper.java
+3
-0
PlanTaskMapper.java
...ejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
+1
-0
CheckRecordDataConsumer.java
...in/amos/patrol/business/data/CheckRecordDataConsumer.java
+49
-18
CheckRecordDataDto.java
.../yeejoin/amos/patrol/business/dto/CheckRecordDataDto.java
+2
-1
PointCheckDetailBo.java
...os/patrol/business/entity/mybatis/PointCheckDetailBo.java
+42
-318
CheckRecordInsertEvent.java
...in/amos/patrol/business/event/CheckRecordInsertEvent.java
+21
-0
CheckRecordInsertListener.java
...s/patrol/business/listener/CheckRecordInsertListener.java
+53
-0
EventPublisher.java
...eejoin/amos/patrol/business/publisher/EventPublisher.java
+23
-0
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+31
-33
ExecutorConfig.java
...n/java/com/yeejoin/amos/patrol/config/ExecutorConfig.java
+1
-2
PersonIdentifyTzsAspect.java
...m/yeejoin/amos/patrol/config/PersonIdentifyTzsAspect.java
+87
-87
AsyncTask.java
...in/java/com/yeejoin/amos/patrol/core/async/AsyncTask.java
+1
-36
IJobService.java
...main/java/com/yeejoin/amos/patrol/quartz/IJobService.java
+0
-2
JobService.java
.../main/java/com/yeejoin/amos/patrol/quartz/JobService.java
+0
-0
application-dev.properties
...spatrol-biz/src/main/resources/application-dev.properties
+12
-3
CheckInputMapper.xml
...rol-biz/src/main/resources/db/mapper/CheckInputMapper.xml
+37
-0
dbTemplate_check.xml
...rol-biz/src/main/resources/db/mapper/dbTemplate_check.xml
+67
-0
dbTemplate_plan_task.xml
...biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+1
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
a32c8e94
...
@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContex
...
@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContex
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
...
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StopWatch
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.auth.exception.AuthException
;
import
org.typroject.tyboot.core.auth.exception.AuthException
;
...
@@ -39,7 +41,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...
@@ -39,7 +41,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.
HashMap
;
import
java.util.
Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -112,6 +114,9 @@ public class ControllerAop {
...
@@ -112,6 +114,9 @@ public class ControllerAop {
urls
.
add
(
"/tcm/base-individuality/person/register"
);
urls
.
add
(
"/tcm/base-individuality/person/register"
);
urls
.
add
(
"/tcm/userInfo/arrangement-statistic"
);
urls
.
add
(
"/tcm/userInfo/arrangement-statistic"
);
urls
.
add
(
"/tcm/userInfo/getPersonType"
);
urls
.
add
(
"/tcm/userInfo/getPersonType"
);
// urls.add("/patrol/api/check/checkCalendarForWx");
urls
.
add
(
"/patrol/api/check/saveRecordAll"
);
urls
.
add
(
"/patrol/api/planTask/queryPlanTaskNew"
);
// 获取请求路径
// 获取请求路径
for
(
String
uri
:
urls
)
{
for
(
String
uri
:
urls
)
{
Pattern
p
=
Pattern
.
compile
(
uri
);
Pattern
p
=
Pattern
.
compile
(
uri
);
...
@@ -123,11 +128,11 @@ public class ControllerAop {
...
@@ -123,11 +128,11 @@ public class ControllerAop {
String
token
=
RequestContext
.
getToken
();
String
token
=
RequestContext
.
getToken
();
// 不需要校验token的接口直接返回
// 不需要校验token的接口直接返回
if
(
joinPoint
.
getSignature
()
instanceof
MethodSignature
)
{
if
(
joinPoint
.
getSignature
()
instanceof
MethodSignature
)
{
if
(!((
MethodSignature
)
joinPoint
.
getSignature
()).
getMethod
().
getAnnotation
(
TycloudOperation
.
class
).
needAuth
()
&&
!
request
.
getParameterMap
().
containsKey
(
"token"
)
&&
ValidationUtil
.
isEmpty
(
token
))
{
if
(!((
MethodSignature
)
joinPoint
.
getSignature
()).
getMethod
().
getAnnotation
(
TycloudOperation
.
class
).
needAuth
()
&&
!
request
.
getParameterMap
().
containsKey
(
"token"
)
&&
ValidationUtil
.
isEmpty
(
token
))
{
return
;
return
;
}
}
}
}
// 平台studio配置的下载接口token从url里取
// 平台studio配置的下载接口token从url里取
if
(
ValidationUtil
.
isEmpty
(
token
))
{
if
(
ValidationUtil
.
isEmpty
(
token
))
{
...
@@ -140,16 +145,23 @@ public class ControllerAop {
...
@@ -140,16 +145,23 @@ public class ControllerAop {
// 验证token有效性,防止token失效
// 验证token有效性,防止token失效
AgencyUserModel
userModel
;
AgencyUserModel
userModel
;
try
{
try
{
// StopWatch stopWatch = new StopWatch();
// stopWatch.start("1");
String
authToken
=
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
token
);
String
authToken
=
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
token
);
if
(
redisUtils
.
hasKey
(
authToken
))
{
if
(
redisUtils
.
hasKey
(
authToken
))
{
logger
.
info
(
"登录命中缓存 ,直接返回!!===========>"
);
return
;
return
;
}
}
FeignClientResult
<
AgencyUserModel
>
agencyUserModel
=
Privilege
.
agencyUserClient
.
getme
();
// stopWatch.stop();
userModel
=
agencyUserModel
.
getResult
();
// logger.info("get auth token count time===========> {}", stopWatch.getTotalTimeSeconds());
if
(
userModel
==
null
)
{
// stopWatch.start("2");
throw
new
Exception
(
"无法获取用户信息"
);
// FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
}
// userModel = agencyUserModel.getResult();
RequestContext
.
setExeUserId
(
userModel
.
getUserId
());
// if (userModel == null) {
// throw new Exception("无法获取用户信息");
// }
// RequestContext.setExeUserId(userModel.getUserId());
// logger.info("get me count time===========> {}", stopWatch.getTotalTimeSeconds());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// 删除失效token缓存
// 删除失效token缓存
logger
.
info
(
"catch pattern before==========>"
+
pattern
);
logger
.
info
(
"catch pattern before==========>"
+
pattern
);
...
@@ -157,7 +169,8 @@ public class ControllerAop {
...
@@ -157,7 +169,8 @@ public class ControllerAop {
logger
.
info
(
"catch pattern after==========>"
+
pattern
);
logger
.
info
(
"catch pattern after==========>"
+
pattern
);
throw
new
RuntimeException
(
e
.
getMessage
());
throw
new
RuntimeException
(
e
.
getMessage
());
}
}
saveUserRedis
(
userModel
,
token
);
// saveUserRedis(userModel, token);
saveUserRedis
();
}
else
{
}
else
{
throw
new
AuthException
(
"请求未包含认证信息."
);
throw
new
AuthException
(
"请求未包含认证信息."
);
}
}
...
@@ -172,9 +185,10 @@ public class ControllerAop {
...
@@ -172,9 +185,10 @@ public class ControllerAop {
DepartmentBo
department
=
new
DepartmentBo
();
DepartmentBo
department
=
new
DepartmentBo
();
RoleBo
role
=
new
RoleBo
();
RoleBo
role
=
new
RoleBo
();
// 平台更新 人员部门可能为NULL 导致redis缓存不到人员信息
// 平台更新 人员部门可能为NULL 导致redis缓存不到人员信息
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
new
HashMap
<>()
;
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
;
DepartmentModel
departmentM
=
new
DepartmentModel
();
DepartmentModel
departmentM
=
new
DepartmentModel
();
CompanyModel
companyM
=
user
.
getCompanys
()
!=
null
?
user
.
getCompanys
().
get
(
0
)
:
null
;
CompanyModel
companyM
=
user
.
getCompanys
()
!=
null
?
user
.
getCompanys
().
get
(
0
)
:
null
;
Bean
.
copyExistPropertis
(
companyM
,
company
);
Bean
.
copyExistPropertis
(
companyM
,
company
);
if
(!
ValidationUtil
.
isEmpty
(
user
.
getCompanyDepartments
()))
{
if
(!
ValidationUtil
.
isEmpty
(
user
.
getCompanyDepartments
()))
{
mapDepartments
=
user
.
getCompanyDepartments
();
mapDepartments
=
user
.
getCompanyDepartments
();
...
@@ -208,6 +222,83 @@ public class ControllerAop {
...
@@ -208,6 +222,83 @@ public class ControllerAop {
redisUtils
.
set
(
authToken
,
JSONObject
.
toJSONString
(
reginParams
),
redisRegionTimeSecond
);
redisUtils
.
set
(
authToken
,
JSONObject
.
toJSONString
(
reginParams
),
redisRegionTimeSecond
);
}
}
private
void
saveUserRedis
()
{
String
authToken
=
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
());
if
(
redisUtils
.
hasKey
(
authToken
))
{
return
;
}
CompanyBo
company
=
new
CompanyBo
();
DepartmentBo
department
=
new
DepartmentBo
();
RoleBo
role
=
new
RoleBo
();
StopWatch
stopWatch0
=
new
StopWatch
();
stopWatch0
.
start
();
StopWatch
stopWatch1
=
new
StopWatch
();
stopWatch1
.
start
(
"用户企业部门人员信息查询任务====>"
);
// 查询当前人所在第一个公司信息
List
<
CompanyModel
>
companyModels
=
FeignUtil
.
remoteCall
(()
->
Privilege
.
companyClient
.
queryListByChild
(
RequestContext
.
getExeUserId
()));
stopWatch1
.
stop
();
// logger.info("用户企业部门人员信息查询任务====>{}s", stopWatch1.getTotalTimeSeconds());
if
(!
ValidationUtil
.
isEmpty
(
companyModels
))
{
CompanyModel
companyM
=
companyModels
.
get
(
0
);
Bean
.
copyExistPropertis
(
companyM
,
company
);
if
(
companyM
!=
null
)
{
// StopWatch stopWatch2 = new StopWatch();
// stopWatch2.start("获取所在公司区域信息====>");
// FeignClientResult<RegionModel> result = Systemctl.regionClient
// .getRegion(Long.valueOf(companyM.getRegionSeq()));
// stopWatch2.stop();
// logger.info("获取所在公司区域信息====>{}s", stopWatch2.getTotalTimeSeconds());
// company.setRegionCode(String.valueOf(result.getResult().getRegionCode()));
// DepartmentModel departmentM;
// // 查询当前人第一个公司下部门信息
// StopWatch stopWatch3 = new StopWatch();
// stopWatch3.start("获取所在部门信息====>");
// Collection<DepartmentModel> departmentList =
// FeignUtil.remoteCall(() -> Privilege.departmentClient.deptTreeWithoutAuth(companyM.getSequenceNbr()));
// stopWatch3.stop();
// logger.info("获取所在部门信息====>{}s", stopWatch3.getTotalTimeSeconds());
// if (!ValidationUtil.isEmpty(departmentList)) {
// departmentM = departmentList.stream().findFirst().get();
// Bean.copyExistPropertis(departmentM, department);
// }
//
// StopWatch stopWatch4 = new StopWatch();
// stopWatch4.start("获取用户角色信息====>");
// Map<String, Object> userOrgRoleMap = FeignUtil.remoteCall(() -> Privilege.userOrgRoleClient.getme());
// List<String> userOrgRoleList = (List<String>) userOrgRoleMap.get("roleId");
// RoleModel roleM =
// FeignUtil.remoteCall(() -> Privilege.roleClient.seleteOne(Long.valueOf((userOrgRoleList.get(0)))));
// stopWatch4.stop();
// logger.info("获取用户角色信息====>{}s", stopWatch4.getTotalTimeSeconds());
// Bean.copyExistPropertis(roleM, role);
StopWatch
stopWatch5
=
new
StopWatch
();
stopWatch5
.
start
(
"获取用户信息====>"
);
List
<
AgencyUserModel
>
userList
=
FeignUtil
.
remoteCall
(()
->
Privilege
.
agencyUserClient
.
queryByIds
(
RequestContext
.
getExeUserId
(),
false
));
stopWatch5
.
stop
();
logger
.
info
(
"获取用户信息====>{}s"
,
stopWatch5
.
getTotalTimeSeconds
());
ReginParams
regionParams
=
new
ReginParams
();
regionParams
.
setCompany
(
company
);
regionParams
.
setRole
(
role
);
regionParams
.
setDepartment
(
department
);
regionParams
.
setUserModel
(
userList
.
get
(
0
));
ReginParams
.
PersonIdentity
personIdentity
=
new
ReginParams
.
PersonIdentity
();
personIdentity
.
setBizOrgCode
(
companyM
.
getOrgCode
());
regionParams
.
setPersonIdentity
(
personIdentity
);
redisUtils
.
set
(
authToken
,
JSONObject
.
toJSONString
(
regionParams
),
redisRegionTimeSecond
);
stopWatch0
.
stop
();
logger
.
info
(
"用户企业部门人员信息查询任务完成=======>{}"
,
stopWatch0
.
getTotalTimeSeconds
());
}
}
}
@AfterReturning
(
returning
=
"ret"
,
pointcut
=
"userCache()"
)
@AfterReturning
(
returning
=
"ret"
,
pointcut
=
"userCache()"
)
public
void
doAfterReturning
(
Object
ret
)
throws
Throwable
{
public
void
doAfterReturning
(
Object
ret
)
throws
Throwable
{
// 统一redis管理
// 统一redis管理
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/pom.xml
View file @
a32c8e94
...
@@ -50,6 +50,11 @@
...
@@ -50,6 +50,11 @@
<artifactId>
transmittable-thread-local
</artifactId>
<artifactId>
transmittable-thread-local
</artifactId>
<version>
2.8.1
</version>
<version>
2.8.1
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-core
</artifactId>
<version>
5.8.16
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/cache/CacheHelper.java
0 → 100644
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
cache
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.patrol.business.dao.repository.IInputItemDao
;
import
com.yeejoin.amos.patrol.dao.entity.InputItem
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
@Component
public
class
CacheHelper
{
@Autowired
IInputItemDao
iInputItemDao
;
@Autowired
RedisUtils
redisUtils
;
private
static
final
String
P_INPUT_ITEM_REDIS_KEY_PREFIX
=
"P_INPUT_ITEM_CACHE_KEY:"
;
@PostConstruct
public
void
init
()
{
List
<
InputItem
>
inputItems
=
iInputItemDao
.
findAll
();
inputItems
.
forEach
(
inputItem
->
redisUtils
.
hset
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
String
.
valueOf
(
inputItem
.
getId
()),
inputItem
));
}
public
InputItem
getInputItemCacheData
(
String
inputItemId
)
{
return
(
InputItem
)
redisUtils
.
hget
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
inputItemId
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/PlanTaskController.java
View file @
a32c8e94
...
@@ -121,10 +121,10 @@ public class PlanTaskController extends AbstractBaseController {
...
@@ -121,10 +121,10 @@ public class PlanTaskController extends AbstractBaseController {
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
defaultValue
=
"current=0&pageSize=10或pageNumber0&pageSize=10"
)
CommonPageable
pageable
)
{
@ApiParam
(
value
=
"分页参数"
,
defaultValue
=
"current=0&pageSize=10或pageNumber0&pageSize=10"
)
CommonPageable
pageable
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
ReginParams
reginParams
=
getSelectedOrgInfo
();
//
ReginParams reginParams = getSelectedOrgInfo();
String
userId
=
RequestContext
.
getExeUserId
();
String
userId
=
RequestContext
.
getExeUserId
();
PlanTaskPageParamUtil
.
fillPlanTask
(
queryRequests
,
params
);
PlanTaskPageParamUtil
.
fillPlanTask
(
queryRequests
,
params
);
params
.
put
(
"orgCode"
,
reginParams
.
getPersonIdentity
().
getBizOrgCode
());
//
params.put("orgCode", reginParams.getPersonIdentity().getBizOrgCode());
params
.
put
(
"userId"
,
userId
);
params
.
put
(
"userId"
,
userId
);
params
.
put
(
"size"
,
pageable
.
getPageSize
());
params
.
put
(
"size"
,
pageable
.
getPageSize
());
params
.
put
(
"number"
,
pageable
.
getPageNumber
());
params
.
put
(
"number"
,
pageable
.
getPageNumber
());
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/CheckInputMapper.java
View file @
a32c8e94
...
@@ -18,4 +18,6 @@ public interface CheckInputMapper extends BaseMapper {
...
@@ -18,4 +18,6 @@ public interface CheckInputMapper extends BaseMapper {
List
<
CheckInputSyncBo
>
getCheckInputSyncBoList
(
Map
<
String
,
Object
>
map
);
List
<
CheckInputSyncBo
>
getCheckInputSyncBoList
(
Map
<
String
,
Object
>
map
);
List
<
CheckInput
>
findByIdIn
(
Map
<
String
,
Object
>
map
);
List
<
CheckInput
>
findByIdIn
(
Map
<
String
,
Object
>
map
);
void
insertBatch
(
@Param
(
"list"
)
List
<
CheckInput
>
checkInputs
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/CheckMapper.java
View file @
a32c8e94
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.patrol.business.vo.CheckAnalysisVo;
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.patrol.business.vo.CheckAnalysisVo;
import
com.yeejoin.amos.patrol.business.vo.CheckInfoVo
;
import
com.yeejoin.amos.patrol.business.vo.CheckInfoVo
;
import
com.yeejoin.amos.patrol.core.common.response.PointCheckInfoBusinessRespone
;
import
com.yeejoin.amos.patrol.core.common.response.PointCheckInfoBusinessRespone
;
import
com.yeejoin.amos.patrol.core.common.response.PointCheckInfoRespone
;
import
com.yeejoin.amos.patrol.core.common.response.PointCheckInfoRespone
;
import
com.yeejoin.amos.patrol.dao.entity.Check
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -288,4 +289,6 @@ public interface CheckMapper extends BaseMapper {
...
@@ -288,4 +289,6 @@ public interface CheckMapper extends BaseMapper {
long
getPeoplePageCount
(
CheckInfoPageParam
param
);
long
getPeoplePageCount
(
CheckInfoPageParam
param
);
List
<
CheckInfoVo
>
getPeopleCheckPage
(
CheckInfoPageParam
param
);
List
<
CheckInfoVo
>
getPeopleCheckPage
(
CheckInfoPageParam
param
);
void
insertBatch
(
@Param
(
"list"
)
List
<
Check
>
checks
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
View file @
a32c8e94
...
@@ -330,4 +330,5 @@ public interface PlanTaskMapper extends BaseMapper {
...
@@ -330,4 +330,5 @@ public interface PlanTaskMapper extends BaseMapper {
List
<
Map
<
String
,
String
>>
selectExcludeItemsByRoutId
(
long
routeId
);
List
<
Map
<
String
,
String
>>
selectExcludeItemsByRoutId
(
long
routeId
);
void
updateStaticTableBatch
(
@Param
(
"list"
)
List
<
StaticTableUpdateDto
>
staticTableUpdateDtos
);
void
updateStaticTableBatch
(
@Param
(
"list"
)
List
<
StaticTableUpdateDto
>
staticTableUpdateDtos
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/data/CheckRecordDataConsumer.java
View file @
a32c8e94
...
@@ -3,8 +3,13 @@ package com.yeejoin.amos.patrol.business.data;
...
@@ -3,8 +3,13 @@ package com.yeejoin.amos.patrol.business.data;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.dao.mapper.CheckInputMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.CheckMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
...
@@ -15,7 +20,10 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum;
...
@@ -15,7 +20,10 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum;
import
com.yeejoin.amos.patrol.dao.entity.*
;
import
com.yeejoin.amos.patrol.dao.entity.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContextModel
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
...
@@ -42,9 +50,15 @@ public class CheckRecordDataConsumer implements Runnable {
...
@@ -42,9 +50,15 @@ public class CheckRecordDataConsumer implements Runnable {
private
IInputItemDao
inputItemDao
;
private
IInputItemDao
inputItemDao
;
private
PlanTaskDetailMapper
planTaskDetailMapper
;
private
AmosRequestContext
requestContext
;
private
Sequence
sequence
;
private
Sequence
sequence
;
private
PlanTaskDetailMapper
planTaskDetailMapper
;
private
CheckMapper
checkMapper
;
private
CheckInputMapper
checkInputMapper
;
public
CheckRecordDataConsumer
(
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
,
ApplicationContext
applicationContext
)
{
public
CheckRecordDataConsumer
(
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
,
ApplicationContext
applicationContext
)
{
...
@@ -56,32 +70,51 @@ public class CheckRecordDataConsumer implements Runnable {
...
@@ -56,32 +70,51 @@ public class CheckRecordDataConsumer implements Runnable {
iPlanTaskDao
=
applicationContext
.
getBean
(
IPlanTaskDao
.
class
);
iPlanTaskDao
=
applicationContext
.
getBean
(
IPlanTaskDao
.
class
);
iPlanTaskDetailDao
=
applicationContext
.
getBean
(
IPlanTaskDetailDao
.
class
);
iPlanTaskDetailDao
=
applicationContext
.
getBean
(
IPlanTaskDetailDao
.
class
);
inputItemDao
=
applicationContext
.
getBean
(
IInputItemDao
.
class
);
inputItemDao
=
applicationContext
.
getBean
(
IInputItemDao
.
class
);
sequence
=
applicationContext
.
getBean
(
Sequence
.
class
);
planTaskDetailMapper
=
applicationContext
.
getBean
(
PlanTaskDetailMapper
.
class
);
planTaskDetailMapper
=
applicationContext
.
getBean
(
PlanTaskDetailMapper
.
class
);
requestContext
=
applicationContext
.
getBean
(
AmosRequestContext
.
class
);
sequence
=
applicationContext
.
getBean
(
Sequence
.
class
);
checkMapper
=
applicationContext
.
getBean
(
CheckMapper
.
class
);
checkInputMapper
=
applicationContext
.
getBean
(
CheckInputMapper
.
class
);
}
}
@Override
@Override
public
void
run
()
{
public
void
run
()
{
while
(
true
)
{
while
(
true
)
{
try
{
try
{
this
.
setRequestContext
();
CheckRecordDataDto
checkRecordDataDto
=
blockingQueue
.
take
();
CheckRecordDataDto
checkRecordDataDto
=
blockingQueue
.
take
();
iPlanTaskDao
.
saveAll
(
checkRecordDataDto
.
getPlanTasks
());
this
.
save2Db
(
checkRecordDataDto
);
iPlanTaskDetailDao
.
saveAll
(
checkRecordDataDto
.
getPlanTaskDetails
());
createCheckRecord
(
checkRecordDataDto
.
getPlanTasks
(),
checkRecordDataDto
.
getAgencyUserModel
());
this
.
updateTaskDetail
(
checkRecordDataDto
.
getPlanTaskDetails
(),
checkRecordDataDto
.
getAgencyUserModel
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"入库失败"
,
e
);
log
.
error
(
"入库失败"
,
e
);
}
finally
{
RequestContext
.
clean
();
}
}
}
}
}
// 生成巡检记录
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
save2Db
(
CheckRecordDataDto
checkRecordDataDto
){
iPlanTaskDao
.
saveAll
(
checkRecordDataDto
.
getPlanTasks
());
iPlanTaskDetailDao
.
saveAll
(
checkRecordDataDto
.
getPlanTaskDetails
());
AgencyUserModel
agencyUserModel
=
this
.
getAgencyUserModel
(
checkRecordDataDto
.
getRequestContextModel
());
createCheckRecord
(
checkRecordDataDto
.
getPlanTasks
(),
agencyUserModel
);
this
.
updateTaskDetail
(
checkRecordDataDto
.
getPlanTaskDetails
(),
checkRecordDataDto
.
getRequestContextModel
().
getExcutedUserId
());
}
private
AgencyUserModel
getAgencyUserModel
(
RequestContextModel
requestContextModel
)
{
List
<
AgencyUserModel
>
agencyUserModels
=
FeignUtil
.
remoteCall
(()->
Privilege
.
agencyUserClient
.
queryByIds
(
requestContextModel
.
getExcutedUserId
(),
false
));
return
agencyUserModels
.
get
(
0
);
}
private
void
setRequestContext
(){
RequestContext
.
setAppKey
(
requestContext
.
getAppKey
());
RequestContext
.
setProduct
(
requestContext
.
getProduct
());
RequestContext
.
setToken
(
requestContext
.
getToken
());
}
}
p
rivate
void
updateTaskDetail
(
List
<
PlanTaskDetail
>
planTaskDetails
,
AgencyUserModel
agencyUserModel
)
{
p
ublic
void
updateTaskDetail
(
List
<
PlanTaskDetail
>
planTaskDetails
,
String
userId
)
{
planTaskDetails
.
forEach
(
planTaskDetail
->
{
planTaskDetails
.
forEach
(
planTaskDetail
->
{
planTaskDetailMapper
.
finishTaskDetail
(
planTaskDetail
.
getId
(),
planTaskDetail
.
getPointId
(),
planTaskDetail
.
getTaskNo
(),
agencyUserModel
.
getUserId
()
);
planTaskDetailMapper
.
finishTaskDetail
(
planTaskDetail
.
getId
(),
planTaskDetail
.
getPointId
(),
planTaskDetail
.
getTaskNo
(),
userId
);
});
});
}
}
...
@@ -151,10 +184,9 @@ public class CheckRecordDataConsumer implements Runnable {
...
@@ -151,10 +184,9 @@ public class CheckRecordDataConsumer implements Runnable {
check
.
setRouteId
(
arg
.
getRouteId
());
check
.
setRouteId
(
arg
.
getRouteId
());
check
.
setCheckTime
(
arg
.
getEndTime
());
check
.
setCheckTime
(
arg
.
getEndTime
());
check
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
check
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
// long checkId = sequence.nextId();
long
checkId
=
sequence
.
nextId
();
// check.setId(checkId);
check
.
setId
(
checkId
);
// checks.add(check);
checks
.
add
(
check
);
iCheckDao
.
saveAndFlush
(
check
);
checkMap
.
put
(
arg
.
getPointId
(),
check
);
checkMap
.
put
(
arg
.
getPointId
(),
check
);
}
else
{
}
else
{
check
=
checkMap
.
get
(
arg
.
getPointId
());
check
=
checkMap
.
get
(
arg
.
getPointId
());
...
@@ -171,7 +203,6 @@ public class CheckRecordDataConsumer implements Runnable {
...
@@ -171,7 +203,6 @@ public class CheckRecordDataConsumer implements Runnable {
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
inputItem
.
getItemType
()))
{
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
inputItem
.
getItemType
()))
{
checkInput
.
setInputValue
(
inputItem
.
getDefaultValue
());
checkInput
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
}
checkInput
.
setCheckId
(
check
.
getId
());
checkInput
.
setCheckId
(
check
.
getId
());
checkInput
.
setInputId
(
arg
.
getInputItemId
());
checkInput
.
setInputId
(
arg
.
getInputItemId
());
checkInput
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
checkInput
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
...
@@ -181,14 +212,14 @@ public class CheckRecordDataConsumer implements Runnable {
...
@@ -181,14 +212,14 @@ public class CheckRecordDataConsumer implements Runnable {
checkInput
.
setInputName
(
arg
.
getInputName
());
checkInput
.
setInputName
(
arg
.
getInputName
());
checkInput
.
setPointClassifyId
(
arg
.
getClassifyId
());
checkInput
.
setPointClassifyId
(
arg
.
getClassifyId
());
checkInput
.
setPointClassifyName
(
arg
.
getClassifyName
());
checkInput
.
setPointClassifyName
(
arg
.
getClassifyName
());
iCheckInputDao
.
saveAndFlush
(
checkInput
);
checkInput
.
setId
(
sequence
.
nextId
()
);
//
checkInputs.add(checkInput);
checkInputs
.
add
(
checkInput
);
}
}
}
}
});
});
// iCheckDao.saveAll
(checks);
checkMapper
.
insertBatch
(
checks
);
// iCheckInputDao.saveAll
(checkInputs);
checkInputMapper
.
insertBatch
(
checkInputs
);
}
}
private
CheckInput
paraseSelect
(
CheckInput
checkInput
,
String
json
,
String
isScore
)
{
private
CheckInput
paraseSelect
(
CheckInput
checkInput
,
String
json
,
String
isScore
)
{
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/CheckRecordDataDto.java
View file @
a32c8e94
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
lombok.Data
;
import
lombok.Data
;
import
org.typroject.tyboot.core.foundation.context.RequestContextModel
;
import
java.util.List
;
import
java.util.List
;
...
@@ -14,5 +15,5 @@ import java.util.List;
...
@@ -14,5 +15,5 @@ import java.util.List;
public
class
CheckRecordDataDto
{
public
class
CheckRecordDataDto
{
List
<
PlanTask
>
planTasks
;
List
<
PlanTask
>
planTasks
;
List
<
PlanTaskDetail
>
planTaskDetails
;
List
<
PlanTaskDetail
>
planTaskDetails
;
AgencyUserModel
agencyUser
Model
;
RequestContextModel
requestContext
Model
;
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/entity/mybatis/PointCheckDetailBo.java
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
entity
.
mybatis
;
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
entity
.
mybatis
;
import
java.util.Date
;
import
lombok.Data
;
public
class
PointCheckDetailBo
{
private
Long
id
;
private
long
pointId
;
private
long
inputItemId
;
private
String
pointName
;
private
String
pointNo
;
private
String
pointStatus
;
private
String
taskStatus
;
private
String
planName
;
private
String
defaultValue
;
public
long
getId
()
{
return
id
;
}
public
long
getInputItemId
()
{
return
inputItemId
;
}
public
String
getDefaultValue
()
{
return
defaultValue
;
}
public
void
setDefaultValue
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
}
private
int
shortMinNumber
;
private
int
shortMaxNumber
;
public
int
getShortMinNumber
()
{
return
shortMinNumber
;
}
public
void
setShortMinNumber
(
int
shortMinNumber
)
{
this
.
shortMinNumber
=
shortMinNumber
;
}
public
int
getShortMaxNumber
()
{
return
shortMaxNumber
;
}
public
void
setShortMaxNumber
(
int
shortMaxNumber
)
{
this
.
shortMaxNumber
=
shortMaxNumber
;
}
private
long
routeId
;
private
String
departmentName
;
private
String
username
;
private
Date
checkTime
;
private
String
beginTime
;
private
String
endTime
;
public
String
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
String
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
private
long
checkId
;
private
String
checkRemark
;
private
String
inputName
;
private
String
inputValue
;
private
String
inputStatus
;
private
String
itemType
;
private
String
dataJson
;
private
String
isMust
;
private
String
pictureJson
;
private
String
isMultiline
;
private
String
orderNo
;
private
long
checkInputId
;
private
String
remark
;
private
String
classifyName
;
private
long
classifyId
;
private
String
riskDesc
;
private
String
userId
;
private
String
checkDepartmentId
;
private
String
planTaskId
;
public
String
getTaskStatus
()
{
return
taskStatus
;
}
public
void
setTaskStatus
(
String
taskStatus
)
{
this
.
taskStatus
=
taskStatus
;
}
public
String
getPlanTaskId
()
{
return
planTaskId
;
}
public
void
setPlanTaskId
(
String
planTaskId
)
{
this
.
planTaskId
=
planTaskId
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getCheckDepartmentId
()
{
return
checkDepartmentId
;
}
public
void
setCheckDepartmentId
(
String
checkDepartmentId
)
{
this
.
checkDepartmentId
=
checkDepartmentId
;
}
public
long
getPointId
()
{
return
pointId
;
}
public
void
setPointId
(
long
pointId
)
{
this
.
pointId
=
pointId
;
}
public
String
getCheckRemark
()
{
return
checkRemark
;
}
public
void
setCheckRemark
(
String
checkRemark
)
{
this
.
checkRemark
=
checkRemark
;
}
public
String
getPointName
()
{
return
pointName
;
}
public
void
setPointName
(
String
pointName
)
{
this
.
pointName
=
pointName
;
}
public
String
getPointNo
()
{
return
pointNo
;
}
public
void
setPointNo
(
String
pointNo
)
{
this
.
pointNo
=
pointNo
;
}
public
String
getPointStatus
()
{
return
pointStatus
;
}
public
void
setPointStatus
(
String
pointStatus
)
{
this
.
pointStatus
=
pointStatus
;
}
public
String
getPlanName
()
{
return
planName
;
}
public
void
setPlanName
(
String
planName
)
{
import
java.io.Serializable
;
this
.
planName
=
planName
;
import
java.util.Date
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
@Data
this
.
departmentName
=
departmentName
;
public
class
PointCheckDetailBo
implements
Serializable
{
}
public
String
getUsername
()
{
private
Long
id
;
return
username
;
private
Long
pointId
;
}
public
void
setUsername
(
String
username
)
{
private
Long
inputItemId
;
this
.
username
=
username
;
}
public
Date
getCheckTime
()
{
private
String
pointName
;
return
checkTime
;
}
public
void
setCheckTime
(
Date
checkTime
)
{
private
String
pointNo
;
this
.
checkTime
=
checkTime
;
}
public
long
getCheckId
()
{
private
String
pointStatus
;
return
checkId
;
}
public
void
setCheckId
(
long
checkId
)
{
private
String
taskStatus
;
this
.
checkId
=
checkId
;
}
public
String
getInputName
()
{
private
String
planName
;
return
inputName
;
}
public
void
setInputName
(
String
inputName
)
{
private
String
defaultValue
;
this
.
inputName
=
inputName
;
}
public
String
getInputValue
()
{
private
int
shortMinNumber
;
return
inputValue
;
}
public
void
setInputValue
(
String
inputValue
)
{
private
int
shortMaxNumber
;
this
.
inputValue
=
inputValue
;
}
public
String
getInputStatus
()
{
private
Long
routeId
;
return
inputStatus
;
}
public
void
setInputStatus
(
String
inputStatus
)
{
private
String
departmentName
;
this
.
inputStatus
=
inputStatus
;
}
public
long
getCheckInputId
()
{
private
String
username
;
return
checkInputId
;
}
public
void
setCheckInputId
(
long
checkInputId
)
{
private
Date
checkTime
;
this
.
checkInputId
=
checkInputId
;
}
public
String
getRemark
()
{
private
String
beginTime
;
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
private
String
endTime
;
this
.
remark
=
remark
;
}
public
long
getRouteId
()
{
private
String
isScore
;
return
routeId
;
}
public
void
setRouteId
(
long
routeId
)
{
private
Long
checkId
;
this
.
routeId
=
routeId
;
}
public
String
getItemType
()
{
private
String
checkRemark
;
return
itemType
;
}
public
void
setItemType
(
String
itemType
)
{
private
String
inputName
;
this
.
itemType
=
itemType
;
}
public
String
getDataJson
()
{
private
String
inputValue
;
return
dataJson
;
}
public
void
setDataJson
(
String
dataJson
)
{
private
String
inputStatus
;
this
.
dataJson
=
dataJson
;
}
public
String
getIsMust
()
{
private
String
itemType
;
return
isMust
;
}
public
void
setIsMust
(
String
isMust
)
{
private
String
dataJson
;
this
.
isMust
=
isMust
;
}
public
String
getPictureJson
()
{
private
String
isMust
;
return
pictureJson
;
}
public
void
setPictureJson
(
String
pictureJson
)
{
private
String
pictureJson
;
this
.
pictureJson
=
pictureJson
;
}
public
String
getIsMultiline
()
{
private
String
isMultiline
;
return
isMultiline
;
}
public
void
setIsMultiline
(
String
isMultiline
)
{
private
String
orderNo
;
this
.
isMultiline
=
isMultiline
;
}
public
String
getOrderNo
()
{
private
Long
checkInputId
;
return
orderNo
;
}
public
void
setOrderNo
(
String
orderNo
)
{
private
String
remark
;
this
.
orderNo
=
orderNo
;
}
public
String
getClassifyName
()
{
private
String
classifyName
;
return
classifyName
;
}
public
void
setClassifyName
(
String
classifyName
)
{
private
Long
classifyId
;
this
.
classifyName
=
classifyName
;
}
public
long
getClassifyId
()
{
private
String
riskDesc
;
return
classifyId
;
private
String
userId
;
}
public
void
setClassifyId
(
long
classifyId
)
{
private
String
checkDepartmentId
;
this
.
classifyId
=
classifyId
;
}
public
String
getRiskDesc
()
{
private
String
planTaskId
;
return
riskDesc
;
}
public
void
setRiskDesc
(
String
riskDesc
)
{
this
.
riskDesc
=
riskDesc
;
}
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/event/CheckRecordInsertEvent.java
0 → 100644
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
event
;
import
com.yeejoin.amos.patrol.business.dto.CheckRecordDataDto
;
import
lombok.Getter
;
import
org.springframework.context.ApplicationEvent
;
@Getter
public
class
CheckRecordInsertEvent
extends
ApplicationEvent
{
private
CheckRecordDataDto
message
;
/**
* Create a new {@code ApplicationEvent}.
*
* @param source the object on which the event initially occurred or with
* which the event is associated (never {@code null})
*/
public
CheckRecordInsertEvent
(
Object
source
,
CheckRecordDataDto
message
)
{
super
(
source
);
this
.
message
=
message
;
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/listener/CheckRecordInsertListener.java
0 → 100644
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
listener
;
import
com.yeejoin.amos.patrol.business.data.CheckRecordDataConsumer
;
import
com.yeejoin.amos.patrol.business.dto.CheckRecordDataDto
;
import
com.yeejoin.amos.patrol.business.event.CheckRecordInsertEvent
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.LinkedBlockingDeque
;
/**
* @author Administrator
*/
@Component
@Slf4j
public
class
CheckRecordInsertListener
implements
ApplicationContextAware
,
ApplicationListener
<
CheckRecordInsertEvent
>
{
private
final
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
=
new
LinkedBlockingDeque
<>();
private
ApplicationContext
applicationContext
;
@Autowired
Executor
asyncServiceExecutor
;
private
int
curSystemThreads
=
Runtime
.
getRuntime
().
availableProcessors
();
@Override
public
void
onApplicationEvent
(
CheckRecordInsertEvent
event
)
{
blockingQueue
.
add
(
event
.
getMessage
());
}
@PostConstruct
public
void
init
()
{
CheckRecordDataConsumer
consumer
=
new
CheckRecordDataConsumer
(
blockingQueue
,
applicationContext
);
for
(
int
i
=
0
;
i
<
curSystemThreads
;
i
++)
{
asyncServiceExecutor
.
execute
(
consumer
);
}
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/publisher/EventPublisher.java
0 → 100644
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
publisher
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.stereotype.Component
;
@Component
@EnableAsync
public
class
EventPublisher
{
private
ApplicationEventPublisher
publisher
;
public
EventPublisher
(
ApplicationEventPublisher
publisher
)
{
this
.
publisher
=
publisher
;
}
@Async
public
void
publish
(
ApplicationEvent
event
)
{
publisher
.
publishEvent
(
event
);
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
a32c8e94
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/ExecutorConfig.java
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
import
com.alibaba.ttl.threadpool.TtlExecutors
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -61,6 +60,6 @@ public class ExecutorConfig {
...
@@ -61,6 +60,6 @@ public class ExecutorConfig {
//等待所有任务结束后再关闭线程池
//等待所有任务结束后再关闭线程池
executor
.
setWaitForTasksToCompleteOnShutdown
(
true
);
executor
.
setWaitForTasksToCompleteOnShutdown
(
true
);
return
TtlExecutors
.
getTtlExecutor
(
executor
)
;
return
executor
;
}
}
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/PersonIdentifyTzsAspect.java
View file @
a32c8e94
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
//package com.yeejoin.amos.patrol.config;
//
//
import
com.alibaba.fastjson.JSON
;
//import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
//import com.alibaba.fastjson.JSONObject;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
//import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
//import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
//import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
//import com.yeejoin.amos.component.feign.model.FeignClientResult;
import
com.yeejoin.amos.patrol.business.feign.JcsFeignClient
;
//import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import
com.yeejoin.amos.patrol.exception.PermissionException
;
//import com.yeejoin.amos.patrol.exception.PermissionException;
import
org.apache.commons.lang3.StringUtils
;
//import org.apache.commons.lang3.StringUtils;
import
org.aspectj.lang.JoinPoint
;
//import org.aspectj.lang.JoinPoint;
import
org.aspectj.lang.annotation.Aspect
;
//import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Before
;
//import org.aspectj.lang.annotation.Before;
import
org.aspectj.lang.annotation.Pointcut
;
//import org.aspectj.lang.annotation.Pointcut;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
//import org.springframework.beans.factory.annotation.Value;
import
org.springframework.core.annotation.Order
;
//import org.springframework.core.annotation.Order;
import
org.springframework.http.HttpStatus
;
//import org.springframework.http.HttpStatus;
import
org.springframework.stereotype.Component
;
//import org.springframework.stereotype.Component;
import
org.springframework.util.ObjectUtils
;
//import org.springframework.util.ObjectUtils;
import
org.springframework.web.bind.annotation.ResponseBody
;
//import org.springframework.web.bind.annotation.ResponseBody;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
/**
///**
* @author DELL
// * @author DELL
*/
// */
@Aspect
//@Aspect
@Component
//@Component
@ResponseBody
//@ResponseBody
@Order
(
value
=
1
)
//@Order(value = 1)
public
class
PersonIdentifyTzsAspect
{
//public class PersonIdentifyTzsAspect {
//
@Autowired
// @Autowired
RedisUtils
redisUtils
;
// RedisUtils redisUtils;
@Autowired
// @Autowired
private
JcsFeignClient
jcsFeignClient
;
// private JcsFeignClient jcsFeignClient;
//
@Value
(
"${logic}"
)
// @Value("${logic}")
Boolean
logic
;
// Boolean logic;
//
@Pointcut
(
"execution(public * com.yeejoin.amos.*.business.controller..*(..))"
)
// @Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
public
void
userDate
()
{
// public void userDate() {
//
}
// }
//
//
@Before
(
"userDate()"
)
// @Before("userDate()")
public
void
personIdentity
(
JoinPoint
joinPoint
)
throws
PermissionException
{
// public void personIdentity(JoinPoint joinPoint) throws PermissionException {
//
//
//定时任务没有token
// //定时任务没有token
if
(
RequestContext
.
getExeUserId
()==
null
||
RequestContext
.
getToken
()==
null
){
// if(RequestContext.getExeUserId()==null|| RequestContext.getToken()==null){
//
}
else
{
// }else {
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
// ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if
(
reginParam
!=
null
)
{
// if (reginParam != null ) {
if
(
reginParam
.
getPersonIdentity
()
==
null
||
StringUtils
.
isEmpty
(
reginParam
.
getPersonIdentity
().
getBizOrgCode
())
)
{
// if (reginParam.getPersonIdentity() == null || StringUtils.isEmpty(reginParam.getPersonIdentity().getBizOrgCode()) ) {
String
userId
=
reginParam
.
getUserModel
().
getUserId
();
// String userId = reginParam.getUserModel().getUserId();
//
if
(
userId
!=
null
)
{
// if (userId != null) {
// FeignClientResult responseModel = jcsFeignClient.selectById(userId);
//// FeignClientResult responseModel = jcsFeignClient.selectById(userId);
//
////
//
////
// if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
//// if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
// throw new RuntimeException(responseModel.getDevMessage());
//// throw new RuntimeException(responseModel.getDevMessage());
//// }
//// String s = JSONObject.toJSONString(responseModel.getResult());
//// ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
// ReginParams.PersonIdentity personIdentity = new ReginParams.PersonIdentity();
// // ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
// //电力默认走公司权限
// if (!logic) {
// personIdentity.setBizOrgCode(StringUtils.isEmpty(reginParam.getCompany().getOrgCode()) ? "-1" : reginParam.getCompany().getOrgCode());
// }
// }
// String s = JSONObject.toJSONString(responseModel.getResult());
//
// ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
// reginParam.setPersonIdentity(personIdentity);
ReginParams
.
PersonIdentity
personIdentity
=
new
ReginParams
.
PersonIdentity
();
// redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
//
//电力默认走公司权限
// }
if
(!
logic
)
{
// }
personIdentity
.
setBizOrgCode
(
StringUtils
.
isEmpty
(
reginParam
.
getCompany
().
getOrgCode
())
?
"-1"
:
reginParam
.
getCompany
().
getOrgCode
());
// }
}
// }
// }
reginParam
.
setPersonIdentity
(
personIdentity
);
//
redisUtils
.
set
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()),
JSONObject
.
toJSONString
(
reginParam
));
//}
//
}
}
}
}
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/core/async/AsyncTask.java
View file @
a32c8e94
...
@@ -62,7 +62,7 @@ import java.util.concurrent.LinkedBlockingDeque;
...
@@ -62,7 +62,7 @@ import java.util.concurrent.LinkedBlockingDeque;
*
*
*/
*/
@Component
@Component
public
class
AsyncTask
implements
ApplicationContextAware
{
public
class
AsyncTask
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
AsyncTask
.
class
);
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
AsyncTask
.
class
);
@Autowired
@Autowired
...
@@ -90,7 +90,6 @@ public class AsyncTask implements ApplicationContextAware {
...
@@ -90,7 +90,6 @@ public class AsyncTask implements ApplicationContextAware {
@Autowired
@Autowired
Executor
asyncServiceExecutor
;
Executor
asyncServiceExecutor
;
ApplicationContext
applicationContext
;
private
static
final
String
TOKE
=
"TOKE"
;
private
static
final
String
TOKE
=
"TOKE"
;
...
@@ -99,7 +98,6 @@ public class AsyncTask implements ApplicationContextAware {
...
@@ -99,7 +98,6 @@ public class AsyncTask implements ApplicationContextAware {
@Autowired
@Autowired
IInputItemDao
inputItemDao
;
IInputItemDao
inputItemDao
;
private
final
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
=
new
LinkedBlockingDeque
<>();
/**
/**
...
@@ -327,37 +325,4 @@ public class AsyncTask implements ApplicationContextAware {
...
@@ -327,37 +325,4 @@ public class AsyncTask implements ApplicationContextAware {
return
afterFilterUserIds
;
return
afterFilterUserIds
;
}
}
private
void
setRequestContextByLocal
(
RequestContextModel
user
)
{
RequestContext
.
setToken
(
user
.
getToken
());
RequestContext
.
setProduct
(
user
.
getProduct
());
RequestContext
.
setAppKey
(
user
.
getAppKey
());
UserTransmittableUtils
.
clear
();
}
@Async
(
"asyncServiceExecutor"
)
public
void
saveCheckRecordAsync
(
List
<
PlanTask
>
planTasks
,
List
<
PlanTaskDetail
>
planTaskDetails
,
String
userId
)
{
this
.
setRequestContextByLocal
(
UserTransmittableUtils
.
getUser
());
FeignClientResult
<
AgencyUserModel
>
agencyUserModel
=
Privilege
.
agencyUserClient
.
queryByUserId
(
userId
);
CheckRecordDataDto
dataDto
=
new
CheckRecordDataDto
();
dataDto
.
setPlanTasks
(
planTasks
);
dataDto
.
setPlanTaskDetails
(
planTaskDetails
);
dataDto
.
setAgencyUserModel
(
agencyUserModel
.
getResult
());
blockingQueue
.
add
(
dataDto
);
UserTransmittableUtils
.
clear
();
}
@PostConstruct
public
void
init
(){
CheckRecordDataConsumer
consumer
=
new
CheckRecordDataConsumer
(
blockingQueue
,
applicationContext
);
for
(
int
i
=
0
;
i
<
10
;
i
++){
asyncServiceExecutor
.
execute
(
consumer
);
}
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/quartz/IJobService.java
View file @
a32c8e94
...
@@ -69,7 +69,5 @@ public interface IJobService {
...
@@ -69,7 +69,5 @@ public interface IJobService {
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
);
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
);
public
JSONObject
getCheckInput
(
Long
routeId
,
Long
pointId
,
String
type
,
CheckRecordParam
requestParam
);
public
JSONObject
getCheckInput
(
Long
routeId
,
Long
pointId
,
String
type
,
CheckRecordParam
requestParam
);
JSONObject
getCheckInput
(
List
<
PointCheckDetailBo
>
pointInputs
,
String
type
,
CheckRecordParam
requestParam
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/quartz/JobService.java
View file @
a32c8e94
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/application-dev.properties
View file @
a32c8e94
...
@@ -23,9 +23,11 @@ spring.reactor.debug-agent.enabled=true
...
@@ -23,9 +23,11 @@ spring.reactor.debug-agent.enabled=true
spring.datasource.url
=
jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.url
=
jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_tzs_biz&allowMultiQueries=true
spring.datasource.username
=
admin
spring.datasource.username
=
admin
spring.datasource.password
=
Yeejoin@2023
spring.datasource.password
=
Yeejoin@2023
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name
=
cn.com.vastbase.Driver
spring.datasource.driver-class-name
=
cn.com.vastbase.Driver
spring.datasource.hikari.maxLifetime
=
1765000
spring.datasource.hikari.maxLifetime
=
1765000
spring.datasource.hikari.maximum-pool-size
=
10
spring.datasource.hikari.maximum-pool-size
=
100
spring.datasource.hikari.minimum-idle
=
15
spring.datasource.testWhileIdle
=
true
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
spring.datasource.validationQuery
=
SELECT 1
...
@@ -190,4 +192,11 @@ spring.jpa.properties.hibernate.order_updates =true
...
@@ -190,4 +192,11 @@ spring.jpa.properties.hibernate.order_updates =true
#spring.shardingsphere.props.sql-show= false
#spring.shardingsphere.props.sql-show= false
#spring.shardingsphere.props.max-connections-size-per-query=5
#spring.shardingsphere.props.max-connections-size-per-query=5
shardingsphere.create.tables.num
=
10
shardingsphere.create.tables.num
=
10
\ No newline at end of file
logging.level.com.zaxxer.hikari
=
DEBUG
amos.system.user.user-name
=
admin_tzs
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
AMOS_STUDIO
amos.system.user.product
=
AMOS_STUDIO_WEB
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/CheckInputMapper.xml
View file @
a32c8e94
...
@@ -159,4 +159,40 @@
...
@@ -159,4 +159,40 @@
</if>
</if>
</where>
</where>
</select>
</select>
<insert
id=
"insertBatch"
parameterType=
"com.yeejoin.amos.patrol.dao.entity.CheckInput"
>
insert into p_check_input (
id,
org_code,
check_id,
input_id,
order_no,
input_value,
is_ok,
score,
route_point_item_id,
remark,
create_date,
point_classify_id,
point_classify_name,
input_name
) VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.id},
#{item.orgCode},
#{item.checkId},
#{item.inputId},
#{item.orderNo},
#{item.inputValue},
#{item.isOk},
#{item.score},
#{item.routePointItemId},
#{item.remark},
CURRENT_TIMESTAMP,
#{item.pointClassifyId},
#{item.pointClassifyName},
#{item.inputName}
)
</foreach>
</insert>
</mapper>
</mapper>
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/dbTemplate_check.xml
View file @
a32c8e94
...
@@ -2313,4 +2313,70 @@
...
@@ -2313,4 +2313,70 @@
<if
test=
"orgCode!=null"
>
AND tb.org_code = #{orgCode}
</if>
<if
test=
"orgCode!=null"
>
AND tb.org_code = #{orgCode}
</if>
</where>
</where>
</select>
</select>
<insert
id=
"insertBatch"
parameterType=
"com.yeejoin.amos.patrol.dao.entity.Check"
>
insert into p_check
(
id,
org_code,
user_id,
point_id,
point_name,
check_time,
upload_time,
error,
device_id,
longitude,
latitude,
address,
shot_number,
remark,
plan_task_id,
route_id,
route_name,
is_ok,
score,
plan_id,
plan_name,
check_mode,
create_date,
plan_task_detail_id,
error_classify,
user_name,
dep_id,
dep_name
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.id},
#{item.orgCode},
#{item.userId},
#{item.pointId},
#{item.pointName},
#{item.checkTime},
#{item.uploadTime},
#{item.error},
#{item.deviceId},
#{item.longitude},
#{item.latitude},
#{item.address},
#{item.shotNumber},
#{item.remark},
#{item.planTaskId},
#{item.routeId},
#{item.routeName},
#{item.isOk},
#{item.score},
#{item.planId},
#{item.planName},
#{item.checkMode},
CURRENT_TIMESTAMP,
#{item.planTaskDetailId},
#{item.errorClassify},
#{item.userName},
#{item.depId},
#{item.depName}
)
</foreach>
</insert>
</mapper>
</mapper>
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
View file @
a32c8e94
...
@@ -741,6 +741,7 @@
...
@@ -741,6 +741,7 @@
pii.picture_json pictureJson,
pii.picture_json pictureJson,
pii.is_multiline isMultiline,
pii.is_multiline isMultiline,
pii.order_no orderNo,
pii.order_no orderNo,
pii.is_score,
prp.point_id,
prp.point_id,
prp.route_id
prp.route_id
FROM
FROM
...
...
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