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
531d50d7
Commit
531d50d7
authored
Apr 21, 2022
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://39.98.45.134:8090/moa/amos-boot-biz
into developer
parents
8c26c0f4
2c85d0ab
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
2695 additions
and
1042 deletions
+2695
-1042
RuleTypeEnum.java
.../com/yeejoin/amos/boot/biz/common/enums/RuleTypeEnum.java
+2
-1
SourceScene.java
...va/com/yeejoin/equipmanage/common/entity/SourceScene.java
+4
-0
CylWarningMsgDto.java
...eejoin/amos/boot/module/tzs/api/dto/CylWarningMsgDto.java
+35
-0
MsgLogDto.java
...a/com/yeejoin/amos/boot/module/tzs/api/dto/MsgLogDto.java
+49
-0
SpecialEquipmentDto.java
...oin/amos/boot/module/tzs/api/dto/SpecialEquipmentDto.java
+2
-0
EsCylinder.java
...m/yeejoin/amos/boot/module/tzs/api/entity/EsCylinder.java
+87
-0
MsgLog.java
...a/com/yeejoin/amos/boot/module/tzs/api/entity/MsgLog.java
+74
-0
EarlyWarningLevelEnum.java
...amos/boot/module/tzs/api/enums/EarlyWarningLevelEnum.java
+36
-0
SpecialEquipmentCategoryEnum.java
...ot/module/tzs/api/enums/SpecialEquipmentCategoryEnum.java
+47
-0
TerminalTypeEnum.java
...join/amos/boot/module/tzs/api/enums/TerminalTypeEnum.java
+20
-0
MsgLogMapper.java
...yeejoin/amos/boot/module/tzs/api/mapper/MsgLogMapper.java
+14
-0
IMsgLogService.java
...join/amos/boot/module/tzs/api/service/IMsgLogService.java
+12
-0
CylinderInfoDto.java
...oin/amos/boot/module/tzs/flc/api/dto/CylinderInfoDto.java
+42
-5
EndUserDto.java
.../yeejoin/amos/boot/module/tzs/flc/api/dto/EndUserDto.java
+72
-0
CylinderInfo.java
...oin/amos/boot/module/tzs/flc/api/entity/CylinderInfo.java
+28
-0
EndUser.java
.../yeejoin/amos/boot/module/tzs/flc/api/entity/EndUser.java
+133
-0
CylinderInfoMapper.java
...os/boot/module/tzs/flc/api/mapper/CylinderInfoMapper.java
+9
-0
EndUserMapper.java
...in/amos/boot/module/tzs/flc/api/mapper/EndUserMapper.java
+14
-0
IEndUserService.java
...amos/boot/module/tzs/flc/api/service/IEndUserService.java
+12
-0
CylinderInfoMapper.xml
...-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
+51
-2
EndUserMapper.xml
...odule-tzs-api/src/main/resources/mapper/EndUserMapper.xml
+5
-0
MsgLogMapper.xml
...module-tzs-api/src/main/resources/mapper/MsgLogMapper.xml
+5
-0
TopographyController.java
.../yeejoin/equipmanage/controller/TopographyController.java
+2
-1
BuildingServiceImpl.java
...yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
+1
-0
ConfirmAlarmServiceImpl.java
...oin/equipmanage/service/impl/ConfirmAlarmServiceImpl.java
+8
-0
FireFightingSystemServiceImpl.java
...uipmanage/service/impl/FireFightingSystemServiceImpl.java
+10
-16
LatentDangerServiceImpl.java
...danger/business/service/impl/LatentDangerServiceImpl.java
+1
-1
PlanAuditServiceImpl.java
...pervision/business/service/impl/PlanAuditServiceImpl.java
+6
-1
PlanTaskServiceImpl.java
...upervision/business/service/impl/PlanTaskServiceImpl.java
+1112
-1001
IPlanTaskService.java
.../supervision/business/service/intfc/IPlanTaskService.java
+6
-5
MsgLogController.java
...amos/boot/module/tzs/biz/controller/MsgLogController.java
+116
-0
SpecialEquipmentController.java
...module/tzs/biz/controller/SpecialEquipmentController.java
+9
-1
ESCylinderRepository.java
...in/amos/boot/module/tzs/biz/dao/ESCylinderRepository.java
+14
-0
ESCylinderServiceImpl.java
...ot/module/tzs/biz/service/impl/ESCylinderServiceImpl.java
+164
-0
MsgLogServiceImpl.java
...s/boot/module/tzs/biz/service/impl/MsgLogServiceImpl.java
+34
-0
TzsAuthServiceImpl.java
.../boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
+2
-4
CylinderInfoController.java
...module/tzs/flc/biz/controller/CylinderInfoController.java
+94
-4
EndUserController.java
...boot/module/tzs/flc/biz/controller/EndUserController.java
+116
-0
CylinderSchedulerJob.java
.../boot/module/tzs/flc/biz/quartz/CylinderSchedulerJob.java
+26
-0
CylinderInfoServiceImpl.java
...ule/tzs/flc/biz/service/impl/CylinderInfoServiceImpl.java
+137
-0
EndUserServiceImpl.java
...t/module/tzs/flc/biz/service/impl/EndUserServiceImpl.java
+34
-0
wl-3.0.1.xml
...ot-system-equip/src/main/resources/changelog/wl-3.0.1.xml
+48
-0
Building.xml
...-boot-system-equip/src/main/resources/mapper/Building.xml
+2
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/enums/RuleTypeEnum.java
View file @
531d50d7
...
...
@@ -13,7 +13,8 @@ public enum RuleTypeEnum {
计划提交
(
"计划提交"
,
"addPlan"
,
"auditPage"
,
RuleConstant
.
WEB
,
RuleConstant
.
TASK
),
计划审核
(
"计划审核"
,
"planAudit"
,
"auditPage"
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
NOTIFY
),
计划审核完成
(
"计划审核完成"
,
"planAuditAll"
,
"formulatePage"
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
TASK
),
计划生成
(
"计划生成"
,
"addPlanTask"
,
null
,
RuleConstant
.
APP
,
RuleConstant
.
NOTIFY
),
消息型计划生成
(
"计划生成"
,
"addPlanTask"
,
null
,
RuleConstant
.
APP
,
RuleConstant
.
NOTIFY
),
任务型计划生成
(
"计划生成"
,
"addPlanTask"
,
null
,
RuleConstant
.
APP
,
RuleConstant
.
TASK
),
计划完成
(
"计划完成"
,
"planCompleted"
,
null
,
RuleConstant
.
APP_WEB
,
RuleConstant
.
NOTIFY
),
// 隐患
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/SourceScene.java
View file @
531d50d7
...
...
@@ -25,6 +25,10 @@ public class SourceScene extends BaseEntity {
@ApiModelProperty
(
value
=
"文件名称"
)
@TableField
(
"source_name"
)
private
String
sourceName
;
@ApiModelProperty
(
value
=
"数据源类型:building(建筑类),system(系统类)"
)
@TableField
(
"source_type"
)
private
String
sourceType
;
@ApiModelProperty
(
value
=
"组态工程id"
)
@TableField
(
"project_id"
)
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/CylWarningMsgDto.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
dto
;
import
java.io.Serializable
;
import
com.yeejoin.amos.component.rule.Label
;
import
com.yeejoin.amos.component.rule.RuleFact
;
import
lombok.Data
;
@RuleFact
(
value
=
"气瓶预警消息"
,
project
=
"气瓶监管"
)
@Data
public
class
CylWarningMsgDto
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Label
(
"企业名称"
)
private
String
companyName
;
@Label
(
"企业联系人"
)
private
String
people
;
@Label
(
"企业联系人电话"
)
private
String
phone
;
@Label
(
"使用人类型"
)
private
String
userType
;
@Label
(
"气瓶使用人"
)
private
String
userPeople
;
@Label
(
"使用人电话"
)
private
String
userPeoplePhone
;
@Label
(
"出厂编号"
)
private
String
factoryNum
;
@Label
(
"预警值"
)
private
String
num
;
@Label
(
"气瓶seq"
)
private
String
cylSeq
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/MsgLogDto.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
dto
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 消息流水表
*
* @author system_generator
* @date 2022-04-20
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"MsgLogDto"
,
description
=
"消息流水表"
)
public
class
MsgLogDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"关联编号"
)
private
String
relationCode
;
@ApiModelProperty
(
value
=
"消息类型(超期预警、许可超期、风险预警)"
)
private
String
msgType
;
@ApiModelProperty
(
value
=
"消息类型名称"
)
private
String
msgTypeName
;
@ApiModelProperty
(
value
=
"消息内容"
)
private
String
body
;
@ApiModelProperty
(
value
=
"接收者账号"
)
private
String
targetCode
;
@ApiModelProperty
(
value
=
"接收者名称"
)
private
String
targetName
;
@ApiModelProperty
(
value
=
"发送日期"
)
private
Date
sendTime
;
@ApiModelProperty
(
value
=
"站端类型: WEB,APP"
)
private
String
terminalType
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/SpecialEquipmentDto.java
View file @
531d50d7
...
...
@@ -54,4 +54,6 @@ public class SpecialEquipmentDto {
@ApiModelProperty
(
value
=
"内部编码"
)
private
String
innerNum
;
@ApiModelProperty
(
value
=
"产权单位"
)
private
String
unitName
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/EsCylinder.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
entity
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.elasticsearch.common.geo.GeoPoint
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.elasticsearch.annotations.Document
;
import
org.springframework.data.elasticsearch.annotations.Field
;
import
org.springframework.data.elasticsearch.annotations.FieldType
;
import
org.springframework.data.elasticsearch.annotations.GeoPointField
;
/**
* @author tb
* @date 2022-04-20.
*/
@Data
@Accessors
(
chain
=
true
)
@Document
(
indexName
=
"cylinder"
,
replicas
=
0
)
public
class
EsCylinder
{
/**
* 主键
*/
@Id
private
Long
sequenceNbr
;
/**
* 气瓶出厂编号
*/
@Field
(
type
=
FieldType
.
Text
)
private
String
factoryNum
;
// /**
// * 所属省
// */
// @Field(type = FieldType.Text)
// private String province;
//
// /**
// * 所属地市
// */
// @Field(type = FieldType.Text)
// private String city;
//
// /**
// * 所属区县
// */
// @Field(type = FieldType.Text)
// private String district;
//
// /**
// * 所属区域代码
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String regionCode;
/**
* 产权单位名称
*/
@Field
(
type
=
FieldType
.
Text
)
private
String
unitName
;
/**
* 经度
*/
@Field
(
type
=
FieldType
.
Double
)
private
Double
longitude
;
/**
* 纬度
*/
@Field
(
type
=
FieldType
.
Double
)
private
Double
latitude
;
/**
* 经纬度字段
*/
@GeoPointField
private
GeoPoint
location
;
/**
* 地址
*/
@Field
(
type
=
FieldType
.
Text
,
searchAnalyzer
=
"ik_max_word"
,
analyzer
=
"ik_max_word"
)
private
String
address
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/entity/MsgLog.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
javax.naming.ldap.PagedResultsControl
;
import
java.util.Date
;
/**
* 消息流水表
*
* @author system_generator
* @date 2022-04-20
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tz_msg_log"
)
public
class
MsgLog
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 关联编号
*/
@TableField
(
"relation_code"
)
private
String
relationCode
;
/**
* 消息类型(超期预警、许可超期、风险预警)
*/
@TableField
(
"msg_type"
)
private
String
msgType
;
/**
* 消息类型名称
*/
private
String
msgTypeName
;
/**
* 消息内容
*/
@TableField
(
"body"
)
private
String
body
;
/**
* 接收者账号
*/
@TableField
(
"target_code"
)
private
String
targetCode
;
/**
* 接收者名称
*/
@TableField
(
"target_name"
)
private
String
targetName
;
/**
* 发送日期
*/
@TableField
(
"send_time"
)
private
Date
sendTime
;
/**
* 站端类型: WEB,APP
*/
private
String
terminalType
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/EarlyWarningLevelEnum.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.Optional
;
/**
* @author DELL
*/
@AllArgsConstructor
@Getter
public
enum
EarlyWarningLevelEnum
{
/**
* 预警等级枚举
*
*/
EARLY_WARNING_FIRST_LEVEL
(
"一级预警"
,
"1"
,
"即将超期"
,
"earlyWarning_firstLevel"
),
EARLY_WARNING_SECOND_LEVEL
(
"二级预警"
,
"2"
,
"即将超期"
,
"earlyWarning_secondLevel"
),
EARLY_WARNING_THREE_LEVEL
(
"三级预警"
,
"3"
,
"已超期"
,
"earlyWarning_threeLevel"
);
private
String
name
;
private
String
level
;
private
String
status
;
private
String
code
;
public
static
EarlyWarningLevelEnum
getEumByLevel
(
String
level
)
{
Optional
<
EarlyWarningLevelEnum
>
op
=
Arrays
.
stream
(
EarlyWarningLevelEnum
.
values
()).
filter
(
e
->
e
.
getLevel
().
equals
(
level
)).
findFirst
();
return
op
.
orElseThrow
(()
->
new
RuntimeException
(
"未知的类型"
));
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/SpecialEquipmentCategoryEnum.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
/**
* <pre>
* 特种设备类别枚举
* </pre>
*
* @author tb
*/
public
enum
SpecialEquipmentCategoryEnum
{
ELEVATOR
(
"3000"
,
"电梯"
),
PRESSURE_VESSEL
(
"2000"
,
"压力容器"
);
/**
* 编码
*/
private
String
code
;
/**
* 名称
*/
private
String
name
;
// 构造方法
SpecialEquipmentCategoryEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
SpecialEquipmentCategoryEnum
getEnum
(
String
code
)
{
for
(
SpecialEquipmentCategoryEnum
specialEquipmentCategoryEnum
:
SpecialEquipmentCategoryEnum
.
values
())
{
if
(
specialEquipmentCategoryEnum
.
getCode
().
equals
(
code
))
{
return
specialEquipmentCategoryEnum
;
}
}
return
null
;
}
public
String
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/TerminalTypeEnum.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* @author DELL
*/
@AllArgsConstructor
@Getter
public
enum
TerminalTypeEnum
{
/**
* 终端类型
*/
TERMINAL_TYPE_WEB
(
"WEB"
),
TERMINAL_TYPE_APP
(
"APP"
);
private
String
code
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/mapper/MsgLogMapper.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* 消息流水表 Mapper 接口
*
* @author system_generator
* @date 2022-04-20
*/
public
interface
MsgLogMapper
extends
BaseMapper
<
MsgLog
>
{
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/service/IMsgLogService.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
service
;
/**
* 消息流水表接口类
*
* @author system_generator
* @date 2022-04-20
*/
public
interface
IMsgLogService
{
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/CylinderInfoDto.java
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
dto
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -16,10 +17,10 @@ import java.util.List;
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"CylinderInfoDto"
,
description
=
"气瓶基本信息"
)
public
class
CylinderInfoDto
extends
BaseDto
{
@ApiModel
(
value
=
"CylinderInfoDto"
,
description
=
"气瓶基本信息"
)
public
class
CylinderInfoDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"气瓶基本信息ID"
)
...
...
@@ -103,7 +104,43 @@ public class CylinderInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"查询单位appid"
)
private
List
<
String
>
appIds
;
@ApiModelProperty
(
value
=
"检验状态 0 已超期 1 正常 2 即将超期"
)
@ApiModelProperty
(
value
=
"检验状态 0 已超期 1 正常 2 即将超期"
)
private
int
inspectionStatas
;
@ApiModelProperty
(
value
=
"检验状态描述"
)
private
String
inspectionStatusDesc
;
@ApiModelProperty
(
value
=
"预警等级"
)
private
String
earlyWarningLevel
;
@ApiModelProperty
(
value
=
"预警等级名称"
)
private
String
earlyWarningLevelName
;
@ApiModelProperty
(
value
=
"最近配送地址"
)
private
String
address
;
@ApiModelProperty
(
value
=
"最近预警时间"
)
private
Date
earlyWarningLevelCalDate
;
@ApiModelProperty
(
value
=
"经度"
)
private
String
longitude
;
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
@ApiModelProperty
(
value
=
"客户名称"
)
private
String
customType
;
@ApiModelProperty
(
value
=
"客户类型"
)
private
String
customName
;
@ApiModelProperty
(
value
=
"联系电话"
)
private
String
contactPhone
;
@ApiModelProperty
(
value
=
"企业负责人手机"
)
private
String
personMobilePhone
;
@ApiModelProperty
(
value
=
"企业负责人"
)
private
String
unitPerson
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/EndUserDto.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 气瓶终端用户
*
* @author system_generator
* @date 2022-04-21
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"EndUserDto"
,
description
=
"气瓶终端用户"
)
public
class
EndUserDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"客户编号"
)
private
String
customCode
;
@ApiModelProperty
(
value
=
"客户名称"
)
private
String
customName
;
@ApiModelProperty
(
value
=
"客户类型"
)
private
String
customType
;
@ApiModelProperty
(
value
=
"开户类型"
)
private
String
accountType
;
@ApiModelProperty
(
value
=
"联系人"
)
private
String
contact
;
@ApiModelProperty
(
value
=
"联系电话"
)
private
String
contactPhone
;
@ApiModelProperty
(
value
=
"客户地址"
)
private
String
address
;
@ApiModelProperty
(
value
=
"充装单位"
)
private
String
fillingUnit
;
@ApiModelProperty
(
value
=
"所属机构"
)
private
String
affiliation
;
@ApiModelProperty
(
value
=
"上次下单时间"
)
private
Date
lastOrderDate
;
@ApiModelProperty
(
value
=
"配送员"
)
private
String
delivery
;
@ApiModelProperty
(
value
=
"配送员电话"
)
private
String
deliveryPhone
;
@ApiModelProperty
(
value
=
"钢瓶码"
)
private
String
cylinderCode
;
@ApiModelProperty
(
value
=
"芯片号"
)
private
String
chipCode
;
@ApiModelProperty
(
value
=
"经度"
)
private
String
longitude
;
@ApiModelProperty
(
value
=
"纬度"
)
private
String
latitude
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/CylinderInfo.java
View file @
531d50d7
...
...
@@ -159,4 +159,32 @@ public class CylinderInfo {
*/
@TableField
(
"integrity"
)
private
Double
integrity
;
/**
* 预警等级
*/
private
String
earlyWarningLevel
;
/**
* 预警等级 计算日期
*/
private
Date
earlyWarningLevelCalDate
;
/**
* 经度
*/
@TableField
(
"longitude"
)
private
String
longitude
;
/**
* 纬度
*/
@TableField
(
"latitude"
)
private
String
latitude
;
/**
* 最近气瓶使用客户编号
*/
@TableField
(
"end_custom_code"
)
private
String
endCustomCode
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/EndUser.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* 气瓶终端用户
*
* @author system_generator
* @date 2022-04-21
*/
@Data
@EqualsAndHashCode
()
@Accessors
(
chain
=
true
)
@TableName
(
"tz_end_user"
)
public
class
EndUser
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"sequence_nbr"
,
type
=
IdType
.
ID_WORKER
)
protected
Long
sequenceNbr
;
@TableField
(
value
=
"rec_date"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
protected
Date
recDate
;
@TableField
(
value
=
"rec_user_id"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
protected
String
recUserId
;
/**
* 客户编号
*/
@TableField
(
"custom_code"
)
private
String
customCode
;
/**
* 客户名称
*/
@TableField
(
"custom_name"
)
private
String
customName
;
/**
* 客户类型
*/
@TableField
(
"custom_type"
)
private
String
customType
;
/**
* 开户类型
*/
@TableField
(
"account_type"
)
private
String
accountType
;
/**
* 联系人
*/
@TableField
(
"contact"
)
private
String
contact
;
/**
* 联系电话
*/
@TableField
(
"contact_phone"
)
private
String
contactPhone
;
/**
* 客户地址
*/
@TableField
(
"address"
)
private
String
address
;
/**
* 充装单位
*/
@TableField
(
"filling_unit"
)
private
String
fillingUnit
;
/**
* 所属机构
*/
@TableField
(
"affiliation"
)
private
String
affiliation
;
/**
* 上次下单时间
*/
@TableField
(
"last_order_date"
)
private
Date
lastOrderDate
;
/**
* 配送员
*/
@TableField
(
"delivery"
)
private
String
delivery
;
/**
* 配送员电话
*/
@TableField
(
"delivery_phone"
)
private
String
deliveryPhone
;
/**
* 钢瓶码
*/
@TableField
(
"cylinder_code"
)
private
String
cylinderCode
;
/**
* 芯片号
*/
@TableField
(
"chip_code"
)
private
String
chipCode
;
/**
* 经度
*/
@TableField
(
"longitude"
)
private
String
longitude
;
/**
* 纬度
*/
@TableField
(
"latitude"
)
private
String
latitude
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/mapper/CylinderInfoMapper.java
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -56,4 +58,11 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
* @return
*/
Integer
getMonthBeforeLastInfoTotalUnit
(
@Param
(
"appId"
)
String
appId
);
Integer
countOverDateNumber
(
@Param
(
"earlyWarningLevel"
)
String
earlyWarningLevel
);
Page
<
CylinderInfoDto
>
queryPageListByEarlyWarningLevel
(
Page
<
CylinderInfoDto
>
page
,
@Param
(
"earlyWarningLevel"
)
String
earlyWarningLevel
);
CylinderInfoDto
getDetail
(
String
sequenceCode
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/mapper/EndUserMapper.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* 气瓶终端用户 Mapper 接口
*
* @author system_generator
* @date 2022-04-21
*/
public
interface
EndUserMapper
extends
BaseMapper
<
EndUser
>
{
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IEndUserService.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
service
;
/**
* 气瓶终端用户接口类
*
* @author system_generator
* @date 2022-04-21
*/
public
interface
IEndUserService
{
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
531d50d7
...
...
@@ -53,6 +53,55 @@
<select
id=
"getMonthBeforeLastInfoTotalUnit"
resultType=
"java.lang.Integer"
>
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =2 AND app_id = #{appId}
</select>
<select
id=
"countOverDateNumber"
resultType=
"java.lang.Integer"
>
SELECT
count(1)
FROM `tz_cylinder_info` ci
where
ci.early_warning_level = #{earlyWarningLevel}
</select>
<select
id=
"queryPageListByEarlyWarningLevel"
resultType=
"com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto"
>
select
ci.sequence_code,
ci.unit_name,
ci.factory_num,
ci.inspection_date,
ci.next_inspection_date,
ci.early_warning_level,
ci.early_warning_level_cal_date,
ci.longitude,
ci.latitude,
eu.address
from
tz_cylinder_info ci
left join tz_end_user eu on ci.end_custom_code = eu.custom_code
where
ci.early_warning_level = #{earlyWarningLevel}
order by ci.next_inspection_date
</select>
<select
id=
"getDetail"
resultType=
"com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto"
>
select
ci.sequence_code,
ci.unit_name,
ci.inspection_date,
ci.factory_num,
ci.next_inspection_date,
ci.early_warning_level,
ci.early_warning_level_cal_date,
ci.longitude,
ci.latitude,
eu.address,
eu.custom_name,
eu.custom_type,
eu.contact_phone,
cu.person_mobile_phone,
cu.unit_person
from
tz_cylinder_info ci
left join tz_end_user eu on ci.end_custom_code = eu.custom_code
left join tz_cylinder_unit cu on cu.app_id = ci.app_id
where
ci.sequence_code = #{sequenceCode}
</select>
</mapper>
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/EndUserMapper.xml
0 → 100644
View file @
531d50d7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EndUserMapper"
>
</mapper>
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/resources/mapper/MsgLogMapper.xml
0 → 100644
View file @
531d50d7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.tzs.api.mapper.MsgLogMapper"
>
</mapper>
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/TopographyController.java
View file @
531d50d7
...
...
@@ -810,7 +810,8 @@ public class TopographyController extends AbstractBaseController {
}
}
}
return
CommonResponseUtil
.
success
(
list
);
List
<
TopographyIotVo
>
result
=
list
.
stream
().
sorted
(
Comparator
.
comparing
(
TopographyIotVo:
:
getTime
).
reversed
()).
collect
(
Collectors
.
toList
());
return
CommonResponseUtil
.
success
(
result
);
}
else
{
logger
.
error
(
"查询物联日志数据为空或iotCode为 ("
+
iotCode
+
") 的装备不存在于物联系统中!"
);
return
CommonResponseUtil
.
success
();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java
View file @
531d50d7
...
...
@@ -238,6 +238,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
model
.
put
(
"id"
,
String
.
valueOf
(
System
.
currentTimeMillis
()));
model
.
put
(
"projectId"
,
String
.
valueOf
(
projectSeq
));
model
.
put
(
"creatorId"
,
userId
);
model
.
put
(
"sourceType"
,
"building"
);
model
.
put
(
"instanceId"
,
resourceDTO
.
getCode
());
model
.
put
(
"name"
,
resourceDTO
.
getName
());
this
.
baseMapper
.
insetSourceScene
(
model
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/ConfirmAlarmServiceImpl.java
View file @
531d50d7
...
...
@@ -63,6 +63,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired
IEquipmentSpecificIndexService
equipmentSpecificIndexService
;
@Autowired
private
ISyncDataService
syncDataService
;
...
...
@@ -165,6 +166,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
ent
.
setEquipmentSpecificId
(
alarmLog
.
getEquipmentSpecificId
());
ent
.
setEquipmentSpecificIndexKey
(
alarmLog
.
getEquipmentSpecificIndexKey
());
String
cleanType
=
equipmentSpecificMapper
.
getEquipmentBySpecificId
(
alarmLog
.
getEquipmentSpecificId
());
int
i
=
0
;
// 是否成功标识
if
(
StringUtil
.
isNotEmpty
(
cleanType
)
&&
AlarmCleanTypeEnum
.
QRXC
.
getCode
().
equals
(
cleanType
))
{
EquipmentSpecificAlarm
alarm
=
equipmentSpecificAlarmMapper
.
selectById
(
alarmLog
.
getEquipmentSpecificAlarmId
());
alarm
.
setStatus
(
AlarmStatusEnum
.
HF
.
getCode
());
...
...
@@ -176,6 +178,12 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
eq
(
EquipmentSpecificIndex:
:
getEquipmentSpecificId
,
alarm
.
getEquipmentSpecificId
()).
eq
(
EquipmentSpecificIndex:
:
getEquipmentIndexKey
,
alarm
.
getEquipmentSpecificIndexKey
());
iEquipmentSpecificIndexSerivce
.
update
(
updateWrapper
);
//指标图标显示根据 EquipmentSpecific 表中的 RealtimeIotIndexValue 判断 同步修改
LambdaUpdateWrapper
<
EquipmentSpecific
>
wrapper
=
new
LambdaUpdateWrapper
<
EquipmentSpecific
>().
set
(
EquipmentSpecific:
:
getRealtimeIotIndexValue
,
"false"
).
set
(
EquipmentSpecific:
:
getRealtimeIotIndexUpdateDate
,
new
Date
()).
eq
(
EquipmentSpecific:
:
getId
,
alarm
.
getEquipmentSpecificId
());
equipmentSpecificSerivce
.
update
(
wrapper
);
MqttReceiveServiceImpl
.
upAlarmLogStatus
(
alarmLog
.
getIotCode
(),
alarmLog
.
getEquipmentSpecificIndexKey
(),
equipmentSpecificAlarmLogService
);
}
// 如果是批量确警,先查询,再确警,用于批量消息推送
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
View file @
531d50d7
...
...
@@ -31,6 +31,7 @@ import com.yeejoin.equipmanage.mapper.*;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.service.*
;
import
org.apache.commons.beanutils.BeanUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
...
...
@@ -48,7 +49,7 @@ import java.net.SocketException;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
public
class
FireFightingSystemServiceImpl
extends
ServiceImpl
<
FireFightingSystemMapper
,
FireFightingSystemEntity
>
implements
IFireFightingSystemService
{
...
...
@@ -353,6 +354,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
sourceScene
.
setSourceId
(
systemId
);
sourceScene
.
setSourceName
(
resourceDTO
.
getName
());
sourceScene
.
setSceneId
(
resourceDTO
.
getId
());
sourceScene
.
setSourceType
(
"system"
);
}
// TODO 获取画布下 绑定的装备点、摄像头,目前消防系统只能绑定装备,不能绑定摄像头(树未返回摄像头)
List
<
Map
>
children
=
(
List
<
Map
>)
parse
.
get
(
"children"
);
...
...
@@ -637,26 +639,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
@Transactional
public
Boolean
deleteSystem
(
Long
id
)
{
// QueryWrapper<FormInstance> fqw = new QueryWrapper<>();
// fqw.eq("field_value",id);
// fqw.groupBy("instance_id");
// List<FormInstance> formInstances = formInstanceMapper.selectList(fqw);
// if (formInstances != null && formInstances.size()>0){
// QueryWrapper<FormInstance> one = new QueryWrapper<>();
// one.eq("instance_id",formInstances.get(0).getInstanceId());
// one.eq("field_name","name");
// List<FormInstance> formInstances1 = formInstanceMapper.selectList(one);
// FormInstance formInstance = formInstances1.get(0);
// String name = formInstance.getFieldValue();
// throw new BadRequest(name+"建筑与该系统存在绑定关系,请清除后再进行删除!");
// }
FireFightingSystemEntity
entity
=
baseMapper
.
selectById
(
id
);
if
(
entity
.
getSceneId
()
!=
null
)
{
try
{
FeignUtil
.
remoteCall
(()
->
Morphic
.
morphicSubjectClient
.
delete
(
entity
.
getSceneId
()));
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"远程调用 MORPHIC 服务的删除操作出错"
);
log
.
error
(
"远程调用 MORPHIC 服务的删除操作出错:"
+
e
.
getMessage
().
toString
(),
e
);
}
}
formInstanceMapper
.
clearSystemId
(
id
);
...
...
@@ -667,7 +657,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if
(
i
>
0
&&
syncSwitch
)
{
syncDataService
.
syncDeletedFireFightingSystem
(
Arrays
.
asList
(
id
));
}
// 删除动态关联表单实例数据
//删除系统图与设备关系表
QueryWrapper
<
SourceScene
>
ssWrapper
=
new
QueryWrapper
<
SourceScene
>();
ssWrapper
.
lambda
().
eq
(
SourceScene:
:
getSourceId
,
id
);
sourceSceneMapper
.
delete
(
ssWrapper
);
//删除动态关联表单实例数据
if
(
entity
.
getInstanceId
()
!=
null
)
{
instanceService
.
remove
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
entity
.
getInstanceId
()));
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/service/impl/LatentDangerServiceImpl.java
View file @
531d50d7
...
...
@@ -2149,7 +2149,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
finalBuildingAbsolutePositionMap
.
get
(
danger
.
getStructureId
().
toString
()).
toString
());
}
LatentDangerBizTypeEnum
bizTypeEnum
=
LatentDangerBizTypeEnum
.
getByCode
(
danger
.
getBizType
());
if
(
bizType
.
equals
(
danger
.
getBizType
()))
{
if
(
bizType
.
equals
(
danger
.
getBizType
())
&&
!
"draft"
.
equals
(
danger
.
getDangerState
())
)
{
LatentDangerState
.
SupervisionDangerStateEnum
dangerStateEnum
=
LatentDangerState
.
SupervisionDangerStateEnum
.
getEnumByCode
(
danger
.
getDangerState
());
danger
.
setProcessState
(
dangerStateEnum
.
getProcessState
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/PlanAuditServiceImpl.java
View file @
531d50d7
...
...
@@ -9,6 +9,7 @@ import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditLogDao;
import
com.yeejoin.amos.supervision.business.dao.repository.IPlanDao
;
import
com.yeejoin.amos.supervision.business.feign.JCSFeignClient
;
import
com.yeejoin.amos.supervision.business.service.intfc.IPlanAuditService
;
import
com.yeejoin.amos.supervision.business.service.intfc.IPlanTaskService
;
import
com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum
;
import
com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum
;
import
com.yeejoin.amos.supervision.common.enums.PlanStatusEnum
;
...
...
@@ -52,7 +53,8 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
@Autowired
JCSFeignClient
jcsFeignClient
;
@Autowired
IPlanTaskService
planTaskService
;
@Override
@Transactional
public
Boolean
auditWorkFlow
(
PlanAuditLog
planAuditLog
,
Integer
status
,
String
condition
,
ReginParams
reginParams
)
throws
Exception
{
...
...
@@ -84,6 +86,9 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
planAuditLog
.
setFlowJson
(
condition
);
planAuditLog
.
setRoleName
(
roleName
);
planAuditLogDao
.
save
(
planAuditLog
);
if
(
"导入外部监查隐患"
.
equals
(
planAuditLog
.
getFlowTaskName
()))
{
planTaskService
.
taskExecutionImportPlan
(
planAuditLog
.
getPlanId
());
}
planService
.
getUserIdsByWorkflow
(
plan
,
instanceId
,
status
,
planAuditLog
.
getExcuteState
());
return
Boolean
.
TRUE
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/PlanTaskServiceImpl.java
View file @
531d50d7
...
...
@@ -75,127 +75,127 @@ import java.util.stream.Collectors;
@Service
(
"planTaskService"
)
public
class
PlanTaskServiceImpl
implements
IPlanTaskService
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
PlanTaskServiceImpl
.
class
);
@Autowired
PlanTaskMapper
planTaskMapper
;
@Autowired
PlanTaskDetailMapper
planTaskDetailMapper
;
@Autowired
PlanMapper
planMapper
;
@Autowired
IPlanTaskDao
iplanTaskDao
;
@Autowired
IPlanDao
iplanDao
;
@Autowired
private
ICheckDao
checkDao
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
private
IPlanTaskDetailDao
planTaskDetail
;
@Autowired
IRoutePointDao
iRoutePointDao
;
@Autowired
IJobService
jobService
;
@Autowired
private
ICheckService
checkService
;
@Autowired
private
Business
business
;
@Autowired
private
EquipFeign
equipFeign
;
@Autowired
private
IPointInputItemDao
pointInputItemDao
;
@Autowired
private
RoutePointItemMapper
routePointItemMapper
;
@Autowired
private
RulePlanService
rulePlanService
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
PointMapper
pointMapper
;
@Autowired
private
JCSFeignClient
jcsFeignClient
;
// 防火监督检查负责人角色名称
@Value
(
"${supervision.person.charger.role:Person_charge_unit_fire_protection_supervision_inspection}"
)
private
String
supervisionPersonChargerRole
;
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
PlanTaskPageParam
params
)
{
long
total
=
planTaskMapper
.
countPlanTask
(
params
);
List
<
HashMap
<
String
,
Object
>>
content
=
planTaskMapper
.
getPlanTaskInfo
(
params
);
return
new
PageImpl
<>(
content
,
params
,
total
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
reGenPlanTask
(
HashMap
<
String
,
Object
>
param
)
throws
ParseException
{
//
1.公共参数准备
String
planId
=
param
.
get
(
"planId"
).
toString
();
//
重做的计划编号id
String
strBeginDate
=
param
.
get
(
"beginDate"
).
toString
();
//
开始日期(yyyy-MM-dd)
String
strEndDate
=
param
.
get
(
"endDate"
).
toString
();
//
结束日期(yyyy-MM-dd)
String
flag
=
param
.
get
(
"changeFlag"
).
toString
();
//
是否记为合格标记:0-否,1-是
Plan
plan
=
iplanDao
.
findById
(
Long
.
parseLong
(
planId
)).
get
();
//
if
(
StringUtil
.
isNotEmpty
(
plan
.
getUserId
()))
{
//
2.数据必输校验,不满足直接return,不再向下进行
Boolean
fileFlag
=
PlanTaskUtil
.
checkMustFile
(
plan
);
if
(!
fileFlag
)
{
return
;
}
//
3.计算生成数据的日期区间(前10位:yyyy-MM-dd)
CalDateVo
vo
=
PlanTaskUtil
.
reGenPlanTaskData
(
plan
,
strBeginDate
,
strEndDate
);
if
(
null
==
vo
)
{
//
计划未开始,则结束
return
;
}
if
(!
vo
.
getIsGenData
())
{
//日期不符合条件直接结束
return
;
}
//3.删除planTask表,按照计划id+日期
deletePlanTaskAndDet
(
param
);
//5.执行数据生成(具体时间 + 人员)
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
REGEN_FLAG
);
//6.插入planTask及planTaskDetail
insertPlanTaskAndDet
(
list
,
plan
,
flag
,
new
Date
());
//7.重新统计计划
if
(
ObjectUtils
.
isEmpty
(
plan
.
getUserId
()))
{
return
;
}
reformStatisticsPlanTask
(
strBeginDate
,
strEndDate
,
plan
.
getUserId
(),
plan
.
getOrgCode
());
}
}
@Override
public
void
reformStatisticsPlanTask
(
String
strBginDate
,
String
strEndDate
,
String
userId
,
String
orgCode
)
throws
ParseException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
startTime
=
sdf
.
parse
(
strBginDate
);
Date
endTime
=
sdf
.
parse
(
strEndDate
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
startTime
);
Date
currentDate
=
new
Date
();
String
strCurrentDate
=
sdf
.
format
(
currentDate
);
long
abortTime
=
endTime
.
getTime
();
if
(
endTime
.
getTime
()
>=
sdf
.
parse
(
strCurrentDate
).
getTime
())
{
abortTime
=
sdf
.
parse
(
strCurrentDate
).
getTime
();
}
String
[]
ids
=
userId
.
split
(
","
);
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
PlanTaskServiceImpl
.
class
);
@Autowired
PlanTaskMapper
planTaskMapper
;
@Autowired
PlanTaskDetailMapper
planTaskDetailMapper
;
@Autowired
PlanMapper
planMapper
;
@Autowired
IPlanTaskDao
iplanTaskDao
;
@Autowired
IPlanDao
iplanDao
;
@Autowired
private
ICheckDao
checkDao
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@Autowired
private
IPlanTaskDetailDao
planTaskDetail
;
@Autowired
IRoutePointDao
iRoutePointDao
;
@Autowired
IJobService
jobService
;
@Autowired
private
ICheckService
checkService
;
@Autowired
private
Business
business
;
@Autowired
private
EquipFeign
equipFeign
;
@Autowired
private
IPointInputItemDao
pointInputItemDao
;
@Autowired
private
RoutePointItemMapper
routePointItemMapper
;
@Autowired
private
RulePlanService
rulePlanService
;
@Autowired
RedisUtils
redisUtils
;
@Autowired
PointMapper
pointMapper
;
@Autowired
private
JCSFeignClient
jcsFeignClient
;
// 防火监督检查负责人角色名称
@Value
(
"${supervision.person.charger.role:Person_charge_unit_fire_protection_supervision_inspection}"
)
private
String
supervisionPersonChargerRole
;
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
PlanTaskPageParam
params
)
{
long
total
=
planTaskMapper
.
countPlanTask
(
params
);
List
<
HashMap
<
String
,
Object
>>
content
=
planTaskMapper
.
getPlanTaskInfo
(
params
);
return
new
PageImpl
<>(
content
,
params
,
total
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
reGenPlanTask
(
HashMap
<
String
,
Object
>
param
)
throws
ParseException
{
//
1.公共参数准备
String
planId
=
param
.
get
(
"planId"
).
toString
();
//
重做的计划编号id
String
strBeginDate
=
param
.
get
(
"beginDate"
).
toString
();
//
开始日期(yyyy-MM-dd)
String
strEndDate
=
param
.
get
(
"endDate"
).
toString
();
//
结束日期(yyyy-MM-dd)
String
flag
=
param
.
get
(
"changeFlag"
).
toString
();
//
是否记为合格标记:0-否,1-是
Plan
plan
=
iplanDao
.
findById
(
Long
.
parseLong
(
planId
)).
get
();
//
if
(
StringUtil
.
isNotEmpty
(
plan
.
getUserId
()))
{
//
2.数据必输校验,不满足直接return,不再向下进行
Boolean
fileFlag
=
PlanTaskUtil
.
checkMustFile
(
plan
);
if
(!
fileFlag
)
{
return
;
}
//
3.计算生成数据的日期区间(前10位:yyyy-MM-dd)
CalDateVo
vo
=
PlanTaskUtil
.
reGenPlanTaskData
(
plan
,
strBeginDate
,
strEndDate
);
if
(
null
==
vo
)
{
//
计划未开始,则结束
return
;
}
if
(!
vo
.
getIsGenData
())
{
// 日期不符合条件直接结束
return
;
}
// 3.删除planTask表,按照计划id+日期
deletePlanTaskAndDet
(
param
);
// 5.执行数据生成(具体时间 + 人员)
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
REGEN_FLAG
);
// 6.插入planTask及planTaskDetail
insertPlanTaskAndDet
(
list
,
plan
,
flag
,
new
Date
());
// 7.重新统计计划
if
(
ObjectUtils
.
isEmpty
(
plan
.
getUserId
()))
{
return
;
}
reformStatisticsPlanTask
(
strBeginDate
,
strEndDate
,
plan
.
getUserId
(),
plan
.
getOrgCode
());
}
}
@Override
public
void
reformStatisticsPlanTask
(
String
strBginDate
,
String
strEndDate
,
String
userId
,
String
orgCode
)
throws
ParseException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
startTime
=
sdf
.
parse
(
strBginDate
);
Date
endTime
=
sdf
.
parse
(
strEndDate
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
startTime
);
Date
currentDate
=
new
Date
();
String
strCurrentDate
=
sdf
.
format
(
currentDate
);
long
abortTime
=
endTime
.
getTime
();
if
(
endTime
.
getTime
()
>=
sdf
.
parse
(
strCurrentDate
).
getTime
())
{
abortTime
=
sdf
.
parse
(
strCurrentDate
).
getTime
();
}
String
[]
ids
=
userId
.
split
(
","
);
// StringBuffer orgCodeBuffer = new StringBuffer();
// Map<String,String> deptMap =new HashMap<>();
// Set<Object> userIds =new HashSet<>();
...
...
@@ -222,70 +222,74 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// userIdOrgCodeMap = idOrgCodeList.stream().collect(Collectors.toMap(x-> String.valueOf(x.get(
// "id")), x->x.get("org_code")));
// }
while
(
cal
.
getTime
().
getTime
()
<=
abortTime
)
{
String
refDate
=
sdf
.
format
(
cal
.
getTime
());
for
(
String
id
:
ids
)
{
if
(!
ObjectUtils
.
isEmpty
(
id
))
{
planTaskMapper
.
reformStatistics
(
id
,
refDate
,
orgCode
);
while
(
cal
.
getTime
().
getTime
()
<=
abortTime
)
{
String
refDate
=
sdf
.
format
(
cal
.
getTime
());
for
(
String
id
:
ids
)
{
if
(!
ObjectUtils
.
isEmpty
(
id
))
{
planTaskMapper
.
reformStatistics
(
id
,
refDate
,
orgCode
);
// planTaskMapper.reformStatistics(id, refDate, userIdOrgCodeMap.get(id));
}
}
cal
.
add
(
Calendar
.
DATE
,
1
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
planTaskDet
(
String
[]
strArry
)
{
if
(
strArry
.
length
<=
0
)
{
throw
new
YeeException
(
"删除数据内容不能为空"
);
}
Set
<
Long
>
taskNos
=
new
HashSet
<>();
for
(
String
id
:
strArry
)
{
PlanTaskDetail
planTkDet
=
planTaskDetail
.
findById
(
Long
.
parseLong
(
id
)).
get
();
if
(
null
!=
planTkDet
)
{
taskNos
.
add
(
planTkDet
.
getTaskNo
());
}
}
planTaskMapper
.
planTaskDet
(
strArry
);
// 删除数据
HashMap
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"IDS"
,
new
ArrayList
<>(
taskNos
));
param
.
put
(
"FINISH_YES"
,
XJConstant
.
PLAN_TASK_DET_FINISH_YES
);
planTaskMapper
.
updatePlanTaskPtInfo
(
param
);
// 更新主表,点数量,完成数量
}
@Override
public
List
<
PlanTaskVo
>
planTaskReport
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
param
)
{
List
<
PlanTaskVo
>
content
=
planTaskMapper
.
getPlanTaskInfoList
(
param
);
String
userIds
=
""
;
String
deptIds
=
""
;
Set
<
String
>
set
=
new
HashSet
<>();
Set
<
String
>
deptIdSet
=
new
HashSet
<>();
content
.
forEach
(
s
->
{
if
(
s
.
getUserName
()
!=
null
)
{
set
.
add
(
s
.
getUserName
());
}
if
(
s
.
getDeptId
()
>
0
)
{
deptIdSet
.
add
(
s
.
getDeptId
()
+
""
);
}
});
List
<
String
>
userList
=
new
ArrayList
<>(
set
);
List
<
String
>
deptList
=
new
ArrayList
<>(
deptIdSet
);
Map
<
String
,
String
>
LoginName
=
new
HashMap
<>();
Map
<
String
,
String
>
userMap
=
new
HashMap
<>();
Map
<
String
,
String
>
depMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
userIds
=
String
.
join
(
","
,
userList
);
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
userIds
);
userMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
for
(
AgencyUserModel
agencyUserModel
:
userModelList
)
{
LoginName
.
put
(
agencyUserModel
.
getUserId
(),
agencyUserModel
.
getMobile
()
!=
null
?
agencyUserModel
.
getMobile
()
:
agencyUserModel
.
getLandlinePhone
());
}
}
}
}
cal
.
add
(
Calendar
.
DATE
,
1
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
planTaskDet
(
String
[]
strArry
)
{
if
(
strArry
.
length
<=
0
)
{
throw
new
YeeException
(
"删除数据内容不能为空"
);
}
Set
<
Long
>
taskNos
=
new
HashSet
<>();
for
(
String
id
:
strArry
)
{
PlanTaskDetail
planTkDet
=
planTaskDetail
.
findById
(
Long
.
parseLong
(
id
)).
get
();
if
(
null
!=
planTkDet
)
{
taskNos
.
add
(
planTkDet
.
getTaskNo
());
}
}
planTaskMapper
.
planTaskDet
(
strArry
);
// 删除数据
HashMap
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"IDS"
,
new
ArrayList
<>(
taskNos
));
param
.
put
(
"FINISH_YES"
,
XJConstant
.
PLAN_TASK_DET_FINISH_YES
);
planTaskMapper
.
updatePlanTaskPtInfo
(
param
);
// 更新主表,点数量,完成数量
}
@Override
public
List
<
PlanTaskVo
>
planTaskReport
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
param
)
{
List
<
PlanTaskVo
>
content
=
planTaskMapper
.
getPlanTaskInfoList
(
param
);
String
userIds
=
""
;
String
deptIds
=
""
;
Set
<
String
>
set
=
new
HashSet
<>();
Set
<
String
>
deptIdSet
=
new
HashSet
<>();
content
.
forEach
(
s
->
{
if
(
s
.
getUserName
()
!=
null
)
{
set
.
add
(
s
.
getUserName
());
}
if
(
s
.
getDeptId
()
>
0
)
{
deptIdSet
.
add
(
s
.
getDeptId
()
+
""
);
}
});
List
<
String
>
userList
=
new
ArrayList
<>(
set
);
List
<
String
>
deptList
=
new
ArrayList
<>(
deptIdSet
);
Map
<
String
,
String
>
LoginName
=
new
HashMap
<>();
Map
<
String
,
String
>
userMap
=
new
HashMap
<>();
Map
<
String
,
String
>
depMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
userIds
=
String
.
join
(
","
,
userList
);
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
userIds
);
userMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
for
(
AgencyUserModel
agencyUserModel
:
userModelList
)
{
LoginName
.
put
(
agencyUserModel
.
getUserId
(),
agencyUserModel
.
getMobile
()
!=
null
?
agencyUserModel
.
getMobile
()
:
agencyUserModel
.
getLandlinePhone
());
}
}
// if(!CollectionUtils.isEmpty(deptList)){
// String dept = String.join(",", deptList);
// List<LinkedHashMap> deptL = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey,dept);
...
...
@@ -301,825 +305,932 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// });
// }
// }
//新安全
content
.
forEach
(
s
->
{
StringBuffer
buffer
=
new
StringBuffer
();
if
(
s
.
getUserDept
().
indexOf
(
"@"
)
>
0
)
{
String
[]
dept
=
s
.
getUserDept
().
split
(
","
);
Arrays
.
asList
(
dept
).
stream
().
forEach
(
x
->
{
String
[]
deptTemp
=
x
.
split
(
"@"
);
List
<
LinkedHashMap
>
deptL
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
deptTemp
[
1
]);
if
(
deptL
.
size
()
>
0
)
{
buffer
.
append
(
deptL
.
get
(
0
).
get
(
"departmentName"
)).
append
(
","
);
}
else
{
buffer
.
append
(
"其他"
).
append
(
","
);
}
});
}
else
{
String
[]
deptTemp
=
s
.
getUserDept
().
split
(
","
);
List
<
LinkedHashMap
>
deptL
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
deptTemp
[
1
]);
if
(
deptL
.
size
()
>
0
)
{
buffer
.
append
(
deptL
.
get
(
0
).
get
(
"departmentName"
)).
append
(
","
);
}
else
{
buffer
.
append
(
"其他"
).
append
(
","
);
}
}
s
.
setDeptName
(
buffer
.
substring
(
0
,
buffer
.
length
()
-
1
));
});
Map
<
String
,
String
>
finalUserMap
=
userMap
;
content
.
forEach
(
c
->
{
StringBuilder
userNames
=
new
StringBuilder
(
""
);
List
<
String
>
userIdsList
=
Arrays
.
asList
(
c
.
getUserName
().
split
(
","
));
for
(
String
userId
:
userIdsList
)
{
userNames
.
append
(
finalUserMap
.
get
(
userId
));
userNames
.
append
(
","
);
}
c
.
setUserName
(
userNames
.
toString
());
});
return
content
;
}
/**
* 自动任务执行
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
taskExecution
(
String
runDate
)
{
//1.扫描plan表查询,需要生成执行数据的任务信息,无则return
Date
now
=
new
Date
();
//今天
if
(
runDate
!=
null
)
{
//上送则已上送的为准
now
=
DateUtil
.
str2Date
(
runDate
,
"yyyyMMdd"
);
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
strDate
=
df
.
format
(
now
);
String
tomorrow
=
DateUtil
.
getIntervalDateStr
(
now
,
1
,
"yyyy-MM-dd"
);
//下一天
// 根据计划状态5,6和next_gen_date查询需要生成任务的计划
List
<
Plan
>
planList
=
iplanDao
.
queryScheduledPlan
(
strDate
,
String
.
valueOf
(
PlanStatusEnum
.
EXAMINE_DEVELOPED
.
getValue
()),
String
.
valueOf
(
PlanStatusEnum
.
IN_EXECUTION
.
getValue
()));
if
(
planList
==
null
||
planList
.
size
()
<=
0
)
{
log
.
info
(
strDate
+
" "
+
" 暂无待生成执行数据的计划"
);
return
;
}
//2.循环遍历执行
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
for
(
Plan
plan
:
planList
)
{
if
(
StringUtils
.
isEmpty
(
plan
.
getUserId
()))
continue
;
paramMap
.
clear
();
paramMap
.
put
(
"id"
,
plan
.
getId
());
//2.1计划数据合法性校验
Boolean
fileFlag
=
PlanTaskUtil
.
checkMustFile
(
plan
);
if
(!
fileFlag
)
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
//更新为明天
continue
;
}
//2.2.计算生成数据的日期区间
CalDateVo
vo
=
PlanTaskUtil
.
reGenPlanTaskData
(
plan
,
tomorrow
,
tomorrow
);
//计划未开始,则更新生成时间为明天
if
(
null
==
vo
)
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
//更新为明天
continue
;
}
//计划已过期,则更新status = 7,已完成
if
(!
vo
.
getIsGenData
())
{
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
COMPLETED
.
getValue
());
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
continue
;
}
//2.3.执行数据生成(具体时间 + 人员)
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
SCHED_FLAG
);
if
(
XJConstant
.
UPD_PLAN_GEN_DATE
.
equals
(
vo
.
getUpdFlag
()))
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
//更新为明天
continue
;
}
else
if
(
XJConstant
.
UPD_PLAN_STATUS
.
equals
(
vo
.
getUpdFlag
()))
{
paramMap
.
put
(
"status"
,
XJConstant
.
PLAN_STATUS_STOP
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
//更新status = 1,停用
continue
;
}
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if
(
iplanTaskDao
.
findById
(
plan
.
getPlanTaskId
())
!=
null
&&
plan
.
getFirstFlag
()
==
XJConstant
.
PLAN_FIRST_STATUS_YES
)
if
(
iplanTaskDao
.
existsById
(
plan
.
getPlanTaskId
()))
{
iplanTaskDao
.
deleteById
(
plan
.
getPlanTaskId
());
}
//2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet
(
list
,
plan
,
XJConstant
.
SCHED_FLAG
,
now
);
}
}
/**
* 删除plantask及det
*
* @param param
*/
public
void
deletePlanTaskAndDet
(
HashMap
<
String
,
Object
>
param
)
{
param
.
put
(
"beginDate"
,
param
.
get
(
"beginDate"
)
+
" "
+
"00:00:00"
);
param
.
put
(
"endDate"
,
param
.
get
(
"endDate"
)
+
" "
+
"23:59:59"
);
List
<
Long
>
ids
=
planTaskMapper
.
getGenPlanTask
(
param
);
for
(
long
id
:
ids
)
{
iplanTaskDao
.
deleteById
(
id
);
;
}
}
/**
* 执行数据生成
*
* @param plan
* @param vo
* @return
*/
public
List
<
HashMap
<
String
,
Object
>>
genAllExeDate
(
Plan
plan
,
CalDateVo
vo
,
String
flag
)
{
//1.生成前8位日期(yyyy-MM-dd)
List
<
HashMap
<
String
,
Date
>>
list
=
PlanTaskUtil
.
genExeDate
(
plan
,
vo
,
flag
);
if
(
list
==
null
||
list
.
size
()
<=
0
)
{
vo
.
setUpdFlag
(
XJConstant
.
UPD_PLAN_GEN_DATE
);
return
null
;
}
//2.生成完整时间(yyyy-MM-dd HH:mm:ss)
List
<
HashMap
<
String
,
Object
>>
timeList
=
PlanTaskUtil
.
genWholeExeDate
(
list
,
plan
);
if
(
timeList
==
null
||
timeList
.
size
()
<=
0
)
{
vo
.
setUpdFlag
(
XJConstant
.
UPD_PLAN_STATUS
);
}
//3.生成含有人员信息的日期执行数据
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
);
}
/**
* plantask及det入库
*
* @param list
* @param plan
* @param flag 是否初始状态0-初始 1-非初始
*/
public
void
insertPlanTaskAndDet
(
List
<
HashMap
<
String
,
Object
>>
list
,
Plan
plan
,
String
flag
,
Date
now
)
{
if
(
list
==
null
||
list
.
size
()
<=
0
)
{
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
paramMap
.
put
(
"id"
,
plan
.
getId
());
paramMap
.
put
(
"next_gen_date"
,
DateUtil
.
formatDatrToStr
(
now
,
"yyyy-MM-dd"
));
// 更新下次任务生成日期
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
}
try
{
// 是否固定日期
String
isFixDate
=
plan
.
getIsFixedDate
();
List
<
Long
>
pointIdList
=
iRoutePointDao
.
queryRoutePointIds
(
plan
.
getRouteId
());
int
pointNum
=
iRoutePointDao
.
countRoutePoint
(
plan
.
getRouteId
());
long
batchNo
=
now
.
getTime
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
startTime
=
list
.
get
(
i
).
get
(
"BEGIN_TIME"
).
toString
();
String
endTime
=
list
.
get
(
i
).
get
(
"END_TIME"
).
toString
();
String
userId
=
list
.
get
(
i
).
get
(
"USER_ID"
)
==
null
?
"-1"
:
list
.
get
(
i
).
get
(
"USER_ID"
).
toString
();
String
userName
=
list
.
get
(
i
).
get
(
"USER_NAME"
)
==
null
?
""
:
list
.
get
(
i
).
get
(
"USER_NAME"
).
toString
();
PlanTask
planTask
=
iplanTaskDao
.
findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId
(
userId
,
startTime
,
endTime
,
plan
.
getId
(),
plan
.
getRouteId
());
if
(
planTask
!=
null
)
{
continue
;
}
planTask
=
new
PlanTask
();
planTask
.
setOrgCode
(
plan
.
getOrgCode
());
planTask
.
setUserName
(
userName
);
planTask
.
setPlanId
(
plan
.
getId
());
planTask
.
setBatchNo
(
batchNo
);
planTask
.
setRouteId
(
plan
.
getRouteId
());
planTask
.
setInOrder
(
plan
.
getInOrder
());
planTask
.
setUserId
(
userId
);
planTask
.
setPointNum
(
pointNum
);
if
(
XJConstant
.
FIX_DATE_NO
.
equals
(
isFixDate
))
{
if
(
sdf
.
parse
(
startTime
).
getTime
()
<=
now
.
getTime
()
&&
sdf
.
parse
(
endTime
).
getTime
()
>=
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_DEAL
);
planTask
.
setFinishNum
(
0
);
}
else
{
if
(
sdf
.
parse
(
endTime
).
getTime
()
<
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_TIMEOUT
);
planTask
.
setFinishNum
(
0
);
}
}
}
else
{
if
(
sdf
.
parse
(
startTime
).
getTime
()
<=
now
.
getTime
()
&&
sdf
.
parse
(
endTime
).
getTime
()
>=
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_DEAL
);
planTask
.
setFinishNum
(
0
);
}
if
(
sdf
.
parse
(
endTime
).
getTime
()
<
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_TIMEOUT
);
planTask
.
setFinishNum
(
0
);
}
}
if
(
XJConstant
.
CHECK_CHANGE_YES
.
equals
(
flag
))
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
planTask
.
setFinishNum
(
pointNum
);
}
if
(
XJConstant
.
FIX_DATE_YES
.
equals
(
isFixDate
)
||
(
XJConstant
.
FIX_DATE_NO
.
equals
(
isFixDate
)
&&
XJConstant
.
PLAN_TYPE_DAY
.
equals
(
plan
.
getPlanType
())))
{
planTask
.
setCheckDate
(
list
.
get
(
i
).
get
(
"BEGIN_TIME"
).
toString
().
substring
(
0
,
10
));
}
planTask
.
setBeginTime
(
startTime
);
planTask
.
setEndTime
(
endTime
);
// 1.保存执行数据主表
iplanTaskDao
.
saveAndFlush
(
planTask
);
long
planId
=
planTask
.
getId
();
for
(
Number
pointId
:
pointIdList
)
{
PlanTaskDetail
planTaskDetailInstance
=
new
PlanTaskDetail
();
planTaskDetailInstance
.
setPointId
(
pointId
.
longValue
());
planTaskDetailInstance
.
setTaskNo
(
planId
);
planTaskDetailInstance
.
setStatus
(
"0"
);
if
(
XJConstant
.
TASK_STATUS_TIMEOUT
==
planTask
.
getFinishStatus
())
{
planTaskDetailInstance
.
setIsFinish
(
Integer
.
parseInt
(
XJConstant
.
PLAN_TASK_DET_FINISH_OUT
));
planTaskDetailInstance
.
setStatus
(
"3"
);
}
if
(
XJConstant
.
CHECK_CHANGE_YES
.
equals
(
flag
))
{
planTaskDetailInstance
.
setIsFinish
(
Integer
.
parseInt
(
XJConstant
.
PLAN_TASK_DET_FINISH_YES
));
planTaskDetailInstance
.
setStatus
(
"1"
);
}
// 查询点下检查项的个数
// 新安全
content
.
forEach
(
s
->
{
StringBuffer
buffer
=
new
StringBuffer
();
if
(
s
.
getUserDept
().
indexOf
(
"@"
)
>
0
)
{
String
[]
dept
=
s
.
getUserDept
().
split
(
","
);
Arrays
.
asList
(
dept
).
stream
().
forEach
(
x
->
{
String
[]
deptTemp
=
x
.
split
(
"@"
);
List
<
LinkedHashMap
>
deptL
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
deptTemp
[
1
]);
if
(
deptL
.
size
()
>
0
)
{
buffer
.
append
(
deptL
.
get
(
0
).
get
(
"departmentName"
)).
append
(
","
);
}
else
{
buffer
.
append
(
"其他"
).
append
(
","
);
}
});
}
else
{
String
[]
deptTemp
=
s
.
getUserDept
().
split
(
","
);
List
<
LinkedHashMap
>
deptL
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
deptTemp
[
1
]);
if
(
deptL
.
size
()
>
0
)
{
buffer
.
append
(
deptL
.
get
(
0
).
get
(
"departmentName"
)).
append
(
","
);
}
else
{
buffer
.
append
(
"其他"
).
append
(
","
);
}
}
s
.
setDeptName
(
buffer
.
substring
(
0
,
buffer
.
length
()
-
1
));
});
Map
<
String
,
String
>
finalUserMap
=
userMap
;
content
.
forEach
(
c
->
{
StringBuilder
userNames
=
new
StringBuilder
(
""
);
List
<
String
>
userIdsList
=
Arrays
.
asList
(
c
.
getUserName
().
split
(
","
));
for
(
String
userId
:
userIdsList
)
{
userNames
.
append
(
finalUserMap
.
get
(
userId
));
userNames
.
append
(
","
);
}
c
.
setUserName
(
userNames
.
toString
());
});
return
content
;
}
/**
* 自动任务执行
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
taskExecution
(
String
runDate
)
{
// 1.扫描plan表查询,需要生成执行数据的任务信息,无则return
Date
now
=
new
Date
();
// 今天
if
(
runDate
!=
null
)
{
// 上送则已上送的为准
now
=
DateUtil
.
str2Date
(
runDate
,
"yyyyMMdd"
);
}
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
strDate
=
df
.
format
(
now
);
String
tomorrow
=
DateUtil
.
getIntervalDateStr
(
now
,
1
,
"yyyy-MM-dd"
);
// 下一天
// 根据计划状态5,6和next_gen_date查询需要生成任务的计划
List
<
Plan
>
planList
=
iplanDao
.
queryScheduledPlan
(
strDate
,
String
.
valueOf
(
PlanStatusEnum
.
EXAMINE_DEVELOPED
.
getValue
()),
String
.
valueOf
(
PlanStatusEnum
.
IN_EXECUTION
.
getValue
()));
if
(
planList
==
null
||
planList
.
size
()
<=
0
)
{
log
.
info
(
strDate
+
" "
+
" 暂无待生成执行数据的计划"
);
return
;
}
// 2.循环遍历执行
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
for
(
Plan
plan
:
planList
)
{
if
(
StringUtils
.
isEmpty
(
plan
.
getUserId
()))
continue
;
paramMap
.
clear
();
paramMap
.
put
(
"id"
,
plan
.
getId
());
// 2.1计划数据合法性校验
Boolean
fileFlag
=
PlanTaskUtil
.
checkMustFile
(
plan
);
if
(!
fileFlag
)
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新为明天
continue
;
}
// 2.2.计算生成数据的日期区间
CalDateVo
vo
=
PlanTaskUtil
.
reGenPlanTaskData
(
plan
,
tomorrow
,
tomorrow
);
// 计划未开始,则更新生成时间为明天
if
(
null
==
vo
)
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新为明天
continue
;
}
// 计划已过期,则更新status = 7,已完成
if
(!
vo
.
getIsGenData
())
{
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
COMPLETED
.
getValue
());
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
continue
;
}
// 2.3.执行数据生成(具体时间 + 人员)
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
SCHED_FLAG
);
if
(
XJConstant
.
UPD_PLAN_GEN_DATE
.
equals
(
vo
.
getUpdFlag
()))
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新为明天
continue
;
}
else
if
(
XJConstant
.
UPD_PLAN_STATUS
.
equals
(
vo
.
getUpdFlag
()))
{
paramMap
.
put
(
"status"
,
XJConstant
.
PLAN_STATUS_STOP
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新status = 1,停用
continue
;
}
// 2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if
(
iplanTaskDao
.
findById
(
plan
.
getPlanTaskId
())
!=
null
&&
plan
.
getFirstFlag
()
==
XJConstant
.
PLAN_FIRST_STATUS_YES
)
if
(
iplanTaskDao
.
existsById
(
plan
.
getPlanTaskId
()))
{
iplanTaskDao
.
deleteById
(
plan
.
getPlanTaskId
());
}
// 2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet
(
list
,
plan
,
XJConstant
.
SCHED_FLAG
,
now
);
}
}
/*
* 用于隐患导入之后的任务生成,不能使用时间获取所有的任务,而是当前时间的任务
*
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
taskExecutionImportPlan
(
Long
id
)
{
Optional
<
Plan
>
planList
=
iplanDao
.
findById
(
id
);
Plan
plan
=
planList
.
get
();
Date
now
=
new
Date
();
// 今天
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
tomorrow
=
DateUtil
.
getIntervalDateStr
(
now
,
1
,
"yyyy-MM-dd"
);
// 下一天
if
(
planList
==
null
)
{
log
.
info
(
" 暂无待生成执行数据的计划"
);
return
false
;
}
// 2.循环遍历执行
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
if
(
StringUtils
.
isEmpty
(
plan
.
getUserId
()))
return
false
;
paramMap
.
clear
();
paramMap
.
put
(
"id"
,
plan
.
getId
());
// 2.1计划数据合法性校验
Boolean
fileFlag
=
PlanTaskUtil
.
checkMustFile
(
plan
);
if
(!
fileFlag
)
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新为明天
return
true
;
}
// 2.2.计算生成数据的日期区间
CalDateVo
vo
=
PlanTaskUtil
.
reGenPlanTaskData
(
plan
,
tomorrow
,
tomorrow
);
// 计划未开始,则更新生成时间为明天
if
(
null
==
vo
)
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新为明天
return
true
;
}
// 计划已过期,则更新status = 7,已完成
if
(!
vo
.
getIsGenData
())
{
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
COMPLETED
.
getValue
());
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
return
true
;
}
// 2.3.执行数据生成(具体时间 + 人员)
List
<
HashMap
<
String
,
Object
>>
list
=
genAllExeDate
(
plan
,
vo
,
XJConstant
.
SCHED_FLAG
);
if
(
XJConstant
.
UPD_PLAN_GEN_DATE
.
equals
(
vo
.
getUpdFlag
()))
{
paramMap
.
put
(
"next_gen_date"
,
tomorrow
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新为明天
return
true
;
}
else
if
(
XJConstant
.
UPD_PLAN_STATUS
.
equals
(
vo
.
getUpdFlag
()))
{
paramMap
.
put
(
"status"
,
XJConstant
.
PLAN_STATUS_STOP
);
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新status = 1,停用
return
true
;
}
// 2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if
(
iplanTaskDao
.
findById
(
plan
.
getPlanTaskId
())
!=
null
&&
plan
.
getFirstFlag
()
==
XJConstant
.
PLAN_FIRST_STATUS_YES
)
if
(
iplanTaskDao
.
existsById
(
plan
.
getPlanTaskId
()))
{
iplanTaskDao
.
deleteById
(
plan
.
getPlanTaskId
());
}
// 2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet
(
list
,
plan
,
XJConstant
.
SCHED_FLAG
,
now
);
return
true
;
}
/**
* 删除plantask及det
*
* @param param
*/
public
void
deletePlanTaskAndDet
(
HashMap
<
String
,
Object
>
param
)
{
param
.
put
(
"beginDate"
,
param
.
get
(
"beginDate"
)
+
" "
+
"00:00:00"
);
param
.
put
(
"endDate"
,
param
.
get
(
"endDate"
)
+
" "
+
"23:59:59"
);
List
<
Long
>
ids
=
planTaskMapper
.
getGenPlanTask
(
param
);
for
(
long
id
:
ids
)
{
iplanTaskDao
.
deleteById
(
id
);
;
}
}
/**
* 执行数据生成
*
* @param plan
* @param vo
* @return
*/
public
List
<
HashMap
<
String
,
Object
>>
genAllExeDate
(
Plan
plan
,
CalDateVo
vo
,
String
flag
)
{
// 1.生成前8位日期(yyyy-MM-dd)
List
<
HashMap
<
String
,
Date
>>
list
=
PlanTaskUtil
.
genExeDate
(
plan
,
vo
,
flag
);
if
(
list
==
null
||
list
.
size
()
<=
0
)
{
vo
.
setUpdFlag
(
XJConstant
.
UPD_PLAN_GEN_DATE
);
return
null
;
}
// 2.生成完整时间(yyyy-MM-dd HH:mm:ss)
List
<
HashMap
<
String
,
Object
>>
timeList
=
PlanTaskUtil
.
genWholeExeDate
(
list
,
plan
);
if
(
timeList
==
null
||
timeList
.
size
()
<=
0
)
{
vo
.
setUpdFlag
(
XJConstant
.
UPD_PLAN_STATUS
);
}
// 3.生成含有人员信息的日期执行数据
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
);
}
/**
* plantask及det入库
*
* @param list
* @param plan
* @param flag 是否初始状态0-初始 1-非初始
*/
public
void
insertPlanTaskAndDet
(
List
<
HashMap
<
String
,
Object
>>
list
,
Plan
plan
,
String
flag
,
Date
now
)
{
if
(
list
==
null
||
list
.
size
()
<=
0
)
{
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
paramMap
.
put
(
"id"
,
plan
.
getId
());
paramMap
.
put
(
"next_gen_date"
,
DateUtil
.
formatDatrToStr
(
now
,
"yyyy-MM-dd"
));
// 更新下次任务生成日期
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
}
try
{
// 是否固定日期
String
isFixDate
=
plan
.
getIsFixedDate
();
List
<
Long
>
pointIdList
=
iRoutePointDao
.
queryRoutePointIds
(
plan
.
getRouteId
());
int
pointNum
=
iRoutePointDao
.
countRoutePoint
(
plan
.
getRouteId
());
long
batchNo
=
now
.
getTime
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
startTime
=
list
.
get
(
i
).
get
(
"BEGIN_TIME"
).
toString
();
String
endTime
=
list
.
get
(
i
).
get
(
"END_TIME"
).
toString
();
String
userId
=
list
.
get
(
i
).
get
(
"USER_ID"
)
==
null
?
"-1"
:
list
.
get
(
i
).
get
(
"USER_ID"
).
toString
();
String
userName
=
list
.
get
(
i
).
get
(
"USER_NAME"
)
==
null
?
""
:
list
.
get
(
i
).
get
(
"USER_NAME"
).
toString
();
PlanTask
planTask
=
iplanTaskDao
.
findByUserIdAndBeginTimeAndEndTimeAndPlanIdAndRouteId
(
userId
,
startTime
,
endTime
,
plan
.
getId
(),
plan
.
getRouteId
());
if
(
planTask
!=
null
)
{
continue
;
}
planTask
=
new
PlanTask
();
planTask
.
setOrgCode
(
plan
.
getOrgCode
());
planTask
.
setUserName
(
userName
);
planTask
.
setPlanId
(
plan
.
getId
());
planTask
.
setBatchNo
(
batchNo
);
planTask
.
setRouteId
(
plan
.
getRouteId
());
planTask
.
setInOrder
(
plan
.
getInOrder
());
planTask
.
setUserId
(
userId
);
planTask
.
setPointNum
(
pointNum
);
if
(
XJConstant
.
FIX_DATE_NO
.
equals
(
isFixDate
))
{
if
(
sdf
.
parse
(
startTime
).
getTime
()
<=
now
.
getTime
()
&&
sdf
.
parse
(
endTime
).
getTime
()
>=
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_DEAL
);
planTask
.
setFinishNum
(
0
);
}
else
{
if
(
sdf
.
parse
(
endTime
).
getTime
()
<
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_TIMEOUT
);
planTask
.
setFinishNum
(
0
);
}
}
}
else
{
if
(
sdf
.
parse
(
startTime
).
getTime
()
<=
now
.
getTime
()
&&
sdf
.
parse
(
endTime
).
getTime
()
>=
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_DEAL
);
planTask
.
setFinishNum
(
0
);
}
if
(
sdf
.
parse
(
endTime
).
getTime
()
<
now
.
getTime
())
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_TIMEOUT
);
planTask
.
setFinishNum
(
0
);
}
}
if
(
XJConstant
.
CHECK_CHANGE_YES
.
equals
(
flag
))
{
planTask
.
setFinishStatus
(
XJConstant
.
TASK_STATUS_FINISH
);
planTask
.
setFinishNum
(
pointNum
);
}
if
(
XJConstant
.
FIX_DATE_YES
.
equals
(
isFixDate
)
||
(
XJConstant
.
FIX_DATE_NO
.
equals
(
isFixDate
)
&&
XJConstant
.
PLAN_TYPE_DAY
.
equals
(
plan
.
getPlanType
())))
{
planTask
.
setCheckDate
(
list
.
get
(
i
).
get
(
"BEGIN_TIME"
).
toString
().
substring
(
0
,
10
));
}
planTask
.
setBeginTime
(
startTime
);
planTask
.
setEndTime
(
endTime
);
// 1.保存执行数据主表
iplanTaskDao
.
saveAndFlush
(
planTask
);
long
planId
=
planTask
.
getId
();
for
(
Number
pointId
:
pointIdList
)
{
PlanTaskDetail
planTaskDetailInstance
=
new
PlanTaskDetail
();
planTaskDetailInstance
.
setPointId
(
pointId
.
longValue
());
planTaskDetailInstance
.
setTaskNo
(
planId
);
planTaskDetailInstance
.
setStatus
(
"0"
);
if
(
XJConstant
.
TASK_STATUS_TIMEOUT
==
planTask
.
getFinishStatus
())
{
planTaskDetailInstance
.
setIsFinish
(
Integer
.
parseInt
(
XJConstant
.
PLAN_TASK_DET_FINISH_OUT
));
planTaskDetailInstance
.
setStatus
(
"3"
);
}
if
(
XJConstant
.
CHECK_CHANGE_YES
.
equals
(
flag
))
{
planTaskDetailInstance
.
setIsFinish
(
Integer
.
parseInt
(
XJConstant
.
PLAN_TASK_DET_FINISH_YES
));
planTaskDetailInstance
.
setStatus
(
"1"
);
}
// 查询点下检查项的个数
// List<PointInputItem> pointInputItemByPointId = pointInputItemDao.getPointInputItemByPointId(pointId.longValue());
Long
routeId
=
plan
.
getRouteId
();
int
itemCount
=
routePointItemMapper
.
getPointItemCount
(
routeId
,
pointId
.
longValue
());
planTaskDetailInstance
.
setItemNum
(
itemCount
);
// 2.保存执行数据明细表
planTaskDetail
.
saveAndFlush
(
planTaskDetailInstance
);
}
sendMessage
(
plan
);
// 定时任务监控
jobService
.
planTaskAddJob
(
planTask
);
}
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
Date
genDate
=
DateUtil
.
str2Date
(
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
(),
"yyyy-MM-dd"
);
//下次生成日期
//明天
Date
tomorrow
=
DateUtil
.
getIntervalDate
(
now
,
1
);
String
strGenDate
=
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
().
substring
(
0
,
10
);
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
paramMap
.
put
(
"id"
,
plan
.
getId
());
paramMap
.
put
(
"next_gen_date"
,
strGenDate
);
if
(
XJConstant
.
SCHED_FLAG
.
equals
(
flag
))
{
paramMap
.
put
(
"plan_task_id"
,
0
);
//修改为初始值
paramMap
.
put
(
"first_flag"
,
XJConstant
.
PLAN_FIRST_STATUS_NO
);
}
else
if
(!
XJConstant
.
SCHED_FLAG
.
equals
(
flag
)
&&
(
genDate
.
getTime
()
-
tomorrow
.
getTime
()
>=
0
)
&&
XJConstant
.
FIX_DATE_NO
.
equals
(
plan
.
getIsFixedDate
()))
{
//更新日期及plantaskId到plan表
long
planTaskId
=
iplanTaskDao
.
findMaxIdByBatchNo
(
batchNo
);
paramMap
.
put
(
"plan_task_id"
,
planTaskId
);
// 更新新的任务id到plan
paramMap
.
put
(
"first_flag"
,
XJConstant
.
PLAN_FIRST_STATUS_NO
);
}
if
(
DateUtil
.
str2Date
(
strGenDate
,
"yyyy-MM-dd"
).
getTime
()
-
now
.
getTime
()
<
0
||
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
strGenDate
))
{
paramMap
.
put
(
"next_gen_date"
,
DateUtil
.
formatDatrToStr
(
now
,
"yyyy-MM-dd"
));
}
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新下次任务生成日期
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
public
void
sendMessage
(
Plan
plan
)
throws
Exception
{
// 查询检查对象对应防火监督负责人id
List
<
String
>
extraUserIds
=
Lists
.
newArrayList
();
List
<
Point
>
pointList
=
pointMapper
.
getPointByPlanId
(
String
.
valueOf
(
plan
.
getId
()));
if
(!
ValidationUtil
.
isEmpty
(
pointList
))
{
List
<
String
>
originalIdList
=
Lists
.
transform
(
pointList
,
Point:
:
getOriginalId
);
List
<
OrgUsrFormDto
>
personList
=
jcsFeignClient
.
getPersonListByCompanyIdList
(
Joiner
.
on
(
","
).
join
(
originalIdList
)).
getResult
();
List
<
String
>
personIdList
=
Lists
.
transform
(
personList
,
OrgUsrFormDto:
:
getAmosOrgId
);
List
<
RoleModel
>
roleList
=
Privilege
.
roleClient
.
queryRoleList
(
supervisionPersonChargerRole
,
null
).
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
roleList
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
roleList
.
get
(
0
).
getSequenceNbr
()),
null
).
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
agencyUserModelList
.
forEach
(
userModel
->
{
if
(
personIdList
.
contains
(
userModel
.
getUserId
()))
{
extraUserIds
.
add
(
userModel
.
getUserId
());
}
});
}
}
}
log
.
info
(
String
.
format
(
"计划对象:%s"
,
JSON
.
toJSON
(
plan
)));
// 规则推送消息
rulePlanService
.
addPlanRule
(
plan
,
null
,
RuleTypeEnum
.
计划生成
,
extraUserIds
);
//根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK -> NOTIFY
}
@Override
public
List
<
PlanTask
>
getPlanTaskByRouteId
(
Long
routeId
)
{
List
<
PlanTask
>
planTaskList
=
planTaskMapper
.
getPlanTaskByRouteId
(
routeId
);
return
planTaskList
;
}
@Override
public
void
disablePlanTask
(
Long
[]
planTaskIds
)
{
// planTask表中status字段置为1
for
(
long
planTaskId
:
planTaskIds
)
{
List
<
PlanTask
>
planTaskList
=
getPlanTaskByRouteId
(
planTaskId
);
for
(
PlanTask
planTask
:
planTaskList
)
{
planTask
.
setStatus
((
byte
)
1
);
iplanTaskDao
.
save
(
planTask
);
}
}
}
@Override
public
List
getPlanTaskInfo
(
HashMap
<
String
,
Object
>
param
)
{
return
planTaskMapper
.
getPlanTaskByPointId
(
param
);
}
@Override
public
Map
findPlanTaskByTaskIdAndPointId
(
long
plantaskId
,
long
pointId
)
{
return
planTaskDetailMapper
.
findPlanTaskByTaskIdAndPointId
(
plantaskId
,
pointId
);
}
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTasks
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
pageParam
)
{
List
<
HashMap
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
()
,
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
params
.
put
(
"loginUserId"
,
reginParam
.
getPersonIdentity
().
getPersonSeq
());
long
total
=
planTaskMapper
.
getPlanTasksCount
(
params
);
if
(
total
==
0
)
{
return
new
PageImpl
<>(
content
,
pageParam
,
total
);
}
params
.
put
(
"offset"
,
pageParam
.
getOffset
());
params
.
put
(
"pageSize"
,
pageParam
.
getPageSize
());
content
=
planTaskMapper
.
getPlanTasks
(
params
);
content
.
forEach
(
c
->
{
if
(
c
.
containsKey
(
"finishStatus"
))
{
String
finishStatusDesc
=
PlanTaskFinishStatusEnum
.
getName
(
Integer
.
parseInt
(
c
.
get
(
"finishStatus"
).
toString
()));
c
.
put
(
"finishStatusDesc"
,
finishStatusDesc
);
}
});
return
new
PageImpl
<>(
content
,
pageParam
,
total
);
}
@Override
public
int
countWaitingTaskByUser
(
String
userId
)
{
return
planTaskMapper
.
countWaitingTaskByUser
(
userId
);
}
@Override
public
Map
queryPlanTaskById
(
Long
planTaskId
)
{
Map
map
=
new
HashMap
();
map
=
planTaskMapper
.
queryPlanTaskById
(
planTaskId
);
if
(
map
.
containsKey
(
"finishStatus"
))
{
String
finishStatusDesc
=
PlanTaskFinishStatusEnum
.
getName
(
Integer
.
parseInt
(
map
.
get
(
"finishStatus"
).
toString
()));
map
.
put
(
"finishStatusDesc"
,
finishStatusDesc
);
}
return
map
;
}
@Override
public
Page
<
Map
<
String
,
Object
>>
getPlanTaskPoints
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
pageable
)
{
List
<
Map
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
long
total
=
planTaskMapper
.
getPlanTaskPointsCount
(
params
);
if
(
total
==
0
)
{
return
new
PageImpl
<>(
content
,
pageable
,
total
);
}
params
.
put
(
"offset"
,
pageable
.
getOffset
());
params
.
put
(
"pageSize"
,
pageable
.
getPageSize
());
List
<
Map
<
String
,
Object
>>
result
=
planTaskMapper
.
getPlanTaskPoints
(
params
);
result
.
forEach
(
r
->
{
if
(
r
.
containsKey
(
"finish"
))
{
String
isFinishDesc
=
PlanTaskDetailIsFinishEnum
.
getName
(
Integer
.
parseInt
(
r
.
get
(
"finish"
).
toString
()));
r
.
put
(
"isFinishDesc"
,
isFinishDesc
);
}
});
return
new
PageImpl
<>(
result
,
pageable
,
total
);
Long
routeId
=
plan
.
getRouteId
();
int
itemCount
=
routePointItemMapper
.
getPointItemCount
(
routeId
,
pointId
.
longValue
());
planTaskDetailInstance
.
setItemNum
(
itemCount
);
// 2.保存执行数据明细表
planTaskDetail
.
saveAndFlush
(
planTaskDetailInstance
);
}
sendMessage
(
plan
);
// 定时任务监控
jobService
.
planTaskAddJob
(
planTask
);
}
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
Date
genDate
=
DateUtil
.
str2Date
(
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
(),
"yyyy-MM-dd"
);
// 下次生成日期
// 明天
Date
tomorrow
=
DateUtil
.
getIntervalDate
(
now
,
1
);
String
strGenDate
=
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
().
substring
(
0
,
10
);
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
paramMap
.
put
(
"id"
,
plan
.
getId
());
paramMap
.
put
(
"next_gen_date"
,
strGenDate
);
if
(
XJConstant
.
SCHED_FLAG
.
equals
(
flag
))
{
paramMap
.
put
(
"plan_task_id"
,
0
);
// 修改为初始值
paramMap
.
put
(
"first_flag"
,
XJConstant
.
PLAN_FIRST_STATUS_NO
);
}
else
if
(!
XJConstant
.
SCHED_FLAG
.
equals
(
flag
)
&&
(
genDate
.
getTime
()
-
tomorrow
.
getTime
()
>=
0
)
&&
XJConstant
.
FIX_DATE_NO
.
equals
(
plan
.
getIsFixedDate
()))
{
// 更新日期及plantaskId到plan表
long
planTaskId
=
iplanTaskDao
.
findMaxIdByBatchNo
(
batchNo
);
paramMap
.
put
(
"plan_task_id"
,
planTaskId
);
// 更新新的任务id到plan
paramMap
.
put
(
"first_flag"
,
XJConstant
.
PLAN_FIRST_STATUS_NO
);
}
if
(
DateUtil
.
str2Date
(
strGenDate
,
"yyyy-MM-dd"
).
getTime
()
-
now
.
getTime
()
<
0
||
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
strGenDate
))
{
paramMap
.
put
(
"next_gen_date"
,
DateUtil
.
formatDatrToStr
(
now
,
"yyyy-MM-dd"
));
}
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新下次任务生成日期
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
public
void
sendMessage
(
Plan
plan
)
throws
Exception
{
// 查询检查对象对应防火监督负责人id
List
<
String
>
extraUserIds
=
Lists
.
newArrayList
();
List
<
Point
>
pointList
=
pointMapper
.
getPointByPlanId
(
String
.
valueOf
(
plan
.
getId
()));
if
(!
ValidationUtil
.
isEmpty
(
pointList
))
{
List
<
String
>
originalIdList
=
Lists
.
transform
(
pointList
,
Point:
:
getOriginalId
);
List
<
OrgUsrFormDto
>
personList
=
jcsFeignClient
.
getPersonListByCompanyIdList
(
Joiner
.
on
(
","
).
join
(
originalIdList
)).
getResult
();
List
<
String
>
personIdList
=
Lists
.
transform
(
personList
,
OrgUsrFormDto:
:
getAmosOrgId
);
List
<
RoleModel
>
roleList
=
Privilege
.
roleClient
.
queryRoleList
(
supervisionPersonChargerRole
,
null
)
.
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
roleList
))
{
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
String
.
valueOf
(
roleList
.
get
(
0
).
getSequenceNbr
()),
null
).
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
agencyUserModelList
))
{
agencyUserModelList
.
forEach
(
userModel
->
{
if
(
personIdList
.
contains
(
userModel
.
getUserId
()))
{
extraUserIds
.
add
(
userModel
.
getUserId
());
}
});
}
}
}
log
.
info
(
String
.
format
(
"计划对象:%s"
,
JSON
.
toJSON
(
plan
)));
// 规则推送消息
rulePlanService
.
addPlanRule
(
plan
,
null
,
RuleTypeEnum
.
消息型计划生成
,
extraUserIds
);
// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
String
userIdString
=
plan
.
getUserId
();
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
userIdString
))
{
String
[]
userIdArr
=
userIdString
.
split
(
","
);
List
<
String
>
userIdList
=
Arrays
.
asList
(
userIdArr
);
// 规则推送消息
rulePlanService
.
addPlanRule
(
plan
,
null
,
RuleTypeEnum
.
任务型计划生成
,
userIdList
);
// 根据bug5569
}
}
@Override
public
List
<
PlanTask
>
getPlanTaskByRouteId
(
Long
routeId
)
{
List
<
PlanTask
>
planTaskList
=
planTaskMapper
.
getPlanTaskByRouteId
(
routeId
);
return
planTaskList
;
}
@Override
public
void
disablePlanTask
(
Long
[]
planTaskIds
)
{
// planTask表中status字段置为1
for
(
long
planTaskId
:
planTaskIds
)
{
List
<
PlanTask
>
planTaskList
=
getPlanTaskByRouteId
(
planTaskId
);
for
(
PlanTask
planTask
:
planTaskList
)
{
planTask
.
setStatus
((
byte
)
1
);
iplanTaskDao
.
save
(
planTask
);
}
}
}
@Override
public
List
getPlanTaskInfo
(
HashMap
<
String
,
Object
>
param
)
{
return
planTaskMapper
.
getPlanTaskByPointId
(
param
);
}
@Override
public
Map
findPlanTaskByTaskIdAndPointId
(
long
plantaskId
,
long
pointId
)
{
return
planTaskDetailMapper
.
findPlanTaskByTaskIdAndPointId
(
plantaskId
,
pointId
);
}
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTasks
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
pageParam
)
{
List
<
HashMap
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
params
.
put
(
"loginUserId"
,
reginParam
.
getPersonIdentity
().
getPersonSeq
());
long
total
=
planTaskMapper
.
getPlanTasksCount
(
params
);
if
(
total
==
0
)
{
return
new
PageImpl
<>(
content
,
pageParam
,
total
);
}
params
.
put
(
"offset"
,
pageParam
.
getOffset
());
params
.
put
(
"pageSize"
,
pageParam
.
getPageSize
());
content
=
planTaskMapper
.
getPlanTasks
(
params
);
content
.
forEach
(
c
->
{
if
(
c
.
containsKey
(
"finishStatus"
))
{
String
finishStatusDesc
=
PlanTaskFinishStatusEnum
.
getName
(
Integer
.
parseInt
(
c
.
get
(
"finishStatus"
).
toString
()));
c
.
put
(
"finishStatusDesc"
,
finishStatusDesc
);
}
});
return
new
PageImpl
<>(
content
,
pageParam
,
total
);
}
@Override
public
int
countWaitingTaskByUser
(
String
userId
)
{
return
planTaskMapper
.
countWaitingTaskByUser
(
userId
);
}
@Override
public
Map
queryPlanTaskById
(
Long
planTaskId
)
{
Map
map
=
new
HashMap
();
map
=
planTaskMapper
.
queryPlanTaskById
(
planTaskId
);
if
(
map
.
containsKey
(
"finishStatus"
))
{
String
finishStatusDesc
=
PlanTaskFinishStatusEnum
.
getName
(
Integer
.
parseInt
(
map
.
get
(
"finishStatus"
).
toString
()));
map
.
put
(
"finishStatusDesc"
,
finishStatusDesc
);
}
return
map
;
}
@Override
public
Page
<
Map
<
String
,
Object
>>
getPlanTaskPoints
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
pageable
)
{
List
<
Map
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
long
total
=
planTaskMapper
.
getPlanTaskPointsCount
(
params
);
if
(
total
==
0
)
{
return
new
PageImpl
<>(
content
,
pageable
,
total
);
}
params
.
put
(
"offset"
,
pageable
.
getOffset
());
params
.
put
(
"pageSize"
,
pageable
.
getPageSize
());
List
<
Map
<
String
,
Object
>>
result
=
planTaskMapper
.
getPlanTaskPoints
(
params
);
result
.
forEach
(
r
->
{
if
(
r
.
containsKey
(
"finish"
))
{
String
isFinishDesc
=
PlanTaskDetailIsFinishEnum
.
getName
(
Integer
.
parseInt
(
r
.
get
(
"finish"
).
toString
()));
r
.
put
(
"isFinishDesc"
,
isFinishDesc
);
}
});
return
new
PageImpl
<>(
result
,
pageable
,
total
);
// return result;
}
@Override
public
int
getCurrentPlanTaskCount
(
String
userId
)
{
return
planTaskMapper
.
getCurrentPlanTaskCount
(
userId
);
}
@Override
public
List
<
PlanTaskVo
>
getPlanTaskListByIds
(
String
toke
,
String
product
,
String
appKey
,
Long
[]
ids
)
{
List
<
PlanTaskVo
>
content
=
planTaskMapper
.
getPlanTaskListByIds
(
ids
);
String
userIds
=
""
;
String
deptIds
=
""
;
Set
<
String
>
set
=
new
HashSet
<>();
Set
<
String
>
deptIdSet
=
new
HashSet
<>();
Map
<
Long
,
Set
<
String
>>
deptMap
=
new
HashMap
<>();
content
.
forEach
(
s
->
{
String
userDept
=
s
.
getUserDept
();
if
(!
ValidationUtil
.
isEmpty
(
userDept
))
{
String
[]
udStrs
=
userDept
.
split
(
","
);
for
(
String
udStr
:
udStrs
)
{
try
{
String
[]
split
=
udStr
.
split
(
"@"
);
set
.
add
(
split
[
0
]);
if
(
split
.
length
>
1
)
{
if
(!
"-1"
.
equals
(
split
[
1
]))
{
deptIdSet
.
add
(
split
[
1
]);
}
if
(!
deptMap
.
containsKey
(
s
.
getId
()))
{
deptMap
.
put
(
s
.
getId
(),
new
HashSet
<>());
}
deptMap
.
get
(
s
.
getId
()).
add
(
split
[
1
]);
}
}
catch
(
Exception
e
)
{
}
}
}
});
List
<
String
>
userList
=
new
ArrayList
<>(
set
);
List
<
String
>
deptList
=
new
ArrayList
<>(
deptIdSet
);
Map
<
String
,
String
>
LoginName
=
new
HashMap
<>();
Map
<
String
,
String
>
userMap
=
new
HashMap
<>();
Map
<
String
,
String
>
depMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
userIds
=
String
.
join
(
","
,
userList
);
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
userIds
);
userMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
for
(
AgencyUserModel
agencyUserModel
:
userModelList
)
{
LoginName
.
put
(
agencyUserModel
.
getUserId
(),
agencyUserModel
.
getMobile
()
!=
null
?
agencyUserModel
.
getMobile
()
:
agencyUserModel
.
getLandlinePhone
());
}
}
if
(!
CollectionUtils
.
isEmpty
(
deptList
))
{
String
dept
=
String
.
join
(
","
,
deptList
);
List
<
LinkedHashMap
>
deptL
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
dept
);
if
(
deptL
!=
null
&&
deptL
.
size
()
>
0
)
{
//新安全
content
.
forEach
(
s
->
{
Set
<
String
>
set1
=
deptMap
.
get
(
s
.
getId
());
if
(!
ValidationUtil
.
isEmpty
(
set1
))
{
deptL
.
forEach
(
s1
->
{
if
(
set1
.
contains
(
s1
.
get
(
"sequenceNbr"
)))
{
if
(!
ValidationUtil
.
isEmpty
(
s
.
getDeptName
()))
{
s
.
setDeptName
(
s
.
getDeptName
()
+
","
+
s1
.
get
(
"departmentName"
));
}
else
{
s
.
setDeptName
(
s1
.
get
(
"departmentName"
).
toString
());
}
}
});
if
(
set1
.
contains
(
"-1"
))
{
if
(!
ValidationUtil
.
isEmpty
(
s
.
getDeptName
()))
{
s
.
setDeptName
(
s
.
getDeptName
()
+
","
+
"其他"
);
}
else
{
s
.
setDeptName
(
"其他"
);
}
}
}
});
}
}
Map
<
String
,
String
>
finalUserMap
=
userMap
;
content
.
forEach
(
c
->
{
StringBuilder
userNames
=
new
StringBuilder
(
""
);
List
<
String
>
userIdsList
=
Arrays
.
asList
(
c
.
getUserName
().
split
(
","
));
for
(
String
userId
:
userIdsList
)
{
userNames
.
append
(
finalUserMap
.
get
(
userId
));
userNames
.
append
(
","
);
}
c
.
setUserName
(
userNames
.
toString
());
});
return
content
;
}
@Override
public
Page
<
CheckChkExListBo
>
getChkExList
(
String
toke
,
String
product
,
String
appKey
,
CheckPtListPageParam
param
)
{
long
total
=
planTaskMapper
.
countChkExListData
(
param
);
List
<
CheckChkExListBo
>
content
=
planTaskMapper
.
getChkExList
(
param
);
//获取用户联系方式
String
userIds
=
""
;
Set
<
String
>
set
=
new
HashSet
<>();
content
.
forEach
(
s
->
{
if
(
s
.
getRealName
()
!=
null
)
{
String
[]
sArr
=
s
.
getRealName
().
split
(
","
);
set
.
addAll
(
Arrays
.
asList
(
sArr
));
}
});
List
<
String
>
userList
=
new
ArrayList
<>(
set
);
Map
<
String
,
AgencyUserModel
>
agencyUserModelMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
userIds
=
String
.
join
(
","
,
userList
);
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
userIds
);
agencyUserModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
Function
.
identity
()));
}
for
(
CheckChkExListBo
bo
:
content
)
{
ArrayList
<
String
>
names
=
new
ArrayList
<>();
ArrayList
<
String
>
mobiles
=
new
ArrayList
<>();
String
nameStrings
=
String
.
join
(
","
,
names
);
String
[]
realNames
=
bo
.
getRealName
().
split
(
","
);
if
(
realNames
.
length
>
1
)
{
System
.
out
.
println
(
"asd"
);
}
for
(
int
i
=
0
;
i
<
realNames
.
length
;
i
++)
{
if
(
agencyUserModelMap
.
containsKey
(
realNames
[
i
]))
{
AgencyUserModel
agencyUserModel
=
agencyUserModelMap
.
get
(
realNames
[
i
]);
names
.
add
(
agencyUserModel
.
getRealName
());
if
(
StringUtil
.
isNotEmpty
(
agencyUserModel
.
getMobile
()))
{
mobiles
.
add
(
agencyUserModel
.
getMobile
());
}
}
}
bo
.
setRealName
(
String
.
join
(
","
,
names
));
if
(
mobiles
.
size
()
>
0
)
{
bo
.
setLoginName
(
String
.
join
(
","
,
mobiles
));
}
}
Page
<
CheckChkExListBo
>
result
=
new
PageImpl
<
CheckChkExListBo
>(
content
,
param
,
total
);
return
result
;
}
@Override
public
Map
<
String
,
Object
>
getPlanTaskStatisticsForApp
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
getPlanTaskStatisticsForApp
(
params
);
}
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetail
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
)
{
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetail
(
toke
,
product
,
appKey
,
check
.
getId
());
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
if
(
planPointInfo
!=
null
)
{
List
<
String
>
userIds
=
Arrays
.
asList
(
planPointInfo
.
getUsername
().
split
(
","
));
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
planPointInfo
.
getUsername
());
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
if
(
userModelMap
!=
null
)
{
List
<
String
>
userNameList
=
new
ArrayList
<>();
for
(
String
userId
:
userIds
)
{
userNameList
.
add
(
userModelMap
.
get
(
userId
));
}
userNameList
.
remove
(
""
);
userNameList
.
remove
(
null
);
pointCheckRespone
.
setUsername
(
Joiner
.
on
(
","
).
join
(
userNameList
));
}
DepartmentModel
departmentBo
=
remoteSecurityService
.
getDepartmentByDeptId
(
toke
,
product
,
appKey
,
planPointInfo
.
getUsername
());
if
(
departmentBo
!=
null
)
{
pointCheckRespone
.
setDepartmentName
(
departmentBo
.
getDepartmentName
());
}
pointCheckRespone
.
setPointId
(
pointId
);
pointCheckRespone
.
setPointName
(
planPointInfo
.
getPointName
());
pointCheckRespone
.
setPointNo
(
planPointInfo
.
getPointNo
());
pointCheckRespone
.
setPointStatus
(
"0"
);
pointCheckRespone
.
setPlanName
(
planPointInfo
.
getPlanName
());
List
<
PointCheckDetailBo
>
pointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
planPointInfo
.
getRouteId
(),
planPointInfo
.
getPointId
());
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
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
());
String
key
=
ObjectUtils
.
isEmpty
(
action
.
getClassifyName
())
?
"其他"
:
action
.
getClassifyName
();
if
(
appResponeMap
.
containsKey
(
key
))
{
appResponeMap
.
getJSONArray
(
key
).
add
(
input
);
}
else
{
List
<
AppCheckInputRespone
>
appCheckInputResponeList
=
new
ArrayList
<
AppCheckInputRespone
>();
appCheckInputResponeList
.
add
(
input
);
appResponeMap
.
put
(
key
,
appCheckInputResponeList
);
}
});
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
else
{
return
null
;
}
}
return
pointCheckRespone
;
}
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
)
{
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
toke
,
product
,
appKey
,
check
.
getId
());
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
if
(
planPointInfo
!=
null
)
{
pointCheckRespone
.
setPointId
(
pointId
);
pointCheckRespone
.
setPointName
(
planPointInfo
.
getPointName
());
pointCheckRespone
.
setPointNo
(
planPointInfo
.
getPointNo
());
pointCheckRespone
.
setPointStatus
(
"0"
);
pointCheckRespone
.
setPlanName
(
planPointInfo
.
getPlanName
());
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
planPointInfo
.
getUserId
());
for
(
AgencyUserModel
userModel
:
userModelList
)
{
pointCheckRespone
.
setUsername
(
userModel
.
getRealName
());
}
}
@Override
public
int
getCurrentPlanTaskCount
(
String
userId
)
{
return
planTaskMapper
.
getCurrentPlanTaskCount
(
userId
);
}
@Override
public
List
<
PlanTaskVo
>
getPlanTaskListByIds
(
String
toke
,
String
product
,
String
appKey
,
Long
[]
ids
)
{
List
<
PlanTaskVo
>
content
=
planTaskMapper
.
getPlanTaskListByIds
(
ids
);
String
userIds
=
""
;
String
deptIds
=
""
;
Set
<
String
>
set
=
new
HashSet
<>();
Set
<
String
>
deptIdSet
=
new
HashSet
<>();
Map
<
Long
,
Set
<
String
>>
deptMap
=
new
HashMap
<>();
content
.
forEach
(
s
->
{
String
userDept
=
s
.
getUserDept
();
if
(!
ValidationUtil
.
isEmpty
(
userDept
))
{
String
[]
udStrs
=
userDept
.
split
(
","
);
for
(
String
udStr
:
udStrs
)
{
try
{
String
[]
split
=
udStr
.
split
(
"@"
);
set
.
add
(
split
[
0
]);
if
(
split
.
length
>
1
)
{
if
(!
"-1"
.
equals
(
split
[
1
]))
{
deptIdSet
.
add
(
split
[
1
]);
}
if
(!
deptMap
.
containsKey
(
s
.
getId
()))
{
deptMap
.
put
(
s
.
getId
(),
new
HashSet
<>());
}
deptMap
.
get
(
s
.
getId
()).
add
(
split
[
1
]);
}
}
catch
(
Exception
e
)
{
}
}
}
});
List
<
String
>
userList
=
new
ArrayList
<>(
set
);
List
<
String
>
deptList
=
new
ArrayList
<>(
deptIdSet
);
Map
<
String
,
String
>
LoginName
=
new
HashMap
<>();
Map
<
String
,
String
>
userMap
=
new
HashMap
<>();
Map
<
String
,
String
>
depMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
userIds
=
String
.
join
(
","
,
userList
);
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
userIds
);
userMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
for
(
AgencyUserModel
agencyUserModel
:
userModelList
)
{
LoginName
.
put
(
agencyUserModel
.
getUserId
(),
agencyUserModel
.
getMobile
()
!=
null
?
agencyUserModel
.
getMobile
()
:
agencyUserModel
.
getLandlinePhone
());
}
}
if
(!
CollectionUtils
.
isEmpty
(
deptList
))
{
String
dept
=
String
.
join
(
","
,
deptList
);
List
<
LinkedHashMap
>
deptL
=
remoteSecurityService
.
listDepartmentByDeptIds
(
toke
,
product
,
appKey
,
dept
);
if
(
deptL
!=
null
&&
deptL
.
size
()
>
0
)
{
// 新安全
content
.
forEach
(
s
->
{
Set
<
String
>
set1
=
deptMap
.
get
(
s
.
getId
());
if
(!
ValidationUtil
.
isEmpty
(
set1
))
{
deptL
.
forEach
(
s1
->
{
if
(
set1
.
contains
(
s1
.
get
(
"sequenceNbr"
)))
{
if
(!
ValidationUtil
.
isEmpty
(
s
.
getDeptName
()))
{
s
.
setDeptName
(
s
.
getDeptName
()
+
","
+
s1
.
get
(
"departmentName"
));
}
else
{
s
.
setDeptName
(
s1
.
get
(
"departmentName"
).
toString
());
}
}
});
if
(
set1
.
contains
(
"-1"
))
{
if
(!
ValidationUtil
.
isEmpty
(
s
.
getDeptName
()))
{
s
.
setDeptName
(
s
.
getDeptName
()
+
","
+
"其他"
);
}
else
{
s
.
setDeptName
(
"其他"
);
}
}
}
});
}
}
Map
<
String
,
String
>
finalUserMap
=
userMap
;
content
.
forEach
(
c
->
{
StringBuilder
userNames
=
new
StringBuilder
(
""
);
List
<
String
>
userIdsList
=
Arrays
.
asList
(
c
.
getUserName
().
split
(
","
));
for
(
String
userId
:
userIdsList
)
{
userNames
.
append
(
finalUserMap
.
get
(
userId
));
userNames
.
append
(
","
);
}
c
.
setUserName
(
userNames
.
toString
());
});
return
content
;
}
@Override
public
Page
<
CheckChkExListBo
>
getChkExList
(
String
toke
,
String
product
,
String
appKey
,
CheckPtListPageParam
param
)
{
long
total
=
planTaskMapper
.
countChkExListData
(
param
);
List
<
CheckChkExListBo
>
content
=
planTaskMapper
.
getChkExList
(
param
);
// 获取用户联系方式
String
userIds
=
""
;
Set
<
String
>
set
=
new
HashSet
<>();
content
.
forEach
(
s
->
{
if
(
s
.
getRealName
()
!=
null
)
{
String
[]
sArr
=
s
.
getRealName
().
split
(
","
);
set
.
addAll
(
Arrays
.
asList
(
sArr
));
}
});
List
<
String
>
userList
=
new
ArrayList
<>(
set
);
Map
<
String
,
AgencyUserModel
>
agencyUserModelMap
=
new
HashMap
<>();
if
(!
CollectionUtils
.
isEmpty
(
userList
))
{
userIds
=
String
.
join
(
","
,
userList
);
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
userIds
);
agencyUserModelMap
=
userModelList
.
stream
()
.
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
Function
.
identity
()));
}
for
(
CheckChkExListBo
bo
:
content
)
{
ArrayList
<
String
>
names
=
new
ArrayList
<>();
ArrayList
<
String
>
mobiles
=
new
ArrayList
<>();
String
nameStrings
=
String
.
join
(
","
,
names
);
String
[]
realNames
=
bo
.
getRealName
().
split
(
","
);
if
(
realNames
.
length
>
1
)
{
System
.
out
.
println
(
"asd"
);
}
for
(
int
i
=
0
;
i
<
realNames
.
length
;
i
++)
{
if
(
agencyUserModelMap
.
containsKey
(
realNames
[
i
]))
{
AgencyUserModel
agencyUserModel
=
agencyUserModelMap
.
get
(
realNames
[
i
]);
names
.
add
(
agencyUserModel
.
getRealName
());
if
(
StringUtil
.
isNotEmpty
(
agencyUserModel
.
getMobile
()))
{
mobiles
.
add
(
agencyUserModel
.
getMobile
());
}
}
}
bo
.
setRealName
(
String
.
join
(
","
,
names
));
if
(
mobiles
.
size
()
>
0
)
{
bo
.
setLoginName
(
String
.
join
(
","
,
mobiles
));
}
}
Page
<
CheckChkExListBo
>
result
=
new
PageImpl
<
CheckChkExListBo
>(
content
,
param
,
total
);
return
result
;
}
@Override
public
Map
<
String
,
Object
>
getPlanTaskStatisticsForApp
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
getPlanTaskStatisticsForApp
(
params
);
}
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetail
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
)
{
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetail
(
toke
,
product
,
appKey
,
check
.
getId
());
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
if
(
planPointInfo
!=
null
)
{
List
<
String
>
userIds
=
Arrays
.
asList
(
planPointInfo
.
getUsername
().
split
(
","
));
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
planPointInfo
.
getUsername
());
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
if
(
userModelMap
!=
null
)
{
List
<
String
>
userNameList
=
new
ArrayList
<>();
for
(
String
userId
:
userIds
)
{
userNameList
.
add
(
userModelMap
.
get
(
userId
));
}
userNameList
.
remove
(
""
);
userNameList
.
remove
(
null
);
pointCheckRespone
.
setUsername
(
Joiner
.
on
(
","
).
join
(
userNameList
));
}
DepartmentModel
departmentBo
=
remoteSecurityService
.
getDepartmentByDeptId
(
toke
,
product
,
appKey
,
planPointInfo
.
getUsername
());
if
(
departmentBo
!=
null
)
{
pointCheckRespone
.
setDepartmentName
(
departmentBo
.
getDepartmentName
());
}
pointCheckRespone
.
setPointId
(
pointId
);
pointCheckRespone
.
setPointName
(
planPointInfo
.
getPointName
());
pointCheckRespone
.
setPointNo
(
planPointInfo
.
getPointNo
());
pointCheckRespone
.
setPointStatus
(
"0"
);
pointCheckRespone
.
setPlanName
(
planPointInfo
.
getPlanName
());
List
<
PointCheckDetailBo
>
pointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
planPointInfo
.
getRouteId
(),
planPointInfo
.
getPointId
());
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
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
());
String
key
=
ObjectUtils
.
isEmpty
(
action
.
getClassifyName
())
?
"其他"
:
action
.
getClassifyName
();
if
(
appResponeMap
.
containsKey
(
key
))
{
appResponeMap
.
getJSONArray
(
key
).
add
(
input
);
}
else
{
List
<
AppCheckInputRespone
>
appCheckInputResponeList
=
new
ArrayList
<
AppCheckInputRespone
>();
appCheckInputResponeList
.
add
(
input
);
appResponeMap
.
put
(
key
,
appCheckInputResponeList
);
}
});
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
else
{
return
null
;
}
}
return
pointCheckRespone
;
}
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
)
{
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
toke
,
product
,
appKey
,
check
.
getId
());
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
if
(
planPointInfo
!=
null
)
{
pointCheckRespone
.
setPointId
(
pointId
);
pointCheckRespone
.
setPointName
(
planPointInfo
.
getPointName
());
pointCheckRespone
.
setPointNo
(
planPointInfo
.
getPointNo
());
pointCheckRespone
.
setPointStatus
(
"0"
);
pointCheckRespone
.
setPlanName
(
planPointInfo
.
getPlanName
());
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
planPointInfo
.
getUserId
());
for
(
AgencyUserModel
userModel
:
userModelList
)
{
pointCheckRespone
.
setUsername
(
userModel
.
getRealName
());
}
// DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId());
DepartmentModel
departmentModel
=
new
DepartmentModel
();
pointCheckRespone
.
setDepartmentName
(
departmentModel
.
getDepartmentName
());
List
<
PointCheckDetailBo
>
pointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
planPointInfo
.
getRouteId
(),
planPointInfo
.
getPointId
());
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
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
());
String
classifyName
=
action
.
getClassifyName
();
if
(!
StringUtil
.
isNotEmpty
(
classifyName
))
{
classifyName
=
"其他"
;
}
String
riskDesc
=
action
.
getRiskDesc
();
if
(!
StringUtil
.
isNotEmpty
(
riskDesc
))
{
riskDesc
=
XJConstant
.
DEFAULT_RISKDESC
;
}
JSONObject
classifyJson
;
if
(
appResponeMap
.
containsKey
(
classifyName
))
{
classifyJson
=
appResponeMap
.
getJSONObject
(
classifyName
);
}
else
{
classifyJson
=
new
JSONObject
();
}
JSONArray
riskDescArr
;
if
(
classifyJson
.
containsKey
(
riskDesc
))
{
riskDescArr
=
classifyJson
.
getJSONArray
(
riskDesc
);
}
else
{
riskDescArr
=
new
JSONArray
();
}
riskDescArr
.
add
(
action
);
classifyJson
.
put
(
riskDesc
,
riskDescArr
);
appResponeMap
.
put
(
classifyName
,
classifyJson
);
});
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
else
{
return
null
;
}
}
return
pointCheckRespone
;
}
@Override
public
String
getCumulativePlanCountByOrgCode
(
String
loginOrgCode
)
{
return
planTaskMapper
.
getCumulativePlanCountByOrgCode
(
loginOrgCode
);
}
@Override
public
List
<
LeavePlanTaskVo
>
queryLeavePlanTask
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
queryLeavePlanTask
(
params
);
}
@Override
public
List
<
CodeOrderVo
>
queryCodeOrderVo
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
queryCodeOrderVo
(
params
);
}
@Override
public
PlanTask
selectPlanTaskStatus
(
Long
id
)
{
// TODO Auto-generated method stub
if
(
iplanTaskDao
.
existsById
(
id
))
{
return
iplanTaskDao
.
findById
(
id
).
get
();
}
return
null
;
}
@Override
public
void
initPlanStatusOrGenDate
()
{
planMapper
.
initUpdatePlanStatus
();
planMapper
.
initUpdatePlanNextGenDate
();
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryPlanTaskTimeAxis
(
Long
userId
,
Integer
createDate
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
String
endTime
=
DateUtil
.
getShortCurrentDate
();
;
String
beginTime
=
""
;
if
(
createDate
!=
null
&&
createDate
==
7
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
7
,
"yyyy-MM-dd"
);
}
else
if
(
createDate
!=
null
&&
createDate
==
30
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
30
,
"yyyy-MM-dd"
);
}
else
{
beginTime
=
DateUtil
.
getShortCurrentDate
();
}
params
.
put
(
"beginTime"
,
beginTime
+
" 00:00:00"
);
params
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
List
<
Map
<
String
,
Object
>>
content
=
planTaskMapper
.
queryPlanTaskTimeAxis
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
Set
<
String
>
userIds
=
Sets
.
newHashSet
();
content
.
forEach
(
e
->
{
String
id
=
e
.
get
(
"userId"
).
toString
();
if
(
StringUtil
.
isNotEmpty
(
id
))
{
userIds
.
add
(
id
);
}
});
Toke
toke
=
remoteSecurityService
.
getServerToken
();
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
.
getToke
(),
toke
.
getProduct
(),
toke
.
getAppKey
(),
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
content
.
forEach
(
e
->
{
StringBuffer
userNames
=
new
StringBuffer
();
List
<
String
>
userIds1
=
Arrays
.
asList
(
e
.
get
(
"userId"
).
toString
().
split
(
","
));
for
(
String
userId1
:
userIds1
)
{
userNames
.
append
(
userModelMap
.
get
(
userId1
)).
append
(
","
);
}
e
.
put
(
"userName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
));
e
.
put
(
"beginTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"beginTime"
),
DateUtil
.
LONG_PATTERN
));
e
.
put
(
"endTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"endTime"
),
DateUtil
.
LONG_PATTERN
));
});
}
return
content
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryTimeAxis
(
Long
userId
,
Integer
createDate
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
String
endTime
=
DateUtil
.
getShortCurrentDate
();
;
String
beginTime
=
""
;
if
(
createDate
!=
null
&&
createDate
==
7
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
7
,
"yyyy-MM-dd"
);
}
else
if
(
createDate
!=
null
&&
createDate
==
30
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
30
,
"yyyy-MM-dd"
);
}
else
{
beginTime
=
DateUtil
.
getShortCurrentDate
();
}
params
.
put
(
"beginTime"
,
beginTime
+
" 00:00:00"
);
params
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
String
structListString
=
equipFeign
.
getStructureNameAll
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
structListString
);
JSONArray
structList
=
jsonObject
.
getJSONArray
(
"result"
);
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
content
=
planTaskMapper
.
queryTimeAxis
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
Set
<
String
>
userIds
=
Sets
.
newHashSet
();
content
.
forEach
(
e
->
{
String
id
=
e
.
get
(
"userId"
).
toString
();
if
(
StringUtil
.
isNotEmpty
(
id
))
{
userIds
.
add
(
id
);
}
});
Toke
toke
=
remoteSecurityService
.
getServerToken
();
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
.
getToke
(),
toke
.
getProduct
(),
toke
.
getAppKey
(),
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
content
.
forEach
(
e
->
{
StringBuffer
userNames
=
new
StringBuffer
();
List
<
String
>
userIds1
=
Arrays
.
asList
(
e
.
get
(
"userId"
).
toString
().
split
(
","
));
for
(
String
userId1
:
userIds1
)
{
userNames
.
append
(
userModelMap
.
get
(
userId1
)).
append
(
","
);
}
HashMap
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"userName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
));
map
.
put
(
"beginTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"beginTime"
),
DateUtil
.
LONG_PATTERN
));
map
.
put
(
"endTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"endTime"
),
DateUtil
.
LONG_PATTERN
));
map
.
put
(
"leftName"
,
"巡检点"
);
map
.
put
(
"titleName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
)
+
"-"
+
e
.
get
(
"name"
).
toString
()
+
"-"
+
e
.
get
(
"STATUS"
).
toString
());
String
structName
=
""
;
if
(!
StringUtils
.
isEmpty
(
e
.
get
(
"risk_source_id"
)))
{
for
(
int
i
=
0
;
i
<
structList
.
size
();
i
++)
{
if
(
structList
.
getJSONObject
(
i
).
get
(
"id"
).
equals
(
e
.
get
(
"risk_source_id"
)))
{
structName
=
structList
.
getJSONObject
(
i
).
get
(
"name"
).
toString
();
}
}
}
else
{
structName
=
"无"
;
}
if
(!
StringUtils
.
isEmpty
(
e
.
get
(
"executorDate"
)))
{
map
.
put
(
"firstPropsValue"
,
structName
+
"-"
+
e
.
get
(
"executorDate"
));
}
else
{
map
.
put
(
"firstPropsValue"
,
structName
+
"-无"
);
}
result
.
add
(
map
);
});
}
return
result
;
}
DepartmentModel
departmentModel
=
new
DepartmentModel
();
pointCheckRespone
.
setDepartmentName
(
departmentModel
.
getDepartmentName
());
List
<
PointCheckDetailBo
>
pointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
planPointInfo
.
getRouteId
(),
planPointInfo
.
getPointId
());
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
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
());
String
classifyName
=
action
.
getClassifyName
();
if
(!
StringUtil
.
isNotEmpty
(
classifyName
))
{
classifyName
=
"其他"
;
}
String
riskDesc
=
action
.
getRiskDesc
();
if
(!
StringUtil
.
isNotEmpty
(
riskDesc
))
{
riskDesc
=
XJConstant
.
DEFAULT_RISKDESC
;
}
JSONObject
classifyJson
;
if
(
appResponeMap
.
containsKey
(
classifyName
))
{
classifyJson
=
appResponeMap
.
getJSONObject
(
classifyName
);
}
else
{
classifyJson
=
new
JSONObject
();
}
JSONArray
riskDescArr
;
if
(
classifyJson
.
containsKey
(
riskDesc
))
{
riskDescArr
=
classifyJson
.
getJSONArray
(
riskDesc
);
}
else
{
riskDescArr
=
new
JSONArray
();
}
riskDescArr
.
add
(
action
);
classifyJson
.
put
(
riskDesc
,
riskDescArr
);
appResponeMap
.
put
(
classifyName
,
classifyJson
);
});
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
else
{
return
null
;
}
}
return
pointCheckRespone
;
}
@Override
public
String
getCumulativePlanCountByOrgCode
(
String
loginOrgCode
)
{
return
planTaskMapper
.
getCumulativePlanCountByOrgCode
(
loginOrgCode
);
}
@Override
public
List
<
LeavePlanTaskVo
>
queryLeavePlanTask
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
queryLeavePlanTask
(
params
);
}
@Override
public
List
<
CodeOrderVo
>
queryCodeOrderVo
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
queryCodeOrderVo
(
params
);
}
@Override
public
PlanTask
selectPlanTaskStatus
(
Long
id
)
{
// TODO Auto-generated method stub
if
(
iplanTaskDao
.
existsById
(
id
))
{
return
iplanTaskDao
.
findById
(
id
).
get
();
}
return
null
;
}
@Override
public
void
initPlanStatusOrGenDate
()
{
planMapper
.
initUpdatePlanStatus
();
planMapper
.
initUpdatePlanNextGenDate
();
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryPlanTaskTimeAxis
(
Long
userId
,
Integer
createDate
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
String
endTime
=
DateUtil
.
getShortCurrentDate
();
;
String
beginTime
=
""
;
if
(
createDate
!=
null
&&
createDate
==
7
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
7
,
"yyyy-MM-dd"
);
}
else
if
(
createDate
!=
null
&&
createDate
==
30
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
30
,
"yyyy-MM-dd"
);
}
else
{
beginTime
=
DateUtil
.
getShortCurrentDate
();
}
params
.
put
(
"beginTime"
,
beginTime
+
" 00:00:00"
);
params
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
List
<
Map
<
String
,
Object
>>
content
=
planTaskMapper
.
queryPlanTaskTimeAxis
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
Set
<
String
>
userIds
=
Sets
.
newHashSet
();
content
.
forEach
(
e
->
{
String
id
=
e
.
get
(
"userId"
).
toString
();
if
(
StringUtil
.
isNotEmpty
(
id
))
{
userIds
.
add
(
id
);
}
});
Toke
toke
=
remoteSecurityService
.
getServerToken
();
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
.
getToke
(),
toke
.
getProduct
(),
toke
.
getAppKey
(),
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
content
.
forEach
(
e
->
{
StringBuffer
userNames
=
new
StringBuffer
();
List
<
String
>
userIds1
=
Arrays
.
asList
(
e
.
get
(
"userId"
).
toString
().
split
(
","
));
for
(
String
userId1
:
userIds1
)
{
userNames
.
append
(
userModelMap
.
get
(
userId1
)).
append
(
","
);
}
e
.
put
(
"userName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
));
e
.
put
(
"beginTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"beginTime"
),
DateUtil
.
LONG_PATTERN
));
e
.
put
(
"endTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"endTime"
),
DateUtil
.
LONG_PATTERN
));
});
}
return
content
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryTimeAxis
(
Long
userId
,
Integer
createDate
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
String
endTime
=
DateUtil
.
getShortCurrentDate
();
;
String
beginTime
=
""
;
if
(
createDate
!=
null
&&
createDate
==
7
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
7
,
"yyyy-MM-dd"
);
}
else
if
(
createDate
!=
null
&&
createDate
==
30
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
30
,
"yyyy-MM-dd"
);
}
else
{
beginTime
=
DateUtil
.
getShortCurrentDate
();
}
params
.
put
(
"beginTime"
,
beginTime
+
" 00:00:00"
);
params
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
String
structListString
=
equipFeign
.
getStructureNameAll
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
structListString
);
JSONArray
structList
=
jsonObject
.
getJSONArray
(
"result"
);
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
content
=
planTaskMapper
.
queryTimeAxis
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
Set
<
String
>
userIds
=
Sets
.
newHashSet
();
content
.
forEach
(
e
->
{
String
id
=
e
.
get
(
"userId"
).
toString
();
if
(
StringUtil
.
isNotEmpty
(
id
))
{
userIds
.
add
(
id
);
}
});
Toke
toke
=
remoteSecurityService
.
getServerToken
();
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
.
getToke
(),
toke
.
getProduct
(),
toke
.
getAppKey
(),
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
content
.
forEach
(
e
->
{
StringBuffer
userNames
=
new
StringBuffer
();
List
<
String
>
userIds1
=
Arrays
.
asList
(
e
.
get
(
"userId"
).
toString
().
split
(
","
));
for
(
String
userId1
:
userIds1
)
{
userNames
.
append
(
userModelMap
.
get
(
userId1
)).
append
(
","
);
}
HashMap
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"userName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
));
map
.
put
(
"beginTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"beginTime"
),
DateUtil
.
LONG_PATTERN
));
map
.
put
(
"endTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"endTime"
),
DateUtil
.
LONG_PATTERN
));
map
.
put
(
"leftName"
,
"巡检点"
);
map
.
put
(
"titleName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
)
+
"-"
+
e
.
get
(
"name"
).
toString
()
+
"-"
+
e
.
get
(
"STATUS"
).
toString
());
String
structName
=
""
;
if
(!
StringUtils
.
isEmpty
(
e
.
get
(
"risk_source_id"
)))
{
for
(
int
i
=
0
;
i
<
structList
.
size
();
i
++)
{
if
(
structList
.
getJSONObject
(
i
).
get
(
"id"
).
equals
(
e
.
get
(
"risk_source_id"
)))
{
structName
=
structList
.
getJSONObject
(
i
).
get
(
"name"
).
toString
();
}
}
}
else
{
structName
=
"无"
;
}
if
(!
StringUtils
.
isEmpty
(
e
.
get
(
"executorDate"
)))
{
map
.
put
(
"firstPropsValue"
,
structName
+
"-"
+
e
.
get
(
"executorDate"
));
}
else
{
map
.
put
(
"firstPropsValue"
,
structName
+
"-无"
);
}
result
.
add
(
map
);
});
}
return
result
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/intfc/IPlanTaskService.java
View file @
531d50d7
...
...
@@ -5,16 +5,15 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.data.domain.Page
;
import
com.yeejoin.amos.supervision.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.supervision.business.param.CheckPtListPageParam
;
import
com.yeejoin.amos.supervision.business.param.PlanTaskPageParam
;
import
com.yeejoin.amos.supervision.business.vo.CodeOrderVo
;
import
com.yeejoin.amos.supervision.business.vo.LeavePlanTaskVo
;
import
com.yeejoin.amos.supervision.business.vo.PlanTaskVo
;
import
com.yeejoin.amos.supervision.core.common.request.CommonPageable
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.data.domain.Page
;
import
com.yeejoin.amos.supervision.business.param.CheckPtListPageParam
;
import
com.yeejoin.amos.supervision.business.param.PlanTaskPageParam
;
import
com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone
;
import
com.yeejoin.amos.supervision.dao.entity.PlanTask
;
...
...
@@ -171,4 +170,6 @@ public interface IPlanTaskService {
List
<
Map
<
String
,
Object
>>
queryPlanTaskTimeAxis
(
Long
userId
,
Integer
createDate
);
List
<
Map
<
String
,
Object
>>
queryTimeAxis
(
Long
userId
,
Integer
createDate
);
Boolean
taskExecutionImportPlan
(
Long
id
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/MsgLogController.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
* 消息流水表
*
* @author system_generator
* @date 2022-04-20
*/
@RestController
@Api
(
tags
=
"消息流水表Api"
)
@RequestMapping
(
value
=
"/msg-log"
)
public
class
MsgLogController
extends
BaseController
{
@Autowired
MsgLogServiceImpl
msgLogServiceImpl
;
/**
* 新增消息流水表
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消息流水表"
,
notes
=
"新增消息流水表"
)
public
ResponseModel
<
MsgLogDto
>
save
(
@RequestBody
MsgLogDto
model
)
{
model
=
msgLogServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新消息流水表"
,
notes
=
"根据sequenceNbr更新消息流水表"
)
public
ResponseModel
<
MsgLogDto
>
updateBySequenceNbrMsgLog
(
@RequestBody
MsgLogDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
msgLogServiceImpl
.
updateWithModel
(
model
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除消息流水表"
,
notes
=
"根据sequenceNbr删除消息流水表"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
msgLogServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个消息流水表"
,
notes
=
"根据sequenceNbr查询单个消息流水表"
)
public
ResponseModel
<
MsgLogDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
msgLogServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"消息流水表分页查询"
,
notes
=
"消息流水表分页查询"
)
public
ResponseModel
<
Page
<
MsgLogDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
MsgLogDto
>
page
=
new
Page
<
MsgLogDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
msgLogServiceImpl
.
queryForMsgLogPage
(
page
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"消息流水表列表全部数据查询"
,
notes
=
"消息流水表列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
MsgLogDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
msgLogServiceImpl
.
queryForMsgLogList
());
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/SpecialEquipmentController.java
View file @
531d50d7
...
...
@@ -26,9 +26,11 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentRegionNum
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintainInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.TestInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.SpecialEquipmentCategoryEnum
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorRelationService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESCylinderServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentRegionNumServiceImpl
;
...
...
@@ -112,6 +114,9 @@ public class SpecialEquipmentController extends BaseController {
@Autowired
EquipmentRegionNumServiceImpl
equipmentRegionNumServiceImpl
;
@Autowired
ESCylinderServiceImpl
esCylinderService
;
/**
* ES查询特种设备信息 带分页 加经纬度过滤 keyword 搜索
...
...
@@ -128,9 +133,12 @@ public class SpecialEquipmentController extends BaseController {
throw
new
BadRequest
(
"参数校验失败."
);
}
if
(
StringUtils
.
isNotBlank
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
// 查找特定设备
if
(
"3000"
.
equals
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
if
(
SpecialEquipmentCategoryEnum
.
ELEVATOR
.
getCode
()
.
equals
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
result
=
esElevatorService
.
queryPageByDto
(
esSpecialEquipmentDto
,
current
,
size
);
}
if
(
SpecialEquipmentCategoryEnum
.
PRESSURE_VESSEL
.
getCode
().
equals
(
esSpecialEquipmentDto
.
getCategoryCode
()))
{
result
=
esCylinderService
.
queryPageByDto
(
esSpecialEquipmentDto
,
current
,
size
);
}
}
return
ResponseHelper
.
buildResponse
(
result
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/dao/ESCylinderRepository.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
dao
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
import
org.springframework.stereotype.Repository
;
/**
* @author fengwang
* @date 2021-09-26.
*/
@Repository
public
interface
ESCylinderRepository
extends
PagingAndSortingRepository
<
EsCylinder
,
Long
>
{
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/ESCylinderServiceImpl.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EsSpecialEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.SpecialEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.SpecialEquipmentCategoryEnum
;
import
com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderRepository
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EndUserServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.common.geo.GeoPoint
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
import
org.springframework.data.elasticsearch.core.SearchHit
;
import
org.springframework.data.elasticsearch.core.SearchHits
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQuery
;
import
org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* <pre>
* 压力容器信息ES检索服务
* </pre>
*
* @author tb
* @version 2022年4月20日
*/
@Service
public
class
ESCylinderServiceImpl
{
@Autowired
private
ElasticsearchRestTemplate
elasticsearchTemplate
;
@Autowired
private
ESCylinderRepository
esCylinderRepository
;
@Autowired
private
EndUserServiceImpl
endUserService
;
/**
* <pre>
* 保存气瓶信息
* </pre>
*
* @param cylinderInfoList 保存气瓶信息
*/
public
boolean
saveEsCylinderToES
(
List
<
CylinderInfo
>
cylinderInfoList
)
{
List
<
EsCylinder
>
esCylinderList
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
cylinderInfoList
))
{
cylinderInfoList
.
forEach
(
cylinderInfo
->
{
EsCylinder
esCylinder
=
new
EsCylinder
();
if
(
StringUtils
.
isNotEmpty
(
cylinderInfo
.
getLongitude
()))
{
esCylinder
.
setLongitude
(
Double
.
parseDouble
(
cylinderInfo
.
getLongitude
()));
}
if
(
StringUtils
.
isNotEmpty
(
cylinderInfo
.
getLatitude
()))
{
esCylinder
.
setLatitude
(
Double
.
parseDouble
(
cylinderInfo
.
getLatitude
()));
}
esCylinder
.
setSequenceNbr
(
cylinderInfo
.
getSequenceNbr
());
EndUser
endUser
=
endUserService
.
getOne
(
new
LambdaQueryWrapper
<
EndUser
>().
eq
(
EndUser:
:
getCustomCode
,
cylinderInfo
.
getEndCustomCode
()));
if
(!
ValidationUtil
.
isEmpty
(
endUser
))
{
esCylinder
.
setAddress
(
endUser
.
getAddress
());
}
esCylinder
.
setFactoryNum
(
cylinderInfo
.
getFactoryNum
());
esCylinder
.
setUnitName
(
cylinderInfo
.
getUnitName
());
if
(
StringUtils
.
isNotBlank
(
cylinderInfo
.
getLatitude
())
&&
StringUtils
.
isNotBlank
(
cylinderInfo
.
getLongitude
()))
{
double
lat
=
Double
.
parseDouble
(
cylinderInfo
.
getLatitude
());
double
lon
=
Double
.
parseDouble
(
cylinderInfo
.
getLongitude
());
esCylinder
.
setLocation
(
new
GeoPoint
(
lat
,
lon
));
}
esCylinderList
.
add
(
esCylinder
);
});
}
esCylinderRepository
.
saveAll
(
esCylinderList
);
return
true
;
}
public
Page
<
SpecialEquipmentDto
>
queryPageByDto
(
EsSpecialEquipmentDto
esSpecialEquipmentDto
,
int
current
,
int
size
)
{
Page
<
SpecialEquipmentDto
>
result
=
new
Page
<>(
current
,
size
);
Double
startLongitude
=
esSpecialEquipmentDto
.
getStartLongitude
();
Double
startLatitude
=
esSpecialEquipmentDto
.
getStartLatitude
();
Double
endLongitude
=
esSpecialEquipmentDto
.
getEndLongitude
();
Double
endLatitude
=
esSpecialEquipmentDto
.
getEndLatitude
();
String
regionCode
=
esSpecialEquipmentDto
.
getRegionCode
();
String
keyword
=
esSpecialEquipmentDto
.
getKeyword
();
/**
* 通用匹配规则,条件构建
*/
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 经度比start 大比end 小 纬度比start 小 比end 大
if
(!
ValidationUtil
.
isEmpty
(
startLongitude
)
&&
!
ValidationUtil
.
isEmpty
(
startLatitude
)
&&
!
ValidationUtil
.
isEmpty
(
endLongitude
)
&&
!
ValidationUtil
.
isEmpty
(
endLatitude
))
{
BoolQueryBuilder
longLatMust
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
qb1
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
"longitude"
).
gte
(
startLongitude
).
lte
(
endLongitude
));
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
rangeQuery
(
"latitude"
).
gte
(
endLatitude
).
lte
(
startLatitude
));
longLatMust
.
must
(
qb1
);
longLatMust
.
must
(
qb2
);
boolMust
.
must
(
longLatMust
);
}
if
(!
ValidationUtil
.
isEmpty
(
regionCode
))
{
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
filter
(
QueryBuilders
.
matchPhraseQuery
(
"regionCode"
,
regionCode
));
boolMust
.
must
(
qb2
);
}
if
(!
ValidationUtil
.
isEmpty
(
keyword
))
{
BoolQueryBuilder
qb0
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"factoryNum"
,
keyword
));
boolMust
.
should
(
qb0
);
BoolQueryBuilder
qb1
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"address"
,
keyword
));
boolMust
.
should
(
qb1
);
BoolQueryBuilder
qb2
=
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"unitName"
,
keyword
));
boolMust
.
should
(
qb2
);
boolMust
.
minimumShouldMatch
(
1
);
}
// 创建查询构造器
NativeSearchQuery
query
=
new
NativeSearchQueryBuilder
()
// 分页
.
withPageable
(
PageRequest
.
of
(
current
-
1
,
size
))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.
withQuery
(
boolMust
).
build
();
query
.
setTrackTotalHits
(
true
);
query
.
setMaxResults
(
size
);
List
<
SpecialEquipmentDto
>
list
=
new
LinkedList
<>();
long
total
=
0
;
try
{
SearchHits
<
EsCylinder
>
searchHits
=
elasticsearchTemplate
.
search
(
query
,
EsCylinder
.
class
);
for
(
SearchHit
searchHit
:
searchHits
.
getSearchHits
())
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
searchHit
.
getContent
());
SpecialEquipmentDto
esCylinderDto
=
JSONObject
.
toJavaObject
(
jsonObject
,
SpecialEquipmentDto
.
class
);
esCylinderDto
.
setCategoryCode
(
SpecialEquipmentCategoryEnum
.
PRESSURE_VESSEL
.
getCode
());
esCylinderDto
.
setUnitName
(
jsonObject
.
getString
(
"unitName"
));
esCylinderDto
.
setRegisterCode
(
jsonObject
.
getString
(
"factoryNum"
));
list
.
add
(
esCylinderDto
);
}
total
=
searchHits
.
getTotalHits
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
result
.
setRecords
(
list
);
result
.
setTotal
(
total
);
return
result
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/MsgLogServiceImpl.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.MsgLogMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IMsgLogService
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
/**
* 消息流水表服务实现类
*
* @author system_generator
* @date 2022-04-20
*/
@Service
public
class
MsgLogServiceImpl
extends
BaseService
<
MsgLogDto
,
MsgLog
,
MsgLogMapper
>
implements
IMsgLogService
{
/**
* 分页查询
*/
public
Page
<
MsgLogDto
>
queryForMsgLogPage
(
Page
<
MsgLogDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
MsgLogDto
>
queryForMsgLogList
()
{
return
this
.
queryForList
(
""
,
false
);
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
View file @
531d50d7
...
...
@@ -166,7 +166,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
if
(
redisUtils
.
hasKey
(
RedisKey
.
CTI_USER_TOKEN
))
{
// 验证token
boolean
validToken
=
TokenOperation
.
refresh
(
redisUtils
.
get
(
RedisKey
.
CTI_USER_TOKEN
).
toString
());
if
(!
validToken
)
{
// 登陆
// 登陆
if
(!
validToken
)
{
this
.
loginCtiUser
();
}
}
else
{
// 登陆
...
...
@@ -178,9 +179,6 @@ public class TzsAuthServiceImpl implements TzsAuthService {
FeignClientResult
<
AgencyUserModel
>
agencyUserModel
=
Privilege
.
agencyUserClient
.
queryByUserName
(
ctiUserName
);
AgencyUserModel
userModel
=
agencyUserModel
.
getResult
();
RequestContext
.
setExeUserId
(
userModel
.
getUserId
());
if
(
userModel
==
null
)
{
throw
new
Exception
(
"无法获取用户信息"
);
}
saveUserRedis
(
userModel
,
ctiToken
);
}
catch
(
Exception
e
)
{
//删除失效token缓存
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/CylinderInfoController.java
View file @
531d50d7
...
...
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESCylinderServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingRecordDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto
;
...
...
@@ -20,10 +22,19 @@ import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.common.recycler.Recycler
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
...
...
@@ -31,7 +42,12 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 气瓶基本信息
...
...
@@ -53,6 +69,9 @@ public class CylinderInfoController extends BaseController {
@Autowired
CylinderFillingRecordServiceImpl
cylinderFillingRecordServiceImpl
;
@Autowired
ESCylinderServiceImpl
esCylinderService
;
private
Map
<
Integer
,
String
>
regionMap
;
...
...
@@ -87,7 +106,6 @@ public class CylinderInfoController extends BaseController {
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
...
...
@@ -841,4 +859,76 @@ public class CylinderInfoController extends BaseController {
return
ResponseHelper
.
buildResponse
(
true
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶超期数量统计"
)
@GetMapping
(
value
=
"/{earlyWarningLevel}/statistics"
)
public
ResponseModel
<
Integer
>
getOverDateStatisticsNumber
(
@PathVariable
String
earlyWarningLevel
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getOverDateStatisticsNumber
(
earlyWarningLevel
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"按照预警类型查询气瓶分页列表"
,
notes
=
"按照预警类型查询气瓶分页列表"
)
@GetMapping
(
value
=
"/{earlyWarningLevel}/page"
)
public
ResponseModel
<
Page
<
CylinderInfoDto
>>
getOverDateStatisticsNumber
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@PathVariable
String
earlyWarningLevel
){
Page
<
CylinderInfoDto
>
page
=
new
Page
<>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
earlyWarningLevelPageList
(
page
,
earlyWarningLevel
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶详情"
)
@GetMapping
(
value
=
"/{sequenceCode}/detail"
)
public
ResponseModel
<
CylinderInfoDto
>
getDetail
(
@PathVariable
String
sequenceCode
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getDetail
(
sequenceCode
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶处置日志"
)
@GetMapping
(
value
=
"/msg/{sequenceCode}/list"
)
public
ResponseModel
<
List
<
MsgLog
>>
getMsgList
(
@PathVariable
String
sequenceCode
,
@RequestParam
(
value
=
"terminalType"
,
required
=
false
)
String
terminalType
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
getMsgList
(
sequenceCode
,
terminalType
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"下次检验日期更新"
,
notes
=
"下次检验日期更新"
)
@PutMapping
(
value
=
"/nextInspectionDate/update"
)
public
ResponseModel
<
Boolean
>
nextInspectionDateUpdate
(
@RequestBody
List
<
CylinderInfoDto
>
cylinderInfoDtos
){
return
ResponseHelper
.
buildResponse
(
cylinderInfoServiceImpl
.
nextInspectionDateUpdate
(
cylinderInfoDtos
));
}
/**
* 气瓶信息放入es
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/init"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"气瓶信息放入es"
,
notes
=
"气瓶信息放入es"
)
public
void
init
(
Integer
num
)
{
IPage
<
CylinderInfo
>
cylinderInfoPage
=
new
Page
<>();
Integer
count
=
cylinderInfoServiceImpl
.
count
();
Integer
times
=
0
;
if
(
ValidationUtil
.
isEmpty
(
num
)
&&
count
!=
0
)
{
times
=
count
/
500
;
int
last
=
count
%
500
;
if
(
last
>
0
)
{
times
++;
}
}
else
if
(
count
!=
0
)
{
times
=
num
;
}
for
(
int
i
=
0
;
i
<
times
;
i
++)
{
cylinderInfoPage
.
setCurrent
(
i
);
cylinderInfoPage
.
setSize
(
500
);
cylinderInfoPage
=
cylinderInfoServiceImpl
.
page
(
cylinderInfoPage
);
esCylinderService
.
saveEsCylinderToES
(
cylinderInfoPage
.
getRecords
());
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/EndUserController.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EndUserServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EndUserDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
/**
* 气瓶终端用户
*
* @author system_generator
* @date 2022-04-21
*/
@RestController
@Api
(
tags
=
"气瓶终端用户Api"
)
@RequestMapping
(
value
=
"/end-user"
)
public
class
EndUserController
extends
BaseController
{
@Autowired
EndUserServiceImpl
endUserServiceImpl
;
/**
* 新增气瓶终端用户
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增气瓶终端用户"
,
notes
=
"新增气瓶终端用户"
)
public
ResponseModel
<
EndUserDto
>
save
(
@RequestBody
EndUserDto
model
)
{
model
=
endUserServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新气瓶终端用户"
,
notes
=
"根据sequenceNbr更新气瓶终端用户"
)
public
ResponseModel
<
EndUserDto
>
updateBySequenceNbrEndUser
(
@RequestBody
EndUserDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
endUserServiceImpl
.
updateWithModel
(
model
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除气瓶终端用户"
,
notes
=
"根据sequenceNbr删除气瓶终端用户"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
endUserServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个气瓶终端用户"
,
notes
=
"根据sequenceNbr查询单个气瓶终端用户"
)
public
ResponseModel
<
EndUserDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
endUserServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶终端用户分页查询"
,
notes
=
"气瓶终端用户分页查询"
)
public
ResponseModel
<
Page
<
EndUserDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
EndUserDto
>
page
=
new
Page
<
EndUserDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
endUserServiceImpl
.
queryForEndUserPage
(
page
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶终端用户列表全部数据查询"
,
notes
=
"气瓶终端用户列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
EndUserDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
endUserServiceImpl
.
queryForEndUserList
());
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/quartz/CylinderSchedulerJob.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
quartz
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
/**
* @author DELL
*/
@Component
@EnableScheduling
public
class
CylinderSchedulerJob
{
@Autowired
private
CylinderInfoServiceImpl
cylinderInfoService
;
/**
* 每天9点-日报生成
*/
@Scheduled
(
cron
=
"0 0 9 * * ?"
)
public
void
dayReport
()
{
cylinderInfoService
.
calEarlyWarningLevel
();
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/CylinderInfoServiceImpl.java
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.CylWarningMsgDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.EarlyWarningLevelEnum
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.*
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.*
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInfoService
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -27,6 +39,7 @@ import java.util.function.IntConsumer;
* @date 2021-12-14
*/
@Service
@Slf4j
public
class
CylinderInfoServiceImpl
extends
BaseService
<
CylinderInfoDto
,
CylinderInfo
,
CylinderInfoMapper
>
implements
ICylinderInfoService
{
...
...
@@ -78,6 +91,17 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Autowired
CylinderFillingUnloadDataUnitServiceImpl
cylinderFillingUnloadDataUnitServiceImpl
;
@Autowired
MsgLogServiceImpl
msgLogService
;
@Autowired
private
RuleTrigger
ruleTrigger
;
@Autowired
TzsAuthServiceImpl
tzsAuthService
;
@Value
(
"${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}"
)
private
String
packageId
;
/**
* 分页查询
...
...
@@ -558,4 +582,116 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
});
}
}
public
Integer
getOverDateStatisticsNumber
(
String
earlyWarningLevel
)
{
return
this
.
baseMapper
.
countOverDateNumber
(
earlyWarningLevel
);
}
public
Page
<
CylinderInfoDto
>
earlyWarningLevelPageList
(
Page
<
CylinderInfoDto
>
page
,
String
earlyWarningLevel
)
{
Page
<
CylinderInfoDto
>
result
=
this
.
baseMapper
.
queryPageListByEarlyWarningLevel
(
page
,
earlyWarningLevel
);
result
.
getRecords
().
forEach
(
r
->
{
r
.
setEarlyWarningLevelName
(
EarlyWarningLevelEnum
.
getEumByLevel
(
earlyWarningLevel
).
getName
());
r
.
setInspectionStatusDesc
(
EarlyWarningLevelEnum
.
getEumByLevel
(
earlyWarningLevel
).
getStatus
());
});
return
result
;
}
public
void
calEarlyWarningLevel
()
{
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间调用规则开始"
);
}
// 1.批量分组大小
int
size
=
500
;
int
total
=
this
.
count
();
int
groupNumber
=
total
/
size
+
1
;
// 2.批量小分组处理数据,调用规则
for
(
int
i
=
0
;
i
<
groupNumber
;
i
++)
{
Page
<
CylinderInfo
>
page
=
new
Page
<>();
page
.
setCurrent
(
i
);
page
.
setSize
(
size
);
LambdaQueryWrapper
<
CylinderInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
orderByDesc
(
CylinderInfo:
:
getSequenceNbr
);
IPage
<
CylinderInfo
>
result
=
this
.
page
(
page
,
wrapper
);
for
(
CylinderInfo
r
:
result
.
getRecords
())
{
// 设置token
tzsAuthService
.
setRequestContext
();
// 调用规则
this
.
touchRuleToCalLevel
(
r
);
}
}
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"气瓶超期预警时间调用规则完成"
);
}
}
private
void
touchRuleToCalLevel
(
CylinderInfo
r
)
{
Date
now
=
new
Date
();
//1.气瓶详情
CylinderInfoDto
cylinderInfoDto
=
this
.
getDetail
(
r
.
getSequenceCode
());
try
{
CylWarningMsgDto
cylWarningMsgDto
=
new
CylWarningMsgDto
();
int
interval
=
DateUtils
.
dateBetweenIncludeToday
(
cylinderInfoDto
.
getNextInspectionDate
(),
now
);
cylWarningMsgDto
.
setNum
(
String
.
valueOf
(
interval
));
cylWarningMsgDto
.
setFactoryNum
(
cylinderInfoDto
.
getFactoryNum
());
cylWarningMsgDto
.
setUserType
(
cylinderInfoDto
.
getCustomType
());
cylWarningMsgDto
.
setUserPeople
(
cylinderInfoDto
.
getCustomName
());
cylWarningMsgDto
.
setUserPeoplePhone
(
cylinderInfoDto
.
getContactPhone
());
cylWarningMsgDto
.
setCylSeq
(
cylinderInfoDto
.
getSequenceCode
());
cylWarningMsgDto
.
setCompanyName
(
cylinderInfoDto
.
getUnitName
());
cylWarningMsgDto
.
setPhone
(
cylinderInfoDto
.
getPersonMobilePhone
());
cylWarningMsgDto
.
setPeople
(
cylinderInfoDto
.
getUnitPerson
());
// 2.循环调用规则 触发计算等级及发送消息
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"调用规则对象!+:{}"
,
JSON
.
toJSONString
(
cylWarningMsgDto
));
}
ruleTrigger
.
publish
(
cylWarningMsgDto
,
packageId
,
null
);
}
catch
(
Exception
e
)
{
log
.
error
(
"调用规则失败!:{}"
,
JSON
.
toJSONString
(
cylinderInfoDto
));
}
}
public
CylinderInfoDto
getDetail
(
String
sequenceCode
)
{
CylinderInfoDto
dto
=
this
.
baseMapper
.
getDetail
(
sequenceCode
);
dto
.
setInspectionStatusDesc
(
dto
.
getEarlyWarningLevel
()
!=
null
?
EarlyWarningLevelEnum
.
getEumByLevel
(
dto
.
getEarlyWarningLevel
()).
getStatus
()
:
""
);
return
dto
;
}
public
List
<
MsgLog
>
getMsgList
(
String
sequenceCode
,
String
terminalType
)
{
LambdaQueryWrapper
<
MsgLog
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
MsgLog:
:
getRelationCode
,
sequenceCode
);
wrapper
.
eq
(
StringUtils
.
isNotEmpty
(
terminalType
),
MsgLog:
:
getTerminalType
,
terminalType
);
wrapper
.
orderByDesc
(
MsgLog:
:
getSendTime
);
return
msgLogService
.
list
(
wrapper
);
}
/**
* 更新气瓶等级
* @param sequenceCode 唯一表设
* @param level 等级
* @return CylinderInfo
*/
public
CylinderInfo
updateEarlyWarningLevel
(
String
sequenceCode
,
String
level
)
{
CylinderInfo
cylinderInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
CylinderInfo
>().
eq
(
CylinderInfo:
:
getSequenceCode
,
sequenceCode
));
cylinderInfo
.
setEarlyWarningLevel
(
level
);
cylinderInfo
.
setEarlyWarningLevelCalDate
(
new
Date
());
this
.
updateById
(
cylinderInfo
);
return
cylinderInfo
;
}
public
Boolean
nextInspectionDateUpdate
(
List
<
CylinderInfoDto
>
cylinderInfoDtos
)
{
// 1.更新下次检验日期
List
<
CylinderInfo
>
cylinderInfos
=
new
ArrayList
<>();
cylinderInfoDtos
.
forEach
(
c
->
{
CylinderInfo
cylinderInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
CylinderInfo
>().
eq
(
CylinderInfo:
:
getSequenceCode
,
c
.
getSequenceCode
()));
cylinderInfo
.
setNextInspectionDate
(
c
.
getNextInspectionDate
());
cylinderInfos
.
add
(
cylinderInfo
);
});
if
(!
cylinderInfos
.
isEmpty
())
{
this
.
updateBatchById
(
cylinderInfos
);
}
// 2.循环调用规则 触发计算等级及发送消息
cylinderInfos
.
forEach
(
this
::
touchRuleToCalLevel
);
return
Boolean
.
TRUE
;
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/EndUserServiceImpl.java
0 → 100644
View file @
531d50d7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EndUserMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IEndUserService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EndUserDto
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
/**
* 气瓶终端用户服务实现类
*
* @author system_generator
* @date 2022-04-21
*/
@Service
public
class
EndUserServiceImpl
extends
BaseService
<
EndUserDto
,
EndUser
,
EndUserMapper
>
implements
IEndUserService
{
/**
* 分页查询
*/
public
Page
<
EndUserDto
>
queryForEndUserPage
(
Page
<
EndUserDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
EndUserDto
>
queryForEndUserList
()
{
return
this
.
queryForList
(
""
,
false
);
}
}
\ No newline at end of file
amos-boot-system-equip/src/main/resources/changelog/wl-3.0.1.xml
View file @
531d50d7
...
...
@@ -2776,4 +2776,51 @@
</sql>
</changeSet>
<changeSet
author=
"my"
id=
"16504254290001-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"wl_source_scene"
columnName=
"source_type"
/>
</not>
</preConditions>
<comment>
wl_source_scene add column source_type 添加组态页面关系表数据源类型字段
</comment>
<sql>
ALTER TABLE `wl_source_scene`
ADD COLUMN `source_type` varchar(255) NULL COMMENT '数据源类型:building(建筑类),system(系统类)' AFTER `source_name`;
UPDATE wl_source_scene ss
SET ss.source_type = 'building'
WHERE
(
SELECT
count(1)
FROM
wl_warehouse_structure ws
WHERE
ws.id = ss.source_id
) > 0;
UPDATE wl_source_scene ss
SET ss.source_type = 'system'
WHERE
(
SELECT
count(1)
FROM
f_fire_fighting_system ffs
WHERE
ffs.id = ss.source_id
) > 0;
</sql>
</changeSet>
<changeSet
author=
"chenzhao"
id=
"2022-04-21-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<tableExists
tableName=
"wl_form_group_column"
/>
</preConditions>
<comment>
add data wl_form_group
</comment>
<sql>
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000346, 'inwhichBuild', '所在建筑', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
amos-boot-system-equip/src/main/resources/mapper/Building.xml
View file @
531d50d7
...
...
@@ -104,6 +104,7 @@
(id,
source_id,
source_name,
source_type,
project_id,
scene_id,
point_in_scene,
...
...
@@ -114,6 +115,7 @@
#{id},
#{instanceId},
#{name},
#{sourceType},
#{projectId},
#{sceneId},
null,
...
...
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