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
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
610 additions
and
654 deletions
+610
-654
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
+32
-138
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
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
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.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
...
...
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StopWatch
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.auth.exception.AuthException
;
...
...
@@ -39,7 +41,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.
HashMap
;
import
java.util.
Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.regex.Pattern
;
...
...
@@ -112,6 +114,9 @@ public class ControllerAop {
urls
.
add
(
"/tcm/base-individuality/person/register"
);
urls
.
add
(
"/tcm/userInfo/arrangement-statistic"
);
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
)
{
Pattern
p
=
Pattern
.
compile
(
uri
);
...
...
@@ -123,11 +128,11 @@ public class ControllerAop {
String
token
=
RequestContext
.
getToken
();
// 不需要校验token的接口直接返回
if
(
joinPoint
.
getSignature
()
instanceof
MethodSignature
)
{
if
(!((
MethodSignature
)
joinPoint
.
getSignature
()).
getMethod
().
getAnnotation
(
TycloudOperation
.
class
).
needAuth
()
&&
!
request
.
getParameterMap
().
containsKey
(
"token"
)
&&
ValidationUtil
.
isEmpty
(
token
))
{
return
;
}
}
if
(
joinPoint
.
getSignature
()
instanceof
MethodSignature
)
{
if
(!((
MethodSignature
)
joinPoint
.
getSignature
()).
getMethod
().
getAnnotation
(
TycloudOperation
.
class
).
needAuth
()
&&
!
request
.
getParameterMap
().
containsKey
(
"token"
)
&&
ValidationUtil
.
isEmpty
(
token
))
{
return
;
}
}
// 平台studio配置的下载接口token从url里取
if
(
ValidationUtil
.
isEmpty
(
token
))
{
...
...
@@ -140,16 +145,23 @@ public class ControllerAop {
// 验证token有效性,防止token失效
AgencyUserModel
userModel
;
try
{
// StopWatch stopWatch = new StopWatch();
// stopWatch.start("1");
String
authToken
=
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
token
);
if
(
redisUtils
.
hasKey
(
authToken
))
{
logger
.
info
(
"登录命中缓存 ,直接返回!!===========>"
);
return
;
}
FeignClientResult
<
AgencyUserModel
>
agencyUserModel
=
Privilege
.
agencyUserClient
.
getme
();
userModel
=
agencyUserModel
.
getResult
();
if
(
userModel
==
null
)
{
throw
new
Exception
(
"无法获取用户信息"
);
}
RequestContext
.
setExeUserId
(
userModel
.
getUserId
());
// stopWatch.stop();
// logger.info("get auth token count time===========> {}", stopWatch.getTotalTimeSeconds());
// stopWatch.start("2");
// FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
// userModel = agencyUserModel.getResult();
// if (userModel == null) {
// throw new Exception("无法获取用户信息");
// }
// RequestContext.setExeUserId(userModel.getUserId());
// logger.info("get me count time===========> {}", stopWatch.getTotalTimeSeconds());
}
catch
(
Exception
e
)
{
// 删除失效token缓存
logger
.
info
(
"catch pattern before==========>"
+
pattern
);
...
...
@@ -157,7 +169,8 @@ public class ControllerAop {
logger
.
info
(
"catch pattern after==========>"
+
pattern
);
throw
new
RuntimeException
(
e
.
getMessage
());
}
saveUserRedis
(
userModel
,
token
);
// saveUserRedis(userModel, token);
saveUserRedis
();
}
else
{
throw
new
AuthException
(
"请求未包含认证信息."
);
}
...
...
@@ -172,9 +185,10 @@ public class ControllerAop {
DepartmentBo
department
=
new
DepartmentBo
();
RoleBo
role
=
new
RoleBo
();
// 平台更新 人员部门可能为NULL 导致redis缓存不到人员信息
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
new
HashMap
<>()
;
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
;
DepartmentModel
departmentM
=
new
DepartmentModel
();
CompanyModel
companyM
=
user
.
getCompanys
()
!=
null
?
user
.
getCompanys
().
get
(
0
)
:
null
;
Bean
.
copyExistPropertis
(
companyM
,
company
);
if
(!
ValidationUtil
.
isEmpty
(
user
.
getCompanyDepartments
()))
{
mapDepartments
=
user
.
getCompanyDepartments
();
...
...
@@ -208,6 +222,83 @@ public class ControllerAop {
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()"
)
public
void
doAfterReturning
(
Object
ret
)
throws
Throwable
{
// 统一redis管理
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/pom.xml
View file @
a32c8e94
...
...
@@ -50,6 +50,11 @@
<artifactId>
transmittable-thread-local
</artifactId>
<version>
2.8.1
</version>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-core
</artifactId>
<version>
5.8.16
</version>
</dependency>
</dependencies>
</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 {
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
defaultValue
=
"current=0&pageSize=10或pageNumber0&pageSize=10"
)
CommonPageable
pageable
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
ReginParams
reginParams
=
getSelectedOrgInfo
();
//
ReginParams reginParams = getSelectedOrgInfo();
String
userId
=
RequestContext
.
getExeUserId
();
PlanTaskPageParamUtil
.
fillPlanTask
(
queryRequests
,
params
);
params
.
put
(
"orgCode"
,
reginParams
.
getPersonIdentity
().
getBizOrgCode
());
//
params.put("orgCode", reginParams.getPersonIdentity().getBizOrgCode());
params
.
put
(
"userId"
,
userId
);
params
.
put
(
"size"
,
pageable
.
getPageSize
());
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 {
List
<
CheckInputSyncBo
>
getCheckInputSyncBoList
(
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;
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.PointCheckInfoRespone
;
import
com.yeejoin.amos.patrol.dao.entity.Check
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.HashMap
;
...
...
@@ -288,4 +289,6 @@ public interface CheckMapper extends BaseMapper {
long
getPeoplePageCount
(
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 {
List
<
Map
<
String
,
String
>>
selectExcludeItemsByRoutId
(
long
routeId
);
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;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
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.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.PlanTaskMapper
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
...
...
@@ -15,7 +20,10 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum;
import
com.yeejoin.amos.patrol.dao.entity.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.transaction.annotation.Transactional
;
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.concurrent.BlockingQueue
;
...
...
@@ -42,9 +50,15 @@ public class CheckRecordDataConsumer implements Runnable {
private
IInputItemDao
inputItemDao
;
private
PlanTaskDetailMapper
planTaskDetailMapper
;
private
AmosRequestContext
requestContext
;
private
Sequence
sequence
;
private
PlanTaskDetailMapper
planTaskDetailMapper
;
private
CheckMapper
checkMapper
;
private
CheckInputMapper
checkInputMapper
;
public
CheckRecordDataConsumer
(
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
,
ApplicationContext
applicationContext
)
{
...
...
@@ -56,32 +70,51 @@ public class CheckRecordDataConsumer implements Runnable {
iPlanTaskDao
=
applicationContext
.
getBean
(
IPlanTaskDao
.
class
);
iPlanTaskDetailDao
=
applicationContext
.
getBean
(
IPlanTaskDetailDao
.
class
);
inputItemDao
=
applicationContext
.
getBean
(
IInputItemDao
.
class
);
sequence
=
applicationContext
.
getBean
(
Sequence
.
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
public
void
run
()
{
while
(
true
)
{
try
{
this
.
setRequestContext
();
CheckRecordDataDto
checkRecordDataDto
=
blockingQueue
.
take
();
iPlanTaskDao
.
saveAll
(
checkRecordDataDto
.
getPlanTasks
());
iPlanTaskDetailDao
.
saveAll
(
checkRecordDataDto
.
getPlanTaskDetails
());
createCheckRecord
(
checkRecordDataDto
.
getPlanTasks
(),
checkRecordDataDto
.
getAgencyUserModel
());
this
.
updateTaskDetail
(
checkRecordDataDto
.
getPlanTaskDetails
(),
checkRecordDataDto
.
getAgencyUserModel
());
this
.
save2Db
(
checkRecordDataDto
);
}
catch
(
Exception
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
->
{
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 {
check
.
setRouteId
(
arg
.
getRouteId
());
check
.
setCheckTime
(
arg
.
getEndTime
());
check
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
// long checkId = sequence.nextId();
// check.setId(checkId);
// checks.add(check);
iCheckDao
.
saveAndFlush
(
check
);
long
checkId
=
sequence
.
nextId
();
check
.
setId
(
checkId
);
checks
.
add
(
check
);
checkMap
.
put
(
arg
.
getPointId
(),
check
);
}
else
{
check
=
checkMap
.
get
(
arg
.
getPointId
());
...
...
@@ -171,7 +203,6 @@ public class CheckRecordDataConsumer implements Runnable {
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
inputItem
.
getItemType
()))
{
checkInput
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
checkInput
.
setCheckId
(
check
.
getId
());
checkInput
.
setInputId
(
arg
.
getInputItemId
());
checkInput
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
...
...
@@ -181,14 +212,14 @@ public class CheckRecordDataConsumer implements Runnable {
checkInput
.
setInputName
(
arg
.
getInputName
());
checkInput
.
setPointClassifyId
(
arg
.
getClassifyId
());
checkInput
.
setPointClassifyName
(
arg
.
getClassifyName
());
iCheckInputDao
.
saveAndFlush
(
checkInput
);
//
checkInputs.add(checkInput);
checkInput
.
setId
(
sequence
.
nextId
()
);
checkInputs
.
add
(
checkInput
);
}
}
});
// iCheckDao.saveAll
(checks);
// iCheckInputDao.saveAll
(checkInputs);
checkMapper
.
insertBatch
(
checks
);
checkInputMapper
.
insertBatch
(
checkInputs
);
}
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;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
lombok.Data
;
import
org.typroject.tyboot.core.foundation.context.RequestContextModel
;
import
java.util.List
;
...
...
@@ -14,5 +15,5 @@ import java.util.List;
public
class
CheckRecordDataDto
{
List
<
PlanTask
>
planTasks
;
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
;
import
java.util.Date
;
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
;
}
import
lombok.Data
;
public
void
setPlanName
(
String
planName
)
{
this
.
planName
=
planName
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
import
java.io.Serializable
;
import
java.util.Date
;
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
@Data
public
class
PointCheckDetailBo
implements
Serializable
{
public
String
getUsername
()
{
return
username
;
}
private
Long
id
;
private
Long
pointId
;
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
private
Long
inputItemId
;
public
Date
getCheckTime
()
{
return
checkTime
;
}
private
String
pointName
;
public
void
setCheckTime
(
Date
checkTime
)
{
this
.
checkTime
=
checkTime
;
}
private
String
pointNo
;
public
long
getCheckId
()
{
return
checkId
;
}
private
String
pointStatus
;
public
void
setCheckId
(
long
checkId
)
{
this
.
checkId
=
checkId
;
}
private
String
taskStatus
;
public
String
getInputName
()
{
return
inputName
;
}
private
String
planName
;
public
void
setInputName
(
String
inputName
)
{
this
.
inputName
=
inputName
;
}
private
String
defaultValue
;
public
String
getInputValue
()
{
return
inputValue
;
}
private
int
shortMinNumber
;
public
void
setInputValue
(
String
inputValue
)
{
this
.
inputValue
=
inputValue
;
}
private
int
shortMaxNumber
;
public
String
getInputStatus
()
{
return
inputStatus
;
}
private
Long
routeId
;
public
void
setInputStatus
(
String
inputStatus
)
{
this
.
inputStatus
=
inputStatus
;
}
private
String
departmentName
;
public
long
getCheckInputId
()
{
return
checkInputId
;
}
private
String
username
;
public
void
setCheckInputId
(
long
checkInputId
)
{
this
.
checkInputId
=
checkInputId
;
}
private
Date
checkTime
;
public
String
getRemark
()
{
return
remark
;
}
private
String
beginTime
;
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
private
String
endTime
;
public
long
getRouteId
()
{
return
routeId
;
}
private
String
isScore
;
public
void
setRouteId
(
long
routeId
)
{
this
.
routeId
=
routeId
;
}
private
Long
checkId
;
public
String
getItemType
()
{
return
itemType
;
}
private
String
checkRemark
;
public
void
setItemType
(
String
itemType
)
{
this
.
itemType
=
itemType
;
}
private
String
inputName
;
public
String
getDataJson
()
{
return
dataJson
;
}
private
String
inputValue
;
public
void
setDataJson
(
String
dataJson
)
{
this
.
dataJson
=
dataJson
;
}
private
String
inputStatus
;
public
String
getIsMust
()
{
return
isMust
;
}
private
String
itemType
;
public
void
setIsMust
(
String
isMust
)
{
this
.
isMust
=
isMust
;
}
private
String
dataJson
;
public
String
getPictureJson
()
{
return
pictureJson
;
}
private
String
isMust
;
public
void
setPictureJson
(
String
pictureJson
)
{
this
.
pictureJson
=
pictureJson
;
}
private
String
pictureJson
;
public
String
getIsMultiline
()
{
return
isMultiline
;
}
private
String
isMultiline
;
public
void
setIsMultiline
(
String
isMultiline
)
{
this
.
isMultiline
=
isMultiline
;
}
private
String
orderNo
;
public
String
getOrderNo
()
{
return
orderNo
;
}
private
Long
checkInputId
;
public
void
setOrderNo
(
String
orderNo
)
{
this
.
orderNo
=
orderNo
;
}
private
String
remark
;
public
String
getClassifyName
()
{
return
classifyName
;
}
private
String
classifyName
;
public
void
setClassifyName
(
String
classifyName
)
{
this
.
classifyName
=
classifyName
;
}
private
Long
classifyId
;
public
long
getClassifyId
()
{
return
classifyId
;
}
private
String
riskDesc
;
private
String
userId
;
public
void
setClassifyId
(
long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
private
String
checkDepartmentId
;
public
String
getRiskDesc
()
{
return
riskDesc
;
}
private
String
planTaskId
;
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
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateTime
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
...
...
@@ -12,24 +13,25 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.patrol.business.cache.CacheHelper
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.dao.mapper.*
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto
;
import
com.yeejoin.amos.patrol.business.dto.StaticTableUpdateDto
;
import
com.yeejoin.amos.patrol.business.dto.UserDetailsDto
;
import
com.yeejoin.amos.patrol.business.dto.*
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
import
com.yeejoin.amos.patrol.business.event.CheckRecordInsertEvent
;
import
com.yeejoin.amos.patrol.business.feign.Business
;
import
com.yeejoin.amos.patrol.business.feign.IdxFeign
;
import
com.yeejoin.amos.patrol.business.feign.JcsFeignClient
;
import
com.yeejoin.amos.patrol.business.feign.TzsFeign
;
import
com.yeejoin.amos.patrol.business.param.CheckPtListPageParam
;
import
com.yeejoin.amos.patrol.business.param.PlanTaskPageParam
;
import
com.yeejoin.amos.patrol.business.publisher.EventPublisher
;
import
com.yeejoin.amos.patrol.business.service.intfc.ICheckService
;
import
com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService
;
import
com.yeejoin.amos.patrol.business.service.intfc.IPlanService
;
...
...
@@ -62,7 +64,6 @@ import org.elasticsearch.client.RequestOptions;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.RangeQueryBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.slf4j.Logger
;
...
...
@@ -88,7 +89,6 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
...
...
@@ -214,8 +214,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired
Executor
asyncServiceExecutor
;
@Autowired
EventPublisher
publisher
;
@Autowired
private
AsyncTask
asyncTask
;
CacheHelper
cacheHelper
;
private
String
DB
=
"amos_tzs_biz."
;
...
...
@@ -241,12 +245,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private
final
String
APP_WEB
=
"APP/WEB"
;
private
static
final
String
TAB
=
"\r\n"
;
private
List
<
PointCheckDetailBo
>
allPointInputs
;
@PostConstruct
public
void
init
(){
allPointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
null
,
null
);
}
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
params
)
{
...
...
@@ -1680,9 +1678,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
=
this
.
buildESPlanTaskListDtoData
(
planTasks
,
esTaskDetailDtos
,
planTaskDetails
);
// 4.保存页面必须的数据
saveMustData
(
esTaskDetailDtos
,
esPlanTaskListDtos
,
planTasks
);
asyncTask
.
saveCheckRecordAsync
(
planTasks
,
planTaskDetails
,
userId
);
this
.
sendInsertMessage
(
planTasks
,
planTaskDetails
);
}
private
void
sendInsertMessage
(
List
<
PlanTask
>
planTasks
,
List
<
PlanTaskDetail
>
planTaskDetails
){
CheckRecordDataDto
dataDto
=
new
CheckRecordDataDto
();
dataDto
.
setPlanTasks
(
planTasks
);
dataDto
.
setPlanTaskDetails
(
planTaskDetails
);
dataDto
.
setRequestContextModel
(
UserTransmittableUtils
.
getUser
());
publisher
.
publish
(
new
CheckRecordInsertEvent
(
this
,
dataDto
));
}
private
void
saveMustData
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
,
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
PlanTask
>
planTasks
)
{
// 保存es数据
List
<
CompletableFuture
<
Void
>>
futures
=
new
ArrayList
<>();
...
...
@@ -1703,8 +1710,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 更新统计数据表
CompletableFuture
<
Void
>
future3
=
CompletableFuture
.
runAsync
(()
->
{
try
{
}
catch
(
Exception
e
)
{
this
.
updateStaticTable
(
planTasks
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
...
...
@@ -1743,25 +1750,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
List
<
ESTaskDetailDto
>
allESTaskDetailDtos
=
esTaskDetail
.
findAllByPlanTaskIdIn
(
planTasks
.
stream
().
map
(
p
->
String
.
valueOf
(
p
.
getId
())).
collect
(
Collectors
.
toList
()));
Map
<
Long
,
ESTaskDetailDto
>
esTaskDetailDtoMap
=
allESTaskDetailDtos
.
stream
().
collect
(
Collectors
.
toMap
(
ESTaskDetailDto:
:
getId
,
Function
.
identity
()));
// 只更新未完成状态
Map
<
Long
,
PlanTask
>
planTaskMap
=
planTasks
.
stream
().
collect
(
Collectors
.
toMap
(
PlanTask:
:
getId
,
Function
.
identity
()));
planTaskDetails
.
forEach
(
planTaskDetail
->
{
ESTaskDetailDto
esTaskDetailDto
=
esTaskDetailDtoMap
.
get
(
planTaskDetail
.
getId
());
PlanTask
planTask
=
planTaskMap
.
get
(
planTaskDetail
.
getTaskNo
());
JSONObject
appCheckInput
=
esTaskDetailDto
.
getAppCheckInput
();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapList
=
(
Map
<
String
,
List
<
Map
<
String
,
Object
>>>)
JSON
.
parse
(
appCheckInput
.
toJSONString
());
List
<
AppCheckInputRespone
>
appCheckInputRespones
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map
:
mapList
.
get
(
"items"
))
{
AppCheckInputRespone
appCheckInputRespone
=
new
AppCheckInputRespone
();
BeanUtils
.
copyProperties
(
appCheckInputRespone
,
map
);
Long
checkInputId
=
Long
.
valueOf
(
map
.
get
(
"checkInputId"
).
toString
());
InputItem
inputItem
=
inputItemDao
.
findById
(
checkInputId
).
get
();
BeanUtil
.
copyProperties
(
map
,
appCheckInputRespone
);
InputItem
inputItem
=
cacheHelper
.
getInputItemCacheData
(
map
.
get
(
"checkInputId"
).
toString
());
CheckInput
checkInput
=
new
CheckInput
();
String
itemType
=
String
.
valueOf
(
map
.
get
(
"itemType"
));
if
(
XJConstant
.
INPUT_ITEM_SELECT
.
equals
(
itemType
))
{
checkInput
=
paraseSelect
(
checkInput
,
String
.
valueOf
(
map
.
get
(
"dataJson"
)));
appCheckInputRespone
=
JSONObject
.
parseObject
(
toJSONString
(
checkInput
),
AppCheckInputRespone
.
class
);
paraseSelect
(
checkInput
,
String
.
valueOf
(
map
.
get
(
"dataJson"
)));
appCheckInputRespone
.
setInputValue
(
checkInput
.
getInputValue
());
}
else
if
(
XJConstant
.
INPUT_ITEM_NUMBER
.
equals
(
itemType
))
{
appCheckInputRespone
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
itemType
))
{
...
...
@@ -1775,9 +1777,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
esTaskDetailDto
.
setPointImgUrls
(
new
ArrayList
<>());
esTaskDetailDto
.
setAppCheckInput
(
appCheckInput
);
esTaskDetailDto
.
setPointStatus
(
String
.
valueOf
(
PlanTaskDetailIsFinishEnum
.
FINISHED
.
getValue
()));
List
<
PointCheckDetailBo
>
pointInputs
=
allPointInputs
.
stream
().
filter
(
p
->
p
.
getPointId
()
==
planTaskDetail
.
getPointId
()
&&
p
.
getRouteId
()
==
planTask
.
getRouteId
()).
collect
(
Collectors
.
toList
());
JSONObject
jsonObject
=
jobService
.
getCheckInput
(
pointInputs
,
"update"
,
null
);
esTaskDetailDto
.
setAppCheckInput
(
jsonObject
);
esTaskDetailDto
.
setPointImgUrls
(
new
ArrayList
<>());
});
return
allESTaskDetailDtos
;
...
...
@@ -1843,7 +1842,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return
planTaskDetailMapper
.
findPlanTaskByTaskIdAndPointId
(
plantaskId
,
pointId
);
}
@Override
public
Page
<
Map
<
String
,
Object
>>
getPlanTasks
(
String
toke
,
String
product
,
String
appKey
,
HashMap
<
String
,
Object
>
params
)
{
CommonPageable
pageParam
=
new
CommonPageable
();
List
<
Map
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
...
...
@@ -1876,11 +1874,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"finishStatus"
,
"*"
+
params
.
get
(
"finishStatus"
)
+
"*"
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
params
.
get
(
"type"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"type"
,
"*"
+
params
.
get
(
"type"
)
+
"*"
));
boolMust
.
must
(
query
);
}
//
if (!ObjectUtils.isEmpty(params.get("type"))) {
//
BoolQueryBuilder query = QueryBuilders.boolQuery();
//
query.must(QueryBuilders.matchPhraseQuery("type", "*" + params.get("type") + "*"));
//
boolMust.must(query);
//
}
if
(!
ObjectUtils
.
isEmpty
(
params
.
get
(
"startTime"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
...
...
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
;
import
com.alibaba.ttl.threadpool.TtlExecutors
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -61,6 +60,6 @@ public class ExecutorConfig {
//等待所有任务结束后再关闭线程池
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
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
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.RedisUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.patrol.business.feign.JcsFeignClient
;
import
com.yeejoin.amos.patrol.exception.PermissionException
;
import
org.apache.commons.lang3.StringUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
/**
* @author DELL
*/
@Aspect
@Component
@ResponseBody
@Order
(
value
=
1
)
public
class
PersonIdentifyTzsAspect
{
@Autowired
RedisUtils
redisUtils
;
@Autowired
private
JcsFeignClient
jcsFeignClient
;
@Value
(
"${logic}"
)
Boolean
logic
;
@Pointcut
(
"execution(public * com.yeejoin.amos.*.business.controller..*(..))"
)
public
void
userDate
()
{
}
@Before
(
"userDate()"
)
public
void
personIdentity
(
JoinPoint
joinPoint
)
throws
PermissionException
{
//定时任务没有token
if
(
RequestContext
.
getExeUserId
()==
null
||
RequestContext
.
getToken
()==
null
){
}
else
{
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
reginParam
!=
null
)
{
if
(
reginParam
.
getPersonIdentity
()
==
null
||
StringUtils
.
isEmpty
(
reginParam
.
getPersonIdentity
().
getBizOrgCode
())
)
{
String
userId
=
reginParam
.
getUserModel
().
getUserId
();
if
(
userId
!=
null
)
{
// FeignClientResult responseModel = jcsFeignClient.selectById(userId);
//
//
// if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
// throw new RuntimeException(responseModel.getDevMessage());
//package com.yeejoin.amos.patrol.config;
//
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//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.RedisUtils;
//import com.yeejoin.amos.component.feign.model.FeignClientResult;
//import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
//import com.yeejoin.amos.patrol.exception.PermissionException;
//import org.apache.commons.lang3.StringUtils;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.core.annotation.Order;
//import org.springframework.http.HttpStatus;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
///**
// * @author DELL
// */
//@Aspect
//@Component
//@ResponseBody
//@Order(value = 1)
//public class PersonIdentifyTzsAspect {
//
// @Autowired
// RedisUtils redisUtils;
// @Autowired
// private JcsFeignClient jcsFeignClient;
//
// @Value("${logic}")
// Boolean logic;
//
// @Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
// public void userDate() {
//
// }
//
//
// @Before("userDate()")
// public void personIdentity(JoinPoint joinPoint) throws PermissionException {
//
//
// //定时任务没有token
// if(RequestContext.getExeUserId()==null|| RequestContext.getToken()==null){
//
// }else {
// ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// if (reginParam != null ) {
// if (reginParam.getPersonIdentity() == null || StringUtils.isEmpty(reginParam.getPersonIdentity().getBizOrgCode()) ) {
// String userId = reginParam.getUserModel().getUserId();
//
// if (userId != null) {
//// FeignClientResult responseModel = jcsFeignClient.selectById(userId);
////
////
//// if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
//// 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);
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
());
}
reginParam
.
setPersonIdentity
(
personIdentity
);
redisUtils
.
set
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()),
JSONObject
.
toJSONString
(
reginParam
));
}
}
}
}
}
}
//
// 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;
*
*/
@Component
public
class
AsyncTask
implements
ApplicationContextAware
{
public
class
AsyncTask
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
AsyncTask
.
class
);
@Autowired
...
...
@@ -90,7 +90,6 @@ public class AsyncTask implements ApplicationContextAware {
@Autowired
Executor
asyncServiceExecutor
;
ApplicationContext
applicationContext
;
private
static
final
String
TOKE
=
"TOKE"
;
...
...
@@ -99,7 +98,6 @@ public class AsyncTask implements ApplicationContextAware {
@Autowired
IInputItemDao
inputItemDao
;
private
final
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
=
new
LinkedBlockingDeque
<>();
/**
...
...
@@ -327,37 +325,4 @@ public class AsyncTask implements ApplicationContextAware {
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 {
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
);
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
...
...
@@ -13,23 +13,8 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.patrol.business.bo.PlanTaskSyncBo
;
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.MsgMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PointMapper
;
import
com.yeejoin.amos.patrol.business.dao.repository.ESPlanTaskList
;
import
com.yeejoin.amos.patrol.business.dao.repository.ESTaskDetail
;
import
com.yeejoin.amos.patrol.business.dao.repository.ICheckDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.ICheckInputDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IInputItemDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IMsgDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IPlanDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.ITaskDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.ITaskFeedbackDao
;
import
com.yeejoin.amos.patrol.business.dao.mapper.*
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
import
com.yeejoin.amos.patrol.business.feign.JcsFeignClient
;
...
...
@@ -39,25 +24,11 @@ import com.yeejoin.amos.patrol.business.service.intfc.IMessageService;
import
com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService
;
import
com.yeejoin.amos.patrol.business.service.intfc.IPlanService
;
import
com.yeejoin.amos.patrol.business.util.DateUtil
;
import
com.yeejoin.amos.patrol.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.patrol.common.enums.PlanTaskDetailIsFinishEnum
;
import
com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum
;
import
com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum
;
import
com.yeejoin.amos.patrol.common.enums.TaskStatusEnum
;
import
com.yeejoin.amos.patrol.common.enums.*
;
import
com.yeejoin.amos.patrol.core.async.AsyncTask
;
import
com.yeejoin.amos.patrol.core.common.response.AppCheckInputRespone
;
import
com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone
;
import
com.yeejoin.amos.patrol.dao.entity.Check
;
import
com.yeejoin.amos.patrol.dao.entity.CheckInput
;
import
com.yeejoin.amos.patrol.dao.entity.ESPlanTaskListDto
;
import
com.yeejoin.amos.patrol.dao.entity.ESTaskDetailDto
;
import
com.yeejoin.amos.patrol.dao.entity.InputItem
;
import
com.yeejoin.amos.patrol.dao.entity.Msg
;
import
com.yeejoin.amos.patrol.dao.entity.Plan
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
com.yeejoin.amos.patrol.dao.entity.Task
;
import
com.yeejoin.amos.patrol.dao.entity.TaskFeedback
;
import
com.yeejoin.amos.patrol.dao.entity.*
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.mqtt.WebMqttComponent
;
import
org.quartz.Job
;
...
...
@@ -75,15 +46,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
...
...
@@ -228,7 +191,7 @@ public class JobService implements IJobService {
log
.
error
(
"项目初始化执行开始添加定时任务监控========"
);
boolean
flag
=
false
;
for
(
PlanTask
planTask
:
planTaskList
)
{
for
(
PlanTask
planTask
:
planTaskList
)
{
try
{
Date
beginTime
=
sdf
.
parse
(
planTask
.
getBeginTime
());
Date
endTime
=
sdf
.
parse
(
planTask
.
getEndTime
());
...
...
@@ -251,11 +214,11 @@ public class JobService implements IJobService {
}
List
<
String
>
newList
=
ids
.
subList
(
i
,
i
+
index
);
planTaskMapper
.
updatePlanTaskList
(
newList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
updateEsPlanTaskList
(
newList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
updateEsPlanTaskList
(
newList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
}
}
else
{
planTaskMapper
.
updatePlanTaskList
(
ids
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
updateEsPlanTaskList
(
ids
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
updateEsPlanTaskList
(
ids
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
}
}
planTaskAddJob
(
planTask
);
...
...
@@ -268,7 +231,7 @@ public class JobService implements IJobService {
if
(
endTime
.
getTime
()
<
timestamp
)
{
log
.
error
(
"项目初始化进行中监听器任务监控2222========"
);
ids
=
planTaskMapper
.
selectPlanTaskIdList
(
planTask
.
getPlanId
(),
PlanTaskFinishStatusEnum
.
NOTSTARTED
.
getValue
());
if
(!
ObjectUtils
.
isEmpty
(
ids
))
{
if
(!
ObjectUtils
.
isEmpty
(
ids
))
{
flag
=
true
;
if
(!
ObjectUtils
.
isEmpty
(
ids
))
{
if
(
ids
.
size
()
>
10000
)
{
...
...
@@ -279,11 +242,11 @@ public class JobService implements IJobService {
}
List
<
String
>
newList
=
ids
.
subList
(
i
,
i
+
index
);
planTaskMapper
.
updatePlanTaskList
(
newList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
updateEsPlanTaskList
(
newList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
updateEsPlanTaskList
(
newList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
}
}
else
{
planTaskMapper
.
updatePlanTaskList
(
ids
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
updateEsPlanTaskList
(
ids
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
updateEsPlanTaskList
(
ids
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
}
}
}
...
...
@@ -300,8 +263,8 @@ public class JobService implements IJobService {
e
.
printStackTrace
();
}
}
// 重新更新统计表 -- 只更新当天统计的数据
if
(
flag
)
{
// 重新更新统计表 -- 只更新当天统计的数据
if
(
flag
)
{
patrolDataSyncService
.
taskStatic
(
null
);
}
}
...
...
@@ -309,7 +272,7 @@ public class JobService implements IJobService {
@Autowired
PointMapper
pointMapper
;
public
void
updateEsPlanTaskList
(
List
<
String
>
ids
,
int
status
,
String
isApp
,
CheckRecordParam
requestParam
)
{
public
void
updateEsPlanTaskList
(
List
<
String
>
ids
,
int
status
,
String
isApp
,
CheckRecordParam
requestParam
)
{
String
type
=
"save"
;
if
(
"app"
.
equals
(
isApp
))
{
type
=
"update"
;
...
...
@@ -326,7 +289,7 @@ public class JobService implements IJobService {
esPlanTaskListDto
.
setTaskPlanNum
(
ObjectUtils
.
isEmpty
(
task
.
get
(
"taskPlanNum"
))
?
"0"
:
task
.
get
(
"taskPlanNum"
).
toString
());
List
<
PlanTaskDetail
>
planTaskDetailList
=
planTaskMapper
.
selectTaskDetails
(
"('"
+
id
+
"')"
);
Long
routId
=
planTaskMapper
.
selectRoutId
(
id
);
List
<
ESTaskDetailDto
>
esTaskDetailDtos
=
new
ArrayList
<>();
List
<
ESTaskDetailDto
>
esTaskDetailDtos
=
new
ArrayList
<>();
for
(
PlanTaskDetail
taskDetail
:
planTaskDetailList
)
{
AppPointCheckRespone
appPointCheckRespone
=
planService
.
queryPointPlanTaskDetail
(
null
,
null
,
null
,
taskDetail
.
getTaskNo
(),
taskDetail
.
getPointId
());
ESTaskDetailDto
esTaskDetailDto
=
esTaskDetail
.
findById
(
String
.
valueOf
(
appPointCheckRespone
.
getId
())).
get
();
...
...
@@ -345,8 +308,8 @@ public class JobService implements IJobService {
}
private
void
updatePlanTaskAndDetailStatus
(
PlanTask
planTask
)
{
List
<
String
>
esIds
=
planTaskMapper
.
selectPlanTaskIdLists
(
planTask
.
getPlanId
(),
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
PlanTaskFinishStatusEnum
.
NOTSTARTED
.
getValue
());
if
(
esIds
.
size
()
>
0
)
{
List
<
String
>
esIds
=
planTaskMapper
.
selectPlanTaskIdLists
(
planTask
.
getPlanId
(),
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
PlanTaskFinishStatusEnum
.
NOTSTARTED
.
getValue
());
if
(
esIds
.
size
()
>
0
)
{
if
(
esIds
.
size
()
>
10000
)
{
int
index
=
10000
;
for
(
int
i
=
0
;
i
<
esIds
.
size
();
i
+=
10000
)
{
...
...
@@ -375,7 +338,7 @@ public class JobService implements IJobService {
}
List
<
Long
>
ids
=
new
ArrayList
<>();
ids
.
add
(
planTask
.
getId
());
if
(!
ValidationUtil
.
isEmpty
(
ids
))
{
if
(!
ValidationUtil
.
isEmpty
(
ids
))
{
planTaskMapper
.
updatePlanTaskDetailsByPlanId
(
ids
);
}
}
...
...
@@ -476,7 +439,7 @@ public class JobService implements IJobService {
}
else
{
check
.
setUserName
(
userName
.
toString
());
}
// check.setDepId(deptId.toString().substring(0, deptId.length() - 1));
// check.setDepId(deptId.toString().substring(0, deptId.length() - 1));
check
.
setDepName
(
deptName
.
toString
());
check
.
setPointId
(
arg
.
getPointId
());
...
...
@@ -563,74 +526,7 @@ public class JobService implements IJobService {
if
(
x
.
getInputItemId
()
==
action
.
getInputItemId
())
{
if
(
x
.
getCheckInputImg
()
!=
null
&&
x
.
getCheckInputImg
().
size
()
>
0
)
{
input
.
setPointInputImgUrls
(
x
.
getCheckInputImg
());
}
else
{
input
.
setPointInputImgUrls
(
new
ArrayList
<>());
}
}
}
}
}
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
input
.
setDefaultValue
(
action
.
getDefaultValue
());
input
.
setDataJson
(
action
.
getDataJson
());
input
.
setIsMultiline
(
action
.
getIsMultiline
());
input
.
setIsMust
(
action
.
getIsMust
());
input
.
setItemType
(
action
.
getItemType
());
input
.
setOrderNo
(
action
.
getOrderNo
());
input
.
setPictureJson
(
action
.
getPictureJson
());
input
.
setClassifyId
(
action
.
getClassifyId
());
input
.
setClassifyName
(
action
.
getClassifyName
());
appCheckInputResponeList
.
add
(
input
);
});
appResponeMap
.
put
(
"items"
,
appCheckInputResponeList
);
return
appResponeMap
;
}
@Override
public
JSONObject
getCheckInput
(
List
<
PointCheckDetailBo
>
pointInputs
,
String
type
,
CheckRecordParam
requestParam
)
{
List
<
AppCheckInputRespone
>
appCheckInputResponeList
=
new
ArrayList
<
AppCheckInputRespone
>();
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
if
(
"save"
.
equals
(
type
))
{
input
.
setInputValue
(
null
);
input
.
setPointInputImgUrls
(
new
ArrayList
<>());
}
else
{
InputItem
inputItem
=
inputItemDao
.
findById
(
action
.
getInputItemId
()).
get
();
CheckInput
checkInput
=
new
CheckInput
();
if
(!
ValidationUtil
.
isEmpty
(
requestParam
))
{
List
<
CheckInputParam
>
checkItems
=
requestParam
.
getCheckItems
();
for
(
CheckInputParam
x
:
checkItems
)
{
if
(
x
.
getInputItemId
()
==
action
.
getInputItemId
())
{
input
.
setInputValue
(
x
.
getInputValue
());
break
;
}
}
}
else
{
if
(
XJConstant
.
INPUT_ITEM_SELECT
.
equals
(
inputItem
.
getItemType
()))
{
checkInput
=
paraseSelect
(
checkInput
,
inputItem
.
getDataJson
(),
inputItem
.
getIsScore
());
input
=
JSONObject
.
parseObject
(
toJSONString
(
checkInput
),
AppCheckInputRespone
.
class
);
}
else
if
(
XJConstant
.
INPUT_ITEM_NUMBER
.
equals
(
inputItem
.
getItemType
()))
{
input
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
inputItem
.
getItemType
()))
{
input
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
}
if
(!
ObjectUtils
.
isEmpty
(
requestParam
))
{
List
<
CheckInputParam
>
checkItems
=
requestParam
.
getCheckItems
();
for
(
CheckInputParam
x
:
checkItems
)
{
if
(
x
.
getInputItemId
()
==
action
.
getInputItemId
())
{
if
(
x
.
getCheckInputImg
()
!=
null
&&
x
.
getCheckInputImg
().
size
()
>
0
)
{
input
.
setPointInputImgUrls
(
x
.
getCheckInputImg
());
}
else
{
}
else
{
input
.
setPointInputImgUrls
(
new
ArrayList
<>());
}
}
...
...
@@ -656,14 +552,12 @@ public class JobService implements IJobService {
return
appResponeMap
;
}
/**
* 创建检查记录
*
* @param planTask
*/
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
)
{
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
)
{
List
<
PlanTaskPointInputItemBo
>
planTaskPointInputItems
=
planTaskMapper
.
getPlanTaskPointInputItemByPlanTaskId
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
Map
<
Long
,
Check
>
checkMap
=
new
HashMap
<>();
Map
<
String
,
String
>
deptMap
=
new
HashMap
<>();
...
...
@@ -739,7 +633,7 @@ public class JobService implements IJobService {
CheckInput
checkInput
=
new
CheckInput
();
if
(
XJConstant
.
INPUT_ITEM_SELECT
.
equals
(
inputItem
.
getItemType
()))
{
checkInput
=
paraseSelect
(
checkInput
,
inputItem
.
getDataJson
(),
inputItem
.
getIsScore
());
checkInput
=
paraseSelect
(
checkInput
,
inputItem
.
getDataJson
(),
inputItem
.
getIsScore
());
}
else
if
(
XJConstant
.
INPUT_ITEM_NUMBER
.
equals
(
inputItem
.
getItemType
()))
{
checkInput
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
inputItem
.
getItemType
()))
{
...
...
@@ -763,14 +657,14 @@ public class JobService implements IJobService {
}
private
CheckInput
paraseSelect
(
CheckInput
checkInput
,
String
json
,
String
isScore
)
{
private
CheckInput
paraseSelect
(
CheckInput
checkInput
,
String
json
,
String
isScore
)
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
json
);
if
(!
ObjectUtils
.
isEmpty
(
jsonArray
))
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
String
validateName
=
jsonObject
.
getString
(
"name"
);
String
validateIsOk
=
jsonObject
.
getString
(
"isOk"
);
if
(
validateIsOk
.
equals
(
"是"
))
{
if
(
validateIsOk
.
equals
(
"是"
))
{
checkInput
.
setInputValue
(
validateName
);
}
}
...
...
@@ -900,9 +794,9 @@ public class JobService implements IJobService {
public
void
planTaskJobPerform
(
long
planId
,
String
jobType
,
String
jobName
)
{
if
(
planDao
.
existsById
(
planId
))
{
List
<
Long
>
notStartPlanTaskList
=
planTaskMapper
.
getPlanTaskListByPlanId
(
planId
,
PlanTaskFinishStatusEnum
.
NOTSTARTED
.
getValue
());
List
<
Long
>
StartPlanTaskList
=
planTaskMapper
.
getPlanTaskListByPlanId
(
planId
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
List
<
PlanTask
>
planTaskList
=
planTaskMapper
.
getPlanTaskTListByPlanId
(
planId
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
List
<
Long
>
notStartPlanTaskList
=
planTaskMapper
.
getPlanTaskListByPlanId
(
planId
,
PlanTaskFinishStatusEnum
.
NOTSTARTED
.
getValue
());
List
<
Long
>
StartPlanTaskList
=
planTaskMapper
.
getPlanTaskListByPlanId
(
planId
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
List
<
PlanTask
>
planTaskList
=
planTaskMapper
.
getPlanTaskTListByPlanId
(
planId
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
List
<
String
>
notStartPlanTaskStringList
=
notStartPlanTaskList
.
stream
()
.
map
(
Object:
:
toString
)
...
...
@@ -916,17 +810,17 @@ public class JobService implements IJobService {
if
(
XJConstant
.
STATUS_MONITOR_START
.
equals
(
jobType
))
{
if
(!
ValidationUtil
.
isEmpty
(
notStartPlanTaskList
))
{
planTaskMapper
.
updatePlanTaskByPlanId
(
notStartPlanTaskList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
());
updateEsPlanTaskList
(
notStartPlanTaskStringList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
updateEsPlanTaskList
(
notStartPlanTaskStringList
,
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
(),
"notApp"
,
null
);
patrolDataSyncService
.
taskStatic
(
null
);
}
}
else
if
(
XJConstant
.
STATUS_MONITOR_END
.
equals
(
jobType
))
{
if
(!
ValidationUtil
.
isEmpty
(
StartPlanTaskList
))
{
planTaskMapper
.
updatePlanTaskByPlanId
(
StartPlanTaskList
,
PlanTaskFinishStatusEnum
.
OVERTIME
.
getValue
());
planTaskMapper
.
updatePlanTaskByPlanId
(
StartPlanTaskList
,
PlanTaskFinishStatusEnum
.
OVERTIME
.
getValue
());
planTaskMapper
.
updatePlanTaskDetailsByPlanId
(
StartPlanTaskList
);
updateEsPlanTaskList
(
StartPlanTaskStringList
,
PlanTaskFinishStatusEnum
.
OVERTIME
.
getValue
(),
"notApp"
,
null
);
updateEsPlanTaskList
(
StartPlanTaskStringList
,
PlanTaskFinishStatusEnum
.
OVERTIME
.
getValue
(),
"notApp"
,
null
);
patrolDataSyncService
.
taskStatic
(
null
);
for
(
PlanTask
planTask:
planTaskList
)
{
for
(
PlanTask
planTask
:
planTaskList
)
{
createOmissionCheckRecord
(
planTask
);
}
// iPlanTaskDao.updatePlanTaskDetailFinishStatus(collect,PlanTaskFinishStatusEnum.UNDERWAY.getValue());
...
...
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
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.password
=
Yeejoin@2023
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name
=
cn.com.vastbase.Driver
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.validationQuery
=
SELECT 1
...
...
@@ -190,4 +192,11 @@ spring.jpa.properties.hibernate.order_updates =true
#spring.shardingsphere.props.sql-show= false
#spring.shardingsphere.props.max-connections-size-per-query=5
shardingsphere.create.tables.num
=
10
\ No newline at end of file
shardingsphere.create.tables.num
=
10
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 @@
</if>
</where>
</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>
\ 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 @@
<if
test=
"orgCode!=null"
>
AND tb.org_code = #{orgCode}
</if>
</where>
</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>
\ 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 @@
pii.picture_json pictureJson,
pii.is_multiline isMultiline,
pii.order_no orderNo,
pii.is_score,
prp.point_id,
prp.route_id
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