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
444a8266
Commit
444a8266
authored
Jul 19, 2024
by
麻笑宇
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…
Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents
e8b7dc41
5eb3e947
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
2924 additions
and
506 deletions
+2924
-506
ProblemStatusEnum.java
...join/amos/boot/module/jg/api/enums/ProblemStatusEnum.java
+63
-0
JgMaintainNoticeMapper.java
...mos/boot/module/jg/api/mapper/JgMaintainNoticeMapper.java
+2
-0
JgReformNoticeMapper.java
.../amos/boot/module/jg/api/mapper/JgReformNoticeMapper.java
+3
-0
JgTransferNoticeMapper.java
...mos/boot/module/jg/api/mapper/JgTransferNoticeMapper.java
+3
-0
JgMaintainNoticeMapper.xml
...-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
+12
-1
JgReformNoticeMapper.xml
...jg-api/src/main/resources/mapper/JgReformNoticeMapper.xml
+12
-0
JgTransferNoticeMapper.xml
...-api/src/main/resources/mapper/JgTransferNoticeMapper.xml
+12
-0
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+15
-1
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+6
-4
JgMaintainNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgMaintainNoticeServiceImpl.java
+252
-187
JgReformNoticeServiceImpl.java
...module/jg/biz/service/impl/JgReformNoticeServiceImpl.java
+224
-160
JgTransferNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
+207
-142
MaintainNoticeEquipUsedCheckImpl.java
...jg/biz/service/impl/MaintainNoticeEquipUsedCheckImpl.java
+54
-0
ReformNoticeEquipUsedCheckImpl.java
...e/jg/biz/service/impl/ReformNoticeEquipUsedCheckImpl.java
+54
-0
TransferNoticeEquipUsedCheckImpl.java
...jg/biz/service/impl/TransferNoticeEquipUsedCheckImpl.java
+55
-0
superviseBusinessCategory.json
...iz/src/main/resources/json/superviseBusinessCategory.json
+6
-6
JyjcInspectionApplicationMapper.java
...dule/jyjc/api/mapper/JyjcInspectionApplicationMapper.java
+8
-0
JyjcInspectionApplicationMapper.xml
...main/resources/mapper/JyjcInspectionApplicationMapper.xml
+32
-1
pom.xml
...s/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/pom.xml
+5
-0
RestTemplateConfig.java
.../amos/boot/module/jyjc/biz/config/RestTemplateConfig.java
+22
-0
DPStatisticsController.java
...ot/module/jyjc/biz/controller/DPStatisticsController.java
+10
-0
DPSubController.java
...amos/boot/module/jyjc/biz/controller/DPSubController.java
+50
-0
DPStatisticsServiceImpl.java
...module/jyjc/biz/service/impl/DPStatisticsServiceImpl.java
+42
-0
DPSubServiceImpl.java
...s/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
+561
-0
DpSubUtils.java
...om/yeejoin/amos/boot/module/jyjc/biz/util/DpSubUtils.java
+41
-0
JsonValueUtils.java
...eejoin/amos/boot/module/jyjc/biz/util/JsonValueUtils.java
+69
-0
RestTemplateUtils.java
...oin/amos/boot/module/jyjc/biz/util/RestTemplateUtils.java
+143
-0
StringUtils.java
...m/yeejoin/amos/boot/module/jyjc/biz/util/StringUtils.java
+67
-0
company.json
...boot-module-jyjc-biz/src/main/resources/json/company.json
+47
-0
equip_1000.json
...t-module-jyjc-biz/src/main/resources/json/equip_1000.json
+91
-0
equip_2000.json
...t-module-jyjc-biz/src/main/resources/json/equip_2000.json
+91
-0
equip_3000.json
...t-module-jyjc-biz/src/main/resources/json/equip_3000.json
+91
-0
equip_4000.json
...t-module-jyjc-biz/src/main/resources/json/equip_4000.json
+91
-0
equip_5000.json
...t-module-jyjc-biz/src/main/resources/json/equip_5000.json
+91
-0
equip_6000.json
...t-module-jyjc-biz/src/main/resources/json/equip_6000.json
+91
-0
equip_8000.json
...t-module-jyjc-biz/src/main/resources/json/equip_8000.json
+91
-0
equip_9000.json
...t-module-jyjc-biz/src/main/resources/json/equip_9000.json
+91
-0
untest_company.json
...dule-jyjc-biz/src/main/resources/json/untest_company.json
+50
-0
TzBaseEnterpriseInfoDto.java
...amos/boot/module/tcm/api/dto/TzBaseEnterpriseInfoDto.java
+3
-0
ProblemStatusEnum.java
...oin/amos/boot/module/tcm/api/enums/ProblemStatusEnum.java
+49
-0
TzBaseEnterpriseInfoMapper.java
...oot/module/tcm/api/mapper/TzBaseEnterpriseInfoMapper.java
+5
-3
TzBaseEnterpriseInfoMapper.xml
.../src/main/resources/mapper/TzBaseEnterpriseInfoMapper.xml
+3
-0
TzBaseEnterpriseInfoServiceImpl.java
...tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+9
-1
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/ProblemStatusEnum.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
enums
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 问题状态
*/
public
enum
ProblemStatusEnum
{
NORMAL
(
"正常"
,
"0"
,
"已处理"
),
ABNORMAL
(
"异常"
,
"1"
,
"未处理"
);
private
String
name
;
private
String
code
;
private
String
desc
;
ProblemStatusEnum
(
String
name
,
String
code
,
String
desc
)
{
this
.
name
=
name
;
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
static
Map
<
String
,
String
>
getNameByCode
=
new
HashMap
<>();
public
static
Map
<
String
,
String
>
getCodeByName
=
new
HashMap
<>();
public
static
Map
<
String
,
String
>
getDescByCode
=
new
HashMap
<>();
public
static
Map
<
String
,
String
>
getNameByDesc
=
new
HashMap
<>();
static
{
for
(
ProblemStatusEnum
e
:
ProblemStatusEnum
.
values
())
{
getNameByCode
.
put
(
e
.
code
,
e
.
name
);
getNameByDesc
.
put
(
e
.
desc
,
e
.
name
);
getDescByCode
.
put
(
e
.
code
,
e
.
desc
);
getCodeByName
.
put
(
e
.
name
,
e
.
code
);
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgMaintainNoticeMapper.java
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgMaintainNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
...
@@ -44,4 +45,5 @@ public interface JgMaintainNoticeMapper extends CustomBaseMapper<JgMaintainNotic
Map
<
String
,
Object
>
getEquipInfoByRecord
(
String
record
);
List
<
CompanyEquipCountDto
>
queryForFlowingEquipList
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgReformNoticeMapper.java
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgReformNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
...
@@ -40,4 +41,6 @@ public interface JgReformNoticeMapper extends CustomBaseMapper<JgReformNotice> {
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
sequenceNbr
);
void
updatePromoter
(
@Param
(
"id"
)
Long
id
);
List
<
CompanyEquipCountDto
>
queryForFlowingEquipList
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgTransferNoticeMapper.java
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
...
@@ -26,4 +27,6 @@ public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotic
@MapKey
(
"sequenceNbr"
)
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
sequenceNbr
);
List
<
CompanyEquipCountDto
>
queryForFlowingEquipList
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
View file @
444a8266
...
...
@@ -274,5 +274,16 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = oi.record
WHERE oi.record = #{record} ORDER BY oi."rec_date" DESC LIMIT 1
</select>
<select
id=
"queryForFlowingEquipList"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"
>
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_maintain_notice a,
tzs_jg_maintain_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgReformNoticeMapper.xml
View file @
444a8266
...
...
@@ -203,4 +203,16 @@
set promoter = null
where sequence_nbr = #{id}
</update>
<select
id=
"queryForFlowingEquipList"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"
>
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_reform_notice a,
tzs_jg_reform_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgTransferNoticeMapper.xml
View file @
444a8266
...
...
@@ -217,4 +217,16 @@
tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
<select
id=
"queryForFlowingEquipList"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"
>
select
a.install_unit_credit_code as companyCode,
group_concat(b.equ_id) as records
from
tzs_jg_transfer_notice a,
tzs_jg_transfer_notice_eq b
where
a.sequence_nbr = b.equip_transfer_id
and a.notice_status not in('6614','6615','6610','6617','6616')
GROUP BY a.install_unit_credit_code
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
View file @
444a8266
...
...
@@ -28,10 +28,12 @@ import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentInfoDto;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateChangeRecord
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgCertificateChangeRecordEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage
;
import
com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing
;
import
com.yeejoin.amos.boot.module.jg.api.enums.*
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.config.PressureVesselListener
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
...
...
@@ -654,7 +656,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
return
objMap
;
}
@Autowired
private
SafetyProblemTracingMapper
safetyProblemTracingMapper
;
/**
* 查询设备基本信息
*
...
...
@@ -669,6 +672,17 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String
county
=
""
;
String
street
=
""
;
String
fullAddress
=
""
;
// 设备问题信息(大屏二级页面使用)
LambdaQueryWrapper
<
SafetyProblemTracing
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
lambdaQueryWrapper
.
eq
(
SafetyProblemTracing:
:
getSourceId
,
record
);
lambdaQueryWrapper
.
orderByDesc
(
SafetyProblemTracing:
:
getRecDate
);
List
<
SafetyProblemTracing
>
safetyProblemTracings
=
safetyProblemTracingMapper
.
selectList
(
lambdaQueryWrapper
);
if
(!
ObjectUtils
.
isEmpty
(
safetyProblemTracings
))
{
objMap
.
put
(
"problemStatus"
,
ProblemStatusEnum
.
getNameByDesc
.
get
(
safetyProblemTracings
.
get
(
0
).
getProblemStatus
()));
objMap
.
put
(
"problemTime"
,
safetyProblemTracings
.
get
(
0
).
getProblemTime
());
}
// 使用信息
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
record
);
if
(!
ValidationUtil
.
isEmpty
(
useInfo
))
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
View file @
444a8266
...
...
@@ -96,6 +96,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
private
static
final
String
PROCESS_DEFINITION_KEY
=
"installationNotificationNew"
;
private
static
final
String
PROCESS_INSTALL_NOTICE_KEY
=
"installNotice"
;
private
static
final
String
TABLE_PAGE_ID
=
"1734141426742095873"
;
private
static
final
String
CONSTRUCTION_TYPE
=
"SGLX"
;
private
static
final
String
CONSTRUCTION_TYPE_NAME
=
"安装"
;
...
...
@@ -431,7 +433,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
"installNotice"
).
equipRepeatUsedCheck
(
jgRelationEquip
.
getEquId
(),
jgInstallationNotice
.
getInstallUnitCreditCode
());
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_INSTALL_NOTICE_KEY
).
equipRepeatUsedCheck
(
jgRelationEquip
.
getEquId
(),
jgInstallationNotice
.
getInstallUnitCreditCode
());
}
}
...
...
@@ -648,12 +650,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
"installNotice"
).
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_INSTALL_NOTICE_KEY
).
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
});
}
private
void
repeatUsedEquipCheck
(
List
<
Map
<
String
,
Object
>>
equipList
,
String
companyCode
)
{
equipList
.
forEach
(
equipMap
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
"installNotice"
).
equipRepeatUsedCheck
(
String
.
valueOf
(
equipMap
.
get
(
"SEQUENCE_NBR"
)),
companyCode
));
equipList
.
forEach
(
equipMap
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_INSTALL_NOTICE_KEY
).
equipRepeatUsedCheck
(
String
.
valueOf
(
equipMap
.
get
(
"SEQUENCE_NBR"
)),
companyCode
));
}
private
void
updateRedisBatch
(
List
<
JgInstallationNotice
>
jgInstallationNotices
)
{
...
...
@@ -955,7 +957,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
"installNotice"
).
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
jgRelationEquip
.
getEquId
()),
jgInstallationNotice
.
getInstallUnitCreditCode
());
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_INSTALL_NOTICE_KEY
).
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
jgRelationEquip
.
getEquId
()),
jgInstallationNotice
.
getInstallUnitCreditCode
());
}
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgMaintainNoticeServiceImpl.java
View file @
444a8266
...
...
@@ -25,6 +25,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgMaintainNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
...
...
@@ -156,11 +159,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getStreet
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getStreetName
()))
{
maintainInfo
.
put
(
"street"
,
notice
.
getStreet
()
+
"_"
+
notice
.
getStreetName
());
}
if
(
Integer
.
parseInt
(
notice
.
getNoticeStatus
())
==
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
())
{
if
(
Integer
.
parseInt
(
notice
.
getNoticeStatus
())
==
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
())
{
// 完成时显示历史数据
JSONObject
hisData
=
commonService
.
queryHistoryData
(
notice
.
getSequenceNbr
());
// 兼容老数据
if
(
hisData
==
null
)
{
if
(
hisData
==
null
)
{
// 老数据逻辑
setNewEquipInfo
(
sequenceNbr
,
maintainInfo
);
return
new
HashMap
<
String
,
Map
<
String
,
Object
>>()
{{
...
...
@@ -182,6 +185,38 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
}
private
void
checkRepeatUsed
(
String
submitType
,
JgMaintainNotice
notice
)
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 流程中校验
LambdaQueryWrapper
<
JgMaintainNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgMaintainNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgMaintainNoticeEq
noticeEq
=
jgMaintainNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
noticeEq
.
getEquId
(),
notice
.
getInstallUnitCreditCode
());
}
}
private
void
repeatUsedEquipCheck
(
List
<
Map
<
String
,
Object
>>
equipList
,
String
companyCode
)
{
equipList
.
forEach
(
equipMap
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
).
equipRepeatUsedCheck
(
String
.
valueOf
(
equipMap
.
get
(
"SEQUENCE_NBR"
)),
companyCode
));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private
void
delRepeatUseEquipData
(
JgMaintainNotice
notice
)
{
LambdaQueryWrapper
<
JgMaintainNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgMaintainNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgMaintainNoticeEq
noticeEq
=
jgMaintainNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
noticeEq
.
getEquId
()),
notice
.
getInstallUnitCreditCode
());
}
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
});
}
private
void
setNewEquipInfo
(
Long
sequenceNbr
,
Map
<
String
,
Object
>
maintainInfo
)
{
JgMaintainNoticeEq
jgMaintainNoticeEq
=
jgMaintainNoticeEqMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JgMaintainNoticeEq
>().
eq
(
JgMaintainNoticeEq:
:
getEquipTransferId
,
sequenceNbr
));
Map
<
String
,
Object
>
map
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
jgMaintainNoticeEq
.
getEquId
());
...
...
@@ -201,113 +236,127 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@Transactional
public
JgMaintainNoticeDto
updateMaintainNotice
(
String
submitType
,
JgMaintainNoticeDto
noticeDto
,
String
op
)
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 字段转换
this
.
convertField
(
noticeDto
);
JgMaintainNotice
notice
=
jgMaintainNoticeMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
// submitType=1为流程提交否则仅为保存业务数据
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 如果没有实例ID,说明是启动并执行一步
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
// 如果有实例ID,为撤回或者驳回后重新提交
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
// 发起流程
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
//下一节点执行人单位(下节点接收机构code)
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNoticeMapper
.
updateById
(
notice
);
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRUE
);
}
else
{
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
//下一节点执行人单位(下节点接收机构code)
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
dto
.
setVariable
(
commMap
);
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
try
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 字段转换
this
.
convertField
(
noticeDto
);
JgMaintainNotice
notice
=
jgMaintainNoticeMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
this
.
checkRepeatUsed
(
submitType
,
notice
);
// submitType=1为流程提交否则仅为保存业务数据
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 如果没有实例ID,说明是启动并执行一步
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
// 如果有实例ID,为撤回或者驳回后重新提交
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
// 发起流程
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
//下一节点执行人单位(下节点接收机构code)
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNoticeMapper
.
updateById
(
notice
);
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALS
E
);
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRU
E
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
taskModelDto
.
setModel
(
taskMessageDto
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
//下一节点执行人单位(下节点接收机构code)
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
dto
.
setVariable
(
commMap
);
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALSE
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
taskModelDto
.
setModel
(
taskMessageDto
);
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
JgMaintainNotice
bean
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgMaintainNoticeMapper
.
updateById
(
bean
);
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
JgMaintainNotice
bean
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgMaintainNoticeMapper
.
updateById
(
bean
);
return
noticeDto
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
return
noticeDto
;
}
...
...
@@ -319,14 +368,14 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
* @return 维修告知列表
*/
@Override
public
Page
<
Map
<
String
,
Object
>>
queryForJgMaintainNoticePage
(
Page
<
JgMaintainNotice
>
page
,
String
sort
,
JgMaintainNoticeDto
model
,
ReginParams
reginParams
)
{
public
Page
<
Map
<
String
,
Object
>>
queryForJgMaintainNoticePage
(
Page
<
JgMaintainNotice
>
page
,
String
sort
,
JgMaintainNoticeDto
model
,
ReginParams
reginParams
)
{
String
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
String
type
=
reginParams
.
getCompany
().
getLevel
();
String
userId
=
reginParams
.
getUserModel
().
getUserId
();
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
List
<
DataDictionary
>
dictionaries
=
dataDictionaryService
.
getByType
(
"WXLX"
);
Page
<
Map
<
String
,
Object
>>
noticePage
=
jgMaintainNoticeMapper
.
queryForPage
(
page
,
sortMap
,
model
,
type
,
orgCode
,
userId
);
Page
<
Map
<
String
,
Object
>>
noticePage
=
jgMaintainNoticeMapper
.
queryForPage
(
page
,
sortMap
,
model
,
type
,
orgCode
,
userId
);
List
<
Map
<
String
,
Object
>>
mappedRecords
=
noticePage
.
getRecords
().
stream
().
peek
(
notice
->
{
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
noticeStatusOpt
.
ifPresent
(
status
->
{
...
...
@@ -364,7 +413,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if
(
Objects
.
isNull
(
JgMaintainNotice
)
||
CollectionUtils
.
isEmpty
(
informationList
))
{
throw
new
IllegalArgumentException
(
"维修告知单不存在"
);
}
Map
<
String
,
Object
>
placeholders
=
jgInstallationNoticeService
.
fullFillTemplateObj
(
informationList
,
BusinessTypeEnum
.
JG_MAINTENANCE_NOTIFICATION
.
getName
().
substring
(
0
,
2
));
Map
<
String
,
Object
>
placeholders
=
jgInstallationNoticeService
.
fullFillTemplateObj
(
informationList
,
BusinessTypeEnum
.
JG_MAINTENANCE_NOTIFICATION
.
getName
().
substring
(
0
,
2
));
String
tempFileName
=
"维修告知单_"
+
System
.
currentTimeMillis
()
+
"_temp"
;
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
...
...
@@ -380,7 +429,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
JgMaintainNotice
jgMaintainNotice
=
this
.
baseMapper
.
selectById
(
sequenceNbr
);
// 删除待办 + 中止流程
commonService
.
deleteTaskModel
(
sequenceNbr
+
""
,
jgMaintainNotice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
sequenceNbr
+
""
,
jgMaintainNotice
.
getInstanceId
());
// 删除业务单
this
.
baseMapper
.
deleteById
(
sequenceNbr
);
// 删除对应equ
...
...
@@ -397,87 +446,102 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgMaintainNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgMaintainNoticeDtoMap
,
ReginParams
reginParams
)
{
try
{
JgMaintainNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgMaintainNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgMaintainNoticeDto
.
class
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备"
);
}
JgMaintainNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgMaintainNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgMaintainNoticeDto
.
class
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备"
);
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
applyNoResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
WXGZ
.
getCode
(),
deviceList
.
size
());
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
applyNoResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
WXGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
applyNoResult
.
getResult
()))
{
log
.
error
(
" 获取告知单号失败"
);
throw
new
RuntimeException
();
}
List
<
String
>
applyNoList
=
applyNoResult
.
getResult
();
List
<
WorkflowResultDto
>
workflowResultDtoList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
List
<
JgMaintainNotice
>
list
=
new
ArrayList
<>();
List
<
JgMaintainNoticeEq
>
equipList
=
new
ArrayList
<>();
CompanyBo
companyBo
=
commonService
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
deviceList
.
forEach
(
obj
->
{
JgMaintainNoticeEq
jgRelationEquip
=
new
JgMaintainNoticeEq
();
JgMaintainNotice
dto
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
applyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
// 统计使用
dto
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
dto
.
setNoticeDate
(
new
Date
());
dto
.
setEquCategory
(
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
)));
dto
.
setEquListCode
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST_CODE"
)));
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
if
(
CollectionUtils
.
isEmpty
(
applyNoResult
.
getResult
()))
{
log
.
error
(
" 获取告知单号失败"
);
throw
new
RuntimeException
();
}
List
<
String
>
applyNoList
=
applyNoResult
.
getResult
();
List
<
WorkflowResultDto
>
workflowResultDtoList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
List
<
JgMaintainNotice
>
list
=
new
ArrayList
<>();
List
<
JgMaintainNoticeEq
>
equipList
=
new
ArrayList
<>();
CompanyBo
companyBo
=
commonService
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
deviceList
.
forEach
(
obj
->
{
JgMaintainNoticeEq
jgRelationEquip
=
new
JgMaintainNoticeEq
();
JgMaintainNotice
dto
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
applyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
// 统计使用
dto
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
dto
.
setNoticeDate
(
new
Date
());
dto
.
setEquCategory
(
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
)));
dto
.
setEquListCode
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST_CODE"
)));
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorRoleIds
());
dto
.
setInstanceStatus
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorRoleIds
()
+
","
+
workflowResultDtoList
.
get
(
i
).
getExecutorRoleIds
());
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNextExecuteUserIds
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorUserIds
());
dto
.
setNextTaskId
(
workflowResultDtoList
.
get
(
i
).
getNextTaskId
());
dto
.
setInstanceId
(
workflowResultDtoList
.
get
(
i
).
getInstanceId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setNextExecuteUserIds
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
dto
.
setEquList
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST"
)));
dto
.
setSupervisoryCode
(
String
.
valueOf
(
obj
.
get
(
"SUPERVISORY_CODE"
)));
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
dto
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
DataDictionary
dictionary
=
iDataDictionaryService
.
getByCode
(
dto
.
getMaintainType
(),
"WXLX"
);
dto
.
setMaintainTypeDesc
(
dictionary
.
getName
());
dto
.
setFullAddress
(
dto
.
getProvinceName
()
+
dto
.
getCityName
()
+
dto
.
getCountyName
()
+
dto
.
getStreetName
()
+
dto
.
getAddress
());
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
jgMaintainNoticeMapper
.
insertBatchSomeColumn
(
list
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorRoleIds
());
dto
.
setInstanceStatus
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorRoleIds
()
+
","
+
workflowResultDtoList
.
get
(
i
).
getExecutorRoleIds
());
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNextExecuteUserIds
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorUserIds
());
dto
.
setNextTaskId
(
workflowResultDtoList
.
get
(
i
).
getNextTaskId
());
dto
.
setInstanceId
(
workflowResultDtoList
.
get
(
i
).
getInstanceId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
buildTask
(
list
,
workflowResultDtoList
,
Boolean
.
TRUE
);
}
else
{
dto
.
setNextExecuteUserIds
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
())
);
// 暂存任务
buildTaskDraft
(
list
);
}
dto
.
setEquList
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST"
)));
dto
.
setSupervisoryCode
(
String
.
valueOf
(
obj
.
get
(
"SUPERVISORY_CODE"
)));
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
dto
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
DataDictionary
dictionary
=
iDataDictionaryService
.
getByCode
(
dto
.
getMaintainType
(),
"WXLX"
);
dto
.
setMaintainTypeDesc
(
dictionary
.
getName
());
dto
.
setFullAddress
(
dto
.
getProvinceName
()
+
dto
.
getCityName
()
+
dto
.
getCountyName
()
+
dto
.
getStreetName
()
+
dto
.
getAddress
());
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
jgMaintainNoticeMapper
.
insertBatchSomeColumn
(
list
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
,
workflowResultDtoList
,
Boolean
.
TRUE
);
}
else
{
// 暂存任务
buildTaskDraft
(
list
);
List
<
JgMaintainNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgMaintainNotice
>
collect
=
list
.
stream
().
filter
(
JgMaintainNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgMaintainNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgMaintainNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
List
<
JgMaintainNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgMaintainNotice
>
collect
=
list
.
stream
().
filter
(
JgMaintainNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgMaintainNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgMaintainNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
private
void
updateRedisBatch
(
List
<
JgMaintainNotice
>
jgMaintainNotices
)
{
...
...
@@ -542,7 +606,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
taskMessageDto
.
setNextTaskId
(
item
.
getNextTaskId
());
taskModelDto
.
setModel
(
taskMessageDto
);
taskModelDto
.
setNextExecuteUser
(
item
.
getNextExecuteIds
());
taskModelDto
.
setTaskContent
(
String
.
format
(
"来自%s【%s】的业务办理,【申请单号:%s】"
,
item
.
getEquList
(),
StringUtils
.
isEmpty
(
item
.
getSupervisoryCode
())
?
""
:
item
.
getSupervisoryCode
(),
item
.
getApplyNo
()));
taskModelDto
.
setTaskContent
(
String
.
format
(
"来自%s【%s】的业务办理,【申请单号:%s】"
,
item
.
getEquList
(),
StringUtils
.
isEmpty
(
item
.
getSupervisoryCode
())
?
""
:
item
.
getSupervisoryCode
(),
item
.
getApplyNo
()));
taskModelDtoList
.
add
(
taskModelDto
);
if
(
bool
)
{
// 删除暂存时生成的待办
...
...
@@ -574,7 +638,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
return
new
ArrayList
<>();
}
private
void
convertField
(
JgMaintainNoticeDto
model
)
{
if
(
null
==
model
)
{
...
...
@@ -722,6 +786,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
commonService
.
rollbackTask
(
jgMaintainNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgMaintainNotice
));
this
.
delRepeatUseEquipData
(
jgMaintainNotice
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
@@ -864,10 +929,10 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
taskModelDto
.
setPageType
(
"edit"
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
jgMaintainNotice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
jgMaintainNotice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNoticeMapper
.
updateById
(
jgMaintainNotice
);
this
.
delRepeatUseEquipData
(
jgMaintainNotice
);
}
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgMaintainNotice
));
}
catch
(
InterruptedException
e
)
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgReformNoticeServiceImpl.java
View file @
444a8266
...
...
@@ -13,22 +13,26 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgReformNoticeEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgReformNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
...
...
@@ -175,86 +179,99 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
*/
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
public
JgReformNoticeDto
updateInstallationNotice
(
String
submitType
,
JgReformNoticeDto
noticeDto
,
String
op
)
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 字段转换
this
.
convertField
(
noticeDto
);
JgReformNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setBusinessKey
(
noticeDto
.
getSequenceNbr
().
toString
());
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setNextExecuteUserCompanyCode
(
noticeDto
.
getReceiveCompanyCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
try
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 字段转换
this
.
convertField
(
noticeDto
);
JgReformNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
this
.
checkRepeatUsed
(
submitType
,
notice
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setBusinessKey
(
noticeDto
.
getSequenceNbr
().
toString
());
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setNextExecuteUserCompanyCode
(
noticeDto
.
getReceiveCompanyCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
jgReformNoticeMapper
.
updateById
(
notice
);
// 删除暂存
commonService
.
deleteTasksByRelationId
(
notice
.
getSequenceNbr
()
+
""
);
// 如果为保存并提交,则创建代办
this
.
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
));
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
dto
.
setVariable
(
commMap
);
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
org
.
apache
.
commons
.
lang3
.
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
updateById
(
notice
);
// 上个代办改为已办
TaskV2Model
taskV2Model
=
this
.
updateLastTodo
(
notice
,
FlowStatusEnum
.
TO_BE_PROCESSED
);
// 创建新的代办
this
.
createNewTodo
(
notice
,
workflowResultDto
,
taskV2Model
,
FlowStatusEnum
.
TO_BE_PROCESSED
);
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
jgReformNoticeMapper
.
updateById
(
notice
);
// 删除暂存
commonService
.
deleteTasksByRelationId
(
notice
.
getSequenceNbr
()
+
""
);
// 如果为保存并提交,则创建代办
this
.
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
));
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
dto
.
setVariable
(
commMap
);
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
org
.
apache
.
commons
.
lang3
.
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
updateById
(
notice
);
// 上个代办改为已办
TaskV2Model
taskV2Model
=
this
.
updateLastTodo
(
notice
,
FlowStatusEnum
.
TO_BE_PROCESSED
);
// 创建新的代办
this
.
createNewTodo
(
notice
,
workflowResultDto
,
taskV2Model
,
FlowStatusEnum
.
TO_BE_PROCESSED
);
JgReformNotice
bean
=
new
JgReformNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgReformNoticeMapper
.
updateById
(
bean
);
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
JgReformNotice
bean
=
new
JgReformNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgReformNoticeMapper
.
updateById
(
bean
);
return
noticeDto
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
return
noticeDto
;
}
...
...
@@ -307,7 +324,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
Collection
<
JgReformNotice
>
JgReformNotices
=
this
.
listByIds
(
Arrays
.
asList
(
sequenceNbrs
));
JgReformNotices
.
forEach
(
notice
->
{
// 删除代办 + 中止流程
commonService
.
deleteTaskModel
(
String
.
valueOf
(
notice
.
getSequenceNbr
()),
notice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
String
.
valueOf
(
notice
.
getSequenceNbr
()),
notice
.
getInstanceId
());
// 删除单子
this
.
baseMapper
.
deleteById
(
notice
.
getSequenceNbr
());
// 删除对应eq
...
...
@@ -354,94 +371,139 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgReformNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
JgReformNoticeDtoMap
,
ReginParams
reginParams
)
{
JgReformNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
JgReformNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgReformNoticeDto
.
class
);
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备!"
);
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
codeResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
GZGZ
.
getCode
(),
deviceList
.
size
());
List
<
String
>
applyNoList
=
null
;
if
(
codeResult
!=
null
&&
!
ValidationUtil
.
isEmpty
(
codeResult
.
getResult
()))
{
applyNoList
=
codeResult
.
getResult
();
}
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
throw
new
BadRequest
(
"申请单编号生成失败,请稍后重试!"
);
}
// 启动工作流
List
<
WorkflowResultDto
>
workflowResultList
=
this
.
startWorkFlow
(
model
.
getReceiveCompanyCode
(),
submitType
,
deviceList
);
List
<
JgReformNotice
>
list
=
new
ArrayList
<>();
List
<
JgReformNoticeEq
>
equipList
=
new
ArrayList
<>();
List
<
String
>
finalApplyNoList
=
applyNoList
;
CompanyBo
companyBo
=
commonService
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
deviceList
.
forEach
(
obj
->
{
JgReformNoticeEq
jgRelationEquip
=
new
JgReformNoticeEq
();
JgReformNotice
dto
=
new
JgReformNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
finalApplyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
dto
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setEquCategory
(
Objects
.
toString
(
obj
.
get
(
"EQU_CATEGORY"
),
""
));
dto
.
setEquListCode
(
Objects
.
toString
(
obj
.
get
(
"EQU_DEFINE"
),
""
));
dto
.
setSupervisoryCode
(
Objects
.
toString
(
obj
.
get
(
"SUPERVISORY_CODE"
),
""
));
dto
.
setEquList
(
Objects
.
toString
(
obj
.
get
(
"EQU_LIST"
),
""
));
dto
.
setFullAddress
(
Objects
.
toString
(
obj
.
get
(
"ADDRESS"
),
""
));
// 统计用
dto
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
try
{
JgReformNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
JgReformNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgReformNoticeDto
.
class
);
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备!"
);
}
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请) todo 回滚异常未写
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
WorkflowResultDto
workflowResult
=
workflowResultList
.
get
(
i
);
dto
.
setNextExecuteIds
(
workflowResult
.
getNextExecutorRoleIds
());
dto
.
setInstanceStatus
(
workflowResult
.
getNextExecutorRoleIds
()
+
","
+
workflowResult
.
getExecutorRoleIds
());
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNextTaskId
(
workflowResult
.
getNextTaskId
());
dto
.
setNextExecuteUserIds
(
workflowResult
.
getNextExecutorUserIds
());
}
else
{
dto
.
setNextExecuteUserIds
(
RequestContext
.
getExeUserId
());
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
}
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
dto
.
setEntrustingUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setEntrustingUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
if
(!
CollectionUtils
.
isEmpty
(
workflowResultList
))
{
dto
.
setInstanceId
(
workflowResultList
.
get
(
i
).
getInstanceId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
// 获取告知单号
ResponseModel
<
List
<
String
>>
codeResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
GZGZ
.
getCode
(),
deviceList
.
size
());
List
<
String
>
applyNoList
=
null
;
if
(
codeResult
!=
null
&&
!
ValidationUtil
.
isEmpty
(
codeResult
.
getResult
()))
{
applyNoList
=
codeResult
.
getResult
();
}
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
throw
new
BadRequest
(
"申请单编号生成失败,请稍后重试!"
);
}
// 启动工作流
List
<
WorkflowResultDto
>
workflowResultList
=
this
.
startWorkFlow
(
model
.
getReceiveCompanyCode
(),
submitType
,
deviceList
);
List
<
JgReformNotice
>
list
=
new
ArrayList
<>();
List
<
JgReformNoticeEq
>
equipList
=
new
ArrayList
<>();
List
<
String
>
finalApplyNoList
=
applyNoList
;
CompanyBo
companyBo
=
commonService
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
deviceList
.
forEach
(
obj
->
{
JgReformNoticeEq
jgRelationEquip
=
new
JgReformNoticeEq
();
JgReformNotice
dto
=
new
JgReformNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
finalApplyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
dto
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setEquCategory
(
Objects
.
toString
(
obj
.
get
(
"EQU_CATEGORY"
),
""
));
dto
.
setEquListCode
(
Objects
.
toString
(
obj
.
get
(
"EQU_DEFINE"
),
""
));
dto
.
setSupervisoryCode
(
Objects
.
toString
(
obj
.
get
(
"SUPERVISORY_CODE"
),
""
));
dto
.
setEquList
(
Objects
.
toString
(
obj
.
get
(
"EQU_LIST"
),
""
));
dto
.
setFullAddress
(
Objects
.
toString
(
obj
.
get
(
"ADDRESS"
),
""
));
// 统计用
dto
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
WorkflowResultDto
workflowResult
=
workflowResultList
.
get
(
i
);
dto
.
setNextExecuteIds
(
workflowResult
.
getNextExecutorRoleIds
());
dto
.
setInstanceStatus
(
workflowResult
.
getNextExecutorRoleIds
()
+
","
+
workflowResult
.
getExecutorRoleIds
());
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setNextTaskId
(
workflowResult
.
getNextTaskId
());
dto
.
setNextExecuteUserIds
(
workflowResult
.
getNextExecutorUserIds
());
}
else
{
dto
.
setNextExecuteUserIds
(
RequestContext
.
getExeUserId
());
}
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
dto
.
setEntrustingUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setEntrustingUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
if
(!
CollectionUtils
.
isEmpty
(
workflowResultList
))
{
dto
.
setInstanceId
(
workflowResultList
.
get
(
i
).
getInstanceId
());
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
jgReformNoticeMapper
.
insertBatchSomeColumn
(
list
);
jgReformNoticeMapper
.
insertBatchSomeColumn
(
list
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
buildTask
(
list
,
workflowResultList
);
}
else
{
this
.
saveTempReformNotice
(
list
);
}
List
<
JgReformNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgReformNotice
>
collect
=
list
.
stream
().
filter
(
JgReformNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgReformNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgReformNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
}
private
void
repeatUsedEquipCheck
(
List
<
Map
<
String
,
Object
>>
equipList
,
String
companyCode
)
{
equipList
.
forEach
(
equipMap
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
).
equipRepeatUsedCheck
(
String
.
valueOf
(
equipMap
.
get
(
"SEQUENCE_NBR"
)),
companyCode
));
}
private
void
checkRepeatUsed
(
String
submitType
,
JgReformNotice
jgReformNotice
)
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
buildTask
(
list
,
workflowResultList
);
}
else
{
this
.
saveTempReformNotice
(
list
);
// 流程中校验
LambdaQueryWrapper
<
JgReformNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgReformNoticeEq:
:
getEquipTransferId
,
jgReformNotice
.
getSequenceNbr
());
JgReformNoticeEq
jgRelationEquip
=
jgReformNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
jgRelationEquip
.
getEquId
(),
jgReformNotice
.
getInstallUnitCreditCode
());
}
List
<
JgReformNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgReformNotice
>
collect
=
list
.
stream
().
filter
(
JgReformNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgReformNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgReformNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
/**
* 删除 redis校验重复引用设备的数据
*/
private
void
delRepeatUseEquipData
(
JgReformNotice
notice
)
{
LambdaQueryWrapper
<
JgReformNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgReformNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgReformNoticeEq
jgRelationEquip
=
jgReformNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
jgRelationEquip
.
getEquId
()),
notice
.
getInstallUnitCreditCode
());
}
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
});
}
private
void
updateRedisBatch
(
List
<
JgReformNotice
>
jgReformNotices
)
{
...
...
@@ -680,6 +742,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
jsonObject
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
ROLLBACK
.
getName
());
commonService
.
rollbackTask
(
notice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
notice
));
this
.
delRepeatUseEquipData
(
notice
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
@@ -788,6 +851,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
taskV2Model
=
this
.
updateLastTodo
(
jgReformNotice
,
FlowStatusEnum
.
REJECTED
);
this
.
createNewTodo
(
jgReformNotice
,
workflowResultDto
,
taskV2Model
,
FlowStatusEnum
.
REJECTED
);
jgReformNoticeMapper
.
updateById
(
jgReformNotice
);
this
.
delRepeatUseEquipData
(
jgReformNotice
);
}
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgReformNotice
));
}
catch
(
InterruptedException
e
)
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
View file @
444a8266
...
...
@@ -24,6 +24,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext
;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
...
...
@@ -141,7 +144,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
transferNotice
.
put
(
"constructionContractList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
else
if
(
"otherAccessories"
.
equalsIgnoreCase
(
s
))
{
transferNotice
.
put
(
"otherAccessoriesList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
else
{
}
else
{
transferNotice
.
put
(
s
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
}
...
...
@@ -172,6 +175,39 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
private
void
checkRepeatUsed
(
String
submitType
,
JgTransferNotice
notice
)
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 流程中校验
LambdaQueryWrapper
<
JgTransferNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgTransferNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgTransferNoticeEq
noticeEq
=
jgTransferNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
equipRepeatUsedCheck
(
noticeEq
.
getEquId
(),
notice
.
getInstallUnitCreditCode
());
}
}
private
void
repeatUsedEquipCheck
(
List
<
Map
<
String
,
Object
>>
equipList
,
String
companyCode
)
{
equipList
.
forEach
(
equipMap
->
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
).
equipRepeatUsedCheck
(
String
.
valueOf
(
equipMap
.
get
(
"SEQUENCE_NBR"
)),
companyCode
));
}
/**
* 删除 redis校验重复引用设备的数据
*/
private
void
delRepeatUseEquipData
(
JgTransferNotice
notice
)
{
LambdaQueryWrapper
<
JgTransferNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgTransferNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
JgTransferNoticeEq
noticeEq
=
jgTransferNoticeEqMapper
.
selectOne
(
queryWrapper
);
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckEquipRepeatUsed
(
Collections
.
singletonList
(
noticeEq
.
getEquId
()),
notice
.
getInstallUnitCreditCode
());
}
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
PROCESS_DEFINITION_KEY
)
.
delDataForCheckWithKey
(
e
.
getData
(),
e
.
getRedisKey
());
});
}
private
Map
<
String
,
Object
>
getEquipInfoNew
(
String
companyLevel
,
Map
<
String
,
Object
>
transferNotice
,
List
<
Map
<
String
,
Object
>>
equipmentInfos
)
{
Map
<
String
,
Object
>
detail
=
equipmentInfos
.
get
(
0
);
Map
<
String
,
Object
>
equInfo
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
detail
.
get
(
"equId"
).
toString
());
...
...
@@ -199,7 +235,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
// 删除待办 及 中止流程
JgTransferNotice
jgTransferNotice
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
commonService
.
deleteTaskModel
(
String
.
valueOf
(
sequenceNbr
),
jgTransferNotice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
String
.
valueOf
(
sequenceNbr
),
jgTransferNotice
.
getInstanceId
());
// 删除业务单
this
.
getBaseMapper
().
deleteById
(
sequenceNbr
);
// 删除对应eq
...
...
@@ -251,126 +287,138 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@Transactional
public
JgTransferNoticeDto
updateTransferNotice
(
String
submitType
,
JgTransferNoticeDto
noticeDto
,
String
op
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 字段转换
this
.
convertField
(
noticeDto
);
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
// 发起流程
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 如果没有实例ID,说明是启动并执行一步
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
//下一节点执行人单位(下节点接收机构code)
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRUE
);
}
else
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
dto
.
setVariable
(
commMap
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
processTaskDTO
=
iCmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
try
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
}
// 字段转换
this
.
convertField
(
noticeDto
);
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
this
.
checkRepeatUsed
(
submitType
,
notice
);
//校验设备是否在流程中
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
// 发起流程
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 如果没有实例ID,说明是启动并执行一步
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
//下一节点执行人单位(下节点接收机构code)
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
list
.
add
(
dto
);
actWorkflowBatchDTO
.
setProcess
(
list
);
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALS
E
);
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRU
E
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
taskModelDto
.
setModel
(
taskMessageDto
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
commMap
.
put
(
"approvalStatus"
,
"提交"
);
}
else
{
commMap
.
put
(
"approvalStatus"
,
op
);
}
dto
.
setVariable
(
commMap
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
processTaskDTO
=
iCmWorkflowService
.
completeOrReject
(
notice
.
getNextTaskId
(),
dto
,
op
);
// 提取节点等信息
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
// 上个代办改为已办
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"taskStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
map
.
put
(
"relationId"
,
notice
.
getInstanceId
());
map
.
put
(
"flowStatus"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
map
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
TaskV2Model
taskV2Model
=
commonService
.
updateTaskModel
(
map
);
if
(
ObjectUtils
.
isEmpty
(
taskV2Model
))
{
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALSE
);
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
// 创建新的代办
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
taskModelDto
.
setModel
(
taskMessageDto
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
JgTransferNotice
bean
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgTransferNoticeMapper
.
updateById
(
bean
);
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
}
else
{
JgTransferNotice
bean
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgTransferNoticeMapper
.
updateById
(
bean
);
return
noticeDto
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
return
noticeDto
;
}
/**
* 分页查询
*/
@Override
public
Page
<
Map
<
String
,
Object
>>
queryForJgTransferNoticePage
(
Page
<
JgTransferNotice
>
page
,
String
sort
,
JgTransferNoticeDto
model
,
String
type
,
ReginParams
reginParams
)
{
public
Page
<
Map
<
String
,
Object
>>
queryForJgTransferNoticePage
(
Page
<
JgTransferNotice
>
page
,
String
sort
,
JgTransferNoticeDto
model
,
String
type
,
ReginParams
reginParams
)
{
String
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
model
.
setTransferToUserIds
(
reginParams
.
getUserModel
().
getUserId
());
Page
<
Map
<
String
,
Object
>>
noticePage
=
jgTransferNoticeMapper
.
queryForPage
(
page
,
sortMap
,
model
,
type
,
orgCode
);
Page
<
Map
<
String
,
Object
>>
noticePage
=
jgTransferNoticeMapper
.
queryForPage
(
page
,
sortMap
,
model
,
type
,
orgCode
);
List
<
Map
<
String
,
Object
>>
mappedRecords
=
noticePage
.
getRecords
().
stream
().
peek
(
notice
->
{
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
...
...
@@ -388,41 +436,57 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgTransferNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgTransferNoticeDtoMap
,
ReginParams
reginParams
)
{
JgTransferNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgTransferNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgTransferNoticeDto
.
class
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
return
new
ArrayList
<>();
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
return
new
ArrayList
<>();
}
// 启动工作流并返回信息
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
//业务数据组装等
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
responseModel
,
workflowResultList
,
list
,
equipList
);
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
// 如果为保存并提交,则创建代办
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
,
workflowResultList
,
Boolean
.
TRUE
);
}
else
{
// 暂存任务
buildTaskDraft
(
list
);
try
{
JgTransferNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgTransferNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgTransferNoticeDto
.
class
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
return
new
ArrayList
<>();
}
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
return
new
ArrayList
<>();
}
// 启动工作流并返回信息
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
//业务数据组装等
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
responseModel
,
workflowResultList
,
list
,
equipList
);
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
// 如果为保存并提交,则创建代办
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
,
workflowResultList
,
Boolean
.
TRUE
);
}
else
{
// 暂存任务
buildTaskDraft
(
list
);
}
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgTransferNotice
>
collect
=
list
.
stream
().
filter
(
JgTransferNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgTransferNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgTransferNotice
>
collect
=
list
.
stream
().
filter
(
JgTransferNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgTransferNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
this
.
updateRedisBatch
(
list
);
return
list
;
}
private
void
updateRedisBatch
(
List
<
JgTransferNotice
>
jgTransferNotices
)
{
...
...
@@ -685,6 +749,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jsonObject
.
put
(
"nextTaskId"
,
jgTransferNotice
.
getNextTaskId
());
commonService
.
rollbackTask
(
jgTransferNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgTransferNotice
));
this
.
delRepeatUseEquipData
(
jgTransferNotice
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/MaintainNoticeEquipUsedCheckImpl.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
*/
@Component
@Slf4j
public
class
MaintainNoticeEquipUsedCheckImpl
extends
BaseEquipUsedCheckService
{
private
RedissonClient
redissonClient
;
private
String
bizType
=
"maintainNotice"
;
private
JgMaintainNoticeMapper
maintainNoticeMapper
;
public
MaintainNoticeEquipUsedCheckImpl
(
RedissonClient
redissonClient
,
JgMaintainNoticeMapper
maintainNoticeMapper
)
{
this
.
redissonClient
=
redissonClient
;
this
.
maintainNoticeMapper
=
maintainNoticeMapper
;
}
@Override
public
RedissonClient
getRedisClient
()
{
return
redissonClient
;
}
@Override
public
String
getApplyBizType
()
{
return
bizType
;
}
@Override
public
void
init
()
{
// 初始化已经完成或者在流程中安装告知的设备数据
List
<
CompanyEquipCountDto
>
companyEquipCountDtos
=
maintainNoticeMapper
.
queryForFlowingEquipList
();
companyEquipCountDtos
.
forEach
(
c
->
{
RBucket
<
Set
<
String
>>
rBucket
=
redissonClient
.
getBucket
(
getFlowingEquipRedisKey
(
c
.
getCompanyCode
(),
bizType
));
rBucket
.
set
(
Arrays
.
stream
(
c
.
getRecords
().
split
(
","
)).
collect
(
Collectors
.
toSet
()));
});
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/ReformNoticeEquipUsedCheckImpl.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
*/
@Component
@Slf4j
public
class
ReformNoticeEquipUsedCheckImpl
extends
BaseEquipUsedCheckService
{
private
RedissonClient
redissonClient
;
private
String
bizType
=
"renovationNoticeNew"
;
private
JgReformNoticeMapper
reformNoticeMapper
;
public
ReformNoticeEquipUsedCheckImpl
(
RedissonClient
redissonClient
,
JgReformNoticeMapper
reformNoticeMapper
)
{
this
.
redissonClient
=
redissonClient
;
this
.
reformNoticeMapper
=
reformNoticeMapper
;
}
@Override
public
RedissonClient
getRedisClient
()
{
return
redissonClient
;
}
@Override
public
String
getApplyBizType
()
{
return
bizType
;
}
@Override
public
void
init
()
{
// 初始化已经完成或者在流程中安装告知的设备数据
List
<
CompanyEquipCountDto
>
companyEquipCountDtos
=
reformNoticeMapper
.
queryForFlowingEquipList
();
companyEquipCountDtos
.
forEach
(
c
->
{
RBucket
<
Set
<
String
>>
rBucket
=
redissonClient
.
getBucket
(
getFlowingEquipRedisKey
(
c
.
getCompanyCode
(),
bizType
));
rBucket
.
set
(
Arrays
.
stream
(
c
.
getRecords
().
split
(
","
)).
collect
(
Collectors
.
toSet
()));
});
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/TransferNoticeEquipUsedCheckImpl.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintainNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.stereotype.Component
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
*/
@Component
@Slf4j
public
class
TransferNoticeEquipUsedCheckImpl
extends
BaseEquipUsedCheckService
{
private
RedissonClient
redissonClient
;
private
String
bizType
=
"transferNotice"
;
private
JgTransferNoticeMapper
noticeMapper
;
public
TransferNoticeEquipUsedCheckImpl
(
RedissonClient
redissonClient
,
JgTransferNoticeMapper
noticeMapper
)
{
this
.
redissonClient
=
redissonClient
;
this
.
noticeMapper
=
noticeMapper
;
}
@Override
public
RedissonClient
getRedisClient
()
{
return
redissonClient
;
}
@Override
public
String
getApplyBizType
()
{
return
bizType
;
}
@Override
public
void
init
()
{
// 初始化已经完成或者在流程中安装告知的设备数据
List
<
CompanyEquipCountDto
>
companyEquipCountDtos
=
noticeMapper
.
queryForFlowingEquipList
();
companyEquipCountDtos
.
forEach
(
c
->
{
RBucket
<
Set
<
String
>>
rBucket
=
redissonClient
.
getBucket
(
getFlowingEquipRedisKey
(
c
.
getCompanyCode
(),
bizType
));
rBucket
.
set
(
Arrays
.
stream
(
c
.
getRecords
().
split
(
","
)).
collect
(
Collectors
.
toSet
()));
});
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/json/superviseBusinessCategory.json
View file @
444a8266
...
...
@@ -31,7 +31,7 @@
"name"
:
"移装告知"
,
"code"
:
"GZ_YZ"
,
"image"
:
"upload/tzs/common/image/移装告知.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
}
],
"DJGL"
:
[
...
...
@@ -49,7 +49,7 @@
"name"
:
"移装变更登记"
,
"code"
:
"DJ_YZ"
,
"image"
:
"upload/tzs/common/image/移装变更登记.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
},
{
"name"
:
"单位变更登记"
,
...
...
@@ -88,16 +88,16 @@
"image"
:
"upload/tzs/common/image/注销报废.png"
},
{
"name"
:
"
设备
启用"
,
"name"
:
"启用"
,
"code"
:
"SB_QY"
,
"image"
:
"upload/tzs/common/image/设备启用.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
},
{
"name"
:
"
设备
停用"
,
"name"
:
"停用"
,
"code"
:
"SB_TY"
,
"image"
:
"upload/tzs/common/image/设备停用.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
}
],
"XZSB"
:
[
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/mapper/JyjcInspectionApplicationMapper.java
View file @
444a8266
...
...
@@ -65,4 +65,12 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
* @return 统计信息
*/
List
<
CountDto
>
queryAllPendingResultInspectApp
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
/**
* 按照8大类,查询指定区域下的报检数量、待检数量
* @param orgCode 指定区域对应的公司
* @param dpFilterParamDto 时间过滤条件
* @return List<CountDto>
*/
List
<
CountDto
>
queryAppByEquListForDP
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/resources/mapper/JyjcInspectionApplicationMapper.xml
View file @
444a8266
...
...
@@ -242,6 +242,37 @@
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status = '6616'
and EXISTS (select 1 from tz_jyjc_inspection_result r where r.result_status='1' and a.application_no = r.application_no)
and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
and date_ge(CAST(a.accept_date as date),#{dto.beginDate}) and date_le(CAST(a.accept_date as date),#{dto.endDate})
group by a.inspection_type
</select>
<select
id=
"queryAppByEquListForDP"
resultType=
"com.yeejoin.amos.boot.biz.common.dto.CountDto"
>
-- 8大类 待检数量
SELECT
count(1) as longValue,
a.equip_classify as keyStr,
'pending' as label
FROM
tz_jyjc_inspection_application a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status = '6616'
and EXISTS (select 1 from tz_jyjc_inspection_result r where r.result_status='1' and a.application_no = r.application_no)
and date_ge(CAST(a.accept_date as date),#{dto.beginDate}) and date_le(CAST(a.accept_date as date),#{dto.endDate})
GROUP BY a.equip_classify
-- 8大类 报检数量统计
union all
SELECT
count(1) as longValue,
a.equip_classify as keyStr,
'reporting' as label
FROM
tz_jyjc_inspection_application a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status != '6610' and a.status != '6615'
and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
GROUP BY a.equip_classify
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/pom.xml
View file @
444a8266
...
...
@@ -34,6 +34,11 @@
<groupId>
net.javacrumbs.shedlock
</groupId>
<artifactId>
shedlock-provider-redis-spring
</artifactId>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
visual-feign-morphic
</artifactId>
<version>
1.9.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
<plugins>
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/config/RestTemplateConfig.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
config
;
import
org.springframework.cloud.client.loadbalancer.LoadBalanced
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.client.RestTemplate
;
/**
* @Author: xl
* @Description:
* @Date: 2022/9/21 18:04
*/
@Configuration
public
class
RestTemplateConfig
{
@Bean
@LoadBalanced
public
RestTemplate
getRestTemplate
()
{
return
new
RestTemplate
();
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/controller/DPStatisticsController.java
View file @
444a8266
...
...
@@ -114,4 +114,14 @@ public class DPStatisticsController {
return
ResponseHelper
.
buildResponse
(
statisticsService
.
queryInspectionOrgListForPublicity
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-检验检测-八大类设备报检/待检数量统计"
,
notes
=
"大屏-检验检测-八大类设备报检/待检数量统计"
)
@PostMapping
(
value
=
"/jy/inspectionEquip/countByEquList"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
inspectionEquipCountByEquList
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
queryInspectionEquipByEquList
(
dpFilterParamDto
));
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/controller/DPSubController.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jyjc.biz.service.impl.DPSubServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.util.Assert
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.Map
;
/**
* 大屏统计controller
*
* @author Administrator
*/
@RestController
@RequestMapping
(
"/dp/sub"
)
@Api
(
tags
=
"大屏二级弹窗"
)
public
class
DPSubController
{
private
DPSubServiceImpl
subService
;
public
DPSubController
(
DPSubServiceImpl
subService
)
{
this
.
subService
=
subService
;
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"动态详情页"
,
notes
=
"动态详情页"
)
@PostMapping
(
value
=
"/{template}"
)
public
ResponseModel
<
JSONObject
>
commonQuery
(
@PathVariable
String
template
,
@RequestBody
Map
<
String
,
Object
>
param
)
{
if
(
template
.
equals
(
"company"
)){
Assert
.
notNull
(
param
.
get
(
"useUnitCode"
),
"企业统一信用代码不能为空"
);
}
else
if
(
template
.
equals
(
"equip"
)){
param
.
put
(
"record"
,
param
.
get
(
"SEQUENCE_NBR"
));
param
.
put
(
"equList"
,
param
.
get
(
"EQU_LIST_CODE"
));
Assert
.
notNull
(
param
.
get
(
"record"
),
"设备ID不能为空"
);
Assert
.
notNull
(
param
.
get
(
"equList"
),
"设备种类不能为空"
);
template
=
template
+
"_"
+
param
.
get
(
"equList"
);
}
else
{
throw
new
RuntimeException
(
"暂无模板"
);
}
return
ResponseHelper
.
buildResponse
(
subService
.
commonQuery
(
template
,
param
));
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/DPStatisticsServiceImpl.java
View file @
444a8266
...
...
@@ -283,4 +283,46 @@ public class DPStatisticsServiceImpl {
String
orgCode
=
this
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
return
openingApplicationMapper
.
queryInspectionOrgListForPublicity
(
orgCode
);
}
public
Map
<
String
,
Object
>
queryInspectionEquipByEquList
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 1.查询条件构造未上送时间时,默认查询数据为近一个月数据
this
.
setDefaultFilter
(
dpFilterParamDto
);
String
orgCode
=
this
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
// 2.x轴数据构建
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
=
equipmentCategoryMapper
.
selectClassify
();
this
.
setXDataForInspectionEquipByEquList
(
result
,
equipmentCategoryDtos
);
// 3.y轴数据设置
// 目前都单设备报检故统计主表即可
List
<
CountDto
>
countDtos
=
inspectionApplicationMapper
.
queryAppByEquListForDP
(
orgCode
,
dpFilterParamDto
);
Map
<
String
,
List
<
CountDto
>>
groupByMap
=
countDtos
.
stream
().
collect
(
Collectors
.
groupingBy
(
CountDto:
:
getLabel
));
this
.
setYDataForInspectionEquipByEquList
(
result
,
groupByMap
,
equipmentCategoryDtos
);
// 4.图列数据设置
this
.
setLegendDataForInspectionEquipByEquList
(
result
);
return
result
;
}
private
void
setYDataForInspectionEquipByEquList
(
Map
<
String
,
Object
>
result
,
Map
<
String
,
List
<
CountDto
>>
groupByMap
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
groupByMap
.
forEach
((
key
,
value
)
->
result
.
put
(
key
,
this
.
setInspectionEquipData
(
value
,
equipmentCategoryDtos
)));
}
private
List
<
Long
>
setInspectionEquipData
(
List
<
CountDto
>
countDtos
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
return
equipmentCategoryDtos
.
stream
().
map
(
e
->
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
e
.
getCode
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
()).
collect
(
Collectors
.
toList
());
}
private
void
setLegendDataForInspectionEquipByEquList
(
Map
<
String
,
Object
>
result
)
{
Map
<
String
,
Object
>
item1
=
new
LinkedHashMap
<>();
item1
.
put
(
"dataKey"
,
"pending"
);
item1
.
put
(
"value"
,
"待检数量"
);
Map
<
String
,
Object
>
item2
=
new
LinkedHashMap
<>();
item2
.
put
(
"dataKey"
,
"reporting"
);
item2
.
put
(
"value"
,
"报检数量"
);
result
.
put
(
"legendData"
,
Arrays
.
asList
(
item1
,
item2
));
}
private
void
setXDataForInspectionEquipByEquList
(
Map
<
String
,
Object
>
result
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
// 8大类
List
<
String
>
names
=
equipmentCategoryDtos
.
stream
().
map
(
EquipmentCategoryDto:
:
getName
).
collect
(
Collectors
.
toList
());
result
.
put
(
"xdata"
,
names
);
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jyjc.biz.util.DpSubUtils
;
import
com.yeejoin.amos.boot.module.jyjc.biz.util.JsonValueUtils
;
import
com.yeejoin.amos.boot.module.jyjc.biz.util.RestTemplateUtils
;
import
com.yeejoin.amos.boot.module.jyjc.biz.util.StringUtils
;
import
com.yeejoin.amos.feign.morphic.Morphic
;
import
com.yeejoin.amos.feign.morphic.model.FormSceneModel
;
import
jdk.nashorn.api.scripting.ScriptObjectMirror
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.client.loadbalancer.LoadBalanced
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.DateUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.script.Invocable
;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptEngineManager
;
import
java.net.URI
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
/**
* 大屏二级页面实现类
*
* @author Administrator
*/
@Slf4j
@Service
public
class
DPSubServiceImpl
{
private
static
final
String
GATEWAY_SERVER_NAME
=
"AMOS-SERVER-GATEWAY"
;
@Autowired
@LoadBalanced
private
RestTemplate
restTemplate
;
public
JSONObject
commonQuery
(
String
template
,
@RequestBody
Map
<
String
,
Object
>
param
){
JSONObject
result
=
new
JSONObject
();
String
templateJson
=
DpSubUtils
.
getFileContent
(
template
+
".json"
);
//1、替换json中所有的变量
if
(!
ValidationUtil
.
isEmpty
(
param
))
{
for
(
Map
.
Entry
item:
param
.
entrySet
())
{
templateJson
=
templateJson
.
replaceAll
(
"\\{"
+
item
.
getKey
()
+
"\\}"
,
item
.
getValue
().
toString
());
}
}
//2、解析结构
result
=
JSON
.
parseObject
(
templateJson
);
JSONArray
tabs
=
result
.
getJSONArray
(
"tabs"
);
JSONObject
content
=
result
.
getJSONObject
(
"content"
);
tabs
.
stream
().
forEach
(
x
->
{
this
.
buildContent
(
content
,
(
JSONObject
)
x
);
});
return
result
;
}
public
void
buildContent
(
JSONObject
content
,
JSONObject
tab
){
Long
formSeq
=
tab
.
getLong
(
"formSeq"
);
Object
resultConvert
=
JsonValueUtils
.
getValueByKey
(
tab
,
"dataConfig"
,
"dataConfig.resultConvert"
);
Object
api
=
JsonValueUtils
.
getValueByKey
(
tab
,
"dataConfig"
,
"dataConfig.api"
);
JSONObject
map
=
content
.
getJSONObject
(
tab
.
getString
(
"key"
));
JSONObject
apiResult
=
new
JSONObject
();
if
(!
ValidationUtil
.
isEmpty
(
api
)){
ResponseModel
responseModel
=
this
.
getApiResult
((
JSONObject
)
api
,
!
ValidationUtil
.
isEmpty
(
resultConvert
)
?
resultConvert
.
toString
()
:
null
);
if
(!
ValidationUtil
.
isEmpty
(
responseModel
))
{
apiResult
=
JSONObject
.
parseObject
(
responseModel
.
getResult
().
toString
());
}
}
if
(!
ValidationUtil
.
isEmpty
(
formSeq
)){
FormSceneModel
formPage
=
Morphic
.
formSceneClient
.
seleteOne
(
formSeq
).
getResult
();
// 1、排除表单隐藏字段
JSONArray
children
=
(
JSONArray
)
JsonValueUtils
.
getValueByKey
(
JSONObject
.
parseObject
(
formPage
.
getContent
()),
"children"
,
"children"
);
Object
showHideRules
=
JsonValueUtils
.
getValueByKey
(
JSONObject
.
parseObject
(
formPage
.
getContent
()),
"formConfig"
,
"formConfig.showHideRules"
);
// 处理显隐逻辑
this
.
processShowHideRules
(
children
,
showHideRules
,
apiResult
);
List
<
Object
>
noHiddenChildren
=
children
.
stream
().
filter
(
x
->
!
"hidden"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.behavior"
))).
collect
(
Collectors
.
toList
());
for
(
int
i
=
0
;
i
<
noHiddenChildren
.
size
();
i
++)
{
JSONObject
yObj
=
(
JSONObject
)
noHiddenChildren
.
get
(
i
);
if
(
"pageSection"
.
equals
(
yObj
.
get
(
"componentKey"
))
||
"columnsLayout"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 分组或者布局容器
List
<
Object
>
mergedArray
=
mergedList
(
yObj
.
getJSONArray
(
"children"
));
// 第一组去除标题
if
(
i
==
0
||
ValidationUtil
.
isEmpty
(
map
.
get
(
"datas"
))){
this
.
buildContentData
(
map
,
mergedArray
,
apiResult
);
}
else
{
this
.
buildSubContentData
(
map
,
i
,
yObj
,
mergedArray
,
apiResult
);
}
}
else
if
(
"subForm"
.
equals
(
yObj
.
get
(
"componentKey"
)))
{
// 子表单
this
.
buildSubFormData
(
map
,
i
,
yObj
,
apiResult
);
}
else
if
(
"formTable"
.
equals
(
yObj
.
get
(
"componentKey"
))){
map
=
new
JSONObject
();
map
.
put
(
"columns"
,
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.modelTableColumns"
));
map
.
put
(
"dataList"
,
apiResult
);
map
.
put
(
"showPage"
,
true
);
content
.
put
(
tab
.
getString
(
"key"
),
map
);
}
}
}
else
{
if
(
ValidationUtil
.
isEmpty
(
map
)){
content
.
put
(
tab
.
getString
(
"key"
),
apiResult
);
}
}
}
private
JSONArray
processShowHideRules
(
JSONArray
children
,
Object
showHideRules
,
JSONObject
apiResult
)
{
if
(!
ValidationUtil
.
isEmpty
(
showHideRules
)){
((
JSONArray
)
showHideRules
).
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
boolean
hide
=
true
;
JSONArray
conditions
=
xObj
.
getJSONArray
(
"condition"
);
String
relation
=
null
;
boolean
lastConditionResult
=
false
;
for
(
int
i
=
0
;
i
<
conditions
.
size
();
i
++)
{
JSONObject
conditionObj
=
conditions
.
getJSONObject
(
i
);
String
value
=
conditionObj
.
getString
(
"value"
);
String
condition
=
conditionObj
.
getString
(
"condition"
);
JSONObject
item
=
this
.
findByEid
(
children
,
JsonValueUtils
.
getValueByKey
(
conditionObj
,
"name"
,
"name.key"
).
toString
());
Object
fieldvalue
=
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
item
,
"visualParams"
,
"visualParams.fieldKey"
));
if
(
ValidationUtil
.
isEmpty
(
relation
)){
if
(
condition
.
equals
(
"notUndefined"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)){
lastConditionResult
=
!
ValidationUtil
.
isEmpty
(
fieldvalue
);
hide
=
false
;
}
else
if
(
condition
.
equals
(
"unequal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
!
fieldvalue
.
equals
(
value
)){
lastConditionResult
=
!
fieldvalue
.
equals
(
value
);
hide
=
false
;
}
else
if
(
condition
.
equals
(
"equal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
fieldvalue
.
equals
(
value
)){
lastConditionResult
=
fieldvalue
.
equals
(
value
);
hide
=
false
;
}
}
else
{
if
(
lastConditionResult
&&
condition
.
equals
(
"notUndefined"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)){
lastConditionResult
=
!
ValidationUtil
.
isEmpty
(
fieldvalue
);
hide
=
false
;
}
else
if
(
lastConditionResult
&&
condition
.
equals
(
"unequal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
!
fieldvalue
.
equals
(
value
)){
lastConditionResult
=
!
fieldvalue
.
equals
(
value
);
hide
=
false
;
}
else
if
(
lastConditionResult
&&
condition
.
equals
(
"equal"
)
&&
!
ValidationUtil
.
isEmpty
(
fieldvalue
)
&&
fieldvalue
.
equals
(
value
)){
lastConditionResult
=
fieldvalue
.
equals
(
value
);
hide
=
false
;
}
else
{
hide
=
true
;
}
}
relation
=
conditionObj
.
getString
(
"relation"
);
}
if
(
hide
)
{
JSONArray
showColumns
=
xObj
.
getJSONArray
(
"showColumns"
);
showColumns
.
stream
().
forEach
(
showColumn
->
{
boolean
match
=
false
;
// 是否匹配标识
List
<
Object
>
collect
=
children
.
stream
().
filter
(
y
->
showColumn
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(
ValidationUtil
.
isEmpty
(
collect
)){
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
if
(
match
){
break
;
}
JSONArray
subChildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
for
(
int
j
=
0
;
j
<
subChildren
.
size
();
j
++)
{
if
(
match
){
break
;
}
Object
cchildren
=
JsonValueUtils
.
getValueByKey
(
subChildren
.
get
(
j
),
"children"
,
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
List
<
Object
>
ccollect
=
((
JSONArray
)
cchildren
).
stream
().
filter
(
y
->
showColumn
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
ccollect
)){
JSONObject
groupObj
=
(
JSONObject
)
ccollect
.
get
(
0
);
JSONObject
visualParams
=
groupObj
.
getJSONObject
(
"visualParams"
);
visualParams
.
put
(
"behavior"
,
"hidden"
);
match
=
true
;
break
;
}
}
}
}
}
else
{
JSONObject
groupObj
=
(
JSONObject
)
collect
.
get
(
0
);
JSONObject
visualParams
=
groupObj
.
getJSONObject
(
"visualParams"
);
visualParams
.
put
(
"behavior"
,
"hidden"
);
}
});
}
});
}
return
children
;
}
private
JSONObject
findByEid
(
JSONArray
children
,
String
eid
)
{
List
<
Object
>
collect
=
children
.
stream
().
filter
(
x
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(
ValidationUtil
.
isEmpty
(
collect
)){
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
JSONArray
subChildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
for
(
int
j
=
0
;
j
<
subChildren
.
size
();
j
++)
{
if
(
ValidationUtil
.
isEmpty
(
subChildren
.
getJSONObject
(
j
).
get
(
"children"
))){
List
<
Object
>
ccollect
=
subChildren
.
stream
().
filter
(
y
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
ccollect
)){
return
(
JSONObject
)
ccollect
.
get
(
0
);
}
}
else
{
Object
cchildren
=
JsonValueUtils
.
getValueByKey
(
subChildren
.
get
(
j
),
"children"
,
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
List
<
Object
>
ccollect
=
((
JSONArray
)
cchildren
).
stream
().
filter
(
y
->
eid
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"eid"
,
"eid"
))).
collect
(
Collectors
.
toList
());
if
(!
ValidationUtil
.
isEmpty
(
ccollect
)){
return
(
JSONObject
)
ccollect
.
get
(
0
);
}
}
}
}
}
}
return
(
JSONObject
)
collect
.
get
(
0
);
}
/**
* 合并分组组件下的所有组件
* @param children
* @return
*/
private
List
<
Object
>
mergedList
(
JSONArray
children
){
JSONArray
mergedArray
=
new
JSONArray
();
int
maxSize
=
0
;
// 初始化为JSONArray的长度
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
JSONArray
cchildren
=
children
.
getJSONObject
(
i
).
getJSONArray
(
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
maxSize
=
Math
.
max
(
maxSize
,
cchildren
.
size
());
}
}
for
(
int
i
=
0
;
i
<
maxSize
;
i
++)
{
for
(
int
j
=
0
;
j
<
children
.
size
();
j
++)
{
JSONArray
cchildren
=
children
.
getJSONObject
(
j
).
getJSONArray
(
"children"
);
if
(!
ValidationUtil
.
isEmpty
(
cchildren
)){
List
<
Object
>
noHiddenMergedArray
=
cchildren
.
stream
().
filter
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
return
!
"hidden"
.
equals
(
JsonValueUtils
.
getValueByKey
(
xObj
,
"visualParams"
,
"visualParams.behavior"
));
}).
collect
(
Collectors
.
toList
());
if
(
i
<
noHiddenMergedArray
.
size
())
{
mergedArray
.
add
(
cchildren
.
get
(
i
));
}
}
}
}
return
mergedArray
;
}
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
){
JSONArray
datas
=
new
JSONArray
();
// 处理二维码
mergedArray
.
stream
().
filter
(
x
->
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
findFirst
().
ifPresent
(
x
->
{
JSONObject
qrcode
=
map
.
getJSONObject
(
"qrcode"
);
String
problemTime
=
apiResult
.
getString
(
"problemTime"
);
String
problemStatus
=
apiResult
.
getString
(
"problemStatus"
);
if
(!
ValidationUtil
.
isEmpty
(
problemTime
)){
try
{
qrcode
.
put
(
"text"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"yyyy-MM-dd"
));
qrcode
.
put
(
"subtext"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"HH:mm:ss"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
"正常"
.
equals
(
problemStatus
)){
problemStatus
=
"green"
;
}
else
if
(
"异常"
.
equals
(
problemStatus
)){
problemStatus
=
"red"
;
}
qrcode
.
put
(
"value"
,
!
ValidationUtil
.
isEmpty
(
apiResult
.
get
(
"useCode"
))
?
apiResult
.
get
(
"useCode"
)
:
apiResult
.
get
(
"USE_ORG_CODE"
));
qrcode
.
put
(
"status"
,
problemStatus
);
});
mergedArray
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.componentKey"
))).
collect
(
Collectors
.
toList
());
mergedArray
.
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
String
fieldKey
=
visualParams
.
getString
(
"fieldKey"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
)){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"label"
,
visualParams
.
getString
(
"label"
));
Object
value
=
apiResult
.
get
(
fieldKey
);
if
(
"upload"
.
equals
(
xObj
.
getString
(
"componentKey"
))){
jsonObject
.
put
(
"type"
,
"img"
);
if
(!
ValidationUtil
.
isEmpty
(
value
)){
jsonObject
.
put
(
"value"
,
((
JSONArray
)
value
).
getJSONObject
(
0
).
getString
(
"url"
));
}
}
else
if
(
"select"
.
equals
(
xObj
.
getString
(
"componentKey"
))){
jsonObject
.
put
(
"type"
,
"text"
);
ResponseModel
selectResult
=
this
.
getApiResult
(
visualParams
.
getJSONObject
(
"api"
),
null
);
if
(!
ValidationUtil
.
isEmpty
(
selectResult
)
&&
!
ValidationUtil
.
isEmpty
(
value
)){
((
JSONArray
)
selectResult
.
getResult
()).
stream
().
filter
(
y
->
value
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"valueKey"
,
"valueKey"
))).
findFirst
().
ifPresent
(
z
->
{
jsonObject
.
put
(
"value"
,
((
JSONObject
)
z
).
getString
(
"nameKey"
));
});
}
else
{
jsonObject
.
put
(
"value"
,
value
);
}
}
else
{
jsonObject
.
put
(
"type"
,
"text"
);
jsonObject
.
put
(
"value"
,
value
);
}
datas
.
add
(
jsonObject
);
}
});
map
.
put
(
"datas"
,
datas
);
return
map
;
}
public
JSONObject
buildSubContentData
(
JSONObject
map
,
int
i
,
JSONObject
yObj
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
){
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
List
<
Object
>
columnsArray
=
children
.
stream
().
filter
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
return
!
ValidationUtil
.
isEmpty
(
xObj
.
getJSONArray
(
"children"
))
&&
xObj
.
getJSONArray
(
"children"
).
size
()
>
0
;
}).
collect
(
Collectors
.
toList
());
JSONObject
subObj
=
new
JSONObject
();
subObj
.
put
(
"key"
,
"key"
+
i
);
subObj
.
put
(
"displayName"
,
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.title"
));
subObj
.
put
(
"renderType"
,
"basic"
);
subObj
.
put
(
"columns"
,
columnsArray
.
size
());
JSONArray
datas
=
new
JSONArray
();
mergedArray
.
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
String
fieldKey
=
visualParams
.
getString
(
"fieldKey"
);
if
(!
ValidationUtil
.
isEmpty
(
fieldKey
)){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"label"
,
visualParams
.
getString
(
"label"
));
Object
value
=
apiResult
.
get
(
fieldKey
);
if
(
"upload"
.
equals
(
xObj
.
getString
(
"componentKey"
))){
jsonObject
.
put
(
"type"
,
"img"
);
if
(!
ValidationUtil
.
isEmpty
(
value
)){
jsonObject
.
put
(
"value"
,
((
JSONArray
)
value
).
getJSONObject
(
0
).
getString
(
"url"
));
}
}
else
if
(
"select"
.
equals
(
xObj
.
getString
(
"componentKey"
))){
jsonObject
.
put
(
"type"
,
"text"
);
ResponseModel
selectResult
=
this
.
getApiResult
(
visualParams
.
getJSONObject
(
"api"
),
null
);
if
(!
ValidationUtil
.
isEmpty
(
selectResult
)
&&
selectResult
.
getStatus
()
==
200
&&
!
ValidationUtil
.
isEmpty
(
value
)){
((
JSONArray
)
selectResult
.
getResult
()).
stream
().
filter
(
y
->
value
.
equals
(
JsonValueUtils
.
getValueByKey
(
y
,
"valueKey"
,
"valueKey"
))).
findFirst
().
ifPresent
(
z
->
{
jsonObject
.
put
(
"value"
,
((
JSONObject
)
z
).
getString
(
"nameKey"
));
});
}
else
{
jsonObject
.
put
(
"value"
,
value
);
}
}
else
{
jsonObject
.
put
(
"type"
,
"text"
);
jsonObject
.
put
(
"value"
,
value
);
}
datas
.
add
(
jsonObject
);
subObj
.
put
(
"datas"
,
datas
);
}
});
subs
.
add
(
subObj
);
return
map
;
}
public
JSONObject
buildSubFormData
(
JSONObject
map
,
int
i
,
JSONObject
yObj
,
JSONObject
apiResult
){
JSONArray
subs
=
map
.
getJSONArray
(
"subs"
);
JSONArray
children
=
yObj
.
getJSONArray
(
"children"
);
JSONObject
subObj
=
new
JSONObject
();
subObj
.
put
(
"key"
,
"key"
+
i
);
subObj
.
put
(
"displayName"
,
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.label"
));
subObj
.
put
(
"renderType"
,
"table"
);
List
<
Object
>
noHiddenChildren
=
children
.
stream
().
filter
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
return
!
"hidden"
.
equals
(
JsonValueUtils
.
getValueByKey
(
xObj
,
"visualParams"
,
"visualParams.behavior"
));
}).
collect
(
Collectors
.
toList
());
List
<
JSONObject
>
columns
=
noHiddenChildren
.
stream
().
map
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"key"
,
xObj
.
get
(
"eid"
));
jsonObject
.
put
(
"dataIndex"
,
visualParams
.
get
(
"fieldKey"
));
jsonObject
.
put
(
"title"
,
visualParams
.
get
(
"label"
));
return
jsonObject
;
}).
collect
(
Collectors
.
toList
());
subObj
.
put
(
"showPage"
,
false
);
subObj
.
put
(
"columns"
,
columns
);
subObj
.
put
(
"dataList"
,
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.fieldKey"
)));
subs
.
add
(
subObj
);
return
map
;
}
public
ResponseModel
getApiResult
(
JSONObject
apiObj
,
String
resultConvert
)
{
String
url
=
apiObj
.
getString
(
"apiPath"
);
String
reqType
=
!
ValidationUtil
.
isEmpty
(
apiObj
.
getString
(
"httpMethod"
))
?
apiObj
.
getString
(
"httpMethod"
)
:
"GET"
;
Object
params
=
apiObj
.
get
(
"params"
);
Object
body
=
apiObj
.
get
(
"body"
);
ResponseEntity
<
String
>
responseEntity
=
null
;
//如果url以/开头,则调用本服务内接口
if
(
url
!=
null
&&
url
.
trim
().
startsWith
(
"/"
))
{
url
=
"http://"
+
GATEWAY_SERVER_NAME
+
url
;
}
if
(
url
!=
null
&&
url
.
trim
().
startsWith
(
"http"
))
{
String
reqUrl
=
buildUrl
(
url
,
params
);
HttpHeaders
httpHeaders
=
this
.
builderHeaders
();
log
.
info
(
"调用第三方接口: {}, httpheaders: {}"
,
reqUrl
,
httpHeaders
);
try
{
URI
reqUri
=
new
URI
(
reqUrl
);
if
(
StringUtils
.
contrastLowerStr
(
"GET"
,
reqType
))
{
responseEntity
=
reqUrl
.
contains
(
GATEWAY_SERVER_NAME
)
?
RestTemplateUtils
.
get
(
restTemplate
,
reqUri
,
httpHeaders
,
body
,
String
.
class
,
new
HashMap
<>())
:
RestTemplateUtils
.
get
(
reqUri
,
httpHeaders
,
body
,
String
.
class
,
new
HashMap
<>());
}
else
if
(
StringUtils
.
contrastLowerStr
(
"POST"
,
reqType
))
{
responseEntity
=
reqUrl
.
contains
(
GATEWAY_SERVER_NAME
)
?
RestTemplateUtils
.
post
(
restTemplate
,
reqUri
,
httpHeaders
,
body
,
String
.
class
,
new
HashMap
<>())
:
RestTemplateUtils
.
post
(
reqUri
,
httpHeaders
,
body
,
String
.
class
,
new
HashMap
<>());
}
else
if
(
StringUtils
.
contrastLowerStr
(
"PUT"
,
reqType
))
{
responseEntity
=
reqUrl
.
contains
(
GATEWAY_SERVER_NAME
)
?
RestTemplateUtils
.
put
(
restTemplate
,
reqUri
,
httpHeaders
,
body
,
String
.
class
)
:
RestTemplateUtils
.
put
(
reqUri
,
httpHeaders
,
body
,
String
.
class
);
}
else
if
(
StringUtils
.
contrastLowerStr
(
"DELETE"
,
reqType
))
{
responseEntity
=
reqUrl
.
contains
(
GATEWAY_SERVER_NAME
)
?
RestTemplateUtils
.
delete
(
restTemplate
,
reqUri
,
httpHeaders
,
body
,
String
.
class
)
:
RestTemplateUtils
.
delete
(
reqUri
,
httpHeaders
,
body
,
String
.
class
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"调用第三方接口失败, 请求头参数:{}"
,
httpHeaders
);
e
.
printStackTrace
();
throw
new
RuntimeException
(
String
.
format
(
"调用第三方接口失败, %s请求【%s】,失败原因:%s"
,
reqType
,
reqUrl
,
e
.
getMessage
()));
}
}
else
{
throw
new
IllegalArgumentException
(
"仅支持以/或http开头的地址"
);
}
String
response
=
responseEntity
.
getBody
();
//结果转换(执行javaScript函数)
Object
bizResult
=
convertResult
(
JSONObject
.
parseObject
(
response
),
resultConvert
);
ResponseModel
responseModel
=
JSONObject
.
parseObject
(
response
,
ResponseModel
.
class
);
JSONObject
ruleData
=
apiObj
.
getJSONObject
(
"ruleData"
);
if
(!
ValidationUtil
.
isEmpty
(
ruleData
))
{
String
responseSuccess
=
ruleData
.
getString
(
"responseSuccess"
).
replace
(
"data"
,
""
);
Object
result
=
JsonValueUtils
.
getValueByKey
(
bizResult
,
"result"
,
responseSuccess
);
boolean
isRefactor
=
false
;
// 是否需要重构返回字段
if
(
result
instanceof
JSONObject
)
{
Map
<
String
,
Object
>
resultMap
=
(
Map
)
result
;
for
(
String
key
:
ruleData
.
keySet
())
{
if
(!(
key
.
equals
(
"responseExpression"
)
||
key
.
equals
(
"responseSuccess"
)
||
key
.
equals
(
"responseError"
)))
{
isRefactor
=
true
;
resultMap
.
put
(
key
,
resultMap
.
get
(
ruleData
.
get
(
key
)));
}
}
result
=
isRefactor
?
resultMap
:
result
;
}
else
if
(
result
instanceof
JSONArray
)
{
JSONArray
jsonArray
=
(
JSONArray
)
result
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
obj
=
jsonArray
.
getJSONObject
(
i
);
for
(
String
key
:
ruleData
.
keySet
())
{
if
(!(
key
.
equals
(
"responseExpression"
)
||
key
.
equals
(
"responseSuccess"
)
||
key
.
equals
(
"responseError"
)))
{
isRefactor
=
true
;
obj
.
put
(
key
,
obj
.
get
(
ruleData
.
get
(
key
)));
}
}
}
result
=
isRefactor
?
jsonArray
:
result
;
}
responseModel
.
setResult
(
result
);
}
return
responseModel
;
}
private
String
buildUrl
(
String
url
,
Object
params
)
{
if
(!
url
.
contains
(
"?"
)
&&
!
ValidationUtil
.
isEmpty
(
params
))
{
url
+=
"?"
;
}
if
(
params
instanceof
Map
)
{
url
=
url
+
StringUtils
.
transMap2UrlParam
((
Map
)
params
);
}
else
if
(
params
instanceof
List
)
{
url
=
url
+
StringUtils
.
transList2UrlParam
((
List
)
params
);
}
return
url
.
replace
(
"?&"
,
"?"
);
}
private
HttpHeaders
builderHeaders
(){
HttpHeaders
httpheaders
=
new
HttpHeaders
();
httpheaders
.
add
(
"appKey"
,
RequestContext
.
getAppKey
());
httpheaders
.
add
(
"product"
,
RequestContext
.
getProduct
());
httpheaders
.
add
(
"token"
,
RequestContext
.
getToken
());
httpheaders
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
return
httpheaders
;
}
/**
* ScriptObjectMirror 转 JavaObject
*
* @param scriptObj
* @return
*/
private
static
Object
convertIntoJavaObject
(
Object
scriptObj
)
{
if
(
scriptObj
instanceof
ScriptObjectMirror
)
{
ScriptObjectMirror
scriptObjectMirror
=
(
ScriptObjectMirror
)
scriptObj
;
if
(
scriptObjectMirror
.
isFunction
())
{
return
scriptObjectMirror
.
toString
();
}
else
if
(
scriptObjectMirror
.
isArray
())
{
return
new
JSONArray
(
scriptObjectMirror
.
values
().
stream
().
map
(
e
->
convertIntoJavaObject
(
e
)).
collect
(
Collectors
.
toList
()));
}
else
{
return
new
JSONObject
(
scriptObjectMirror
.
entrySet
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getKey
(),
e
->
convertIntoJavaObject
(
e
.
getValue
()))));
}
}
else
{
return
scriptObj
;
}
}
/**
* 结果转换(执行javaScript函数)
*
* @param bizResult 原始请求结果
* @param resultConvert js转换脚本
* @return 转换后的结果
*/
private
Object
convertResult
(
Object
bizResult
,
String
resultConvert
)
{
if
(!
ValidationUtil
.
isEmpty
(
resultConvert
))
{
//获取javaScript执行引擎
ScriptEngine
engine
=
new
ScriptEngineManager
().
getEngineByName
(
"javascript"
);
//获取js函数执行体并拼接函数名
String
jsFun
=
"function resultConvert(data){"
+
resultConvert
+
"}"
;
//向js函数传入参数
engine
.
put
(
"data"
,
bizResult
);
try
{
engine
.
eval
(
jsFun
);
if
(
engine
instanceof
Invocable
)
{
Invocable
invoke
=
(
Invocable
)
engine
;
//执行js函数,获取返回值
bizResult
=
invoke
.
invokeFunction
(
"resultConvert"
,
bizResult
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"js表达式runtime错误:{}"
,
e
.
getMessage
());
throw
new
RuntimeException
(
String
.
format
(
"结果转换错误【%s】"
,
e
.
getMessage
()));
}
//ScriptObjectMirror 转 JavaObject
bizResult
=
convertIntoJavaObject
(
bizResult
);
}
return
bizResult
;
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/util/DpSubUtils.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
util
;
import
org.springframework.core.io.ClassPathResource
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
public
class
DpSubUtils
{
public
static
String
companyJson
=
null
;
public
static
String
textJson
=
null
;
public
static
String
imageJson
=
null
;
public
static
String
circleJson
=
null
;
public
static
String
rectJson
=
null
;
static
{
// companyJson = getFileContent("company.json");
// textJson = getFileContent("text.json");
// imageJson = getFileContent("image.json");
// circleJson = getFileContent("circle.json");
// rectJson = getFileContent("rect.json");
}
public
static
String
getFileContent
(
String
filename
){
try
{
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
new
ClassPathResource
(
"json/"
+
filename
).
getInputStream
()));
StringBuffer
sb
=
new
StringBuffer
();
String
line
=
null
;
while
((
line
=
br
.
readLine
())!=
null
){
if
(
line
.
trim
().
length
()>
0
)
sb
.
append
(
line
);
}
br
.
close
();
return
sb
.
toString
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
// return null;
}
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/util/JsonValueUtils.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
util
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Strings
;
/**
* @Author: xl
* @Description: json快速取值
* @Date: 2022/5/12 11:11
*/
public
class
JsonValueUtils
{
public
static
Object
getValueByKey
(
Object
originObject
,
String
startKey
,
String
targetKey
)
{
if
(
Strings
.
isNullOrEmpty
(
startKey
))
{
return
originObject
;
}
if
(
originObject
instanceof
JSONObject
)
{
return
getValueFromJSONObjectByKey
((
JSONObject
)
originObject
,
startKey
,
targetKey
);
}
if
(
originObject
instanceof
JSONArray
)
{
return
getValueFromJSONArrayByKey
((
JSONArray
)
originObject
,
startKey
,
targetKey
);
}
return
null
;
}
private
static
String
getNextKey
(
String
startKey
,
String
targetKey
)
{
if
(
Strings
.
isNullOrEmpty
(
targetKey
))
{
return
null
;
}
String
[]
keys
=
targetKey
.
split
(
"\\."
);
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++)
{
if
(
keys
[
i
].
equals
(
startKey
)
&&
(
i
<
keys
.
length
-
1
))
{
return
keys
[
i
+
1
];
}
}
return
null
;
}
private
static
Object
getValueFromJSONArrayByKey
(
JSONArray
originObject
,
String
startKey
,
String
targetKey
)
{
try
{
Integer
integer
=
Integer
.
valueOf
(
startKey
);
JSONObject
jsonObject
=
originObject
.
getJSONObject
(
integer
);
Object
targetObject
=
getValueFromJSONObjectByKey
(
jsonObject
,
getNextKey
(
startKey
,
targetKey
),
targetKey
);
if
(
targetObject
!=
null
)
{
return
targetObject
;
}
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
Object
getValueFromJSONObjectByKey
(
JSONObject
originObject
,
String
startKey
,
String
targetKey
)
{
Object
object
=
originObject
.
get
(
startKey
);
return
object
!=
null
?
getValueByKey
(
object
,
getNextKey
(
startKey
,
targetKey
),
targetKey
)
:
null
;
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/util/RestTemplateUtils.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
util
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.client.RestTemplate
;
import
java.net.URI
;
import
java.util.Map
;
/**
* @Author: xl
* @Description: 远程调用工具类
* @Date: 2021/10/8 13:46
*/
public
class
RestTemplateUtils
{
private
static
class
SingletonRestTemplate
{
static
final
RestTemplate
INSTANCE
=
new
RestTemplate
();
}
private
RestTemplateUtils
()
{
}
public
static
RestTemplate
getInstance
()
{
return
SingletonRestTemplate
.
INSTANCE
;
}
/**
* 带请求头的GET请求调用方式
*
* @param uri 请求URL
* @param headers 请求头参数
* @param responseType 返回对象类型
* @param uriVariables URL中的变量,与Map中的key对应
* @return ResponseEntity 响应对象封装类
*/
public
static
<
T
>
ResponseEntity
<
T
>
get
(
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
,
Map
<
String
,
?>
uriVariables
)
{
HttpEntity
<?>
requestEntity
=
new
HttpEntity
<>(
headers
);
return
RestTemplateUtils
.
getInstance
().
exchange
(
uri
,
HttpMethod
.
GET
,
requestEntity
,
responseType
);
}
/**
* @param restTemplate 可传入负载均衡的restTemplate
* @param uri
* @param headers
* @param responseType
* @param uriVariables
* @param <T>
* @return
*/
public
static
<
T
>
ResponseEntity
<
T
>
get
(
RestTemplate
restTemplate
,
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
,
Map
<
String
,
?>
uriVariables
)
{
HttpEntity
<?>
requestEntity
=
new
HttpEntity
<>(
headers
);
return
restTemplate
.
exchange
(
uri
,
HttpMethod
.
GET
,
requestEntity
,
responseType
);
}
/**
* 带请求头的POST请求调用方式
*
* @param uri 请求URL
* @param headers 请求头参数
* @param requestBody 请求参数体
* @param responseType 返回对象类型
* @param uriVariables URL中的变量,与Map中的key对应
* @return ResponseEntity 响应对象封装类
*/
public
static
<
T
>
ResponseEntity
<
T
>
post
(
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
,
Map
<
String
,
?>
uriVariables
)
{
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<
Object
>(
requestBody
,
headers
);
return
RestTemplateUtils
.
getInstance
().
postForEntity
(
uri
,
requestEntity
,
responseType
);
}
/**
* @param restTemplate 可传入负载均衡的restTemplate
* @param uri
* @param headers
* @param requestBody
* @param responseType
* @param uriVariables
* @param <T>
* @return
*/
public
static
<
T
>
ResponseEntity
<
T
>
post
(
RestTemplate
restTemplate
,
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
,
Map
<
String
,
?>
uriVariables
)
{
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<
Object
>(
requestBody
,
headers
);
return
restTemplate
.
postForEntity
(
uri
,
requestEntity
,
responseType
);
}
/**
* 带请求头的PUT请求调用方式
*
* @param uri 请求URL
* @param headers 请求头参数
* @param requestBody 请求参数体
* @param responseType 返回对象类型
* @return ResponseEntity 响应对象封装类
*/
public
static
<
T
>
ResponseEntity
<
T
>
put
(
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
)
{
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<
Object
>(
requestBody
,
headers
);
return
RestTemplateUtils
.
getInstance
().
exchange
(
uri
,
HttpMethod
.
PUT
,
requestEntity
,
responseType
);
}
/**
* @param restTemplate 可传入负载均衡的restTemplate
* @param uri
* @param headers
* @param requestBody
* @param responseType
* @param <T>
* @return
*/
public
static
<
T
>
ResponseEntity
<
T
>
put
(
RestTemplate
restTemplate
,
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
)
{
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<
Object
>(
requestBody
,
headers
);
return
restTemplate
.
exchange
(
uri
,
HttpMethod
.
PUT
,
requestEntity
,
responseType
);
}
/**
* 带请求头的DELETE请求调用方式
*
* @param uri 请求URL
* @param headers 请求头参数
* @param requestBody 请求参数体
* @param responseType 返回对象类型
* @return ResponseEntity 响应对象封装类
*/
public
static
<
T
>
ResponseEntity
<
T
>
delete
(
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
)
{
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<
Object
>(
requestBody
,
headers
);
return
RestTemplateUtils
.
getInstance
().
exchange
(
uri
,
HttpMethod
.
DELETE
,
requestEntity
,
responseType
);
}
/**
* @param restTemplate 可传入负载均衡的restTemplate
* @param uri
* @param headers
* @param requestBody
* @param responseType
* @param <T>
* @return
*/
public
static
<
T
>
ResponseEntity
<
T
>
delete
(
RestTemplate
restTemplate
,
URI
uri
,
HttpHeaders
headers
,
Object
requestBody
,
Class
<
T
>
responseType
)
{
HttpEntity
<
Object
>
requestEntity
=
new
HttpEntity
<
Object
>(
requestBody
,
headers
);
return
restTemplate
.
exchange
(
uri
,
HttpMethod
.
DELETE
,
requestEntity
,
responseType
);
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/util/StringUtils.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jyjc
.
biz
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author: xinglei
* @Description:
* @Date: 2020/8/24 9:58
*/
public
class
StringUtils
{
public
static
boolean
contrastLowerStr
(
String
str1
,
String
str2
)
{
boolean
flag
=
false
;
if
(
str1
.
toLowerCase
().
equals
(
str2
.
toLowerCase
()))
{
flag
=
true
;
}
return
flag
;
}
/**
* 将map转换成url
*
* @param map
* @return
*/
public
static
String
transMap2UrlParam
(
Map
<
String
,
Object
>
map
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
for
(
Map
.
Entry
entry
:
map
.
entrySet
())
{
// 值为空或匹配total不拼接
if
(
ValidationUtil
.
isEmpty
(
entry
.
getValue
())
||
"total"
.
equals
(
entry
.
getKey
()))
continue
;
try
{
stringBuilder
.
append
(
"&"
).
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
URLEncoder
.
encode
(
entry
.
getValue
().
toString
(),
"UTF-8"
));
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
}
return
stringBuilder
.
toString
();
}
/**
* 将list转换成url
*
* @param list
* @return
*/
public
static
String
transList2UrlParam
(
List
<
Map
<
String
,
Object
>>
list
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
list
.
forEach
(
x
->
{
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
x
));
try
{
stringBuilder
.
append
(
"&"
).
append
(
map
.
get
(
"key"
)).
append
(
"="
).
append
(
URLEncoder
.
encode
(
map
.
get
(
"value"
).
toString
(),
"UTF-8"
));
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
});
return
stringBuilder
.
toString
();
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/company.json
0 → 100644
View file @
444a8266
{
"name"
:
"检验检测机构模板"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"基本信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793454184889085953"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/tcm/baseEnterprise/getInfoByUseCode/map"
,
"params"
:
{
"useCode"
:
"{useUnitCode}"
}
},
"resultConvert"
:
""
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"设备列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1792821076963651585"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"USE_UNIT_CREDIT_CODE"
:
"{useUnitCode}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
2
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_1000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-锅炉"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"gl"
,
"displayName"
:
"锅炉技术参数"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734819004637278210"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"gl"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_2000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-压力容器"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"ylrq"
,
"displayName"
:
"压力容器技术参数"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734818687287848961"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"ylrq"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_3000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-电梯"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"dt"
,
"displayName"
:
"电梯技术参数"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734504628768239617"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"dt"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_4000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-起重机械"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"qzqx"
,
"displayName"
:
"起重机械技术参数"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734818709194698753"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"qzqx"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_5000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-场(厂)内机动车"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"cnjdc"
,
"displayName"
:
"场(厂)内机动车技术参数"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734818684284727297"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"cnjdc"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_6000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-大型游乐设施"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"dxylss"
,
"displayName"
:
"大型游乐设施技术参数"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734818700369883137"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"dxylss"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_8000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-压力管道"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"ylgd"
,
"displayName"
:
"压力管道"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734818687287848961"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"ylgd"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/equip_9000.json
0 → 100644
View file @
444a8266
{
"name"
:
"设备-客运索道"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"设备信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793458381554479105"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipInfo"
}
}
}
},
{
"key"
:
"kysd"
,
"displayName"
:
"客运索道"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1734818694514634753"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/equipment-register/{record}"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result.equipParams"
}
}
}
},
{
"key"
:
"reghistory"
,
"displayName"
:
"监管履历信息"
,
"renderType"
:
"timeline"
,
"formSeq"
:
""
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/common/equOnJgServiceOperationRecords"
,
"params"
:
{
"record"
:
"{record}"
},
"ruleData"
:
{
"responseSuccess"
:
"data.result"
,
"operater"
:
"content"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"问题列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1793458819301404673"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/jg/safety-problem-tracing/equipId/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"record"
:
"{record}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
3
,
"datas"
:
[],
"qrcode"
:
{},
"subs"
:
[]
},
"kysd"
:
{
"columns"
:
4
,
"datas"
:
[],
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/untest_company.json
0 → 100644
View file @
444a8266
{
"name"
:
"非检验检测机构模板"
,
"tabs"
:
[
{
"key"
:
"basic"
,
"displayName"
:
"基本信息"
,
"renderType"
:
"basic"
,
"formSeq"
:
"1793454184889085953"
,
"dataConfig"
:
{
"api"
:
{
"reqType"
:
"GET"
,
"url"
:
"/tcm/baseEnterprise/getInfoByUseCode"
,
"params"
:
{
"useCode"
:
"{useUnitCode}"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"设备列表"
,
"renderType"
:
"table"
,
"formSeq"
:
"1792821076963651585"
,
"dataConfig"
:
{
"api"
:
{
"reqType"
:
"GET"
,
"url"
:
"/jg/equipment-register/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
10
,
"USE_UNIT_CREDIT_CODE"
:
"{useUnitCode}"
}
}
}
}
],
"content"
:
{
"basic"
:
{
"columns"
:
2
,
"datas"
:
[],
"qrcode"
:
{
"src"
:
"/public/ag/zongshu.png"
,
"text"
:
"2023/12/26"
,
"subtext"
:
"23:10:16"
},
"subs"
:
[]
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/dto/TzBaseEnterpriseInfoDto.java
View file @
444a8266
...
...
@@ -289,6 +289,9 @@ public class TzBaseEnterpriseInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"行业主管部门"
)
private
String
industrySupervisor
;
@ApiModelProperty
(
value
=
"企业问题状态"
)
private
String
status
;
private
String
region
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/enums/ProblemStatusEnum.java
0 → 100644
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
api
.
enums
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 问题状态
*/
public
enum
ProblemStatusEnum
{
NORMAL
(
"正常"
,
"0"
),
ABNORMAL
(
"异常"
,
"1"
);
private
String
name
;
private
String
code
;
ProblemStatusEnum
(
String
name
,
String
code
)
{
this
.
name
=
name
;
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setStatus
(
String
code
)
{
this
.
code
=
code
;
}
public
static
Map
<
String
,
String
>
getName
=
new
HashMap
<>();
public
static
Map
<
String
,
String
>
getCode
=
new
HashMap
<>();
static
{
for
(
ProblemStatusEnum
e
:
ProblemStatusEnum
.
values
())
{
getName
.
put
(
e
.
code
,
e
.
name
);
getCode
.
put
(
e
.
name
,
e
.
code
);
}
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/mapper/TzBaseEnterpriseInfoMapper.java
View file @
444a8266
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
api
.
mapper
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -11,6 +8,9 @@ import com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto;
import
com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 企业数据信息 Mapper 接口
*
...
...
@@ -54,4 +54,6 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
List
<
TzBaseEnterpriseInfo
>
listNoQrCode
();
List
<
Map
<
String
,
Object
>>
getEquipType
(
@Param
(
"type"
)
String
type
);
Map
<
String
,
Object
>
getProblemInfoBySourceId
(
@Param
(
"sourceId"
)
String
sourceId
);
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/TzBaseEnterpriseInfoMapper.xml
View file @
444a8266
...
...
@@ -172,5 +172,8 @@
</if>
</where>
</select>
<select
id=
"getProblemInfoBySourceId"
resultType=
"java.util.Map"
>
select * from tzs_safety_problem_tracing where source_id = #{sourceId} order by rec_date desc limit 1
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
444a8266
...
...
@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.tcm.api.dto.TzsBaseInstitutionDto;
import
com.yeejoin.amos.boot.module.tcm.api.entity.*
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.EnterpriseEnums
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.LicenceTypeEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.ProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.UnitTypeEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper
;
...
...
@@ -242,7 +243,8 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
public
Map
<
String
,
Object
>
getInfoByUseCodeMap
(
String
useCode
)
{
TzBaseEnterpriseInfoDto
infoByUseCode
=
getInfoByUseCode
(
useCode
);
// 通过sourceId获取问题信息
Map
<
String
,
Object
>
problemInfo
=
baseMapper
.
getProblemInfoBySourceId
(
infoByUseCode
.
getSequenceNbr
().
toString
());
ObjectMapper
objectMapper
=
new
ObjectMapper
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
...
...
@@ -272,6 +274,12 @@ public class TzBaseEnterpriseInfoServiceImpl
resultMap
.
remove
(
"regUnitIcDto"
);
resultMap
.
remove
(
"regUnitInfoDto"
);
resultMap
.
remove
(
"tzsBaseInstitution"
);
resultMap
.
put
(
"unitAddress"
,
resultMap
.
get
(
"province"
)
+
"/"
+
resultMap
.
get
(
"city"
)
+
"/"
+
resultMap
.
get
(
"district"
));
resultMap
.
put
(
"longitudeLatitude"
,
resultMap
.
get
(
"address"
));
resultMap
.
put
(
"problemTime"
,
ObjectUtils
.
isEmpty
(
problemInfo
)
?
null
:
problemInfo
.
get
(
"problem_time"
));
resultMap
.
put
(
"problemStatus"
,
(
ObjectUtils
.
isEmpty
(
resultMap
.
get
(
"status"
))
||
"null"
.
equals
(
resultMap
.
get
(
"status"
)))
?
ProblemStatusEnum
.
NORMAL
.
getName
()
:
ProblemStatusEnum
.
getName
.
get
(
resultMap
.
get
(
"status"
)));
return
resultMap
;
}
...
...
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