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
37a8b900
Commit
37a8b900
authored
Nov 08, 2023
by
litengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保存代码优化
parent
ae971d1d
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
228 additions
and
126 deletions
+228
-126
JobService.java
.../main/java/com/yeejoin/amos/patrol/quartz/JobService.java
+3
-3
logback-dev.xml
...os-boot-module-tcm-biz/src/main/resources/logback-dev.xml
+11
-11
PatrolApplication.java
...biz/src/main/java/com/yeejoin/amos/PatrolApplication.java
+1
-0
CheckController.java
...join/amos/patrol/business/controller/CheckController.java
+4
-11
IPlanTaskDetailDao.java
...os/patrol/business/dao/repository/IPlanTaskDetailDao.java
+2
-0
RepositoryTs.java
...oin/amos/patrol/business/dao/repository/RepositoryTs.java
+14
-0
CheckServiceImpl.java
...n/amos/patrol/business/service/impl/CheckServiceImpl.java
+10
-74
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+25
-9
RepositoryTImpl.java
...in/amos/patrol/business/service/impl/RepositoryTImpl.java
+62
-0
RouteServiceImpl.java
...n/amos/patrol/business/service/impl/RouteServiceImpl.java
+23
-11
ICheckService.java
...oin/amos/patrol/business/service/intfc/ICheckService.java
+3
-2
ExecutorConfig.java
...n/java/com/yeejoin/amos/patrol/config/ExecutorConfig.java
+64
-0
LatentDanerScheduled.java
...om/yeejoin/amos/patrol/schedule/LatentDanerScheduled.java
+5
-4
dbTemplate_plan_task.xml
...biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+1
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/quartz/JobService.java
View file @
37a8b900
...
@@ -185,9 +185,9 @@ public class JobService implements IJobService {
...
@@ -185,9 +185,9 @@ public class JobService implements IJobService {
iPlanTaskDetailDao
.
saveAndFlush
(
action
);
iPlanTaskDetailDao
.
saveAndFlush
(
action
);
});
});
}
}
if
(
PlanTaskFinishStatusEnum
.
OVERTIME
.
getValue
()
==
status
)
{
//
if (PlanTaskFinishStatusEnum.OVERTIME.getValue() == status) {
createOmissionCheckRecord
(
planTask
);
//
createOmissionCheckRecord(planTask);
}
//
}
}
}
/**
/**
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/resources/logback-dev.xml
View file @
37a8b900
...
@@ -37,20 +37,20 @@
...
@@ -37,20 +37,20 @@
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
-->
<!--myibatis log configure-->
<!--myibatis log configure-->
<logger
name=
"com.apache.ibatis"
level=
"
debug
"
/>
<logger
name=
"com.apache.ibatis"
level=
"
INFO
"
/>
<logger
name=
"org.mybatis"
level=
"
debug
"
/>
<logger
name=
"org.mybatis"
level=
"
INFO
"
/>
<logger
name=
"java.sql.Connection"
level=
"
debug
"
/>
<logger
name=
"java.sql.Connection"
level=
"
INFO
"
/>
<logger
name=
"java.sql.Statement"
level=
"
debug
"
/>
<logger
name=
"java.sql.Statement"
level=
"
INFO
"
/>
<logger
name=
"java.sql.PreparedStatement"
level=
"
debug
"
/>
<logger
name=
"java.sql.PreparedStatement"
level=
"
INFO
"
/>
<logger
name=
"org.springframework"
level=
"
debug
"
/>
<logger
name=
"org.springframework"
level=
"
INFO
"
/>
<logger
name=
"com.baomidou.mybatisplus"
level=
"
debug
"
/>
<logger
name=
"com.baomidou.mybatisplus"
level=
"
INFO
"
/>
<logger
name=
"org.apache.activemq"
level=
"
debug
"
/>
<logger
name=
"org.apache.activemq"
level=
"
INFO
"
/>
<logger
name=
"org.typroject"
level=
"
debug
"
/>
<logger
name=
"org.typroject"
level=
"
INFO
"
/>
<logger
name=
"com.yeejoin"
level=
"
debug
"
/>
<logger
name=
"com.yeejoin"
level=
"
INFO
"
/>
<!-- 日志输出级别 -->
<!-- 日志输出级别 -->
<root
level=
"
debug
"
>
<root
level=
"
INFO
"
>
<!-- <appender-ref ref="FILE" /> -->
<!-- <appender-ref ref="FILE" /> -->
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"STDOUT"
/>
<!-- <appender-ref ref="ELK" />-->
<!-- <appender-ref ref="ELK" />-->
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/PatrolApplication.java
View file @
37a8b900
...
@@ -21,6 +21,7 @@ import org.springframework.context.annotation.ComponentScan;
...
@@ -21,6 +21,7 @@ import org.springframework.context.annotation.ComponentScan;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/CheckController.java
View file @
37a8b900
...
@@ -205,16 +205,9 @@ public class CheckController extends AbstractBaseController {
...
@@ -205,16 +205,9 @@ public class CheckController extends AbstractBaseController {
public
ResponseModel
<
Object
>
saveCheckRecordNew
(
public
ResponseModel
<
Object
>
saveCheckRecordNew
(
@ApiParam
(
value
=
"检查信息"
,
required
=
false
)
@RequestBody
(
required
=
true
)
CheckRecordParam
requestParam
)
{
@ApiParam
(
value
=
"检查信息"
,
required
=
false
)
@RequestBody
(
required
=
true
)
CheckRecordParam
requestParam
)
{
int
statu
=
-
1
;
int
statu
=
-
1
;
PlanTask
planTask
=
null
;
PlanTask
planTask
=
planTaskService
.
selectPlanTaskStatus
(
requestParam
.
getPlanTaskId
())
;
log
.
info
(
"手机app保存巡检记录++++++++++++++++++++++: {}"
,
JSON
.
toJSONString
(
requestParam
));
log
.
info
(
"手机app保存巡检记录++++++++++++++++++++++: {}"
,
JSON
.
toJSONString
(
requestParam
));
if
(
requestParam
.
getPlanTaskId
()!=
null
&&
requestParam
.
getPlanTaskId
()
!=
0
){
List
<
Map
<
String
,
Object
>>
map
=
checkService
.
selectCheckById
(
requestParam
.
getPlanTaskId
(),
requestParam
.
getPointId
());
if
(!
CollectionUtils
.
isEmpty
(
map
))
{
List
<
Long
>
ids
=
map
.
stream
().
map
(
m
->
Long
.
valueOf
(
m
.
get
(
"id"
).
toString
())).
collect
(
Collectors
.
toList
());
checkService
.
delCheckByTaskId
(
requestParam
.
getPlanTaskId
(),
ids
,
requestParam
.
getPointId
());
}
planTask
=
planTaskService
.
selectPlanTaskStatus
(
requestParam
.
getPlanTaskId
());
}
AgencyUserModel
user
=
getUserInfo
();
AgencyUserModel
user
=
getUserInfo
();
String
userId
=
user
.
getUserId
();
String
userId
=
user
.
getUserId
();
String
realName
=
user
.
getRealName
();
String
realName
=
user
.
getRealName
();
...
@@ -251,7 +244,7 @@ public class CheckController extends AbstractBaseController {
...
@@ -251,7 +244,7 @@ public class CheckController extends AbstractBaseController {
String
orgCode
=
reginParams
.
getPersonIdentity
().
getBizOrgCode
();
String
orgCode
=
reginParams
.
getPersonIdentity
().
getBizOrgCode
();
requestParam
.
setOrgCode
(
orgCode
);
requestParam
.
setOrgCode
(
orgCode
);
requestParam
.
setUserId
(
getUserId
());
requestParam
.
setUserId
(
getUserId
());
CheckDto
checkDto
=
checkService
.
saveCheckRecordNew
(
requestParam
);
CheckDto
checkDto
=
checkService
.
saveCheckRecordNew
(
requestParam
,
planTask
);
return
ResponseHelper
.
buildResponse
(
checkDto
);
return
ResponseHelper
.
buildResponse
(
checkDto
);
}
else
{
}
else
{
return
ResponseHelperUtil
.
buildErrorResponse
(
"无需重新巡检"
);
return
ResponseHelperUtil
.
buildErrorResponse
(
"无需重新巡检"
);
...
@@ -723,7 +716,7 @@ public class CheckController extends AbstractBaseController {
...
@@ -723,7 +716,7 @@ public class CheckController extends AbstractBaseController {
@RequestMapping
(
value
=
"/v2/queryCheckPointDetail"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/v2/queryCheckPointDetail"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryCheckPointDetailInVersion2
(
@RequestParam
long
checkId
)
{
public
CommonResponse
queryCheckPointDetailInVersion2
(
@RequestParam
long
checkId
)
{
try
{
try
{
AppPointCheckRespone
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
getToken
(),
getProduct
(),
getAppKey
(),
checkId
);
AppPointCheckRespone
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
getToken
(),
getProduct
(),
getAppKey
(),
checkId
,
null
,
null
);
return
CommonResponseUtil
.
success
(
pointCheckRespone
);
return
CommonResponseUtil
.
success
(
pointCheckRespone
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/repository/IPlanTaskDetailDao.java
View file @
37a8b900
...
@@ -3,11 +3,13 @@ package com.yeejoin.amos.patrol.business.dao.repository;
...
@@ -3,11 +3,13 @@ package com.yeejoin.amos.patrol.business.dao.repository;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.List
;
@Repository
(
"planTaskDetail"
)
@Repository
(
"planTaskDetail"
)
@EnableJpaRepositories
public
interface
IPlanTaskDetailDao
extends
BaseDao
<
PlanTaskDetail
,
Long
>
{
public
interface
IPlanTaskDetailDao
extends
BaseDao
<
PlanTaskDetail
,
Long
>
{
@Modifying
@Modifying
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/repository/RepositoryTs.java
0 → 100644
View file @
37a8b900
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
repository
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
RepositoryTs
{
// 批量存储的方法
<
S
>
Iterable
<
S
>
batchSave
(
Iterable
<
S
>
var1
);
// 批量更新的方法
<
S
>
Iterable
<
S
>
batchUpdate
(
Iterable
<
S
>
var1
);
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/CheckServiceImpl.java
View file @
37a8b900
...
@@ -206,15 +206,6 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -206,15 +206,6 @@ public class CheckServiceImpl implements ICheckService {
)
{
)
{
checkShotDao
.
saveAndFlush
(
cs
);
checkShotDao
.
saveAndFlush
(
cs
);
}
}
// 巡检站端与中心级数据同步
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
// 事物提交后业务逻辑
patrolDataSyncService
.
checkDataSync
(
check
);
patrolDataSyncService
.
checkShotDataSync
(
imgList
);
}
});
}
}
@Override
@Override
...
@@ -463,16 +454,14 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -463,16 +454,14 @@ public class CheckServiceImpl implements ICheckService {
@Override
@Override
@Transactional
@Transactional
public
CheckDto
saveCheckRecordNew
(
CheckRecordParam
requestParam
)
{
public
CheckDto
saveCheckRecordNew
(
CheckRecordParam
requestParam
,
PlanTask
planTask
)
{
try
{
try
{
PlanTaskDetail
taskDetail
=
null
;
PlanTaskDetail
taskDetail
=
null
;
PlanTask
planTask
=
null
;
Check
check
=
new
Check
();
Check
check
=
new
Check
();
HashMap
<
String
,
Object
>
routeParam
=
new
HashMap
<
String
,
Object
>();
HashMap
<
String
,
Object
>
routeParam
=
new
HashMap
<
String
,
Object
>();
Map
detail
=
null
;
Map
detail
=
null
;
Boolean
isOffline
=
requestParam
.
getIsOffline
();
Point
point
=
iPointService
.
queryPointById
(
requestParam
.
getPointId
());
Point
point
=
iPointService
.
queryPointById
(
requestParam
.
getPointId
());
if
(!
ObjectUtils
.
isEmpty
(
requestParam
)
&&
if
(!
ObjectUtils
.
isEmpty
(
requestParam
)
&&
...
@@ -480,8 +469,6 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -480,8 +469,6 @@ public class CheckServiceImpl implements ICheckService {
&&
requestParam
.
getPlanTaskId
()
>
0
)
{
&&
requestParam
.
getPlanTaskId
()
>
0
)
{
detail
=
planTaskDetailMapper
.
findPlanTaskByTaskIdAndPointId
(
requestParam
.
getPlanTaskId
(),
requestParam
.
getPointId
());
detail
=
planTaskDetailMapper
.
findPlanTaskByTaskIdAndPointId
(
requestParam
.
getPlanTaskId
(),
requestParam
.
getPointId
());
if
(!
ObjectUtils
.
isEmpty
(
detail
))
{
if
(!
ObjectUtils
.
isEmpty
(
detail
))
{
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
requestParam
.
getPlanTaskId
(),
requestParam
.
getPointId
());
planTask
=
planTaskDao
.
findById
(
requestParam
.
getPlanTaskId
()).
get
();
Optional
<
PlanTaskDetail
>
planD
=
planTaskDetailDao
.
findById
(
Long
.
valueOf
(
detail
.
get
(
"id"
).
toString
()));
Optional
<
PlanTaskDetail
>
planD
=
planTaskDetailDao
.
findById
(
Long
.
valueOf
(
detail
.
get
(
"id"
).
toString
()));
taskDetail
=
planD
.
get
();
taskDetail
=
planD
.
get
();
routeParam
.
put
(
"routeId"
,
planTask
.
getRouteId
());
routeParam
.
put
(
"routeId"
,
planTask
.
getRouteId
());
...
@@ -547,9 +534,7 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -547,9 +534,7 @@ public class CheckServiceImpl implements ICheckService {
}
}
InputItem
inputItem
=
inputItemDao
.
findById
(
item
.
getInputItemId
()).
get
();
InputItem
inputItem
=
inputItemDao
.
findById
(
item
.
getInputItemId
()).
get
();
CheckInput
checkInput
=
new
CheckInput
();
CheckInput
checkInput
=
new
CheckInput
();
if
(
isOffline
&&
check
.
getId
()
!=
0
)
{
checkInput
=
checkInputDao
.
findByCheckIdAndInputIdAndPointClassifyId
(
check
.
getId
(),
inputItem
.
getId
(),
item
.
getClassifyIds
());
}
checkInput
.
setCreateDate
(
new
Date
());
checkInput
.
setCreateDate
(
new
Date
());
checkInput
.
setOrgCode
(
requestParam
.
getOrgCode
());
checkInput
.
setOrgCode
(
requestParam
.
getOrgCode
());
checkInput
.
setInputId
(
Long
.
valueOf
(
item
.
getInputItemId
()
+
""
));
checkInput
.
setInputId
(
Long
.
valueOf
(
item
.
getInputItemId
()
+
""
));
...
@@ -606,15 +591,10 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -606,15 +591,10 @@ public class CheckServiceImpl implements ICheckService {
planTaskDetailDao
.
saveAndFlush
(
taskDetail
);
planTaskDetailDao
.
saveAndFlush
(
taskDetail
);
check
.
setError
(
error
);
check
.
setError
(
error
);
check
.
setErrorClassify
(
StringUtils
.
join
(
errorClassifyNames
.
keySet
(),
","
));
check
.
setErrorClassify
(
StringUtils
.
join
(
errorClassifyNames
.
keySet
(),
","
));
//计划外巡检是否计分 ,计划内默认都是计分
if
(
XJConstant
.
POINT_OK_SCORE
.
equals
(
point
.
getIsScore
())
||
requestParam
.
getPlanTaskId
()
!=
null
)
{
check
.
setScore
(
score
);
}
else
{
check
.
setScore
(
Integer
.
parseInt
(
XJConstant
.
POINT_NOT_SCORE
));
}
try
{
try
{
log
.
error
(
"手机app保存巡检记录++++++++++++++++++++++"
+
check
.
toString
()
+
"<Over><Over><Over><Over>"
);
log
.
error
(
"手机app保存巡检记录++++++++++++++++++++++"
+
check
.
toString
()
+
"<Over><Over><Over><Over>"
);
check
=
checkDao
.
save
(
check
);
check
=
checkDao
.
save
AndFlush
(
check
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -664,10 +644,8 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -664,10 +644,8 @@ public class CheckServiceImpl implements ICheckService {
imgList
.
add
(
img
);
imgList
.
add
(
img
);
}
}
}
}
List
<
CheckInput
>
checkInputList
=
new
ArrayList
<>();
for
(
CheckInput
checkInput
:
checkItemList
)
{
for
(
CheckInput
checkInput
:
checkItemList
)
{
checkInputDao
.
saveAndFlush
(
checkInput
);
checkInputDao
.
saveAndFlush
(
checkInput
);
checkInputList
.
add
(
checkInput
);
}
}
if
(
imgList
.
size
()
>
0
)
{
if
(
imgList
.
size
()
>
0
)
{
...
@@ -919,19 +897,15 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -919,19 +897,15 @@ public class CheckServiceImpl implements ICheckService {
}
}
@Override
@Override
public
AppPointCheckRespone
queryCheckPointDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
long
checkId
)
{
public
AppPointCheckRespone
queryCheckPointDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
long
checkId
,
Long
planTaskId
,
Long
pointId
)
{
// List list = checkMapper.queryCheckPointInputItem(planTaskId, pointId);
List
<
PointCheckDetailBo
>
list
=
checkMapper
.
findCheckPointInputItem
(
checkId
);
List
<
PointCheckDetailBo
>
list
=
checkMapper
.
findCheckPointInputItem
(
checkId
);
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
if
(!
list
.
isEmpty
())
{
if
(!
list
.
isEmpty
())
{
// InetAddress address = InetAddress.getLocalHost();
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
// String ip = address.getHostAddress();
// String ipPort = "http://" + fileIp + ":" + filePort + "/";
List
<
String
>
pointImgUrls
=
new
ArrayList
<>();
List
<
String
>
pointImgUrls
=
new
ArrayList
<>();
PointCheckDetailBo
pointCheckDetailBo
=
list
.
get
(
0
);
PointCheckDetailBo
pointCheckDetailBo
=
list
.
get
(
0
);
List
<
CheckShot
>
pointShot
=
checkShotDao
.
findAllByCheckIdAndCheckInputIdAndClassifyId
(
pointCheckDetailBo
.
getCheckId
(),
0
l
,
0
l
);
List
<
CheckShot
>
pointShot
=
checkShotDao
.
findAllByCheckIdAndCheckInputIdAndClassifyId
(
pointCheckDetailBo
.
getCheckId
(),
0
l
,
0
l
);
pointShot
.
forEach
(
action
->
{
pointShot
.
forEach
(
action
->
{
// pointImgUrls.add(fileUrl + action.getPhotoData());
pointImgUrls
.
add
(
action
.
getPhotoData
());
pointImgUrls
.
add
(
action
.
getPhotoData
());
});
});
Check
check
=
checkDao
.
findById
(
checkId
).
get
();
Check
check
=
checkDao
.
findById
(
checkId
).
get
();
...
@@ -942,25 +916,6 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -942,25 +916,6 @@ public class CheckServiceImpl implements ICheckService {
pointCheckRespone
.
setPlanName
(
pointCheckDetailBo
.
getPlanName
());
pointCheckRespone
.
setPlanName
(
pointCheckDetailBo
.
getPlanName
());
pointCheckRespone
.
setRemark
(
pointCheckDetailBo
.
getCheckRemark
());
pointCheckRespone
.
setRemark
(
pointCheckDetailBo
.
getCheckRemark
());
//pointCheckRespone.setDepartmentName(pointCheckDetailBo.getDepartmentName());
//pointCheckRespone.setUsername(pointCheckDetailBo.getUsername());
// DepartmentModel departmentBo = remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,pointCheckDetailBo.getCheckDepartmentId());
// if (departmentBo != null) {
// pointCheckRespone.setDepartmentName(departmentBo.getDepartmentName());
// }
//pointCheckRespone.setDepartmentName(pointCheckDetailBo.getDepartmentName());
// List<String> userIds = Arrays.asList(pointCheckDetailBo.getUserId().split(","));
// List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,pointCheckDetailBo.getUserId());
// Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName,(k1,k2)->k2));
// if (userModelMap != null) {
// List<String> userNameList = new ArrayList<>();
// for(String userId : userIds){
// userNameList.add(userModelMap.get(userId));
// }
// userNameList.remove("");
// userNameList.remove(null);
// pointCheckRespone.setUsername(Joiner.on(",").join(userNameList));
// }
pointCheckRespone
.
setCheckTime
(
pointCheckDetailBo
.
getCheckTime
());
pointCheckRespone
.
setCheckTime
(
pointCheckDetailBo
.
getCheckTime
());
pointCheckRespone
.
setStrCheckTime
(
DateUtil
.
getLongDate
(
pointCheckDetailBo
.
getCheckTime
()));
pointCheckRespone
.
setStrCheckTime
(
DateUtil
.
getLongDate
(
pointCheckDetailBo
.
getCheckTime
()));
pointCheckRespone
.
setCheckId
(
pointCheckDetailBo
.
getCheckId
());
pointCheckRespone
.
setCheckId
(
pointCheckDetailBo
.
getCheckId
());
...
@@ -968,6 +923,7 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -968,6 +923,7 @@ public class CheckServiceImpl implements ICheckService {
pointCheckRespone
.
setScore
(
check
.
getScore
()
+
""
);
pointCheckRespone
.
setScore
(
check
.
getScore
()
+
""
);
pointCheckRespone
.
setUsername
(
pointCheckDetailBo
.
getUsername
());
pointCheckRespone
.
setUsername
(
pointCheckDetailBo
.
getUsername
());
pointCheckRespone
.
setDepartmentName
(
pointCheckDetailBo
.
getDepartmentName
());
pointCheckRespone
.
setDepartmentName
(
pointCheckDetailBo
.
getDepartmentName
());
List
<
AppCheckInputRespone
>
appCheckInputResponeList
=
new
ArrayList
<
AppCheckInputRespone
>();
JSONObject
appResponeMap
=
new
JSONObject
();
JSONObject
appResponeMap
=
new
JSONObject
();
list
.
forEach
(
action
->
{
list
.
forEach
(
action
->
{
List
<
String
>
pointInputImgUrls
=
new
ArrayList
<>();
List
<
String
>
pointInputImgUrls
=
new
ArrayList
<>();
...
@@ -993,31 +949,11 @@ public class CheckServiceImpl implements ICheckService {
...
@@ -993,31 +949,11 @@ public class CheckServiceImpl implements ICheckService {
appCheckInputRespone
.
setClassifyName
(
action
.
getClassifyName
());
appCheckInputRespone
.
setClassifyName
(
action
.
getClassifyName
());
appCheckInputRespone
.
setRemark
(
action
.
getRemark
());
appCheckInputRespone
.
setRemark
(
action
.
getRemark
());
appCheckInputRespone
.
setPlanTaskId
(
action
.
getPlanTaskId
());
appCheckInputRespone
.
setPlanTaskId
(
action
.
getPlanTaskId
());
String
classifyName
=
action
.
getClassifyName
();
if
(!
StringUtil
.
isNotEmpty
(
classifyName
))
{
classifyName
=
"其他"
;
}
String
riskDesc
=
action
.
getRiskDesc
();
if
(!
StringUtil
.
isNotEmpty
(
riskDesc
))
{
riskDesc
=
XJConstant
.
DEFAULT_RISKDESC
;
}
JSONObject
classifyJson
;
appCheckInputResponeList
.
add
(
appCheckInputRespone
);
if
(
appResponeMap
.
containsKey
(
classifyName
))
{
classifyJson
=
appResponeMap
.
getJSONObject
(
classifyName
);
}
else
{
classifyJson
=
new
JSONObject
();
}
JSONArray
riskDescArr
;
if
(
classifyJson
.
containsKey
(
riskDesc
))
{
riskDescArr
=
classifyJson
.
getJSONArray
(
riskDesc
);
}
else
{
riskDescArr
=
new
JSONArray
();
}
riskDescArr
.
add
(
appCheckInputRespone
);
classifyJson
.
put
(
riskDesc
,
riskDescArr
);
appResponeMap
.
put
(
classifyName
,
classifyJson
);
});
});
appResponeMap
.
put
(
"items"
,
appCheckInputResponeList
);
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
return
pointCheckRespone
;
return
pointCheckRespone
;
}
}
...
...
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 @
37a8b900
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
import
com.sun.corba.se.impl.activation.RepositoryImpl
;
import
com.yeejoin.amos.boot.biz.common.constants.RuleConstant
;
import
com.yeejoin.amos.boot.biz.common.constants.RuleConstant
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
...
@@ -54,6 +55,7 @@ import org.slf4j.LoggerFactory;
...
@@ -54,6 +55,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronization
;
...
@@ -141,6 +143,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -141,6 +143,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired
@Autowired
private
ICheckShotDao
iCheckShotDao
;
private
ICheckShotDao
iCheckShotDao
;
@Autowired
private
RepositoryTs
repositoryTs
;
private
final
String
PATROL_PLAN_TASK_KEY
=
"PATROL_PLAN_ID:"
;
private
final
String
PATROL_PLAN_TASK_KEY
=
"PATROL_PLAN_ID:"
;
private
final
String
packageId
=
"消息/addCheckRule"
;
private
final
String
packageId
=
"消息/addCheckRule"
;
...
@@ -685,6 +690,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -685,6 +690,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
());
}
}
System
.
out
.
println
(
userDetailsDtos
.
size
()+
"==================="
);
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
,
userDetailsDtos
,
route
);
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
,
userDetailsDtos
,
route
);
}
}
...
@@ -697,6 +703,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -697,6 +703,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
* @param plan
* @param plan
* @param flag 是否初始状态0-初始 1-非初始
* @param flag 是否初始状态0-初始 1-非初始
*/
*/
@Async
(
"asyncServiceExecutor"
)
public
void
insertPlanTaskAndDetNew
(
List
<
HashMap
<
String
,
Object
>>
list
,
Plan
plan
,
String
flag
,
Date
now
)
{
public
void
insertPlanTaskAndDetNew
(
List
<
HashMap
<
String
,
Object
>>
list
,
Plan
plan
,
String
flag
,
Date
now
)
{
if
(
list
==
null
||
list
.
size
()
<=
0
)
{
if
(
list
==
null
||
list
.
size
()
<=
0
)
{
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
...
@@ -732,6 +739,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -732,6 +739,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
List
<
PlanTask
>
planTaskList
=
new
ArrayList
<>();
List
<
PlanTask
>
planTaskList
=
new
ArrayList
<>();
List
<
PlanTaskDetail
>
planTaskDetailListSync
=
new
ArrayList
<>();
List
<
PlanTaskDetail
>
planTaskDetailListSync
=
new
ArrayList
<>();
PlanTask
planTask
=
new
PlanTask
();
PlanTask
planTask
=
new
PlanTask
();
List
<
PlanTask
>
taskList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
startTime
=
list
.
get
(
i
).
get
(
"BEGIN_TIME"
).
toString
();
String
startTime
=
list
.
get
(
i
).
get
(
"BEGIN_TIME"
).
toString
();
...
@@ -742,11 +750,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -742,11 +750,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String
orgCode
=
list
.
get
(
i
).
get
(
"ORG_CODE"
)
==
null
?
"-1"
:
String
.
valueOf
(
list
.
get
(
i
).
get
(
"ORG_CODE"
));
String
orgCode
=
list
.
get
(
i
).
get
(
"ORG_CODE"
)
==
null
?
"-1"
:
String
.
valueOf
(
list
.
get
(
i
).
get
(
"ORG_CODE"
));
String
unitCode
=
list
.
get
(
i
).
get
(
"UNIT_CODE"
)
==
null
?
"-1"
:
String
.
valueOf
(
list
.
get
(
i
).
get
(
"UNIT_CODE"
));
String
unitCode
=
list
.
get
(
i
).
get
(
"UNIT_CODE"
)
==
null
?
"-1"
:
String
.
valueOf
(
list
.
get
(
i
).
get
(
"UNIT_CODE"
));
planTask
=
iplanTaskDao
.
findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId
(
userId
,
startTime
,
endTime
,
plan
.
getId
(),
plan
.
getRouteId
());
//
planTask = iplanTaskDao.findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId(userId, startTime, endTime, plan.getId(), plan.getRouteId());
if
(
planTask
!=
null
)
{
//
if (planTask != null) {
continue
;
//
continue;
}
//
}
//
planTask = new PlanTask();
planTask
=
new
PlanTask
();
//修改巡检p_plan_task orgcode为执行人的org_code -- add by wujunkai 20201216
//修改巡检p_plan_task orgcode为执行人的org_code -- add by wujunkai 20201216
planTask
.
setOrgCode
(
orgCode
);
planTask
.
setOrgCode
(
orgCode
);
...
@@ -791,7 +799,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -791,7 +799,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTask
.
setBeginTime
(
startTime
);
planTask
.
setBeginTime
(
startTime
);
planTask
.
setEndTime
(
endTime
);
planTask
.
setEndTime
(
endTime
);
// 1.保存执行数据主表
// 1.保存执行数据主表
iplanTaskDao
.
saveAndFlush
(
planTask
);
// iplanTaskDao.saveAndFlush(planTask);
taskList
.
add
(
planTask
);
// 发送APP待办消息 (20220617 改为定时任务发送消息)
// 发送APP待办消息 (20220617 改为定时任务发送消息)
// sendMessage(plan, planTask);
// sendMessage(plan, planTask);
String
executorId
=
planTask
.
getUserId
();
String
executorId
=
planTask
.
getUserId
();
...
@@ -811,10 +820,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -811,10 +820,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskDetailInstance
.
setStatus
(
"1"
);
planTaskDetailInstance
.
setStatus
(
"1"
);
}
}
// 2.保存执行数据明细表
// 2.保存执行数据明细表
planTaskDetail
.
saveAndFlush
(
planTaskDetailInstance
);
//
planTaskDetail.saveAndFlush(planTaskDetailInstance);
planTaskDetailListSync
.
add
(
planTaskDetailInstance
);
planTaskDetailListSync
.
add
(
planTaskDetailInstance
);
}
}
}
}
repositoryTs
.
batchSave
(
taskList
);
repositoryTs
.
batchSave
(
planTaskDetailListSync
);
// 定时任务监控
// 定时任务监控
log
.
error
(
"计划重做开始添加定时任务监控========"
);
log
.
error
(
"计划重做开始添加定时任务监控========"
);
jobService
.
planTaskAddJob
(
planTask
);
jobService
.
planTaskAddJob
(
planTask
);
...
@@ -1138,7 +1149,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1138,7 +1149,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
PlanTask
planTask
=
planTaskOptional
.
get
();
PlanTask
planTask
=
planTaskOptional
.
get
();
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
if
(
planTask
.
getRiskStatus
()
!=
1
)
{
planTask
.
setRiskStatus
(
XJConstant
.
NORISK_NUM
);
planTask
.
setRiskStatus
(
XJConstant
.
NORISK_NUM
);
}
iplanTaskDao
.
saveAndFlush
(
planTask
);
iplanTaskDao
.
saveAndFlush
(
planTask
);
List
<
PlanTaskDetail
>
planTaskDetails
=
iPlanTaskDetailDao
.
findAllByTaskNoAndStatus
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
NOTSTARTED
.
getValue
());
List
<
PlanTaskDetail
>
planTaskDetails
=
iPlanTaskDetailDao
.
findAllByTaskNoAndStatus
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
NOTSTARTED
.
getValue
());
if
(!
planTaskDetails
.
isEmpty
())
{
if
(!
planTaskDetails
.
isEmpty
())
{
...
@@ -1453,6 +1466,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1453,6 +1466,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
toke
,
product
,
appKey
,
check
.
getId
(),
planTaskId
,
pointId
);
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
pointCheckRespone
.
setTaskStatus
(
planPointInfo
.
getTaskStatus
());
pointCheckRespone
.
setTaskStatus
(
planPointInfo
.
getTaskStatus
());
pointCheckRespone
.
setPointStatus
(
planPointInfo
.
getPointStatus
());
pointCheckRespone
.
setPointStatus
(
planPointInfo
.
getPointStatus
());
...
@@ -1527,7 +1543,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1527,7 +1543,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
appResponeMap
.
put
(
"items"
,
appCheckInputResponeList
);
appResponeMap
.
put
(
"items"
,
appCheckInputResponeList
);
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
}
}
return
pointCheckRespone
;
return
pointCheckRespone
;
}
}
...
@@ -1536,7 +1552,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1536,7 +1552,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
toke
,
product
,
appKey
,
check
.
getId
());
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
toke
,
product
,
appKey
,
check
.
getId
()
,
null
,
null
);
}
else
{
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/RepositoryTImpl.java
0 → 100644
View file @
37a8b900
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
com.yeejoin.amos.patrol.business.dao.repository.RepositoryTs
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
java.util.Iterator
;
@Service
public
class
RepositoryTImpl
implements
RepositoryTs
{
private
static
final
int
BATCH_SIZE
=
1
;
@PersistenceContext
private
final
EntityManager
em
;
public
RepositoryTImpl
(
EntityManager
em
)
{
this
.
em
=
em
;
}
@Override
@Transactional
public
<
S
>
Iterable
<
S
>
batchSave
(
Iterable
<
S
>
var1
)
{
Iterator
<
S
>
iterator
=
var1
.
iterator
();
int
index
=
0
;
while
(
iterator
.
hasNext
()){
em
.
persist
(
iterator
.
next
());
index
++;
if
(
index
%
BATCH_SIZE
==
0
){
em
.
flush
();
em
.
clear
();
}
}
if
(
index
%
BATCH_SIZE
!=
0
){
em
.
flush
();
em
.
clear
();
}
return
var1
;
}
@Override
public
<
S
>
Iterable
<
S
>
batchUpdate
(
Iterable
<
S
>
var1
)
{
Iterator
<
S
>
iterator
=
var1
.
iterator
();
int
index
=
0
;
while
(
iterator
.
hasNext
()){
em
.
merge
(
iterator
.
next
());
index
++;
if
(
index
%
BATCH_SIZE
==
0
){
em
.
flush
();
em
.
clear
();
}
}
if
(
index
%
BATCH_SIZE
!=
0
){
em
.
flush
();
em
.
clear
();
}
return
var1
;
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/RouteServiceImpl.java
View file @
37a8b900
...
@@ -30,6 +30,8 @@ import org.springframework.stereotype.Service;
...
@@ -30,6 +30,8 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
...
@@ -78,6 +80,15 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
...
@@ -78,6 +80,15 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
@Autowired
@Autowired
private
IRoutePointItemDao
iRoutePointItemDao
;
private
IRoutePointItemDao
iRoutePointItemDao
;
@Autowired
private
RepositoryTs
repositoryTs
;
@PersistenceContext
private
final
EntityManager
em
;
public
RouteServiceImpl
(
EntityManager
em
)
{
this
.
em
=
em
;
}
@Override
@Override
@Transactional
@Transactional
...
@@ -257,11 +268,15 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
...
@@ -257,11 +268,15 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
points
.
add
(
rp
);
points
.
add
(
rp
);
pointIds
.
add
(
rp
.
getPointId
());
pointIds
.
add
(
rp
.
getPointId
());
});
});
List
<
RoutePoint
>
savedPoints
=
iRoutePointDao
.
saveAll
(
points
);
List
<
Map
<
String
,
Object
>>
pointRefItem
=
pointMapper
.
getPointRefItem
(
pointIds
);
List
<
Map
<
String
,
Object
>>
pointRefItem
=
pointMapper
.
getPointRefItem
(
pointIds
);
if
(!
savedPoints
.
isEmpty
())
{
for
(
RoutePoint
rt:
routePoints
savedPoints
.
forEach
(
rp
->
{
)
{
String
excludeItems
=
rp
.
getExcludeItems
();
em
.
persist
(
rt
);
em
.
flush
();
em
.
clear
();
String
excludeItems
=
rt
.
getExcludeItems
();
Set
<
Long
>
excludeItemIdSet
=
new
HashSet
<>();
Set
<
Long
>
excludeItemIdSet
=
new
HashSet
<>();
if
(
excludeItems
!=
null
&&
!
excludeItems
.
isEmpty
())
{
if
(
excludeItems
!=
null
&&
!
excludeItems
.
isEmpty
())
{
String
[]
itemIds
=
excludeItems
.
split
(
","
);
String
[]
itemIds
=
excludeItems
.
split
(
","
);
...
@@ -274,12 +289,12 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
...
@@ -274,12 +289,12 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
}
}
final
int
[]
orderNum
=
{
1
};
final
int
[]
orderNum
=
{
1
};
pointRefItem
.
forEach
(
ref
->
{
pointRefItem
.
forEach
(
ref
->
{
Long
pointId
=
rp
.
getPointId
();
Long
pointId
=
rt
.
getPointId
();
if
(
pointId
.
equals
(
ref
.
get
(
"pointId"
))){
if
(
pointId
.
equals
(
ref
.
get
(
"pointId"
))){
if
(!
excludeItemIdSet
.
contains
(
ref
.
get
(
"itemId"
)))
{
if
(!
excludeItemIdSet
.
contains
(
ref
.
get
(
"itemId"
)))
{
RoutePointItem
item
=
new
RoutePointItem
();
RoutePointItem
item
=
new
RoutePointItem
();
item
.
setPointInputItemId
((
Long
)
ref
.
get
(
"id"
));
item
.
setPointInputItemId
((
Long
)
ref
.
get
(
"id"
));
item
.
setRoutePointId
(
rp
.
getId
());
item
.
setRoutePointId
(
rt
.
getId
());
item
.
setPointClassifyId
(
ref
.
containsKey
(
"classifyId"
)?
Long
.
valueOf
(
ref
.
get
(
"classifyId"
).
toString
()):
null
);
item
.
setPointClassifyId
(
ref
.
containsKey
(
"classifyId"
)?
Long
.
valueOf
(
ref
.
get
(
"classifyId"
).
toString
()):
null
);
item
.
setOrderNo
(
orderNum
[
0
]++);
item
.
setOrderNo
(
orderNum
[
0
]++);
item
.
setPointId
(
pointId
);
item
.
setPointId
(
pointId
);
...
@@ -288,12 +303,9 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
...
@@ -288,12 +303,9 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
}
}
}
}
});
});
});
if
(!
items
.
isEmpty
())
{
if
(!
items
.
isEmpty
())
{
for
(
RoutePointItem
routePointItem:
items
repositoryTs
.
batchSave
(
items
);
)
{
iRoutePointItemDao
.
saveAndFlush
(
routePointItem
);
}
}
}
}
}
}
}
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/intfc/ICheckService.java
View file @
37a8b900
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.patrol.core.common.response.CommonPage;
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.patrol.core.common.response.CommonPage;
import
com.yeejoin.amos.patrol.core.common.response.GraphInitDataResponse
;
import
com.yeejoin.amos.patrol.core.common.response.GraphInitDataResponse
;
import
com.yeejoin.amos.patrol.core.common.response.QueryCriteriaRespone
;
import
com.yeejoin.amos.patrol.core.common.response.QueryCriteriaRespone
;
import
com.yeejoin.amos.patrol.dao.entity.CheckShot
;
import
com.yeejoin.amos.patrol.dao.entity.CheckShot
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.exception.YeeException
;
import
com.yeejoin.amos.patrol.exception.YeeException
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -36,7 +37,7 @@ public interface ICheckService {
...
@@ -36,7 +37,7 @@ public interface ICheckService {
void
saveCheckImg
(
List
<
CheckShot
>
imgList
);
void
saveCheckImg
(
List
<
CheckShot
>
imgList
);
CheckDto
saveCheckRecord
(
CheckRecordParam
requestParam
,
AgencyUserModel
user
,
DepartmentBo
departmentModel
,
Toke
token
);
CheckDto
saveCheckRecord
(
CheckRecordParam
requestParam
,
AgencyUserModel
user
,
DepartmentBo
departmentModel
,
Toke
token
);
CheckDto
saveCheckRecordNew
(
CheckRecordParam
requestParam
);
CheckDto
saveCheckRecordNew
(
CheckRecordParam
requestParam
,
PlanTask
planTask
);
/**
/**
* 巡检记录删除
* 巡检记录删除
*
*
...
@@ -69,7 +70,7 @@ public interface ICheckService {
...
@@ -69,7 +70,7 @@ public interface ICheckService {
AppPointCheckRespone
queryCheckPointDetail
(
String
toke
,
String
product
,
String
appKey
,
long
checkId
);
AppPointCheckRespone
queryCheckPointDetail
(
String
toke
,
String
product
,
String
appKey
,
long
checkId
);
AppPointCheckRespone
queryCheckPointDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
long
checkId
);
AppPointCheckRespone
queryCheckPointDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
long
checkId
,
Long
planTaskId
,
Long
pointId
);
AppPointCheckRespone
queryCheckPointDetailInVersion2New
(
long
checkId
);
AppPointCheckRespone
queryCheckPointDetailInVersion2New
(
long
checkId
);
/**
/**
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/ExecutorConfig.java
0 → 100644
View file @
37a8b900
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
/**
* @author 瑾年
* @className ExecutorConfig
* @date 2020/8/26 10:31
*/
@Slf4j
@Configuration
@EnableAsync
public
class
ExecutorConfig
{
/**
* 配置队列大小
* */
@Value
(
"${executor.queueCapacity}"
)
private
int
queueCapacity
;
/***
* 配置线程池中的线程的名称前缀
* */
@Value
(
"${executor.namePrefix}"
)
private
String
namePrefix
;
/**
* 线程池维护线程所允许的空闲时间
* */
@Value
(
"${executor.keepAliveSeconds}"
)
private
int
keepAliveSeconds
;
@Bean
(
name
=
"asyncServiceExecutor"
)
public
Executor
asyncServiceExecutor
()
{
log
.
info
(
"初始化异步线程池"
);
//获取cpu核心数,最大线程数和核心线程数为cpu核心数的2倍
int
curSystemThreads
=
Runtime
.
getRuntime
().
availableProcessors
()
*
2
;
log
.
info
(
"系统可用线程池个数:{}"
,
curSystemThreads
);
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
//配置核心线程数
executor
.
setCorePoolSize
(
curSystemThreads
);
//配置最大线程数
executor
.
setMaxPoolSize
(
curSystemThreads
);
//配置队列大小
executor
.
setQueueCapacity
(
queueCapacity
);
//配置线程池中的线程的名称前缀
executor
.
setThreadNamePrefix
(
namePrefix
);
//线程池维护线程所允许的空闲时间
executor
.
setKeepAliveSeconds
(
keepAliveSeconds
);
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
// CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行--拒绝策略
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
//执行初始化
executor
.
initialize
();
//等待所有任务结束后再关闭线程池
executor
.
setWaitForTasksToCompleteOnShutdown
(
true
);
return
executor
;
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/schedule/LatentDanerScheduled.java
View file @
37a8b900
...
@@ -19,8 +19,8 @@ public class LatentDanerScheduled {
...
@@ -19,8 +19,8 @@ public class LatentDanerScheduled {
* 每1分钟执行一次:查询逾期的隐患,修改状态
* 每1分钟执行一次:查询逾期的隐患,修改状态
*/
*/
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
//
@Scheduled(cron = "0 0/1 * * * ?")
public
void
updateDangerStateOfOvertime
()
{
//
public void updateDangerStateOfOvertime() {
iLatentDangerService
.
updateDangerStateOfOvertime
();
//
iLatentDangerService.updateDangerStateOfOvertime();
}
//
}
}
}
\ 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 @
37a8b900
...
@@ -501,7 +501,7 @@
...
@@ -501,7 +501,7 @@
AND ptd.id = #{planTaskId} and pptd.status = #{planTaskDetailStatus}
AND ptd.id = #{planTaskId} and pptd.status = #{planTaskDetailStatus}
) temp2 on(temp1.point_id = temp2.pointId
) temp2 on(temp1.point_id = temp2.pointId
AND temp1.route_id = temp2.routeId)
AND temp1.route_id = temp2.routeId)
GROUP BY pointName
</select>
</select>
<!-- 巡检执行情况统计分页用 -->
<!-- 巡检执行情况统计分页用 -->
<select
id=
"countChkExListData"
resultType=
"long"
>
<select
id=
"countChkExListData"
resultType=
"long"
>
...
...
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