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
4ebd478c
Commit
4ebd478c
authored
Dec 05, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
两个规定 - 一键提交优化
parent
8a68b3d0
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
800 additions
and
221 deletions
+800
-221
pom.xml
...t-module-tzspatrol/amos-boot-module-tzspatrol-api/pom.xml
+5
-0
BasicEntity.java
.../java/com/yeejoin/amos/patrol/dao/entity/BasicEntity.java
+0
-0
Check.java
...c/main/java/com/yeejoin/amos/patrol/dao/entity/Check.java
+0
-0
PlanTask.java
...ain/java/com/yeejoin/amos/patrol/dao/entity/PlanTask.java
+8
-8
PlanTaskDetail.java
...va/com/yeejoin/amos/patrol/dao/entity/PlanTaskDetail.java
+9
-9
UserTransmittableUtils.java
...com/yeejoin/amos/patrol/utils/UserTransmittableUtils.java
+31
-0
CheckController.java
...join/amos/patrol/business/controller/CheckController.java
+5
-6
PlanTaskDetailMapper.java
...amos/patrol/business/dao/mapper/PlanTaskDetailMapper.java
+5
-0
PlanTaskMapper.java
...ejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
+3
-0
ESPlanTaskList.java
...n/amos/patrol/business/dao/repository/ESPlanTaskList.java
+4
-0
ESTaskDetail.java
...oin/amos/patrol/business/dao/repository/ESTaskDetail.java
+4
-1
IPlanTaskDao.java
...oin/amos/patrol/business/dao/repository/IPlanTaskDao.java
+7
-0
IPlanTaskDetailDao.java
...os/patrol/business/dao/repository/IPlanTaskDetailDao.java
+1
-0
CheckRecordDataConsumer.java
...in/amos/patrol/business/data/CheckRecordDataConsumer.java
+208
-0
CheckRecordDataDto.java
.../yeejoin/amos/patrol/business/dto/CheckRecordDataDto.java
+18
-0
StaticTableUpdateDto.java
...eejoin/amos/patrol/business/dto/StaticTableUpdateDto.java
+15
-0
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+302
-181
IPlanTaskService.java
.../amos/patrol/business/service/intfc/IPlanTaskService.java
+2
-0
ExecutorConfig.java
...n/java/com/yeejoin/amos/patrol/config/ExecutorConfig.java
+3
-1
AsyncTask.java
...in/java/com/yeejoin/amos/patrol/core/async/AsyncTask.java
+68
-2
IJobService.java
...main/java/com/yeejoin/amos/patrol/quartz/IJobService.java
+4
-0
JobService.java
.../main/java/com/yeejoin/amos/patrol/quartz/JobService.java
+68
-9
dbTemplate_plan_task.xml
...biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+17
-4
plan_task_detail.xml
...rol-biz/src/main/resources/db/mapper/plan_task_detail.xml
+13
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/pom.xml
View file @
4ebd478c
...
@@ -45,6 +45,11 @@
...
@@ -45,6 +45,11 @@
<version>
4.0.0
</version>
<version>
4.0.0
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
transmittable-thread-local
</artifactId>
<version>
2.8.1
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/BasicEntity.java
View file @
4ebd478c
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/Check.java
View file @
4ebd478c
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/PlanTask.java
View file @
4ebd478c
...
@@ -159,7 +159,7 @@ public class PlanTask extends BasicEntity {
...
@@ -159,7 +159,7 @@ public class PlanTask extends BasicEntity {
/**
/**
* 任务点明细
* 任务点明细
*/
*/
private
List
<
PlanTaskDetail
>
taskDetail
;
//
private List<PlanTaskDetail> taskDetail;
public
PlanTask
()
{
public
PlanTask
()
{
}
}
...
@@ -254,10 +254,10 @@ public class PlanTask extends BasicEntity {
...
@@ -254,10 +254,10 @@ public class PlanTask extends BasicEntity {
}
}
@OneToMany
(
mappedBy
=
"planTask"
,
fetch
=
FetchType
.
EAGER
,
cascade
=
{
CascadeType
.
REMOVE
,
CascadeType
.
MERGE
,
CascadeType
.
PERSIST
})
//
@OneToMany(mappedBy = "planTask", fetch= FetchType.EAGER, cascade = {CascadeType.REMOVE,CascadeType.MERGE,CascadeType.PERSIST })
public
List
<
PlanTaskDetail
>
getTaskDetail
()
{
//
public List<PlanTaskDetail> getTaskDetail() {
return
taskDetail
;
//
return taskDetail;
}
//
}
public
String
getInOrder
()
{
public
String
getInOrder
()
{
return
inOrder
;
return
inOrder
;
...
@@ -267,9 +267,9 @@ public class PlanTask extends BasicEntity {
...
@@ -267,9 +267,9 @@ public class PlanTask extends BasicEntity {
this
.
inOrder
=
inOrder
;
this
.
inOrder
=
inOrder
;
}
}
public
void
setTaskDetail
(
List
<
PlanTaskDetail
>
taskDetail
)
{
//
public void setTaskDetail(List<PlanTaskDetail> taskDetail) {
this
.
taskDetail
=
taskDetail
;
//
this.taskDetail = taskDetail;
}
//
}
public
String
getUserId
()
{
public
String
getUserId
()
{
return
userId
;
return
userId
;
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/dao/entity/PlanTaskDetail.java
View file @
4ebd478c
...
@@ -53,7 +53,7 @@ public class PlanTaskDetail extends BasicEntity {
...
@@ -53,7 +53,7 @@ public class PlanTaskDetail extends BasicEntity {
@Column
(
name
=
"executor_date"
)
@Column
(
name
=
"executor_date"
)
private
Date
executorDate
;
private
Date
executorDate
;
private
PlanTask
planTask
;
//
private PlanTask planTask;
/**
/**
* 状态:0 未开始;1 合格;2 不合格;3 漏检
* 状态:0 未开始;1 合格;2 不合格;3 漏检
...
@@ -97,16 +97,16 @@ public class PlanTaskDetail extends BasicEntity {
...
@@ -97,16 +97,16 @@ public class PlanTaskDetail extends BasicEntity {
this
.
taskNo
=
taskNo
;
this
.
taskNo
=
taskNo
;
}
}
@ManyToOne
(
fetch
=
FetchType
.
EAGER
)
//
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn
(
name
=
"taskNo"
,
referencedColumnName
=
"id"
,
updatable
=
false
,
insertable
=
false
)
//
@JoinColumn(name = "taskNo", referencedColumnName = "id", updatable = false, insertable = false)
public
PlanTask
getPlanTask
()
{
//
public PlanTask getPlanTask() {
return
planTask
;
//
return planTask;
}
//
}
public
void
setPlanTask
(
PlanTask
planTask
)
{
//
public void setPlanTask(PlanTask planTask) {
this
.
planTask
=
planTask
;
//
this.planTask = planTask;
}
//
}
public
String
getStatus
()
{
public
String
getStatus
()
{
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/utils/UserTransmittableUtils.java
0 → 100644
View file @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
utils
;
import
com.alibaba.ttl.TransmittableThreadLocal
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContextModel
;
/**
* @author Administrator
* 主子线程见数据共享
*/
public
class
UserTransmittableUtils
{
private
static
final
TransmittableThreadLocal
<
RequestContextModel
>
userLocal
=
new
TransmittableThreadLocal
<>();
public
static
RequestContextModel
getUser
()
{
return
userLocal
.
get
();
}
public
static
void
setUser
(){
RequestContextModel
requestContextModel
=
new
RequestContextModel
();
requestContextModel
.
setAgencyCode
(
RequestContext
.
getAgencyCode
());
requestContextModel
.
setAppKey
(
RequestContext
.
getAppKey
());
requestContextModel
.
setToken
(
RequestContext
.
getToken
());
requestContextModel
.
setProduct
(
RequestContext
.
getProduct
());
requestContextModel
.
setExcutedUserId
(
RequestContext
.
getExeUserId
());
userLocal
.
set
(
requestContextModel
);
}
public
static
void
clear
(){
userLocal
.
remove
();
}
}
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 @
4ebd478c
...
@@ -49,6 +49,7 @@ import com.yeejoin.amos.patrol.dao.entity.*;
...
@@ -49,6 +49,7 @@ import com.yeejoin.amos.patrol.dao.entity.*;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.mqtt.WebMqttComponent
;
import
com.yeejoin.amos.patrol.mqtt.WebMqttComponent
;
import
com.yeejoin.amos.patrol.quartz.JobService
;
import
com.yeejoin.amos.patrol.quartz.JobService
;
import
com.yeejoin.amos.patrol.utils.UserTransmittableUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
...
@@ -230,16 +231,14 @@ public class CheckController extends AbstractBaseController {
...
@@ -230,16 +231,14 @@ public class CheckController extends AbstractBaseController {
@RequestMapping
(
value
=
"/saveRecordAll"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/saveRecordAll"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
<
Object
>
saveCheckRecordAll
(
@RequestParam
String
ids
)
{
public
ResponseModel
<
Object
>
saveCheckRecordAll
(
@RequestParam
String
ids
)
{
String
userId
=
RequestContext
.
getExeUserId
();
String
userId
=
RequestContext
.
getExeUserId
();
String
[]
idArr
=
ids
.
split
(
","
);
try
{
try
{
for
(
String
str:
idArr
UserTransmittableUtils
.
setUser
();
)
{
planTaskService
.
handleAllBatch
(
ids
,
userId
);
planTaskService
.
handleAll
(
str
,
userId
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ResponseHelperUtil
.
buildErrorResponse
(
"提交失败:"
+
e
.
getMessage
());
return
ResponseHelperUtil
.
buildErrorResponse
(
"提交失败:"
+
e
.
getMessage
());
}
finally
{
UserTransmittableUtils
.
clear
();
}
}
return
ResponseHelper
.
buildResponse
(
"提交成功"
);
return
ResponseHelper
.
buildResponse
(
"提交成功"
);
}
}
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/PlanTaskDetailMapper.java
View file @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
mapper
;
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
mapper
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
public
interface
PlanTaskDetailMapper
extends
BaseMapper
{
public
interface
PlanTaskDetailMapper
extends
BaseMapper
{
...
@@ -9,4 +11,7 @@ public interface PlanTaskDetailMapper extends BaseMapper {
...
@@ -9,4 +11,7 @@ public interface PlanTaskDetailMapper extends BaseMapper {
,
@Param
(
value
=
"executorId"
)
String
executorId
);
,
@Param
(
value
=
"executorId"
)
String
executorId
);
Map
findPlanTaskByTaskIdAndPointId
(
@Param
(
value
=
"planTaskId"
)
long
planTaskId
,
@Param
(
value
=
"pointId"
)
long
pointId
);
Map
findPlanTaskByTaskIdAndPointId
(
@Param
(
value
=
"planTaskId"
)
long
planTaskId
,
@Param
(
value
=
"pointId"
)
long
pointId
);
List
<
PlanTaskDetail
>
findAllByIdInAndStatus
(
@Param
(
"planTaskIds"
)
List
<
Long
>
planTaskNo
,
@Param
(
"status"
)
String
status
);
}
}
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 @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
mapper
;
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
mapper
;
import
com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto
;
import
com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto
;
import
com.yeejoin.amos.patrol.business.dto.StaticTableUpdateDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
...
@@ -327,4 +328,6 @@ public interface PlanTaskMapper extends BaseMapper {
...
@@ -327,4 +328,6 @@ public interface PlanTaskMapper extends BaseMapper {
List
<
String
>
getPlanTaskIds
(
@Param
(
value
=
"id"
)
long
id
);
List
<
String
>
getPlanTaskIds
(
@Param
(
value
=
"id"
)
long
id
);
List
<
Map
<
String
,
String
>>
selectExcludeItemsByRoutId
(
long
routeId
);
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/dao/repository/ESPlanTaskList.java
View file @
4ebd478c
...
@@ -5,6 +5,10 @@ import com.yeejoin.amos.patrol.dao.entity.ESPlanTaskListDto;
...
@@ -5,6 +5,10 @@ import com.yeejoin.amos.patrol.dao.entity.ESPlanTaskListDto;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
interface
ESPlanTaskList
extends
PagingAndSortingRepository
<
ESPlanTaskListDto
,
String
>
{
public
interface
ESPlanTaskList
extends
PagingAndSortingRepository
<
ESPlanTaskListDto
,
String
>
{
List
<
ESPlanTaskListDto
>
findAllByPlanTaskIdIn
(
List
<
String
>
planTaskIds
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/repository/ESTaskDetail.java
View file @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
repository
;
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.patrol.dao.entity.ESPlanTaskListDto
;
import
com.yeejoin.amos.patrol.dao.entity.ESTaskDetailDto
;
import
com.yeejoin.amos.patrol.dao.entity.ESTaskDetailDto
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
interface
ESTaskDetail
extends
PagingAndSortingRepository
<
ESTaskDetailDto
,
String
>
{
public
interface
ESTaskDetail
extends
PagingAndSortingRepository
<
ESTaskDetailDto
,
String
>
{
List
<
ESTaskDetailDto
>
findAllByPlanTaskIdIn
(
List
<
String
>
planTaskIds
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/repository/IPlanTaskDao.java
View file @
4ebd478c
...
@@ -64,4 +64,11 @@ public interface IPlanTaskDao extends BaseDao<PlanTask, Long> {
...
@@ -64,4 +64,11 @@ public interface IPlanTaskDao extends BaseDao<PlanTask, Long> {
@Transactional
@Transactional
@Query
(
value
=
"update p_plan_task_detail set is_finish = (?2) where plan_id in (?1)"
,
nativeQuery
=
true
)
@Query
(
value
=
"update p_plan_task_detail set is_finish = (?2) where plan_id in (?1)"
,
nativeQuery
=
true
)
void
updatePlanTaskDetailFinishStatus
(
List
<
Long
>
collect
,
int
value
);
void
updatePlanTaskDetailFinishStatus
(
List
<
Long
>
collect
,
int
value
);
/**
* 查询所有任务
* @param ids
* @return List<PlanTask>
*/
List
<
PlanTask
>
findAllByIdIn
(
List
<
Long
>
ids
);
}
}
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 @
4ebd478c
...
@@ -46,4 +46,5 @@ public interface IPlanTaskDetailDao extends BaseDao<PlanTaskDetail, Long> {
...
@@ -46,4 +46,5 @@ public interface IPlanTaskDetailDao extends BaseDao<PlanTaskDetail, Long> {
@Query
(
value
=
"select * FROM p_plan_task_detail WHERE id = ?1 AND status = ?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"select * FROM p_plan_task_detail WHERE id = ?1 AND status = ?2"
,
nativeQuery
=
true
)
List
<
PlanTaskDetail
>
findAllByIdAndStatus
(
long
id
,
String
status
);
List
<
PlanTaskDetail
>
findAllByIdAndStatus
(
long
id
,
String
status
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/data/CheckRecordDataConsumer.java
0 → 100644
View file @
4ebd478c
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.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
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.*
;
import
com.yeejoin.amos.patrol.business.dto.CheckRecordDataDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo
;
import
com.yeejoin.amos.patrol.common.enums.CheckStatusEnum
;
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.util.ObjectUtils
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
/**
* @author Administrator
*/
@Slf4j
public
class
CheckRecordDataConsumer
implements
Runnable
{
private
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
;
private
ApplicationContext
applicationContext
;
private
IPlanTaskDao
iPlanTaskDao
;
private
ICheckDao
iCheckDao
;
private
ICheckInputDao
iCheckInputDao
;
private
PlanTaskMapper
planTaskMapper
;
private
IPlanTaskDetailDao
iPlanTaskDetailDao
;
private
IInputItemDao
inputItemDao
;
private
Sequence
sequence
;
private
PlanTaskDetailMapper
planTaskDetailMapper
;
public
CheckRecordDataConsumer
(
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
,
ApplicationContext
applicationContext
)
{
this
.
blockingQueue
=
blockingQueue
;
this
.
applicationContext
=
applicationContext
;
iCheckDao
=
applicationContext
.
getBean
(
ICheckDao
.
class
);
iCheckInputDao
=
applicationContext
.
getBean
(
ICheckInputDao
.
class
);
planTaskMapper
=
applicationContext
.
getBean
(
PlanTaskMapper
.
class
);
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
);
}
@Override
public
void
run
()
{
while
(
true
)
{
try
{
CheckRecordDataDto
checkRecordDataDto
=
blockingQueue
.
take
();
iPlanTaskDao
.
saveAll
(
checkRecordDataDto
.
getPlanTasks
());
iPlanTaskDetailDao
.
saveAll
(
checkRecordDataDto
.
getPlanTaskDetails
());
createCheckRecord
(
checkRecordDataDto
.
getPlanTasks
(),
checkRecordDataDto
.
getAgencyUserModel
());
this
.
updateTaskDetail
(
checkRecordDataDto
.
getPlanTaskDetails
(),
checkRecordDataDto
.
getAgencyUserModel
());
}
catch
(
Exception
e
)
{
log
.
error
(
"入库失败"
,
e
);
}
}
// 生成巡检记录
}
private
void
updateTaskDetail
(
List
<
PlanTaskDetail
>
planTaskDetails
,
AgencyUserModel
agencyUserModel
)
{
planTaskDetails
.
forEach
(
planTaskDetail
->
{
planTaskDetailMapper
.
finishTaskDetail
(
planTaskDetail
.
getId
(),
planTaskDetail
.
getPointId
(),
planTaskDetail
.
getTaskNo
(),
agencyUserModel
.
getUserId
());
});
}
/**
* 创建检查记录
*
* @param planTasks 任务主表
* @param agencyUserModel 用户
*/
public
void
createCheckRecord
(
List
<
PlanTask
>
planTasks
,
AgencyUserModel
agencyUserModel
)
{
List
<
Check
>
checks
=
new
ArrayList
<>();
List
<
CheckInput
>
checkInputs
=
new
ArrayList
<>();
planTasks
.
forEach
(
planTask
->
{
List
<
PlanTaskPointInputItemBo
>
planTaskPointInputItems
=
planTaskMapper
.
getPlanTaskPointInputItemByPlanTaskId
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
Map
<
Long
,
Check
>
checkMap
=
new
HashMap
<>();
Map
<
String
,
String
>
deptMap
=
new
HashMap
<>();
StringBuffer
deptName
=
new
StringBuffer
();
StringBuffer
deptId
=
new
StringBuffer
();
StringBuffer
userName
=
new
StringBuffer
();
if
(
planTask
.
getUserDept
().
indexOf
(
","
)
>
0
)
{
List
<
String
>
depts
=
Arrays
.
asList
(
planTask
.
getUserDept
().
split
(
","
));
depts
.
stream
().
forEach
(
dept
->
{
deptMap
.
put
(
dept
.
split
(
"@"
)[
0
],
dept
.
split
(
"@"
)[
2
]);
deptName
.
append
(
dept
.
split
(
"@"
)[
2
]).
append
(
","
);
deptId
.
append
(
dept
.
split
(
"@"
)[
0
]).
append
(
","
);
});
Set
<
String
>
departmentOrgCode
=
new
HashSet
<>();
for
(
String
key
:
deptMap
.
keySet
())
{
departmentOrgCode
.
add
(
deptMap
.
get
(
key
));
}
StringBuffer
deptIds
=
new
StringBuffer
();
Iterator
it
=
departmentOrgCode
.
iterator
();
while
(
it
.
hasNext
())
{
deptIds
.
append
(
it
.
next
()).
append
(
","
);
}
String
realNames
=
""
;
if
(
agencyUserModel
!=
null
)
{
realNames
=
agencyUserModel
.
getRealName
().
join
(
","
);
userName
.
append
(
realNames
);
}
}
for
(
PlanTaskPointInputItemBo
arg
:
planTaskPointInputItems
)
{
Check
check
=
new
Check
();
if
(
checkMap
.
get
(
arg
.
getPointId
())
==
null
)
{
check
.
setOrgCode
(
arg
.
getOrgCode
());
check
.
setUserId
(
planTask
.
getUserId
());
int
len
=
userName
.
toString
().
indexOf
(
","
);
if
(
len
!=
-
1
)
{
check
.
setUserName
(
userName
.
toString
());
}
else
{
check
.
setUserName
(
userName
.
toString
());
}
check
.
setDepName
(
deptName
.
toString
());
check
.
setPointId
(
arg
.
getPointId
());
check
.
setPointName
(
arg
.
getPointName
());
check
.
setRouteName
(
arg
.
getRouteName
());
check
.
setPlanName
(
arg
.
getPlanName
());
check
.
setErrorClassify
(
arg
.
getClassifyName
());
check
.
setUploadTime
(
new
Date
());
check
.
setPlanId
(
arg
.
getPlanId
());
check
.
setPlanTaskId
(
arg
.
getPlanTaskId
());
check
.
setPlanTaskDetailId
(
arg
.
getPlanTaskDetailId
());
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
);
checkMap
.
put
(
arg
.
getPointId
(),
check
);
}
else
{
check
=
checkMap
.
get
(
arg
.
getPointId
());
}
if
(
arg
.
getInputItemId
()
!=
null
)
{
InputItem
inputItem
=
inputItemDao
.
findById
(
arg
.
getInputItemId
()).
get
();
CheckInput
checkInput
=
new
CheckInput
();
if
(
XJConstant
.
INPUT_ITEM_SELECT
.
equals
(
inputItem
.
getItemType
()))
{
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
()))
{
checkInput
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
checkInput
.
setCheckId
(
check
.
getId
());
checkInput
.
setInputId
(
arg
.
getInputItemId
());
checkInput
.
setIsOk
(
CheckStatusEnum
.
QUALIFIED
.
getCode
());
checkInput
.
setRoutePointItemId
(
arg
.
getRoutePointItemId
());
checkInput
.
setOrderNo
(
arg
.
getOrderNo
());
checkInput
.
setOrgCode
(
arg
.
getOrgCode
());
checkInput
.
setInputName
(
arg
.
getInputName
());
checkInput
.
setPointClassifyId
(
arg
.
getClassifyId
());
checkInput
.
setPointClassifyName
(
arg
.
getClassifyName
());
iCheckInputDao
.
saveAndFlush
(
checkInput
);
// checkInputs.add(checkInput);
}
}
});
// iCheckDao.saveAll(checks);
// iCheckInputDao.saveAll(checkInputs);
}
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
(
"是"
))
{
checkInput
.
setInputValue
(
validateName
);
}
}
}
return
checkInput
;
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/CheckRecordDataDto.java
0 → 100644
View file @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dto
;
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
java.util.List
;
/**
* @author Administrator
*/
@Data
public
class
CheckRecordDataDto
{
List
<
PlanTask
>
planTasks
;
List
<
PlanTaskDetail
>
planTaskDetails
;
AgencyUserModel
agencyUserModel
;
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/StaticTableUpdateDto.java
0 → 100644
View file @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dto
;
import
lombok.Data
;
/**
* @author Administrator
*/
@Data
public
class
StaticTableUpdateDto
{
String
table
;
Integer
riskEnd
;
Integer
noRiskEnd
;
String
orgCode
;
String
checkTime
;
}
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 @
4ebd478c
...
@@ -16,25 +16,11 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...
@@ -16,25 +16,11 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.dao.mapper.CheckMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.*
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.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.ICheckShotDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IInputItemDao
;
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.IPlanTaskHistoryDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IRouteDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.RepositoryTs
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto
;
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.UserDetailsDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
...
@@ -51,17 +37,9 @@ import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
...
@@ -51,17 +37,9 @@ import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import
com.yeejoin.amos.patrol.business.util.MyByteArrayMultipartFile
;
import
com.yeejoin.amos.patrol.business.util.MyByteArrayMultipartFile
;
import
com.yeejoin.amos.patrol.business.util.PlanTaskUtil
;
import
com.yeejoin.amos.patrol.business.util.PlanTaskUtil
;
import
com.yeejoin.amos.patrol.business.util.WordTemplateUtils
;
import
com.yeejoin.amos.patrol.business.util.WordTemplateUtils
;
import
com.yeejoin.amos.patrol.business.vo.CalDateVo
;
import
com.yeejoin.amos.patrol.business.vo.*
;
import
com.yeejoin.amos.patrol.business.vo.CodeOrderVo
;
import
com.yeejoin.amos.patrol.common.enums.*
;
import
com.yeejoin.amos.patrol.business.vo.DefectVo
;
import
com.yeejoin.amos.patrol.core.async.AsyncTask
;
import
com.yeejoin.amos.patrol.business.vo.LeavePlanTaskVo
;
import
com.yeejoin.amos.patrol.business.vo.PlanTaskVo
;
import
com.yeejoin.amos.patrol.common.enums.NotifyBusinessTypeEum
;
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.PlanTaskTheStatusEnum
;
import
com.yeejoin.amos.patrol.common.enums.PlanTaskTypeStatusEnum
;
import
com.yeejoin.amos.patrol.core.common.request.CommonPageable
;
import
com.yeejoin.amos.patrol.core.common.request.CommonPageable
;
import
com.yeejoin.amos.patrol.core.common.response.AppCheckInputRespone
;
import
com.yeejoin.amos.patrol.core.common.response.AppCheckInputRespone
;
import
com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone
;
import
com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone
;
...
@@ -69,27 +47,11 @@ import com.yeejoin.amos.patrol.core.enums.DefectLevelEnum;
...
@@ -69,27 +47,11 @@ import com.yeejoin.amos.patrol.core.enums.DefectLevelEnum;
import
com.yeejoin.amos.patrol.core.enums.WordTemplateEnum
;
import
com.yeejoin.amos.patrol.core.enums.WordTemplateEnum
;
import
com.yeejoin.amos.patrol.core.util.DateUtil
;
import
com.yeejoin.amos.patrol.core.util.DateUtil
;
import
com.yeejoin.amos.patrol.core.util.StringUtil
;
import
com.yeejoin.amos.patrol.core.util.StringUtil
;
import
com.yeejoin.amos.patrol.dao.entity.Check
;
import
com.yeejoin.amos.patrol.dao.entity.*
;
import
com.yeejoin.amos.patrol.dao.entity.CheckHistory
;
import
com.yeejoin.amos.patrol.dao.entity.CheckInput
;
import
com.yeejoin.amos.patrol.dao.entity.CheckInputHistory
;
import
com.yeejoin.amos.patrol.dao.entity.CheckShot
;
import
com.yeejoin.amos.patrol.dao.entity.CheckShotHistory
;
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.Plan
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetailHistory
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskHistory
;
import
com.yeejoin.amos.patrol.dao.entity.Route
;
import
com.yeejoin.amos.patrol.dao.entity.StaticDay
;
import
com.yeejoin.amos.patrol.dao.entity.StaticMonth
;
import
com.yeejoin.amos.patrol.dao.entity.StaticWeek
;
import
com.yeejoin.amos.patrol.exception.YeeException
;
import
com.yeejoin.amos.patrol.exception.YeeException
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.quartz.IJobService
;
import
com.yeejoin.amos.patrol.quartz.IJobService
;
import
com.yeejoin.amos.patrol.utils.UserTransmittableUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.compress.utils.Lists
;
import
org.apache.commons.compress.utils.Lists
;
import
org.apache.commons.compress.utils.Sets
;
import
org.apache.commons.compress.utils.Sets
;
...
@@ -124,6 +86,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...
@@ -124,6 +86,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.PersistenceContext
;
...
@@ -143,21 +106,9 @@ import java.text.ParseException;
...
@@ -143,21 +106,9 @@ import java.text.ParseException;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.GregorianCalendar
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.function.Function
;
import
java.util.function.Function
;
...
@@ -258,6 +209,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -258,6 +209,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired
@Autowired
AmosRequestContext
amosRequestContext
;
AmosRequestContext
amosRequestContext
;
@Autowired
Executor
asyncServiceExecutor
;
@Autowired
private
AsyncTask
asyncTask
;
private
String
DB
=
"amos_tzs_biz."
;
private
String
DB
=
"amos_tzs_biz."
;
private
String
P_STATIC_DAY
=
"p_static_day"
;
private
String
P_STATIC_DAY
=
"p_static_day"
;
...
@@ -282,6 +239,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -282,6 +239,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private
final
String
APP_WEB
=
"APP/WEB"
;
private
final
String
APP_WEB
=
"APP/WEB"
;
private
static
final
String
TAB
=
"\r\n"
;
private
static
final
String
TAB
=
"\r\n"
;
private
List
<
PointCheckDetailBo
>
allPointInputs
;
@PostConstruct
public
void
init
(){
allPointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
null
,
null
);
}
@Override
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
params
)
{
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
params
)
{
...
@@ -500,15 +463,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -500,15 +463,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
REGEN_FLAG
);
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
REGEN_FLAG
);
//6.插入planTask及planTaskDetail
//6.插入planTask及planTaskDetail
insertPlanTaskAndDetNew
(
list
,
plan
,
flag
,
new
Date
(),
oldEsPlanTaskListDtos
);
insertPlanTaskAndDetNew
(
list
,
plan
,
flag
,
new
Date
(),
oldEsPlanTaskListDtos
);
// 更新统计表
// 更新统计表
taskStaticExecution
(
null
);
taskStaticExecution
(
null
);
}
}
private
void
notifyBusinessRefresh
(
String
type
)
{
private
void
notifyBusinessRefresh
(
String
type
)
{
try
{
try
{
business
.
planTaskInsertToB
(
type
);
business
.
planTaskInsertToB
(
type
);
...
@@ -778,7 +739,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -778,7 +739,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 判断当天是不是月第一天
// 判断当天是不是月第一天
int
date
=
DateUtils
.
getDate
(
new
Date
());
int
date
=
DateUtils
.
getDate
(
new
Date
());
int
month
=
DateUtils
.
getMonth
(
new
Date
());
int
month
=
DateUtils
.
getMonth
(
new
Date
());
if
(
date
==
1
)
{
if
(
date
==
1
)
{
// 日统计表按月归档
// 日统计表按月归档
Calendar
calendar
=
new
GregorianCalendar
();
Calendar
calendar
=
new
GregorianCalendar
();
calendar
.
setTime
(
new
Date
());
calendar
.
setTime
(
new
Date
());
...
@@ -786,21 +747,21 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -786,21 +747,21 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Date
oldDate
=
calendar
.
getTime
();
Date
oldDate
=
calendar
.
getTime
();
try
{
try
{
String
s
=
DateUtils
.
dateFormat
(
oldDate
,
DateUtils
.
MONTH_PATTERN
);
String
s
=
DateUtils
.
dateFormat
(
oldDate
,
DateUtils
.
MONTH_PATTERN
);
s
=
s
.
replace
(
"-"
,
""
);
s
=
s
.
replace
(
"-"
,
""
);
createNeedTime
(
P_STATIC_DAY
,
DB
,
P_STATIC_DAY
+
"_"
+
s
);
createNeedTime
(
P_STATIC_DAY
,
DB
,
P_STATIC_DAY
+
"_"
+
s
);
List
<
StaticDay
>
staticDay
=
planTaskMapper
.
findStaticDay
();
List
<
StaticDay
>
staticDay
=
planTaskMapper
.
findStaticDay
();
Iterable
join
=
CompletableFuture
.
supplyAsync
(()
->
repositoryTs
.
batchSave
(
staticDay
)).
join
();
Iterable
join
=
CompletableFuture
.
supplyAsync
(()
->
repositoryTs
.
batchSave
(
staticDay
)).
join
();
if
(!
ValidationUtil
.
isEmpty
(
join
))
{
if
(!
ValidationUtil
.
isEmpty
(
join
))
{
planTaskMapper
.
deleteDate
(
P_STATIC_DAY
);
planTaskMapper
.
deleteDate
(
P_STATIC_DAY
);
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
(
month
==
1
)
{
if
(
month
==
1
)
{
try
{
try
{
String
s
=
DateUtils
.
dateFormat
(
oldDate
,
DateUtils
.
YEAR_PATTERN
);
String
s
=
DateUtils
.
dateFormat
(
oldDate
,
DateUtils
.
YEAR_PATTERN
);
createNeedTime
(
P_STATIC_WEEK
,
DB
,
P_STATIC_WEEK
+
"_"
+
s
);
createNeedTime
(
P_STATIC_WEEK
,
DB
,
P_STATIC_WEEK
+
"_"
+
s
);
List
<
StaticDay
>
staticWeeks
=
planTaskMapper
.
findStaticWeek
();
List
<
StaticDay
>
staticWeeks
=
planTaskMapper
.
findStaticWeek
();
Iterable
join
=
CompletableFuture
.
supplyAsync
(()
->
repositoryTs
.
batchSave
(
staticWeeks
)).
join
();
Iterable
join
=
CompletableFuture
.
supplyAsync
(()
->
repositoryTs
.
batchSave
(
staticWeeks
)).
join
();
if
(!
ValidationUtil
.
isEmpty
(
join
))
{
if
(!
ValidationUtil
.
isEmpty
(
join
))
{
...
@@ -816,22 +777,22 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -816,22 +777,22 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskMapper
.
deleteOne
(
P_STATIC_WEEK
,
runDate
);
planTaskMapper
.
deleteOne
(
P_STATIC_WEEK
,
runDate
);
planTaskMapper
.
deleteOne
(
P_STATIC_MONTH
,
runDate
);
planTaskMapper
.
deleteOne
(
P_STATIC_MONTH
,
runDate
);
// 插入日统计表
// 插入日统计表
List
<
Map
<
String
,
Object
>>
listDay
=
checkMapper
.
planCount
(
runDate
,
null
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
day
.
getValue
()),
null
,
null
,
null
);
List
<
Map
<
String
,
Object
>>
listDay
=
checkMapper
.
planCount
(
runDate
,
null
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
day
.
getValue
()),
null
,
null
,
null
);
List
<
StaticDay
>
staticDays
=
listDay
.
stream
().
map
(
e
->
{
List
<
StaticDay
>
staticDays
=
listDay
.
stream
().
map
(
e
->
{
String
s
=
JSON
.
toJSONString
(
e
);
String
s
=
JSON
.
toJSONString
(
e
);
StaticDay
staticDay
=
JSON
.
parseObject
(
s
,
StaticDay
.
class
);
StaticDay
staticDay
=
JSON
.
parseObject
(
s
,
StaticDay
.
class
);
return
staticDay
;
return
staticDay
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
// 插入周统计表
// 插入周统计表
List
<
Map
<
String
,
Object
>>
listWeek
=
checkMapper
.
planCount
(
runDate
,
null
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
week
.
getValue
()),
null
,
null
,
null
);
List
<
Map
<
String
,
Object
>>
listWeek
=
checkMapper
.
planCount
(
runDate
,
null
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
week
.
getValue
()),
null
,
null
,
null
);
List
<
StaticWeek
>
staticWeeks
=
listWeek
.
stream
().
map
(
e
->
{
List
<
StaticWeek
>
staticWeeks
=
listWeek
.
stream
().
map
(
e
->
{
String
s
=
JSON
.
toJSONString
(
e
);
String
s
=
JSON
.
toJSONString
(
e
);
StaticWeek
staticWeek
=
JSON
.
parseObject
(
s
,
StaticWeek
.
class
);
StaticWeek
staticWeek
=
JSON
.
parseObject
(
s
,
StaticWeek
.
class
);
return
staticWeek
;
return
staticWeek
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
// 插入月统计表
// 插入月统计表
List
<
Map
<
String
,
Object
>>
listMonth
=
checkMapper
.
planCount
(
runDate
,
null
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
month
.
getValue
()),
null
,
null
,
null
);
List
<
Map
<
String
,
Object
>>
listMonth
=
checkMapper
.
planCount
(
runDate
,
null
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
month
.
getValue
()),
null
,
null
,
null
);
List
<
StaticMonth
>
staticMonths
=
listMonth
.
stream
().
map
(
e
->
{
List
<
StaticMonth
>
staticMonths
=
listMonth
.
stream
().
map
(
e
->
{
String
s
=
JSON
.
toJSONString
(
e
);
String
s
=
JSON
.
toJSONString
(
e
);
StaticMonth
staticMonth
=
JSON
.
parseObject
(
s
,
StaticMonth
.
class
);
StaticMonth
staticMonth
=
JSON
.
parseObject
(
s
,
StaticMonth
.
class
);
return
staticMonth
;
return
staticMonth
;
...
@@ -888,13 +849,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -888,13 +849,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// Route route = new Route();
// Route route = new Route();
List
<
UserDetailsDto
>
userDetailsDtos
=
new
ArrayList
<>();
List
<
UserDetailsDto
>
userDetailsDtos
=
new
ArrayList
<>();
// 获取用户组下所有的用户信息
// 获取用户组下所有的用户信息
try
{
try
{
ResponseModel
<
List
<
UserDetailsDto
>>
groupAndPersonInfo
=
tzsFeign
.
getGroupAndPersonInfo
(
Long
.
valueOf
(
plan
.
getUserGroupId
()));
ResponseModel
<
List
<
UserDetailsDto
>>
groupAndPersonInfo
=
tzsFeign
.
getGroupAndPersonInfo
(
Long
.
valueOf
(
plan
.
getUserGroupId
()));
userDetailsDtos
=
groupAndPersonInfo
.
getResult
();
userDetailsDtos
=
groupAndPersonInfo
.
getResult
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
());
}
}
System
.
out
.
println
(
userDetailsDtos
.
size
()
+
"==================="
);
System
.
out
.
println
(
userDetailsDtos
.
size
()
+
"==================="
);
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
,
userDetailsDtos
,
route
);
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
,
userDetailsDtos
,
route
);
}
}
...
@@ -1092,13 +1053,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1092,13 +1053,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
}
}
stopWatch
.
stop
();
stopWatch
.
stop
();
log
.
info
(
"获取点详情基础数据,耗时:{} 秒"
,
stopWatch
.
getTotalTimeSeconds
());
log
.
info
(
"获取点详情基础数据,耗时:{} 秒"
,
stopWatch
.
getTotalTimeSeconds
());
StopWatch
stopWatch1
=
new
StopWatch
();
StopWatch
stopWatch1
=
new
StopWatch
();
stopWatch1
.
start
();
stopWatch1
.
start
();
List
<
ESTaskDetailDto
>
esTaskInfo
=
planTaskMapper
.
selectTaskInfoList
(
plan
.
getId
());
List
<
ESTaskDetailDto
>
esTaskInfo
=
planTaskMapper
.
selectTaskInfoList
(
plan
.
getId
());
stopWatch1
.
stop
();
stopWatch1
.
stop
();
log
.
info
(
"获取点详情其他数据,耗时:{} 秒"
,
stopWatch1
.
getTotalTimeSeconds
());
log
.
info
(
"获取点详情其他数据,耗时:{} 秒"
,
stopWatch1
.
getTotalTimeSeconds
());
List
<
AppCheckInputRespone
>
pointInputs
=
planTaskMapper
.
selectPointInputs
(
plan
.
getRouteId
());
List
<
AppCheckInputRespone
>
pointInputs
=
planTaskMapper
.
selectPointInputs
(
plan
.
getRouteId
());
List
<
Map
<
String
,
String
>>
excludeItems
=
planTaskMapper
.
selectExcludeItemsByRoutId
(
plan
.
getRouteId
());
List
<
Map
<
String
,
String
>>
excludeItems
=
planTaskMapper
.
selectExcludeItemsByRoutId
(
plan
.
getRouteId
());
...
@@ -1128,7 +1089,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1128,7 +1089,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
esTaskDetailDto
.
setAppCheckInput
(
appResponeMap
);
esTaskDetailDto
.
setAppCheckInput
(
appResponeMap
);
}
}
stopWatch2
.
stop
();
stopWatch2
.
stop
();
log
.
info
(
"组装点详情数据,耗时:{} 秒"
,
stopWatch2
.
getTotalTimeSeconds
());
log
.
info
(
"组装点详情数据,耗时:{} 秒"
,
stopWatch2
.
getTotalTimeSeconds
());
StopWatch
stopWatch3
=
new
StopWatch
();
StopWatch
stopWatch3
=
new
StopWatch
();
stopWatch3
.
start
();
stopWatch3
.
start
();
if
(!
ValidationUtil
.
isEmpty
(
esTaskDetailDtos
))
{
if
(!
ValidationUtil
.
isEmpty
(
esTaskDetailDtos
))
{
...
@@ -1146,7 +1107,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1146,7 +1107,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
}
}
stopWatch3
.
stop
();
stopWatch3
.
stop
();
log
.
info
(
"点详情数据存入es,耗时:{} 秒"
,
stopWatch3
.
getTotalTimeSeconds
());
log
.
info
(
"点详情数据存入es,耗时:{} 秒"
,
stopWatch3
.
getTotalTimeSeconds
());
StopWatch
stopWatch4
=
new
StopWatch
();
StopWatch
stopWatch4
=
new
StopWatch
();
stopWatch4
.
start
();
stopWatch4
.
start
();
...
@@ -1170,7 +1131,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1170,7 +1131,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
}
}
stopWatch4
.
stop
();
stopWatch4
.
stop
();
log
.
info
(
"planTaskDetails转化,耗时:{} 秒"
,
stopWatch4
.
getTotalTimeSeconds
());
log
.
info
(
"planTaskDetails转化,耗时:{} 秒"
,
stopWatch4
.
getTotalTimeSeconds
());
StopWatch
stopWatch5
=
new
StopWatch
();
StopWatch
stopWatch5
=
new
StopWatch
();
stopWatch5
.
start
();
stopWatch5
.
start
();
...
@@ -1195,7 +1156,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1195,7 +1156,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
}
}
stopWatch5
.
stop
();
stopWatch5
.
stop
();
log
.
info
(
"esPlanTaskListDtos统计组装,耗时:{} 秒"
,
stopWatch5
.
getTotalTimeSeconds
());
log
.
info
(
"esPlanTaskListDtos统计组装,耗时:{} 秒"
,
stopWatch5
.
getTotalTimeSeconds
());
StopWatch
stopWatch6
=
new
StopWatch
();
StopWatch
stopWatch6
=
new
StopWatch
();
stopWatch6
.
start
();
stopWatch6
.
start
();
...
@@ -1218,12 +1179,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1218,12 +1179,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
}
}
stopWatch6
.
stop
();
stopWatch6
.
stop
();
log
.
info
(
"esPlanTaskListDtos数据组装,耗时:{} 秒"
,
stopWatch6
.
getTotalTimeSeconds
());
log
.
info
(
"esPlanTaskListDtos数据组装,耗时:{} 秒"
,
stopWatch6
.
getTotalTimeSeconds
());
StopWatch
stopWatch7
=
new
StopWatch
();
StopWatch
stopWatch7
=
new
StopWatch
();
stopWatch7
.
start
();
stopWatch7
.
start
();
saveEsPlanTaskList
(
esPlanTaskListDtos
,
oldEsPlanTaskListDtos
);
saveEsPlanTaskList
(
esPlanTaskListDtos
,
oldEsPlanTaskListDtos
);
stopWatch7
.
stop
();
stopWatch7
.
stop
();
log
.
info
(
"任务存入es,耗时:{} 秒"
,
stopWatch7
.
getTotalTimeSeconds
());
log
.
info
(
"任务存入es,耗时:{} 秒"
,
stopWatch7
.
getTotalTimeSeconds
());
}
}
...
@@ -1234,7 +1195,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1234,7 +1195,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
String
validateName
=
jsonObject
.
getString
(
"name"
);
String
validateName
=
jsonObject
.
getString
(
"name"
);
String
validateIsOk
=
jsonObject
.
getString
(
"isOk"
);
String
validateIsOk
=
jsonObject
.
getString
(
"isOk"
);
if
(
validateIsOk
.
equals
(
"是"
))
{
if
(
validateIsOk
.
equals
(
"是"
))
{
checkInput
.
setInputValue
(
validateName
);
checkInput
.
setInputValue
(
validateName
);
}
}
}
}
...
@@ -1560,16 +1521,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1560,16 +1521,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
handleAll
(
String
id
,
String
userId
)
{
public
void
handleAll
(
String
id
,
String
userId
)
{
StopWatch
stopWatch
=
new
StopWatch
();
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
stopWatch
.
start
();
// todo 1.改成批量查询
Optional
<
PlanTask
>
planTaskOptional
=
iplanTaskDao
.
findById
(
Long
.
valueOf
(
id
));
Optional
<
PlanTask
>
planTaskOptional
=
iplanTaskDao
.
findById
(
Long
.
valueOf
(
id
));
PlanTask
planTask
=
planTaskOptional
.
get
();
PlanTask
planTask
=
planTaskOptional
.
get
();
stopWatch
.
stop
();
stopWatch
.
stop
();
log
.
info
(
"一键提交=========> 获取planTask耗时 :{}s"
,
stopWatch
.
getTotalTimeSeconds
());
log
.
info
(
"一键提交=========> 获取planTask耗时 :{}s"
,
stopWatch
.
getTotalTimeSeconds
());
if
(
planTask
.
getFinishStatus
()
==
XJConstant
.
TASK_STATUS_DEAL
)
{
if
(
planTask
.
getFinishStatus
()
==
XJConstant
.
TASK_STATUS_DEAL
)
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
if
(
planTask
.
getRiskStatus
()
!=
1
)
{
if
(
planTask
.
getRiskStatus
()
!=
1
)
{
planTask
.
setRiskStatus
(
XJConstant
.
NORISK_NUM
);
planTask
.
setRiskStatus
(
XJConstant
.
NORISK_NUM
);
}
}
stopWatch
.
start
();
stopWatch
.
start
();
...
@@ -1583,18 +1545,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1583,18 +1545,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
log
.
info
(
"一键提交=========> 生成createCheckRecord检记录耗时 :{}s"
,
stopWatch
.
getTotalTimeSeconds
());
log
.
info
(
"一键提交=========> 生成createCheckRecord检记录耗时 :{}s"
,
stopWatch
.
getTotalTimeSeconds
());
// 更新统计表
// 更新统计表
if
(
planTask
.
getPlanType
().
equals
(
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
day
.
getValue
())))
{
if
(
planTask
.
getPlanType
().
equals
(
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
day
.
getValue
())))
{
planTaskMapper
.
updateSingle
(
P_STATIC_DAY
,
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
planTaskMapper
.
updateSingle
(
P_STATIC_DAY
,
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
planTask
.
getOrgCode
(),
planTask
.
getCheckDate
());
planTask
.
getOrgCode
(),
planTask
.
getCheckDate
());
}
else
if
(
planTask
.
getPlanType
().
equals
(
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
week
.
getValue
())))
{
}
else
if
(
planTask
.
getPlanType
().
equals
(
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
week
.
getValue
())))
{
planTaskMapper
.
updateSingle
(
P_STATIC_WEEK
,
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
planTaskMapper
.
updateSingle
(
P_STATIC_WEEK
,
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
planTask
.
getOrgCode
(),
planTask
.
getCheckDate
());
planTask
.
getOrgCode
(),
planTask
.
getCheckDate
());
}
else
{
}
else
{
planTaskMapper
.
updateSingle
(
P_STATIC_WEEK
,
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
planTaskMapper
.
updateSingle
(
P_STATIC_WEEK
,
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
,
planTask
.
getOrgCode
(),
planTask
.
getCheckDate
());
planTask
.
getOrgCode
(),
planTask
.
getCheckDate
());
}
}
stopWatch
.
start
();
stopWatch
.
start
();
List
<
PlanTaskDetail
>
planTaskDetails
=
iPlanTaskDetailDao
.
findAllByTaskNoAndStatus
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
NOTSTARTED
.
getValue
());
List
<
PlanTaskDetail
>
planTaskDetails
=
iPlanTaskDetailDao
.
findAllByTaskNoAndStatus
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
NOTSTARTED
.
getValue
());
...
@@ -1607,18 +1569,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1607,18 +1569,18 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskDetails
.
stream
().
map
(
action
->
{
planTaskDetails
.
stream
().
map
(
action
->
{
action
.
setStatus
(
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
action
.
setStatus
(
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
iPlanTaskDetailDao
.
saveAndFlush
(
action
);
iPlanTaskDetailDao
.
saveAndFlush
(
action
);
planTaskDetailMapper
.
finishTaskDetail
(
action
.
getId
(),
action
.
getPointId
(),
//
planTaskDetailMapper.finishTaskDetail(action.getId(), action.getPointId(),
action
.
getPlanTask
().
getId
(),
userId
);
//
action.getPlanTask().getId(), userId);
// AppPointCheckRespone appPointCheckRespone = planService.queryPointPlanTaskDetail(null, null, null, action.getTaskNo(), action.getPointId());
// AppPointCheckRespone appPointCheckRespone = planService.queryPointPlanTaskDetail(null, null, null, action.getTaskNo(), action.getPointId());
ESTaskDetailDto
esTaskDetailDto
=
esTaskDetail
.
findById
(
String
.
valueOf
(
action
.
getId
())).
get
();
ESTaskDetailDto
esTaskDetailDto
=
esTaskDetail
.
findById
(
String
.
valueOf
(
action
.
getId
())).
get
();
JSONObject
appCheckInput
=
esTaskDetailDto
.
getAppCheckInput
();
JSONObject
appCheckInput
=
esTaskDetailDto
.
getAppCheckInput
();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapList
=
(
Map
<
String
,
List
<
Map
<
String
,
Object
>>>)
JSON
.
parse
(
appCheckInput
.
toJSONString
());
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapList
=
(
Map
<
String
,
List
<
Map
<
String
,
Object
>>>)
JSON
.
parse
(
appCheckInput
.
toJSONString
());
List
<
AppCheckInputRespone
>
appCheckInputRespones
=
new
ArrayList
<>();
List
<
AppCheckInputRespone
>
appCheckInputRespones
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map
:
mapList
.
get
(
"items"
))
{
for
(
Map
<
String
,
Object
>
map
:
mapList
.
get
(
"items"
))
{
AppCheckInputRespone
appCheckInputRespone
=
new
AppCheckInputRespone
();
AppCheckInputRespone
appCheckInputRespone
=
new
AppCheckInputRespone
();
BeanUtils
.
copyProperties
(
appCheckInputRespone
,
map
);
BeanUtils
.
copyProperties
(
appCheckInputRespone
,
map
);
...
@@ -1637,7 +1599,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1637,7 +1599,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
appCheckInputRespone
.
setInputValue
(
inputItem
.
getDefaultValue
());
appCheckInputRespone
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
}
appCheckInputRespone
.
setPointInputImgUrls
(
new
ArrayList
<>()
);
appCheckInputRespone
.
setPointInputImgUrls
(
new
ArrayList
<>());
appCheckInputRespones
.
add
(
appCheckInputRespone
);
appCheckInputRespones
.
add
(
appCheckInputRespone
);
}
}
appCheckInput
.
put
(
"items"
,
appCheckInputRespones
);
appCheckInput
.
put
(
"items"
,
appCheckInputRespones
);
...
@@ -1673,6 +1635,174 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1673,6 +1635,174 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
handleAllBatch
(
String
planTaskIds
,
String
userId
)
{
// 1.数组准备:查询要一键提交的任务及更新状态
List
<
PlanTask
>
planTasks
=
getPlanTasks
(
planTaskIds
);
if
(
planTasks
.
isEmpty
())
{
return
;
}
// 2.数组准备:查询未完成状态的任务明细及更新状态
List
<
PlanTaskDetail
>
planTaskDetails
=
getWaitingDealPlanTaskDetails
(
planTasks
);
// 3.数组准备: es存储数据组装
List
<
ESTaskDetailDto
>
esTaskDetailDtos
=
this
.
buildESTaskDetailDtoData
(
planTasks
,
planTaskDetails
);
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
=
this
.
buildESPlanTaskListDtoData
(
planTasks
,
esTaskDetailDtos
,
planTaskDetails
);
// 4.保存页面必须的数据
saveMustData
(
esTaskDetailDtos
,
esPlanTaskListDtos
,
planTasks
);
asyncTask
.
saveCheckRecordAsync
(
planTasks
,
planTaskDetails
,
userId
);
}
private
void
saveMustData
(
List
<
ESTaskDetailDto
>
esTaskDetailDtos
,
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
PlanTask
>
planTasks
)
{
// 保存es数据
List
<
CompletableFuture
<
Void
>>
futures
=
new
ArrayList
<>();
CompletableFuture
<
Void
>
future1
=
CompletableFuture
.
runAsync
(()
->
{
try
{
esTaskDetail
.
saveAll
(
esTaskDetailDtos
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
CompletableFuture
<
Void
>
future2
=
CompletableFuture
.
runAsync
(()
->
{
try
{
esPlanTaskList
.
saveAll
(
esPlanTaskListDtos
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
// 更新统计数据表
CompletableFuture
<
Void
>
future3
=
CompletableFuture
.
runAsync
(()
->
{
try
{
}
catch
(
Exception
e
)
{
this
.
updateStaticTable
(
planTasks
);
log
.
error
(
e
.
getMessage
(),
e
);
}
},
asyncServiceExecutor
);
futures
.
add
(
future1
);
futures
.
add
(
future2
);
futures
.
add
(
future3
);
CompletableFuture
<
Void
>
allOfFuture
=
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
]));
allOfFuture
.
join
();
}
private
void
updateStaticTable
(
List
<
PlanTask
>
planTasks
)
{
List
<
StaticTableUpdateDto
>
staticTableUpdateDtos
=
planTasks
.
stream
().
map
(
planTask
->
{
StaticTableUpdateDto
updateDto
=
new
StaticTableUpdateDto
();
updateDto
.
setTable
(
this
.
getTable
(
planTask
));
updateDto
.
setRiskEnd
(
XJConstant
.
RISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
);
updateDto
.
setNoRiskEnd
(
XJConstant
.
NORISK_NUM
==
planTask
.
getRiskStatus
()
?
1
:
0
);
updateDto
.
setOrgCode
(
planTask
.
getOrgCode
());
updateDto
.
setCheckTime
(
planTask
.
getCheckDate
());
return
updateDto
;
}).
collect
(
Collectors
.
toList
());
planTaskMapper
.
updateStaticTableBatch
(
staticTableUpdateDtos
);
}
private
String
getTable
(
PlanTask
planTask
)
{
if
(
planTask
.
getPlanType
().
equals
(
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
day
.
getValue
())))
{
return
P_STATIC_DAY
;
}
else
if
(
planTask
.
getPlanType
().
equals
(
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
week
.
getValue
())))
{
return
P_STATIC_WEEK
;
}
else
{
return
P_STATIC_MONTH
;
}
}
private
List
<
ESTaskDetailDto
>
buildESTaskDetailDtoData
(
List
<
PlanTask
>
planTasks
,
List
<
PlanTaskDetail
>
planTaskDetails
)
{
// 查询所有的
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
();
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
);
}
else
if
(
XJConstant
.
INPUT_ITEM_NUMBER
.
equals
(
itemType
))
{
appCheckInputRespone
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
else
if
(
XJConstant
.
INPUT_ITEM_TEXT
.
equals
(
itemType
))
{
appCheckInputRespone
.
setInputValue
(
inputItem
.
getDefaultValue
());
}
appCheckInputRespone
.
setPointInputImgUrls
(
new
ArrayList
<>());
appCheckInputRespones
.
add
(
appCheckInputRespone
);
}
appCheckInput
.
put
(
"items"
,
appCheckInputRespones
);
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
;
}
private
List
<
ESPlanTaskListDto
>
buildESPlanTaskListDtoData
(
List
<
PlanTask
>
planTasks
,
List
<
ESTaskDetailDto
>
esTaskDetailDtos
,
List
<
PlanTaskDetail
>
planTaskDetails
)
{
List
<
String
>
ids
=
planTasks
.
stream
().
map
(
p
->
String
.
valueOf
(
p
.
getId
())).
collect
(
Collectors
.
toList
());
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
=
esPlanTaskList
.
findAllByPlanTaskIdIn
(
ids
);
esPlanTaskListDtos
.
forEach
(
esPlanTaskListDto
->
{
esPlanTaskListDto
.
setFinishStatus
(
String
.
valueOf
(
PlanTaskFinishStatusEnum
.
FINISHED
.
getValue
()));
esPlanTaskListDto
.
setFinshNum
(
this
.
filterByStatus
(
"1"
,
esPlanTaskListDto
.
getPlanTaskId
(),
esTaskDetailDtos
));
esPlanTaskListDto
.
setOmission
(
this
.
filterByStatus
(
"3"
,
esPlanTaskListDto
.
getPlanTaskId
(),
esTaskDetailDtos
));
esPlanTaskListDto
.
setUnqualified
(
this
.
filterByStatus
(
"2"
,
esPlanTaskListDto
.
getPlanTaskId
(),
esTaskDetailDtos
));
esPlanTaskListDto
.
setUnplan
(
this
.
filterByStatus
(
"0"
,
esPlanTaskListDto
.
getPlanTaskId
(),
esTaskDetailDtos
));
esPlanTaskListDto
.
setTaskPlanNum
(
this
.
filterByStatus
(
"1"
,
esPlanTaskListDto
.
getPlanTaskId
(),
esTaskDetailDtos
));
esPlanTaskListDto
.
setPoints
(
this
.
buildPlanTaskPoint
(
esPlanTaskListDto
.
getPlanTaskId
(),
planTaskDetails
));
});
return
esPlanTaskListDtos
;
}
private
List
<
PlanTaskDetail
>
buildPlanTaskPoint
(
String
planTaskId
,
List
<
PlanTaskDetail
>
planTaskDetails
)
{
return
planTaskDetails
.
stream
().
filter
(
t
->
Long
.
parseLong
(
planTaskId
)
==
t
.
getTaskNo
()).
collect
(
Collectors
.
toList
());
}
private
String
filterByStatus
(
String
status
,
String
planTaskId
,
List
<
ESTaskDetailDto
>
esTaskDetailDtos
)
{
long
count
=
esTaskDetailDtos
.
stream
().
filter
(
e
->
e
.
getPlanTaskId
().
equals
(
planTaskId
)
&&
e
.
getPointStatus
().
equals
(
status
)).
count
();
return
String
.
valueOf
(
count
);
}
private
List
<
PlanTaskDetail
>
getWaitingDealPlanTaskDetails
(
List
<
PlanTask
>
planTasks
)
{
List
<
Long
>
planTaskIdsList
=
planTasks
.
stream
().
map
(
BasicEntity:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
PlanTaskDetail
>
planTaskDetails
=
planTaskDetailMapper
.
findAllByIdInAndStatus
(
planTaskIdsList
,
PlanTaskDetailStatusEnum
.
NOTSTARTED
.
getValue
());
planTaskDetails
.
forEach
(
planTaskDetail
->
{
planTaskDetail
.
setStatus
(
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
});
return
planTaskDetails
;
}
private
List
<
PlanTask
>
getPlanTasks
(
String
planTaskIds
)
{
List
<
Long
>
planTaskIdsList
=
Arrays
.
stream
(
planTaskIds
.
split
(
","
))
.
map
(
Long:
:
parseLong
)
.
collect
(
Collectors
.
toList
());
List
<
PlanTask
>
planTasks
=
iplanTaskDao
.
findAllByIdIn
(
planTaskIdsList
);
List
<
PlanTask
>
result
=
planTasks
.
stream
().
filter
(
p
->
p
.
getFinishStatus
()
==
XJConstant
.
TASK_STATUS_DEAL
).
collect
(
Collectors
.
toList
());
result
.
forEach
(
planTask
->
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
if
(
planTask
.
getRiskStatus
()
!=
1
)
{
planTask
.
setRiskStatus
(
XJConstant
.
NORISK_NUM
);
}
});
return
result
;
}
@Override
public
List
getPlanTaskInfo
(
HashMap
<
String
,
Object
>
param
)
{
public
List
getPlanTaskInfo
(
HashMap
<
String
,
Object
>
param
)
{
return
planTaskMapper
.
getPlanTaskByPointId
(
param
);
return
planTaskMapper
.
getPlanTaskByPointId
(
param
);
}
}
...
@@ -1686,10 +1816,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1686,10 +1816,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
public
Page
<
Map
<
String
,
Object
>>
getPlanTasks
(
String
toke
,
String
product
,
String
appKey
,
HashMap
<
String
,
Object
>
params
)
{
public
Page
<
Map
<
String
,
Object
>>
getPlanTasks
(
String
toke
,
String
product
,
String
appKey
,
HashMap
<
String
,
Object
>
params
)
{
CommonPageable
pageParam
=
new
CommonPageable
();
CommonPageable
pageParam
=
new
CommonPageable
();
List
<
Map
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
List
<
Map
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
if
(
params
.
containsKey
(
"finishStatus"
))
{
if
(
params
.
containsKey
(
"finishStatus"
))
{
params
.
put
(
"finishStatus"
,
String
.
valueOf
(
PlanTaskTheStatusEnum
.
getValue
(
params
.
get
(
"finishStatus"
).
toString
())));
params
.
put
(
"finishStatus"
,
String
.
valueOf
(
PlanTaskTheStatusEnum
.
getValue
(
params
.
get
(
"finishStatus"
).
toString
())));
}
}
if
(
params
.
containsKey
(
"type"
))
{
if
(
params
.
containsKey
(
"type"
))
{
params
.
put
(
"type"
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
getValue
(
params
.
get
(
"type"
).
toString
())));
params
.
put
(
"type"
,
String
.
valueOf
(
PlanTaskTypeStatusEnum
.
getValue
(
params
.
get
(
"type"
).
toString
())));
}
}
...
@@ -1743,7 +1873,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1743,7 +1873,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
totle
=
response
.
getInternalResponse
().
hits
().
getTotalHits
().
value
;
totle
=
response
.
getInternalResponse
().
hits
().
getTotalHits
().
value
;
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
e
->
{
list
.
forEach
(
e
->
{
e
.
put
(
"executiveName"
,
e
.
get
(
"userName"
)
);
e
.
put
(
"executiveName"
,
e
.
get
(
"userName"
)
);
});
});
}
}
return
new
PageImpl
<>(
list
,
pageParam
,
totle
);
return
new
PageImpl
<>(
list
,
pageParam
,
totle
);
...
@@ -1911,78 +2041,76 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -1911,78 +2041,76 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
@Override
@Override
public
HashMap
<
String
,
Object
>
getChkExListNew
(
String
orgCode
,
CommonPageable
commonPageable
)
{
public
HashMap
<
String
,
Object
>
getChkExListNew
(
String
orgCode
,
CommonPageable
commonPageable
)
{
CheckPtListPageParam
param
=
new
CheckPtListPageParam
();
CheckPtListPageParam
param
=
new
CheckPtListPageParam
();
param
.
setPageNumber
(
commonPageable
.
getPageNumber
());
param
.
setPageNumber
(
commonPageable
.
getPageNumber
());
param
.
setPageSize
(
commonPageable
.
getPageSize
());
param
.
setPageSize
(
commonPageable
.
getPageSize
());
param
.
setOrgCode
(
orgCode
);
param
.
setOrgCode
(
orgCode
);
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
date
=
new
Date
();
Date
date
=
new
Date
();
String
c
=
dateFormat
.
format
(
date
);
String
c
=
dateFormat
.
format
(
date
);
param
.
setCheckDate
(
c
);
param
.
setCheckDate
(
c
);
long
total
=
planTaskMapper
.
countChkExListDataNew
(
param
);
long
total
=
planTaskMapper
.
countChkExListDataNew
(
param
);
List
<
CheckChkExListBo
>
content
=
planTaskMapper
.
getChkExListNew
(
param
);
List
<
CheckChkExListBo
>
content
=
planTaskMapper
.
getChkExListNew
(
param
);
Page
<
CheckChkExListBo
>
result
=
new
PageImpl
<
CheckChkExListBo
>(
content
,
param
,
total
);
Page
<
CheckChkExListBo
>
result
=
new
PageImpl
<
CheckChkExListBo
>(
content
,
param
,
total
);
List
<
HashMap
<
String
,
Object
>>
colModel
=
new
ArrayList
<>();
List
<
HashMap
<
String
,
Object
>>
colModel
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
temph1
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
temph1
=
new
HashMap
<>();
temph1
.
put
(
"fid"
,
"name"
);
temph1
.
put
(
"fid"
,
"name"
);
temph1
.
put
(
"dataIndex"
,
"name"
);
temph1
.
put
(
"dataIndex"
,
"name"
);
temph1
.
put
(
"name"
,
"巡检计划名称"
);
temph1
.
put
(
"name"
,
"巡检计划名称"
);
temph1
.
put
(
"title"
,
"巡检计划名称"
);
temph1
.
put
(
"title"
,
"巡检计划名称"
);
temph1
.
put
(
"type"
,
"name"
);
temph1
.
put
(
"type"
,
"name"
);
temph1
.
put
(
"key"
,
"name"
);
temph1
.
put
(
"key"
,
"name"
);
HashMap
<
String
,
Object
>
temph2
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
temph2
=
new
HashMap
<>();
temph2
.
put
(
"fid"
,
"lastTime"
);
temph2
.
put
(
"fid"
,
"lastTime"
);
temph2
.
put
(
"dataIndex"
,
"lastTime"
);
temph2
.
put
(
"dataIndex"
,
"lastTime"
);
temph2
.
put
(
"name"
,
"开始时间"
);
temph2
.
put
(
"name"
,
"开始时间"
);
temph2
.
put
(
"title"
,
"开始时间"
);
temph2
.
put
(
"title"
,
"开始时间"
);
temph2
.
put
(
"type"
,
"lastTime"
);
temph2
.
put
(
"type"
,
"lastTime"
);
temph2
.
put
(
"key"
,
"lastTime"
);
temph2
.
put
(
"key"
,
"lastTime"
);
HashMap
<
String
,
Object
>
temph3
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
temph3
=
new
HashMap
<>();
temph3
.
put
(
"fid"
,
"endTime"
);
temph3
.
put
(
"fid"
,
"endTime"
);
temph3
.
put
(
"dataIndex"
,
"endTime"
);
temph3
.
put
(
"dataIndex"
,
"endTime"
);
temph3
.
put
(
"name"
,
"结束时间"
);
temph3
.
put
(
"name"
,
"结束时间"
);
temph3
.
put
(
"title"
,
"结束时间"
);
temph3
.
put
(
"title"
,
"结束时间"
);
temph3
.
put
(
"type"
,
"endTime"
);
temph3
.
put
(
"type"
,
"endTime"
);
temph3
.
put
(
"key"
,
"endTime"
);
temph3
.
put
(
"key"
,
"endTime"
);
HashMap
<
String
,
Object
>
temph4
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
temph4
=
new
HashMap
<>();
temph4
.
put
(
"fid"
,
"finishStatus"
);
temph4
.
put
(
"fid"
,
"finishStatus"
);
temph4
.
put
(
"dataIndex"
,
"finishStatus"
);
temph4
.
put
(
"dataIndex"
,
"finishStatus"
);
temph4
.
put
(
"name"
,
"完成情况"
);
temph4
.
put
(
"name"
,
"完成情况"
);
temph4
.
put
(
"title"
,
"完成情况"
);
temph4
.
put
(
"title"
,
"完成情况"
);
temph4
.
put
(
"type"
,
"finishStatus"
);
temph4
.
put
(
"type"
,
"finishStatus"
);
temph4
.
put
(
"key"
,
"finishStatus"
);
temph4
.
put
(
"key"
,
"finishStatus"
);
HashMap
<
String
,
Object
>
temph5
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
temph5
=
new
HashMap
<>();
temph5
.
put
(
"fid"
,
"realName"
);
temph5
.
put
(
"fid"
,
"realName"
);
temph5
.
put
(
"dataIndex"
,
"realName"
);
temph5
.
put
(
"dataIndex"
,
"realName"
);
temph5
.
put
(
"name"
,
"巡检人员"
);
temph5
.
put
(
"name"
,
"巡检人员"
);
temph5
.
put
(
"title"
,
"巡检人员"
);
temph5
.
put
(
"title"
,
"巡检人员"
);
temph5
.
put
(
"type"
,
"realName"
);
temph5
.
put
(
"type"
,
"realName"
);
temph5
.
put
(
"key"
,
"realName"
);
temph5
.
put
(
"key"
,
"realName"
);
colModel
.
add
(
temph1
);
colModel
.
add
(
temph1
);
colModel
.
add
(
temph2
);
colModel
.
add
(
temph2
);
colModel
.
add
(
temph3
);
colModel
.
add
(
temph3
);
colModel
.
add
(
temph4
);
colModel
.
add
(
temph4
);
colModel
.
add
(
temph5
);
colModel
.
add
(
temph5
);
HashMap
<
String
,
Object
>
dataGridMock
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
dataGridMock
=
new
HashMap
<>();
dataGridMock
.
put
(
"current"
,
result
.
getNumber
()+
1
);
dataGridMock
.
put
(
"current"
,
result
.
getNumber
()
+
1
);
dataGridMock
.
put
(
"total"
,
result
.
getTotalElements
());
dataGridMock
.
put
(
"total"
,
result
.
getTotalElements
());
dataGridMock
.
put
(
"pagination"
,
true
);
dataGridMock
.
put
(
"pagination"
,
true
);
dataGridMock
.
put
(
"totalPage"
,
result
.
getTotalPages
());
dataGridMock
.
put
(
"totalPage"
,
result
.
getTotalPages
());
dataGridMock
.
put
(
"dataList"
,
result
.
getContent
());
dataGridMock
.
put
(
"dataList"
,
result
.
getContent
());
dataGridMock
.
put
(
"pageSize"
,
result
.
getSize
());
dataGridMock
.
put
(
"pageSize"
,
result
.
getSize
());
HashMap
<
String
,
Object
>
DATE
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
DATE
=
new
HashMap
<>();
DATE
.
put
(
"dataGridMock"
,
dataGridMock
);
DATE
.
put
(
"dataGridMock"
,
dataGridMock
);
DATE
.
put
(
"colModel"
,
colModel
);
DATE
.
put
(
"colModel"
,
colModel
);
return
DATE
;
return
DATE
;
}
}
@Override
@Override
public
Map
<
String
,
Object
>
getPlanTaskStatisticsForApp
(
HashMap
<
String
,
Object
>
params
)
{
public
Map
<
String
,
Object
>
getPlanTaskStatisticsForApp
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
getPlanTaskStatisticsForApp
(
params
);
return
planTaskMapper
.
getPlanTaskStatisticsForApp
(
params
);
...
@@ -2059,15 +2187,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2059,15 +2187,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
@Override
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetailInVersion2New
(
Long
planTaskId
,
Long
pointId
)
{
public
AppPointCheckRespone
queryPointPlanTaskDetailInVersion2New
(
Long
planTaskId
,
Long
pointId
)
{
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
)
{
...
@@ -2282,7 +2403,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2282,7 +2403,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskPageList
(
PlanTaskPageParam
param
)
{
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskPageList
(
PlanTaskPageParam
param
)
{
CommonPageable
commonPageable
=
new
CommonPageable
(
param
.
getPageNumber
()
-
1
,
param
.
getPageSize
());
CommonPageable
commonPageable
=
new
CommonPageable
(
param
.
getPageNumber
()
-
1
,
param
.
getPageSize
());
if
(
param
.
getPageNumber
()
>=
1
)
{
if
(
param
.
getPageNumber
()
>=
1
)
{
param
.
setPageNumber
((
param
.
getPageNumber
()
-
1
)*
param
.
getPageSize
());
param
.
setPageNumber
((
param
.
getPageNumber
()
-
1
)
*
param
.
getPageSize
());
}
}
long
total
=
planTaskMapper
.
countData
(
param
);
long
total
=
planTaskMapper
.
countData
(
param
);
List
<
HashMap
<
String
,
Object
>>
content
=
planTaskMapper
.
planTaskPage
(
param
);
List
<
HashMap
<
String
,
Object
>>
content
=
planTaskMapper
.
planTaskPage
(
param
);
...
@@ -2362,8 +2483,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2362,8 +2483,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
map
.
put
(
"task_name"
,
infoMap
.
get
(
"taskName"
));
map
.
put
(
"task_name"
,
infoMap
.
get
(
"taskName"
));
map
.
put
(
"begin_time"
,
begin
);
map
.
put
(
"begin_time"
,
begin
);
map
.
put
(
"end_time"
,
end
);
map
.
put
(
"end_time"
,
end
);
String
timestr
=
DateUtils
.
secondsToTimeStr
(
Integer
.
parseInt
(
infoMap
.
get
(
"difSecond"
).
toString
()));
String
timestr
=
DateUtils
.
secondsToTimeStr
(
Integer
.
parseInt
(
infoMap
.
get
(
"difSecond"
).
toString
()));
map
.
put
(
"task_total_time"
,
timestr
);
map
.
put
(
"task_total_time"
,
timestr
);
map
.
put
(
"task_status"
,
infoMap
.
get
(
"taskStatus"
));
map
.
put
(
"task_status"
,
infoMap
.
get
(
"taskStatus"
));
Map
<
String
,
Object
>
executeInfoMap
=
planTaskMapper
.
getPlanTaskExecuteInfo
(
taskDetailId
);
Map
<
String
,
Object
>
executeInfoMap
=
planTaskMapper
.
getPlanTaskExecuteInfo
(
taskDetailId
);
// 执行情况参数
// 执行情况参数
...
@@ -2412,7 +2533,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2412,7 +2533,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
List
<
DefectVo
>
res
=
new
ArrayList
();
List
<
DefectVo
>
res
=
new
ArrayList
();
if
(
result
!=
null
&&
0
<
result
.
size
())
{
if
(
result
!=
null
&&
0
<
result
.
size
())
{
for
(
Object
object
:
result
)
{
for
(
Object
object
:
result
)
{
DefectVo
vo
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
object
),
DefectVo
.
class
);
DefectVo
vo
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
object
),
DefectVo
.
class
);
res
.
add
(
vo
);
res
.
add
(
vo
);
}
}
...
@@ -2427,20 +2548,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2427,20 +2548,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
defectMap
.
put
(
"defect_level"
,
DefectLevelEnum
.
getByKey
(
x
.
getDefectLevel
()).
getValue
());
defectMap
.
put
(
"defect_level"
,
DefectLevelEnum
.
getByKey
(
x
.
getDefectLevel
()).
getValue
());
defectMap
.
put
(
"defect_equip_name"
,
x
.
getDefectEquipmentName
());
defectMap
.
put
(
"defect_equip_name"
,
x
.
getDefectEquipmentName
());
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
if
(!
StringUtils
.
isEmpty
(
x
.
getDefectEquipmentIds
())){
if
(!
StringUtils
.
isEmpty
(
x
.
getDefectEquipmentIds
()))
{
if
(
x
.
getDefectEquipmentIds
().
contains
(
","
)){
if
(
x
.
getDefectEquipmentIds
().
contains
(
","
))
{
String
[]
ids
=
x
.
getDefectEquipmentIds
().
split
(
","
);
String
[]
ids
=
x
.
getDefectEquipmentIds
().
split
(
","
);
List
<
String
>
equipIds
=
Arrays
.
asList
(
ids
);
List
<
String
>
equipIds
=
Arrays
.
asList
(
ids
);
if
(
0
<
equipIds
.
size
())
{
if
(
0
<
equipIds
.
size
())
{
for
(
String
s
:
equipIds
)
{
for
(
String
s
:
equipIds
)
{
sb
.
append
(
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
==
null
?
""
:
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
.
get
(
"equipLocation"
)).
append
(
","
);
sb
.
append
(
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
==
null
?
""
:
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
.
get
(
"equipLocation"
)).
append
(
","
);
}
}
}
}
}
else
{
}
else
{
sb
.
append
(
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
==
null
?
""
:
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
.
get
(
"equipLocation"
));
sb
.
append
(
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
==
null
?
""
:
planTaskMapper
.
getDefectEquipInfo
(
x
.
getDefectEquipmentIds
())
.
get
(
"equipLocation"
));
}
}
}
}
defectMap
.
put
(
"defect_equip_position"
,
sb
==
null
?
""
:
sb
);
defectMap
.
put
(
"defect_equip_position"
,
sb
==
null
?
""
:
sb
);
defectMap
.
put
(
"defect_equip_describe"
,
x
.
getDefectDescribe
());
defectMap
.
put
(
"defect_equip_describe"
,
x
.
getDefectDescribe
());
defectMap
.
put
(
"defect_report_time"
,
sdf
.
format
(
x
.
getAddTime
()));
defectMap
.
put
(
"defect_report_time"
,
sdf
.
format
(
x
.
getAddTime
()));
defectMap
.
put
(
"defect_discovery_name"
,
x
.
getDefectDiscover
());
defectMap
.
put
(
"defect_discovery_name"
,
x
.
getDefectDiscover
());
...
@@ -2607,46 +2728,46 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2607,46 +2728,46 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
int
zxcdw
=
0
;
int
zxcdw
=
0
;
for
(
Map
<
String
,
Object
>
map
:
statics
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrljxcdw"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrljxcdw"
))
{
xcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
xcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
}
}
if
(
map
.
get
(
"code"
).
equals
(
"xfxchg"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchg"
))
{
hgdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
hgdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
}
}
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrlcdw"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrlcdw"
))
{
lcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
lcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
}
}
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrzxcdw"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxcjrzxcdw"
))
{
zxcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
zxcdw
=
Integer
.
parseInt
(
map
.
get
(
"value"
).
toString
());
}
}
}
}
if
(
xcdw
==
0
)
{
if
(
xcdw
==
0
)
{
for
(
Map
<
String
,
Object
>
map
:
statics
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
map
.
put
(
"value"
,
"0"
);
map
.
put
(
"value"
,
"0"
);
}
}
}
}
}
else
{
}
else
{
for
(
Map
<
String
,
Object
>
map
:
statics
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxchgzb"
))
{
map
.
put
(
"value"
,
String
.
format
(
"%.2f"
,
(((
double
)
hgdw
/
(
double
)
xcdw
))
*
100
));
map
.
put
(
"value"
,
String
.
format
(
"%.2f"
,
(((
double
)
hgdw
/
(
double
)
xcdw
))
*
100
));
}
}
}
}
}
}
if
(
zxcdw
==
0
)
{
if
(
zxcdw
==
0
)
{
for
(
Map
<
String
,
Object
>
map
:
statics
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxclcl"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxclcl"
))
{
map
.
put
(
"value"
,
"0"
);
map
.
put
(
"value"
,
"0"
);
}
}
}
}
}
else
{
}
else
{
for
(
Map
<
String
,
Object
>
map
:
statics
for
(
Map
<
String
,
Object
>
map
:
statics
)
{
)
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxclcl"
))
{
if
(
map
.
get
(
"code"
).
equals
(
"xfxclcl"
))
{
map
.
put
(
"value"
,
String
.
format
(
"%.2f"
,
(((
double
)
lcdw
/
(
double
)
zxcdw
))*
100
)
);
map
.
put
(
"value"
,
String
.
format
(
"%.2f"
,
(((
double
)
lcdw
/
(
double
)
zxcdw
))
*
100
)
);
}
}
}
}
}
}
...
@@ -2697,8 +2818,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2697,8 +2818,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if
(
executeQuery
.
next
())
{
if
(
executeQuery
.
next
())
{
log
.
info
(
"table exist :"
+
msg
);
log
.
info
(
"table exist :"
+
msg
);
}
else
{
}
else
{
createSqlOrigin
=
createSqlOrigin
.
substring
(
0
,
createSqlOrigin
.
indexOf
(
";"
));
createSqlOrigin
=
createSqlOrigin
.
substring
(
0
,
createSqlOrigin
.
indexOf
(
";"
));
String
creatsql
=
org
.
apache
.
commons
.
lang3
.
StringUtils
.
replace
(
createSqlOrigin
,
existTableName
,
create
).
replaceFirst
(
create
,
DB
+
create
).
replace
(
"bigint(64)"
,
"int8"
).
replace
(
"smallint(16)"
,
"int2"
);
String
creatsql
=
org
.
apache
.
commons
.
lang3
.
StringUtils
.
replace
(
createSqlOrigin
,
existTableName
,
create
).
replaceFirst
(
create
,
DB
+
create
).
replace
(
"bigint(64)"
,
"int8"
).
replace
(
"smallint(16)"
,
"int2"
);
if
(
0
==
stmt
.
executeUpdate
(
creatsql
))
{
if
(
0
==
stmt
.
executeUpdate
(
creatsql
))
{
log
.
info
(
msg
+
"success !"
);
log
.
info
(
msg
+
"success !"
);
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/intfc/IPlanTaskService.java
View file @
4ebd478c
...
@@ -209,4 +209,6 @@ public interface IPlanTaskService {
...
@@ -209,4 +209,6 @@ public interface IPlanTaskService {
Map
<
String
,
Object
>
queryPatrolInfoList
(
String
bizOrgCode
,
Date
startDate
,
Date
endDate
);
Map
<
String
,
Object
>
queryPatrolInfoList
(
String
bizOrgCode
,
Date
startDate
,
Date
endDate
);
void
backPatrolInfo
();
void
backPatrolInfo
();
void
handleAllBatch
(
String
ids
,
String
userId
);
}
}
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 @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
import
com.alibaba.ttl.threadpool.TtlExecutors
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -59,6 +60,7 @@ public class ExecutorConfig {
...
@@ -59,6 +60,7 @@ public class ExecutorConfig {
executor
.
initialize
();
executor
.
initialize
();
//等待所有任务结束后再关闭线程池
//等待所有任务结束后再关闭线程池
executor
.
setWaitForTasksToCompleteOnShutdown
(
true
);
executor
.
setWaitForTasksToCompleteOnShutdown
(
true
);
return
executor
;
return
TtlExecutors
.
getTtlExecutor
(
executor
);
}
}
}
}
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 @
4ebd478c
...
@@ -6,31 +6,55 @@ import com.google.common.base.Joiner;
...
@@ -6,31 +6,55 @@ import com.google.common.base.Joiner;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.dao.mapper.MsgSubscribeMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.MsgSubscribeMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper
;
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.IMsgDao
;
import
com.yeejoin.amos.patrol.business.data.CheckRecordDataConsumer
;
import
com.yeejoin.amos.patrol.business.dto.CheckRecordDataDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.MsgSubscribeBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.MsgSubscribeBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.business.service.intfc.IMessageService
;
import
com.yeejoin.amos.patrol.business.service.intfc.IMessageService
;
import
com.yeejoin.amos.patrol.business.service.intfc.ISafety3DDataSendService
;
import
com.yeejoin.amos.patrol.business.service.intfc.ISafety3DDataSendService
;
import
com.yeejoin.amos.patrol.business.util.Toke
;
import
com.yeejoin.amos.patrol.business.util.Toke
;
import
com.yeejoin.amos.patrol.common.enums.CheckStatusEnum
;
import
com.yeejoin.amos.patrol.common.enums.JPushTypeEnum
;
import
com.yeejoin.amos.patrol.common.enums.JPushTypeEnum
;
import
com.yeejoin.amos.patrol.common.enums.MsgSubscribeEnum
;
import
com.yeejoin.amos.patrol.common.enums.MsgSubscribeEnum
;
import
com.yeejoin.amos.patrol.dao.entity.Msg
;
import
com.yeejoin.amos.patrol.common.enums.PlanTaskDetailStatusEnum
;
import
com.yeejoin.amos.patrol.dao.entity.*
;
import
com.yeejoin.amos.patrol.email.IEmailService
;
import
com.yeejoin.amos.patrol.email.IEmailService
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.utils.UserTransmittableUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.scheduling.annotation.AsyncResult
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContextModel
;
import
javax.annotation.PostConstruct
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.LinkedBlockingDeque
;
/**
/**
* 异步执行任务
* 异步执行任务
...
@@ -38,7 +62,7 @@ import java.util.concurrent.Future;
...
@@ -38,7 +62,7 @@ import java.util.concurrent.Future;
*
*
*/
*/
@Component
@Component
public
class
AsyncTask
{
public
class
AsyncTask
implements
ApplicationContextAware
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
AsyncTask
.
class
);
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
AsyncTask
.
class
);
@Autowired
@Autowired
...
@@ -63,10 +87,19 @@ public class AsyncTask {
...
@@ -63,10 +87,19 @@ public class AsyncTask {
@Autowired
@Autowired
AmosRequestContext
amosRequestContext
;
AmosRequestContext
amosRequestContext
;
@Autowired
Executor
asyncServiceExecutor
;
ApplicationContext
applicationContext
;
private
static
final
String
TOKE
=
"TOKE"
;
private
static
final
String
TOKE
=
"TOKE"
;
private
static
final
String
TAB
=
"\r\n"
;
private
static
final
String
TAB
=
"\r\n"
;
@Autowired
IInputItemDao
inputItemDao
;
private
final
BlockingQueue
<
CheckRecordDataDto
>
blockingQueue
=
new
LinkedBlockingDeque
<>();
/**
/**
...
@@ -294,4 +327,37 @@ public class AsyncTask {
...
@@ -294,4 +327,37 @@ public class AsyncTask {
return
afterFilterUserIds
;
return
afterFilterUserIds
;
}
}
private
void
setRequestContextByLocal
(
RequestContextModel
user
)
{
RequestContext
.
setToken
(
user
.
getToken
());
RequestContext
.
setProduct
(
user
.
getProduct
());
RequestContext
.
setAppKey
(
user
.
getAppKey
());
UserTransmittableUtils
.
clear
();
}
@Async
(
"asyncServiceExecutor"
)
public
void
saveCheckRecordAsync
(
List
<
PlanTask
>
planTasks
,
List
<
PlanTaskDetail
>
planTaskDetails
,
String
userId
)
{
this
.
setRequestContextByLocal
(
UserTransmittableUtils
.
getUser
());
FeignClientResult
<
AgencyUserModel
>
agencyUserModel
=
Privilege
.
agencyUserClient
.
queryByUserId
(
userId
);
CheckRecordDataDto
dataDto
=
new
CheckRecordDataDto
();
dataDto
.
setPlanTasks
(
planTasks
);
dataDto
.
setPlanTaskDetails
(
planTaskDetails
);
dataDto
.
setAgencyUserModel
(
agencyUserModel
.
getResult
());
blockingQueue
.
add
(
dataDto
);
UserTransmittableUtils
.
clear
();
}
@PostConstruct
public
void
init
(){
CheckRecordDataConsumer
consumer
=
new
CheckRecordDataConsumer
(
blockingQueue
,
applicationContext
);
for
(
int
i
=
0
;
i
<
10
;
i
++){
asyncServiceExecutor
.
execute
(
consumer
);
}
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/quartz/IJobService.java
View file @
4ebd478c
package
com
.
yeejoin
.
amos
.
patrol
.
quartz
;
package
com
.
yeejoin
.
amos
.
patrol
.
quartz
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
import
com.yeejoin.amos.patrol.business.param.CheckRecordParam
;
import
com.yeejoin.amos.patrol.business.param.CheckRecordParam
;
import
com.yeejoin.amos.patrol.dao.entity.Msg
;
import
com.yeejoin.amos.patrol.dao.entity.Msg
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.Task
;
import
com.yeejoin.amos.patrol.dao.entity.Task
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
public
interface
IJobService
{
public
interface
IJobService
{
...
@@ -68,4 +70,6 @@ public interface IJobService {
...
@@ -68,4 +70,6 @@ public interface IJobService {
public
JSONObject
getCheckInput
(
Long
routeId
,
Long
pointId
,
String
type
,
CheckRecordParam
requestParam
);
public
JSONObject
getCheckInput
(
Long
routeId
,
Long
pointId
,
String
type
,
CheckRecordParam
requestParam
);
JSONObject
getCheckInput
(
List
<
PointCheckDetailBo
>
pointInputs
,
String
type
,
CheckRecordParam
requestParam
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/quartz/JobService.java
View file @
4ebd478c
...
@@ -589,6 +589,73 @@ public class JobService implements IJobService {
...
@@ -589,6 +589,73 @@ public class JobService implements IJobService {
return
appResponeMap
;
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
{
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
;
}
/**
/**
...
@@ -599,13 +666,11 @@ public class JobService implements IJobService {
...
@@ -599,13 +666,11 @@ public class JobService implements IJobService {
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
)
{
public
void
createCheckRecord
(
PlanTask
planTask
,
String
userId
)
{
List
<
PlanTaskPointInputItemBo
>
planTaskPointInputItems
=
planTaskMapper
.
getPlanTaskPointInputItemByPlanTaskId
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
List
<
PlanTaskPointInputItemBo
>
planTaskPointInputItems
=
planTaskMapper
.
getPlanTaskPointInputItemByPlanTaskId
(
planTask
.
getId
(),
PlanTaskDetailStatusEnum
.
QUALIFIED
.
getValue
());
Map
<
Long
,
Check
>
checkMap
=
new
HashMap
<>();
Map
<
Long
,
Check
>
checkMap
=
new
HashMap
<>();
Set
<
Long
>
checkIds
=
new
HashSet
<
Long
>();
Map
<
String
,
String
>
deptMap
=
new
HashMap
<>();
Map
<
String
,
String
>
deptMap
=
new
HashMap
<>();
StringBuffer
deptName
=
new
StringBuffer
();
StringBuffer
deptName
=
new
StringBuffer
();
StringBuffer
deptId
=
new
StringBuffer
();
StringBuffer
deptId
=
new
StringBuffer
();
StringBuffer
userName
=
new
StringBuffer
();
StringBuffer
userName
=
new
StringBuffer
();
if
(
planTask
.
getUserDept
().
indexOf
(
","
)
>
0
)
{
if
(
planTask
.
getUserDept
().
indexOf
(
","
)
>
0
)
{
List
<
String
>
ids
=
Arrays
.
asList
(
planTask
.
getUserId
().
split
(
","
));
List
<
String
>
depts
=
Arrays
.
asList
(
planTask
.
getUserDept
().
split
(
","
));
List
<
String
>
depts
=
Arrays
.
asList
(
planTask
.
getUserDept
().
split
(
","
));
depts
.
stream
().
forEach
(
dept
->
{
depts
.
stream
().
forEach
(
dept
->
{
deptMap
.
put
(
dept
.
split
(
"@"
)[
0
],
dept
.
split
(
"@"
)[
2
]);
deptMap
.
put
(
dept
.
split
(
"@"
)[
0
],
dept
.
split
(
"@"
)[
2
]);
...
@@ -631,9 +696,6 @@ public class JobService implements IJobService {
...
@@ -631,9 +696,6 @@ public class JobService implements IJobService {
userName
.
append
(
realNames
);
userName
.
append
(
realNames
);
}
}
}
}
List
<
Check
>
checkList
=
new
ArrayList
<>();
List
<
Long
>
checkInputIdList
=
new
ArrayList
<>();
for
(
PlanTaskPointInputItemBo
arg
:
planTaskPointInputItems
)
{
for
(
PlanTaskPointInputItemBo
arg
:
planTaskPointInputItems
)
{
Check
check
=
new
Check
();
Check
check
=
new
Check
();
if
(
checkMap
.
get
(
arg
.
getPointId
())
==
null
)
{
if
(
checkMap
.
get
(
arg
.
getPointId
())
==
null
)
{
...
@@ -667,9 +729,7 @@ public class JobService implements IJobService {
...
@@ -667,9 +729,7 @@ public class JobService implements IJobService {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
iCheckDao
.
flush
();
iCheckDao
.
flush
();
checkList
.
add
(
check
);
checkMap
.
put
(
arg
.
getPointId
(),
check
);
checkMap
.
put
(
arg
.
getPointId
(),
check
);
checkIds
.
add
(
check
.
getId
());
}
else
{
}
else
{
check
=
checkMap
.
get
(
arg
.
getPointId
());
check
=
checkMap
.
get
(
arg
.
getPointId
());
}
}
...
@@ -695,8 +755,7 @@ public class JobService implements IJobService {
...
@@ -695,8 +755,7 @@ public class JobService implements IJobService {
checkInput
.
setInputName
(
arg
.
getInputName
());
checkInput
.
setInputName
(
arg
.
getInputName
());
checkInput
.
setPointClassifyId
(
arg
.
getClassifyId
());
checkInput
.
setPointClassifyId
(
arg
.
getClassifyId
());
checkInput
.
setPointClassifyName
(
arg
.
getClassifyName
());
checkInput
.
setPointClassifyName
(
arg
.
getClassifyName
());
CheckInput
checkInput1
=
iCheckInputDao
.
saveAndFlush
(
checkInput
);
iCheckInputDao
.
saveAndFlush
(
checkInput
);
checkInputIdList
.
add
(
checkInput1
.
getId
());
}
}
}
}
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
View file @
4ebd478c
...
@@ -740,17 +740,23 @@
...
@@ -740,17 +740,23 @@
pii.default_value defaultValue,
pii.default_value defaultValue,
pii.picture_json pictureJson,
pii.picture_json pictureJson,
pii.is_multiline isMultiline,
pii.is_multiline isMultiline,
pii.order_no orderNo
pii.order_no orderNo,
prp.point_id,
prp.route_id
FROM
FROM
p_route_point_item prpi
p_route_point_item prpi
LEFT JOIN p_point_classify ppc ON ppc.id = prpi.point_classify_id
LEFT JOIN p_point_classify ppc ON ppc.id = prpi.point_classify_id
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
LEFT JOIN p_point_inputitem ppii ON ppii.id = prpi.point_input_item_id
LEFT JOIN p_point_inputitem ppii ON ppii.id = prpi.point_input_item_id
LEFT JOIN p_input_item pii ON pii.id = ppii.input_item_id
LEFT JOIN p_input_item pii ON pii.id = ppii.input_item_id
WHERE prp.point_id = #{pointId}
<where>
AND prp.route_id =#{routeId}
1=1
<!--AND NOT FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items)-->
<if
test=
"pointId !=null and pointId !=''"
>
and prp.point_id = #{pointId}
</if>
<if
test=
"routeId !=null and routeId !=''"
>
and prp.route_id =#{routeId}
</if>
AND (FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items) is null or FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items)
<![CDATA[<=]]>
0)
AND (FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items) is null or FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items)
<![CDATA[<=]]>
0)
</where>
<!--AND NOT FIND_IN_SET(prpi.point_input_item_id,prp.exclude_items)-->
ORDER BY
ORDER BY
prpi.order_no
prpi.order_no
...
@@ -1882,4 +1888,10 @@
...
@@ -1882,4 +1888,10 @@
<select
id=
"selectExcludeItemsByRoutId"
resultType=
"java.util.Map"
>
<select
id=
"selectExcludeItemsByRoutId"
resultType=
"java.util.Map"
>
select point_id,exclude_items from p_route_point where route_id = #{routeId}
select point_id,exclude_items from p_route_point where route_id = #{routeId}
</select>
</select>
<update
id=
"updateStaticTableBatch"
>
<foreach
collection=
"list"
item=
"item"
separator=
";"
>
update ${item.table} set not_start = not_start - 1,risk_end = risk_end + #{item.riskEnd},no_risk_end = no_risk_end + #{item.noRiskEnd}
where org_code = #{item.orgCode} AND check_time = #{item.checkTime}
</foreach>
</update>
</mapper>
</mapper>
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/plan_task_detail.xml
View file @
4ebd478c
...
@@ -18,4 +18,16 @@
...
@@ -18,4 +18,16 @@
where pp.id = #{pointId}
where pp.id = #{pointId}
and pt.id = #{planTaskId}
and pt.id = #{planTaskId}
</select>
</select>
<select
id=
"findAllByIdInAndStatus"
resultType=
"com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail"
>
select
pptd.*,
pp.name,
pp.point_no
from
"p_plan_task_detail" pptd LEFT JOIN p_point pp ON pp."id"=pptd.point_id
where
pptd.task_no in
<foreach
collection=
"planTaskIds"
item=
"planTaskId"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{planTaskId}
</foreach>
and pptd.status = #{status}
</select>
</mapper>
</mapper>
\ No newline at end of file
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