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
e55cb9bf
Commit
e55cb9bf
authored
Jul 19, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_tzs_register_to_0715' of…
Merge branch 'develop_tzs_register_to_0715' of
http://36.40.66.175:5000/moa/amos-boot-biz
into develop_tzs_register_to_0715
parents
0af2db3d
312e56b6
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
2109 additions
and
510 deletions
+2109
-510
DPFilterParamDto.java
...oin/amos/boot/module/common/api/dto/DPFilterParamDto.java
+5
-0
DPStatisticsMapper.java
...in/amos/boot/module/jg/api/mapper/DPStatisticsMapper.java
+59
-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
DPStatisticsMapper.xml
...e-jg-api/src/main/resources/mapper/DPStatisticsMapper.xml
+419
-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
DPStatisticsController.java
...boot/module/jg/biz/controller/DPStatisticsController.java
+87
-0
DPStatisticsServiceImpl.java
...t/module/jg/biz/service/impl/DPStatisticsServiceImpl.java
+611
-4
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
DPSubServiceImpl.java
...s/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
+21
-4
TzBaseEnterpriseInfoServiceImpl.java
...tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+5
-2
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/DPFilterParamDto.java
View file @
e55cb9bf
...
@@ -26,4 +26,9 @@ public class DPFilterParamDto {
...
@@ -26,4 +26,9 @@ public class DPFilterParamDto {
* 数据统计的结束日期
* 数据统计的结束日期
*/
*/
private
String
endDate
;
private
String
endDate
;
/**
* 业务类型0告知管理,1使用登记,2变更登记,3停用启用,4注销报废
*/
private
String
businessKey
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/DPStatisticsMapper.java
0 → 100644
View file @
e55cb9bf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
public
interface
DPStatisticsMapper
{
List
<
Map
<
String
,
Object
>>
maintenanceCountTopTen
(
@Param
(
"dpFilterParamDto"
)
DPFilterParamDto
dpFilterParamDto
);
List
<
Map
<
String
,
Object
>>
maintenanceCount
(
@Param
(
"dpFilterParamDto"
)
DPFilterParamDto
dpFilterParamDto
);
List
<
Map
<
String
,
Object
>>
installCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
maintenanceNoticeCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
reformCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
transferCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
useCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
vehicleCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
changeNameCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
changeReformCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
changeTransferCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
changeUnitCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
changeVehicleCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
disableCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
cancelCount
(
@Param
(
"cityCode"
)
String
cityCode
);
List
<
Map
<
String
,
Object
>>
installEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
maintenanceEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
reformEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
transferEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
useEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
changeReformEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
changeTransferEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
changeUnitEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
List
<
Map
<
String
,
Object
>>
vehicleEquCount
(
@Param
(
"cityCode"
)
String
cityCode
,
@Param
(
"startTime"
)
String
startTime
);
}
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 @
e55cb9bf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.dto.JgMaintainNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
@@ -44,4 +45,5 @@ public interface JgMaintainNoticeMapper extends CustomBaseMapper<JgMaintainNotic
...
@@ -44,4 +45,5 @@ public interface JgMaintainNoticeMapper extends CustomBaseMapper<JgMaintainNotic
Map
<
String
,
Object
>
getEquipInfoByRecord
(
String
record
);
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 @
e55cb9bf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.dto.JgReformNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
@@ -40,4 +41,6 @@ public interface JgReformNoticeMapper extends CustomBaseMapper<JgReformNotice> {
...
@@ -40,4 +41,6 @@ public interface JgReformNoticeMapper extends CustomBaseMapper<JgReformNotice> {
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
sequenceNbr
);
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
sequenceNbr
);
void
updatePromoter
(
@Param
(
"id"
)
Long
id
);
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 @
e55cb9bf
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.dto.JgTransferNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
...
@@ -26,4 +27,6 @@ public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotic
...
@@ -26,4 +27,6 @@ public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotic
@MapKey
(
"sequenceNbr"
)
@MapKey
(
"sequenceNbr"
)
List
<
Map
<
String
,
Object
>>
queryEquipInformation
(
@Param
(
"sequenceNbr"
)
long
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/DPStatisticsMapper.xml
0 → 100644
View file @
e55cb9bf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.jg.api.mapper.DPStatisticsMapper"
>
<select
id=
"maintenanceCountTopTen"
resultType=
"java.util.Map"
>
SELECT
COUNT(1),
pc.company_name AS companyName,
sr.region_name AS regionName
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN ( SELECT DISTINCT record, ME_UNIT_CREDIT_CODE FROM idx_biz_jg_maintenance_record_info ) AS jri ON jri.ME_UNIT_CREDIT_CODE = bi.use_unit_code
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{dpFilterParamDto.cityCode} )
GROUP BY
sr.region_code
ORDER BY
COUNT DESC
LIMIT 10;
</select>
<select
id=
"maintenanceCount"
resultType=
"java.util.Map"
>
SELECT
COUNT(1),
pc.company_name AS companyName,
sr.region_name AS regionName
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN ( SELECT DISTINCT record, ME_UNIT_CREDIT_CODE FROM idx_biz_jg_maintenance_record_info ) AS jri ON jri.ME_UNIT_CREDIT_CODE = bi.use_unit_code
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{dpFilterParamDto.cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"installCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code AS regionCode
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_installation_notice T ON T.use_unit_credit_code = bi.use_unit_code and T.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"maintenanceNoticeCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_maintain_notice mn ON mn.use_unit_credit_code = bi.use_unit_code
AND mn.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"reformCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_reform_notice rm ON rm.use_unit_credit_code = bi.use_unit_code
AND rm.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"transferCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_transfer_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"useCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_use_registration ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"vehicleCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information vi ON vi.use_unit_credit_code = bi.use_unit_code
AND vi.status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"changeNameCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_name crn ON crn.use_unit_credit_code = bi.use_unit_code
AND crn.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"changeReformCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_reform t ON t.use_unit_credit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"changeTransferCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_transfer t ON t.use_unit_credit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"changeUnitCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_unit t ON t.use_unit_credit_code = bi.use_unit_code
AND t.status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"changeVehicleCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_unit t ON t.use_unit_credit_code = bi.use_unit_code
AND t.status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"disableCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_enable_disable t ON t.use_unit_credit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"cancelCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
pc.company_name AS companyName,
sr.region_name AS regionName,
sr.region_code
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_scrap_cancel t ON t.use_unit_code = bi.use_unit_code
AND t.audit_status = '已完成'
INNER JOIN systemctl_region sr ON pc.company_code = sr.region_code
WHERE
pc.company_code IN ( SELECT region_code :: VARCHAR FROM systemctl_region WHERE parent_region_code = #{cityCode} )
GROUP BY
sr.region_code
</select>
<select
id=
"installEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_installation_notice T ON T.use_unit_credit_code = bi.use_unit_code
AND T.notice_status = 6616
INNER JOIN tzs_jg_installation_notice_eq te ON te.equip_transfer_id = T.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and T.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"maintenanceEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_maintain_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN tzs_jg_maintain_notice_eq te ON te.equip_transfer_id = tn.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and tn.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"reformEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_reform_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN tzs_jg_reform_notice_eq te ON te.equip_transfer_id = tn.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and tn.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"transferEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_transfer_notice tn ON tn.use_unit_credit_code = bi.use_unit_code
AND tn.notice_status = 6616
INNER JOIN tzs_jg_transfer_notice_eq te ON te.equip_transfer_id = tn.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and tn.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"useEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_use_registration ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_use_registration_eq te ON te.equip_transfer_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"changeReformEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_reform ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_change_registration_reform_eq te ON te.equip_transfer_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"changeTransferEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_transfer ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_change_registration_transfer_eq te ON te.equip_transfer_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"changeUnitEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_change_registration_unit ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.status = '已完成'
INNER JOIN tzs_jg_change_registration_unit_eq te ON te.unit_change_registration_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
<select
id=
"vehicleEquCount"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
jri.equ_list AS equList,
jri.equ_category AS equCategory
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_vehicle_information_eq te ON te.vehicle_id = ur.sequence_nbr
INNER JOIN idx_biz_jg_register_info jri ON te.equ_id = jri.record
WHERE
pc.company_code = #{cityCode} and ur.rec_date
>
= #{startTime}
GROUP BY
jri.equ_category
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
View file @
e55cb9bf
...
@@ -274,5 +274,16 @@
...
@@ -274,5 +274,16 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = oi.record
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
WHERE oi.record = #{record} ORDER BY oi."rec_date" DESC LIMIT 1
</select>
</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>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgReformNoticeMapper.xml
View file @
e55cb9bf
...
@@ -203,4 +203,16 @@
...
@@ -203,4 +203,16 @@
set promoter = null
set promoter = null
where sequence_nbr = #{id}
where sequence_nbr = #{id}
</update>
</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>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgTransferNoticeMapper.xml
View file @
e55cb9bf
...
@@ -217,4 +217,16 @@
...
@@ -217,4 +217,16 @@
tjtn.sequence_nbr = #{sequenceNbr}
tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
LIMIT 1
</select>
</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>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/DPStatisticsController.java
View file @
e55cb9bf
...
@@ -115,4 +115,91 @@ public class DPStatisticsController {
...
@@ -115,4 +115,91 @@ public class DPStatisticsController {
}
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
queryBizCycleData
(
dpFilterParamDto
));
return
ResponseHelper
.
buildResponse
(
statisticsService
.
queryBizCycleData
(
dpFilterParamDto
));
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-左侧设备状态情况统计"
,
notes
=
"监管大屏-左侧设备状态情况统计"
)
@PostMapping
(
value
=
"/equStateCount"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
equStateCount
(
@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
.
equStateCount
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-右侧停用、注销、报废设备状态情况统计"
,
notes
=
"监管大屏-右侧停用、注销、报废设备状态情况统计"
)
@PostMapping
(
value
=
"/equStopStateCount"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
equStopStateCount
(
@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
.
equStopStateCount
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-维保电梯数量TOP10"
,
notes
=
"监管大屏-维保电梯数量TOP10"
)
@PostMapping
(
value
=
"/maintenanceCountTopTen"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
maintenanceCountTopTen
(
@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
.
maintenanceCountTopTen
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-维保电梯数量"
,
notes
=
"监管大屏-维保电梯数量"
)
@PostMapping
(
value
=
"/maintenanceCount"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
maintenanceCount
(
@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
.
maintenanceCount
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-左侧各地市业务办理平均时效"
,
notes
=
"监管大屏-左侧各地市业务办理平均时效"
)
@PostMapping
(
value
=
"/cityBusinessCount"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
cityBusinessCount
(
@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
.
cityBusinessCount
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-左侧获取业务类型"
,
notes
=
"监管大屏-左侧获取业务类型"
)
@PostMapping
(
value
=
"/getBusinessKey"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getBusinessKey
(
@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
.
getBusinessKey
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-右侧施工告知的设备数办理情况统计"
,
notes
=
"监管大屏-右侧施工告知的设备数办理情况统计"
)
@PostMapping
(
value
=
"/getNoticeEquCount"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getNoticeEquCount
(
@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
.
getNoticeEquCount
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"监管大屏-右侧使用办理的设备数量情况统计"
,
notes
=
"监管大屏-右侧使用办理的设备数量情况统计"
)
@PostMapping
(
value
=
"/getRegEquCount"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getRegEquCount
(
@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
.
getRegEquCount
(
dpFilterParamDto
));
}
}
}
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/DPStatisticsServiceImpl.java
View file @
e55cb9bf
...
@@ -10,10 +10,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto;
...
@@ -10,10 +10,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto;
import
com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.FourColorCountItemEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.FourColorCountItemEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.FourColorEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.FourColorEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgScrapCancelMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper
;
...
@@ -36,8 +33,11 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
...
@@ -36,8 +33,11 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
...
@@ -114,6 +114,9 @@ public class DPStatisticsServiceImpl {
...
@@ -114,6 +114,9 @@ public class DPStatisticsServiceImpl {
private
static
List
<
RegionModel
>
regionModels
=
new
ArrayList
<>();
private
static
List
<
RegionModel
>
regionModels
=
new
ArrayList
<>();
@Resource
private
DPStatisticsMapper
dpStatisticsMapper
;
public
DPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JgUseRegistrationMapper
useRegistrationMapper
,
EquipTechParamPipelineMapper
techParamsPipelineMapper
,
JgEnableDisableMapper
enableDisableMapper
,
JgScrapCancelMapper
scrapCancelMapper
,
RestHighLevelClient
restHighLevelClient
,
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
,
CommonMapper
commonMapper
,
TzsUserInfoMapper
userInfoMapper
)
{
public
DPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JgUseRegistrationMapper
useRegistrationMapper
,
EquipTechParamPipelineMapper
techParamsPipelineMapper
,
JgEnableDisableMapper
enableDisableMapper
,
JgScrapCancelMapper
scrapCancelMapper
,
RestHighLevelClient
restHighLevelClient
,
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
,
CommonMapper
commonMapper
,
TzsUserInfoMapper
userInfoMapper
)
{
this
.
equipmentCategoryMapper
=
equipmentCategoryMapper
;
this
.
equipmentCategoryMapper
=
equipmentCategoryMapper
;
...
@@ -668,4 +671,608 @@ public class DPStatisticsServiceImpl {
...
@@ -668,4 +671,608 @@ public class DPStatisticsServiceImpl {
}
}
return
orgCode
;
return
orgCode
;
}
}
public
List
<
Map
<
String
,
Object
>>
equStateCount
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"EQU_STATE_COUNT"
).
field
(
"EQU_STATE"
);
builder
.
aggregation
(
aggregationBuilder
);
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"EQU_STATE_COUNT"
);
Map
<
String
,
Long
>
dataMap
=
new
HashMap
<>();
Long
total
=
terms
.
getBuckets
().
stream
().
mapToLong
(
Terms
.
Bucket
::
getDocCount
).
sum
();
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
String
category
=
bucket
.
getKeyAsString
();
// 或者使用 bucket.getKey() 对于非字符串类型
long
docCount
=
bucket
.
getDocCount
();
dataMap
.
put
(
category
,
docCount
);
}
/**
* 3 报废
* 1 在用
* 2 停用
* 4 注销
* 0 未登记
*/
for
(
int
i
=
0
;
i
<
5
;
i
++){
Map
<
String
,
Object
>
map
=
new
HashMap
();
if
(
i
==
0
){
map
.
put
(
"name"
,
"未登记"
);
}
else
if
(
i
==
1
){
map
.
put
(
"name"
,
"在用"
);
}
else
if
(
i
==
2
){
map
.
put
(
"name"
,
"停用"
);
}
else
if
(
i
==
3
){
map
.
put
(
"name"
,
"报废"
);
}
else
if
(
i
==
4
){
map
.
put
(
"name"
,
"注销"
);
}
map
.
put
(
"value"
,
dataMap
.
getOrDefault
(
String
.
valueOf
(
i
),
0L
));
resultList
.
add
(
map
);
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
resultList
;
}
public
Map
<
String
,
Object
>
equStopStateCount
(
DPFilterParamDto
dpFilterParamDto
)
{
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
// 设备状态
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"EQU_STATE_COUNT"
).
field
(
"EQU_STATE"
)
//设备类型
.
subAggregation
(
AggregationBuilders
.
terms
(
"EQU_LIST_CODE_COUNT"
).
field
(
"EQU_LIST_CODE"
));
builder
.
aggregation
(
aggregationBuilder
);
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"EQU_STATE_COUNT"
);
Map
<
String
,
Long
>
dataMap
=
new
HashMap
<>();
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
String
category
=
bucket
.
getKeyAsString
();
// 或者使用 bucket.getKey() 对于非字符串类型
Terms
subTerms
=
bucket
.
getAggregations
().
get
(
"EQU_LIST_CODE_COUNT"
);
for
(
Terms
.
Bucket
subBucket
:
subTerms
.
getBuckets
()){
String
subCategory
=
subBucket
.
getKeyAsString
();
long
docCount
=
subBucket
.
getDocCount
();
dataMap
.
put
(
category
+
"#"
+
subCategory
,
docCount
);
}
}
/**
* 2300 气瓶
* 3000 电梯
* 4000 起重机械
* 2000 压力容器
* 5000 场(厂)内专用机动车辆
* 1000 锅炉
* 8000 压力管道
* F000 安全附件
* 7000 压力管道元件
* 9000 客运索道
* 6000 大型游乐设施
*/
/**
* 2 停用
* 4 注销
* 3 报废
*/
List
<
Map
<
String
,
Object
>>
legendDataList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
3
;
i
++){
Map
<
String
,
Object
>
map
=
new
HashMap
();
if
(
i
==
0
){
map
.
put
(
"dataKey"
,
"stop"
);
map
.
put
(
"name"
,
"停用"
);
}
else
if
(
i
==
1
){
map
.
put
(
"dataKey"
,
"logout"
);
map
.
put
(
"name"
,
"注销"
);
}
else
if
(
i
==
2
){
map
.
put
(
"dataKey"
,
"scrap"
);
map
.
put
(
"name"
,
"报废"
);
}
legendDataList
.
add
(
map
);
}
List
<
String
>
xDataList
=
Arrays
.
asList
(
"气瓶"
,
"电梯"
,
"压力容器"
,
"锅炉"
,
"起重机械"
,
"场(厂)内专用"
,
"大型游乐设施"
,
"压力管道"
,
"客运索道"
);
List
<
Object
>
stop
=
new
ArrayList
<>();
List
<
Object
>
logout
=
new
ArrayList
<>();
List
<
Object
>
scrap
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
9
;
i
++){
if
(
i
==
0
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#2300"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#2300"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#2300"
,
0L
));
}
else
if
(
i
==
1
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#3000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#3000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#3000"
,
0L
));
}
else
if
(
i
==
2
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#2000"
,
0L
)-
dataMap
.
getOrDefault
(
"2#2300"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#2000"
,
0L
)-
dataMap
.
getOrDefault
(
"4#2300"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#2000"
,
0L
)-
dataMap
.
getOrDefault
(
"3#2300"
,
0L
));
}
else
if
(
i
==
3
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#1000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#1000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#1000"
,
0L
));
}
else
if
(
i
==
4
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#4000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#4000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#4000"
,
0L
));
}
else
if
(
i
==
5
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#5000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#5000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#5000"
,
0L
));
}
else
if
(
i
==
6
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#6000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#6000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#6000"
,
0L
));
}
else
if
(
i
==
7
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#8000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#8000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#8000"
,
0L
));
}
else
if
(
i
==
8
){
stop
.
add
(
dataMap
.
getOrDefault
(
"2#9000"
,
0L
));
logout
.
add
(
dataMap
.
getOrDefault
(
"4#9000"
,
0L
));
scrap
.
add
(
dataMap
.
getOrDefault
(
"3#9000"
,
0L
));
}
}
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
returnMap
.
put
(
"legendData"
,
legendDataList
);
returnMap
.
put
(
"xdata"
,
xDataList
);
returnMap
.
put
(
"stop"
,
stop
);
returnMap
.
put
(
"logout"
,
logout
);
returnMap
.
put
(
"scrap"
,
scrap
);
return
returnMap
;
}
catch
(
Exception
e
){
throw
new
RuntimeException
(
e
);
}
}
public
List
<
Map
<
String
,
Object
>>
maintenanceCountTopTen
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
Map
<
String
,
Object
>>
list
=
dpStatisticsMapper
.
maintenanceCountTopTen
(
dpFilterParamDto
);
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"key"
,
i
);
result
.
put
(
"city"
,
list
.
get
(
i
).
get
(
"regionName"
));
result
.
put
(
"count"
,
list
.
get
(
i
).
get
(
"count"
));
result
.
put
(
"name"
,
list
.
get
(
i
).
get
(
"companyName"
));
resultList
.
add
(
result
);
}
return
resultList
;
}
public
Map
<
String
,
Object
>
maintenanceCount
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
Map
<
String
,
Object
>>
list
=
dpStatisticsMapper
.
maintenanceCount
(
dpFilterParamDto
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
xList
=
new
ArrayList
();
List
yList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
xList
.
add
(
list
.
get
(
i
).
get
(
"regionName"
));
yList
.
add
(
list
.
get
(
i
).
get
(
"count"
));
}
resultMap
.
put
(
"xdata"
,
xList
);
resultMap
.
put
(
"ydata"
,
yList
);
return
resultMap
;
}
public
Map
<
String
,
Object
>
cityBusinessCount
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
/**
* 业务类型0告知管理,1使用登记,2变更登记,3停用启用,4注销报废
*/
if
(
"0"
.
equals
(
dpFilterParamDto
.
getBusinessKey
())){
resultMap
=
noticeCount
(
resultMap
,
dpFilterParamDto
.
getCityCode
());
}
else
if
(
"1"
.
equals
(
dpFilterParamDto
.
getBusinessKey
())){
resultMap
=
useCount
(
resultMap
,
dpFilterParamDto
.
getCityCode
());
}
else
if
(
"2"
.
equals
(
dpFilterParamDto
.
getBusinessKey
())){
resultMap
=
changeCount
(
resultMap
,
dpFilterParamDto
.
getCityCode
());
}
else
if
(
"3"
.
equals
(
dpFilterParamDto
.
getBusinessKey
())){
resultMap
=
disableCount
(
resultMap
,
dpFilterParamDto
.
getCityCode
());
}
else
if
(
"4"
.
equals
(
dpFilterParamDto
.
getBusinessKey
())){
resultMap
=
cancelCount
(
resultMap
,
dpFilterParamDto
.
getCityCode
());
}
return
resultMap
;
}
private
Map
<
String
,
Object
>
cancelCount
(
Map
<
String
,
Object
>
resultMap
,
String
cityCode
)
{
Map
<
String
,
Integer
>
countMap
=
new
HashMap
<>();
//注销报废
List
<
Map
<
String
,
Object
>>
cancelList
=
dpStatisticsMapper
.
cancelCount
(
cityCode
);
countByMap
(
countMap
,
cancelList
);
List
<
Object
>
xDataList
=
new
ArrayList
<>();
List
<
Object
>
yDataList
=
new
ArrayList
<>();
countMap
.
forEach
((
k
,
v
)->{
xDataList
.
add
(
k
);
yDataList
.
add
(
v
);
});
resultMap
.
put
(
"xdata"
,
xDataList
);
resultMap
.
put
(
"ydata"
,
yDataList
);
return
resultMap
;
}
private
Map
<
String
,
Object
>
disableCount
(
Map
<
String
,
Object
>
resultMap
,
String
cityCode
)
{
Map
<
String
,
Integer
>
countMap
=
new
HashMap
<>();
//启用停用
List
<
Map
<
String
,
Object
>>
disableList
=
dpStatisticsMapper
.
disableCount
(
cityCode
);
countByMap
(
countMap
,
disableList
);
List
<
Object
>
xDataList
=
new
ArrayList
<>();
List
<
Object
>
yDataList
=
new
ArrayList
<>();
countMap
.
forEach
((
k
,
v
)->{
xDataList
.
add
(
k
);
yDataList
.
add
(
v
);
});
resultMap
.
put
(
"xdata"
,
xDataList
);
resultMap
.
put
(
"ydata"
,
yDataList
);
return
resultMap
;
}
private
Map
<
String
,
Object
>
changeCount
(
Map
<
String
,
Object
>
resultMap
,
String
cityCode
)
{
Map
<
String
,
Integer
>
countMap
=
new
HashMap
<>();
//更名变更登记
List
<
Map
<
String
,
Object
>>
changeNameList
=
dpStatisticsMapper
.
changeNameCount
(
cityCode
);
countByMap
(
countMap
,
changeNameList
);
//改造变更登记
List
<
Map
<
String
,
Object
>>
reformList
=
dpStatisticsMapper
.
changeReformCount
(
cityCode
);
countByMap
(
countMap
,
reformList
);
//移装变更登记
List
<
Map
<
String
,
Object
>>
transferList
=
dpStatisticsMapper
.
changeTransferCount
(
cityCode
);
countByMap
(
countMap
,
transferList
);
//单位变更登记
List
<
Map
<
String
,
Object
>>
unitList
=
dpStatisticsMapper
.
changeUnitCount
(
cityCode
);
countByMap
(
countMap
,
unitList
);
//单位变更登记
List
<
Map
<
String
,
Object
>>
vehicleList
=
dpStatisticsMapper
.
changeVehicleCount
(
cityCode
);
countByMap
(
countMap
,
vehicleList
);
List
<
Object
>
xDataList
=
new
ArrayList
<>();
List
<
Object
>
yDataList
=
new
ArrayList
<>();
countMap
.
forEach
((
k
,
v
)->{
xDataList
.
add
(
k
);
yDataList
.
add
(
v
);
});
resultMap
.
put
(
"xdata"
,
xDataList
);
resultMap
.
put
(
"ydata"
,
yDataList
);
return
resultMap
;
}
private
Map
<
String
,
Object
>
useCount
(
Map
<
String
,
Object
>
resultMap
,
String
cityCode
)
{
Map
<
String
,
Integer
>
countMap
=
new
HashMap
<>();
//使用登记
List
<
Map
<
String
,
Object
>>
useList
=
dpStatisticsMapper
.
useCount
(
cityCode
);
countByMap
(
countMap
,
useList
);
//气瓶登记
List
<
Map
<
String
,
Object
>>
vehicleList
=
dpStatisticsMapper
.
vehicleCount
(
cityCode
);
countByMap
(
countMap
,
vehicleList
);
List
<
Object
>
xDataList
=
new
ArrayList
<>();
List
<
Object
>
yDataList
=
new
ArrayList
<>();
countMap
.
forEach
((
k
,
v
)->{
xDataList
.
add
(
k
);
yDataList
.
add
(
v
);
});
resultMap
.
put
(
"xdata"
,
xDataList
);
resultMap
.
put
(
"ydata"
,
yDataList
);
return
resultMap
;
}
private
Map
<
String
,
Object
>
noticeCount
(
Map
<
String
,
Object
>
resultMap
,
String
cityCode
)
{
Map
<
String
,
Integer
>
countMap
=
new
HashMap
<>();
//安装告知
List
<
Map
<
String
,
Object
>>
installlist
=
dpStatisticsMapper
.
installCount
(
cityCode
);
countByMap
(
countMap
,
installlist
);
//维修告知
List
<
Map
<
String
,
Object
>>
maintenancelist
=
dpStatisticsMapper
.
maintenanceNoticeCount
(
cityCode
);
countByMap
(
countMap
,
maintenancelist
);
//改造告知
List
<
Map
<
String
,
Object
>>
reformlist
=
dpStatisticsMapper
.
reformCount
(
cityCode
);
countByMap
(
countMap
,
reformlist
);
//移装告知
List
<
Map
<
String
,
Object
>>
transferlist
=
dpStatisticsMapper
.
transferCount
(
cityCode
);
countByMap
(
countMap
,
transferlist
);
List
<
Object
>
xDataList
=
new
ArrayList
<>();
List
<
Object
>
yDataList
=
new
ArrayList
<>();
countMap
.
forEach
((
k
,
v
)->{
xDataList
.
add
(
k
);
yDataList
.
add
(
v
);
});
resultMap
.
put
(
"xdata"
,
xDataList
);
resultMap
.
put
(
"ydata"
,
yDataList
);
return
resultMap
;
}
private
void
countByMap
(
Map
<
String
,
Integer
>
countMap
,
List
<
Map
<
String
,
Object
>>
list
){
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
if
(
null
==
countMap
.
get
(
list
.
get
(
i
).
get
(
"regionName"
))){
countMap
.
put
(
list
.
get
(
i
).
get
(
"regionName"
).
toString
(),
Integer
.
valueOf
(
list
.
get
(
i
).
get
(
"count"
)+
""
));
}
else
{
countMap
.
put
(
list
.
get
(
i
).
get
(
"regionName"
).
toString
(),
countMap
.
get
(
list
.
get
(
i
).
get
(
"regionName"
).
toString
())+
Integer
.
valueOf
(
list
.
get
(
i
).
get
(
"count"
)+
""
));
}
}
}
public
List
<
Map
<
String
,
Object
>>
getBusinessKey
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
/**
* 告知管理、使用登记、变更登记、停用启用、注销报废
*/
for
(
int
i
=
0
;
i
<
5
;
i
++){
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
i
==
0
){
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"告知管理"
);
}
else
if
(
i
==
1
){
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"使用登记"
);
}
else
if
(
i
==
2
){
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"变更登记"
);
}
else
if
(
i
==
3
){
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"停用启用"
);
}
else
if
(
i
==
4
){
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"注销报废"
);
}
resultList
.
add
(
result
);
}
return
resultList
;
}
public
Map
<
String
,
Object
>
getNoticeEquCount
(
DPFilterParamDto
dpFilterParamDto
)
{
String
startTime
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
//安装告知
List
<
Map
<
String
,
Object
>>
installlist
=
dpStatisticsMapper
.
installEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
installCountMap
=
new
HashMap
<>();
countNoticEquList
(
installCountMap
,
installlist
);
//维修告知
List
<
Map
<
String
,
Object
>>
maintenancelist
=
dpStatisticsMapper
.
maintenanceEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
maintenanceCountMap
=
new
HashMap
<>();
countNoticEquList
(
maintenanceCountMap
,
maintenancelist
);
//改造告知
List
<
Map
<
String
,
Object
>>
reformlist
=
dpStatisticsMapper
.
reformEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
reformCountMap
=
new
HashMap
<>();
countNoticEquList
(
reformCountMap
,
reformlist
);
//移装告知
List
<
Map
<
String
,
Object
>>
transferlist
=
dpStatisticsMapper
.
transferEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
transferCountMap
=
new
HashMap
<>();
countNoticEquList
(
transferCountMap
,
transferlist
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
List
legendData
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
4
;
i
++){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
if
(
i
==
0
){
map
.
put
(
"dataKey"
,
"installNotify"
);
map
.
put
(
"value"
,
"安装告知"
);
}
else
if
(
i
==
1
){
map
.
put
(
"dataKey"
,
"transformNotify"
);
map
.
put
(
"value"
,
"改造告知"
);
}
else
if
(
i
==
2
){
map
.
put
(
"dataKey"
,
"maintainNotify"
);
map
.
put
(
"value"
,
"维修告知"
);
}
else
if
(
i
==
3
){
map
.
put
(
"dataKey"
,
"transloadingNotify"
);
map
.
put
(
"value"
,
"移装告知"
);
}
legendData
.
add
(
map
);
}
resultMap
.
put
(
"legendData"
,
legendData
);
List
<
String
>
xDataList
=
Arrays
.
asList
(
"气瓶"
,
"电梯"
,
"压力容器"
,
"锅炉"
,
"起重机械"
,
"场(厂)内专用"
,
"大型游乐设施"
,
"压力管道"
,
"客运索道"
);
resultMap
.
put
(
"xdata"
,
xDataList
);
List
installNotify
=
new
ArrayList
<>();
List
transformNotify
=
new
ArrayList
<>();
List
maintainNotify
=
new
ArrayList
<>();
List
transloadingNotify
=
new
ArrayList
<>();
/**
* 2300 气瓶
* 3000 电梯
* 2000 压力容器
* 1000 锅炉
* 4000 起重机械
* 5000 场(厂)内专用机动车辆
* 6000 大型游乐设施
* 8000 压力管道
* 9000 客运索道
*/
for
(
int
i
=
0
;
i
<
xDataList
.
size
();
i
++){
if
(
i
==
0
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"2300"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"2300"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"2300"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"2300"
,
0
));
}
else
if
(
i
==
1
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"3000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"3000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"3000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"3000"
,
0
));
}
else
if
(
i
==
2
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"2000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"2000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"2000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"2000"
,
0
));
}
else
if
(
i
==
3
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"1000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"1000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"1000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"1000"
,
0
));
}
else
if
(
i
==
4
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"4000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"4000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"4000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"4000"
,
0
));
}
else
if
(
i
==
5
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"5000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"5000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"5000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"5000"
,
0
));
}
else
if
(
i
==
6
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"6000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"6000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"6000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"6000"
,
0
));
}
else
if
(
i
==
7
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"8000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"8000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"8000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"8000"
,
0
));
}
else
if
(
i
==
8
){
installNotify
.
add
(
installCountMap
.
getOrDefault
(
"9000"
,
0
));
transformNotify
.
add
(
reformCountMap
.
getOrDefault
(
"9000"
,
0
));
maintainNotify
.
add
(
maintenanceCountMap
.
getOrDefault
(
"9000"
,
0
));
transloadingNotify
.
add
(
transferCountMap
.
getOrDefault
(
"9000"
,
0
));
}
}
resultMap
.
put
(
"installNotify"
,
installNotify
);
resultMap
.
put
(
"transformNotify"
,
transformNotify
);
resultMap
.
put
(
"maintainNotify"
,
maintainNotify
);
resultMap
.
put
(
"transloadingNotify"
,
transloadingNotify
);
return
resultMap
;
}
private
void
countNoticEquList
(
Map
<
String
,
Integer
>
countMap
,
List
<
Map
<
String
,
Object
>>
list
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
if
(
"2300"
.
equals
(
list
.
get
(
i
).
get
(
"equCategory"
))){
if
(
null
==
countMap
.
get
(
"2300"
)){
countMap
.
put
(
"2300"
,
Integer
.
valueOf
(
list
.
get
(
i
).
get
(
"count"
)+
""
));
}
else
{
countMap
.
put
(
"2300"
,
countMap
.
get
(
"2300"
)+
Integer
.
valueOf
(
list
.
get
(
i
).
get
(
"count"
)+
""
));
}
}
else
{
if
(
null
==
countMap
.
get
(
list
.
get
(
i
).
get
(
"equList"
).
toString
())){
countMap
.
put
(
list
.
get
(
i
).
get
(
"equList"
).
toString
(),
Integer
.
valueOf
(
list
.
get
(
i
).
get
(
"count"
)+
""
));
}
else
{
countMap
.
put
(
list
.
get
(
i
).
get
(
"equList"
).
toString
(),
countMap
.
get
(
list
.
get
(
i
).
get
(
"equList"
).
toString
())+
Integer
.
valueOf
(
list
.
get
(
i
).
get
(
"count"
)+
""
));
}
}
}
}
public
Map
<
String
,
Object
>
getRegEquCount
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
String
startTime
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
//使用登记
List
<
Map
<
String
,
Object
>>
uselist
=
dpStatisticsMapper
.
useEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
useCountMap
=
new
HashMap
<>();
countNoticEquList
(
useCountMap
,
uselist
);
//气瓶使用登记
List
<
Map
<
String
,
Object
>>
vehicleList
=
dpStatisticsMapper
.
vehicleEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
vehicleCountMap
=
new
HashMap
<>();
countNoticEquList
(
vehicleCountMap
,
vehicleList
);
//改造变更登记
List
<
Map
<
String
,
Object
>>
changeReformList
=
dpStatisticsMapper
.
changeReformEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
changeReformCountMap
=
new
HashMap
<>();
countNoticEquList
(
changeReformCountMap
,
changeReformList
);
//移装变更登记
List
<
Map
<
String
,
Object
>>
changeTransferList
=
dpStatisticsMapper
.
changeTransferEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
changeTransferCountMap
=
new
HashMap
<>();
countNoticEquList
(
changeTransferCountMap
,
changeTransferList
);
//单位变更登记
List
<
Map
<
String
,
Object
>>
changeUnitList
=
dpStatisticsMapper
.
changeUnitEquCount
(
dpFilterParamDto
.
getCityCode
(),
startTime
);
Map
<
String
,
Integer
>
changeUnitCountMap
=
new
HashMap
<>();
countNoticEquList
(
changeUnitCountMap
,
changeUnitList
);
List
legendData
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
4
;
i
++){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
if
(
i
==
0
){
map
.
put
(
"dataKey"
,
"useRegistration"
);
map
.
put
(
"value"
,
"使用登记"
);
}
else
if
(
i
==
1
){
map
.
put
(
"dataKey"
,
"modificateModifyRegistration"
);
map
.
put
(
"value"
,
"改造变更登记"
);
}
else
if
(
i
==
2
){
map
.
put
(
"dataKey"
,
"transloadingModifyRegistration"
);
map
.
put
(
"value"
,
"移装变更登记"
);
}
else
if
(
i
==
3
){
map
.
put
(
"dataKey"
,
"unitModifyRegistration"
);
map
.
put
(
"value"
,
"单位变更登记"
);
}
legendData
.
add
(
map
);
}
resultMap
.
put
(
"legendData"
,
legendData
);
List
<
String
>
xDataList
=
Arrays
.
asList
(
"气瓶"
,
"电梯"
,
"压力容器"
,
"锅炉"
,
"起重机械"
,
"场(厂)内专用"
,
"大型游乐设施"
,
"压力管道"
,
"客运索道"
);
resultMap
.
put
(
"xdata"
,
xDataList
);
List
useRegistration
=
new
ArrayList
<>();
List
modificateModifyRegistration
=
new
ArrayList
<>();
List
transloadingModifyRegistration
=
new
ArrayList
<>();
List
unitModifyRegistration
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
xDataList
.
size
();
i
++){
if
(
i
==
0
){
useRegistration
.
add
(
vehicleCountMap
.
getOrDefault
(
"2300"
,
0
));
modificateModifyRegistration
.
add
(
changeReformCountMap
.
getOrDefault
(
"2300"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"2300"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"2300"
,
0
));
}
else
if
(
i
==
1
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"3000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"3000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"3000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"3000"
,
0
));
}
else
if
(
i
==
2
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"2000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"2000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"2000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"2000"
,
0
));
}
else
if
(
i
==
3
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"1000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"1000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"1000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"1000"
,
0
));
}
else
if
(
i
==
4
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"4000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"4000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"4000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"4000"
,
0
));
}
else
if
(
i
==
5
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"5000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"5000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"5000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"5000"
,
0
));
}
else
if
(
i
==
6
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"6000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"6000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"6000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"6000"
,
0
));
}
else
if
(
i
==
7
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"8000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"8000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"8000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"8000"
,
0
));
}
else
if
(
i
==
8
){
useRegistration
.
add
(
useCountMap
.
getOrDefault
(
"9000"
,
0
));
modificateModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"9000"
,
0
));
transloadingModifyRegistration
.
add
(
changeTransferCountMap
.
getOrDefault
(
"9000"
,
0
));
unitModifyRegistration
.
add
(
changeUnitCountMap
.
getOrDefault
(
"9000"
,
0
));
}
}
resultMap
.
put
(
"useRegistration"
,
useRegistration
);
resultMap
.
put
(
"modificateModifyRegistration"
,
modificateModifyRegistration
);
resultMap
.
put
(
"transloadingModifyRegistration"
,
transloadingModifyRegistration
);
resultMap
.
put
(
"unitModifyRegistration"
,
unitModifyRegistration
);
return
resultMap
;
}
}
}
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 @
e55cb9bf
...
@@ -96,6 +96,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -96,6 +96,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
private
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
private
static
final
String
PROCESS_DEFINITION_KEY
=
"installationNotificationNew"
;
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
TABLE_PAGE_ID
=
"1734141426742095873"
;
private
static
final
String
CONSTRUCTION_TYPE
=
"SGLX"
;
private
static
final
String
CONSTRUCTION_TYPE
=
"SGLX"
;
private
static
final
String
CONSTRUCTION_TYPE_NAME
=
"安装"
;
private
static
final
String
CONSTRUCTION_TYPE_NAME
=
"安装"
;
...
@@ -431,7 +433,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -431,7 +433,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
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
...
@@ -648,12 +650,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private
void
rollBackForDelRedisData
()
{
private
void
rollBackForDelRedisData
()
{
FlowingEquipRedisContext
.
getContext
().
forEach
(
e
->
{
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
)
{
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
)
{
private
void
updateRedisBatch
(
List
<
JgInstallationNotice
>
jgInstallationNotices
)
{
...
@@ -955,7 +957,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
...
@@ -955,7 +957,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
JgInstallationNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
queryWrapper
.
eq
(
JgInstallationNoticeEq:
:
getEquipTransferId
,
jgInstallationNotice
.
getSequenceNbr
());
JgInstallationNoticeEq
jgRelationEquip
=
jgInstallationNoticeEqMapper
.
selectOne
(
queryWrapper
);
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
)
@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 @
e55cb9bf
...
@@ -25,6 +25,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
...
@@ -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.IJgInstallationNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgMaintainNoticeService
;
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.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.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
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.jg.biz.utils.WordTemplateUtils
;
...
@@ -156,11 +159,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -156,11 +159,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getStreet
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getStreetName
()))
{
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getStreet
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getStreetName
()))
{
maintainInfo
.
put
(
"street"
,
notice
.
getStreet
()
+
"_"
+
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
());
JSONObject
hisData
=
commonService
.
queryHistoryData
(
notice
.
getSequenceNbr
());
// 兼容老数据
// 兼容老数据
if
(
hisData
==
null
)
{
if
(
hisData
==
null
)
{
// 老数据逻辑
// 老数据逻辑
setNewEquipInfo
(
sequenceNbr
,
maintainInfo
);
setNewEquipInfo
(
sequenceNbr
,
maintainInfo
);
return
new
HashMap
<
String
,
Map
<
String
,
Object
>>()
{{
return
new
HashMap
<
String
,
Map
<
String
,
Object
>>()
{{
...
@@ -182,6 +185,38 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -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
)
{
private
void
setNewEquipInfo
(
Long
sequenceNbr
,
Map
<
String
,
Object
>
maintainInfo
)
{
JgMaintainNoticeEq
jgMaintainNoticeEq
=
jgMaintainNoticeEqMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JgMaintainNoticeEq
>().
eq
(
JgMaintainNoticeEq:
:
getEquipTransferId
,
sequenceNbr
));
JgMaintainNoticeEq
jgMaintainNoticeEq
=
jgMaintainNoticeEqMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JgMaintainNoticeEq
>().
eq
(
JgMaintainNoticeEq:
:
getEquipTransferId
,
sequenceNbr
));
Map
<
String
,
Object
>
map
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
jgMaintainNoticeEq
.
getEquId
());
Map
<
String
,
Object
>
map
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
jgMaintainNoticeEq
.
getEquId
());
...
@@ -201,113 +236,127 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -201,113 +236,127 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@Transactional
@Transactional
public
JgMaintainNoticeDto
updateMaintainNotice
(
String
submitType
,
JgMaintainNoticeDto
noticeDto
,
String
op
)
{
public
JgMaintainNoticeDto
updateMaintainNotice
(
String
submitType
,
JgMaintainNoticeDto
noticeDto
,
String
op
)
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
try
{
}
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
// 字段转换
throw
new
IllegalArgumentException
(
"参数不能为空"
);
this
.
convertField
(
noticeDto
);
}
JgMaintainNotice
notice
=
jgMaintainNoticeMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
// 字段转换
// submitType=1为流程提交否则仅为保存业务数据
this
.
convertField
(
noticeDto
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
JgMaintainNotice
notice
=
jgMaintainNoticeMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
this
.
checkRepeatUsed
(
submitType
,
notice
);
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// submitType=1为流程提交否则仅为保存业务数据
// 如果没有实例ID,说明是启动并执行一步
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
// 如果有实例ID,为撤回或者驳回后重新提交
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
// 如果没有实例ID,说明是启动并执行一步
// 发起流程
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
// 如果有实例ID,为撤回或者驳回后重新提交
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
// 发起流程
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
//下一节点执行人单位(下节点接收机构code)
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
list
.
add
(
dto
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
actWorkflowBatchDTO
.
setProcess
(
list
);
//下一节点执行人单位(下节点接收机构code)
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveCompanyCode
());
// 提取节点等信息
list
.
add
(
dto
);
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
actWorkflowBatchDTO
.
setProcess
(
list
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
// 提取节点等信息
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
}
else
{
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
}
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
}
else
{
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
}
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
jgMaintainNoticeMapper
.
updateById
(
notice
);
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
// 如果为保存并提交,则创建代办
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRUE
);
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
}
else
{
jgMaintainNoticeMapper
.
updateById
(
notice
);
// 只调用执行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
.
FALS
E
);
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRU
E
);
}
else
{
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
// 只调用执行API,返回下个节点信息,用于填充业务字段
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
//组装信息
// 创建新的代办
TaskResultDTO
dto
=
new
TaskResultDTO
();
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
dto
.
setResultCode
(
"approvalStatus"
);
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
taskModelDto
.
setModel
(
taskMessageDto
);
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
commMap
.
put
(
"approvalStatus"
,
"提交"
);
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
}
else
{
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
commMap
.
put
(
"approvalStatus"
,
op
);
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
}
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
//下一节点执行人单位(下节点接收机构code)
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
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
));
return
noticeDto
;
}
else
{
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
JgMaintainNotice
bean
=
new
JgMaintainNotice
();
log
.
error
(
e
.
getMessage
(),
e
);
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
this
.
rollBackForDelRedisData
();
jgMaintainNoticeMapper
.
updateById
(
bean
);
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
...
@@ -319,14 +368,14 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
* @return 维修告知列表
* @return 维修告知列表
*/
*/
@Override
@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
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
String
type
=
reginParams
.
getCompany
().
getLevel
();
String
type
=
reginParams
.
getCompany
().
getLevel
();
String
userId
=
reginParams
.
getUserModel
().
getUserId
();
String
userId
=
reginParams
.
getUserModel
().
getUserId
();
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
List
<
DataDictionary
>
dictionaries
=
dataDictionaryService
.
getByType
(
"WXLX"
);
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
->
{
List
<
Map
<
String
,
Object
>>
mappedRecords
=
noticePage
.
getRecords
().
stream
().
peek
(
notice
->
{
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
noticeStatusOpt
.
ifPresent
(
status
->
{
noticeStatusOpt
.
ifPresent
(
status
->
{
...
@@ -364,7 +413,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -364,7 +413,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if
(
Objects
.
isNull
(
JgMaintainNotice
)
||
CollectionUtils
.
isEmpty
(
informationList
))
{
if
(
Objects
.
isNull
(
JgMaintainNotice
)
||
CollectionUtils
.
isEmpty
(
informationList
))
{
throw
new
IllegalArgumentException
(
"维修告知单不存在"
);
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
tempFileName
=
"维修告知单_"
+
System
.
currentTimeMillis
()
+
"_temp"
;
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
...
@@ -380,7 +429,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -380,7 +429,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
JgMaintainNotice
jgMaintainNotice
=
this
.
baseMapper
.
selectById
(
sequenceNbr
);
JgMaintainNotice
jgMaintainNotice
=
this
.
baseMapper
.
selectById
(
sequenceNbr
);
// 删除待办 + 中止流程
// 删除待办 + 中止流程
commonService
.
deleteTaskModel
(
sequenceNbr
+
""
,
jgMaintainNotice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
sequenceNbr
+
""
,
jgMaintainNotice
.
getInstanceId
());
// 删除业务单
// 删除业务单
this
.
baseMapper
.
deleteById
(
sequenceNbr
);
this
.
baseMapper
.
deleteById
(
sequenceNbr
);
// 删除对应equ
// 删除对应equ
...
@@ -397,87 +446,102 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -397,87 +446,102 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgMaintainNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgMaintainNoticeDtoMap
,
ReginParams
reginParams
)
{
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
);
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 字段转换
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
convertField
(
model
);
}
// 获取告知设备列表
// 获取告知单号
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
ResponseModel
<
List
<
String
>>
applyNoResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
WXGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备"
);
}
// 获取告知单号
ResponseModel
<
List
<
String
>>
applyNoResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
WXGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
applyNoResult
.
getResult
()))
{
if
(
CollectionUtils
.
isEmpty
(
applyNoResult
.
getResult
()))
{
log
.
error
(
" 获取告知单号失败"
);
log
.
error
(
" 获取告知单号失败"
);
throw
new
RuntimeException
();
throw
new
RuntimeException
();
}
}
List
<
String
>
applyNoList
=
applyNoResult
.
getResult
();
List
<
String
>
applyNoList
=
applyNoResult
.
getResult
();
List
<
WorkflowResultDto
>
workflowResultDtoList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
List
<
WorkflowResultDto
>
workflowResultDtoList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
List
<
JgMaintainNotice
>
list
=
new
ArrayList
<>();
List
<
JgMaintainNotice
>
list
=
new
ArrayList
<>();
List
<
JgMaintainNoticeEq
>
equipList
=
new
ArrayList
<>();
List
<
JgMaintainNoticeEq
>
equipList
=
new
ArrayList
<>();
CompanyBo
companyBo
=
commonService
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
CompanyBo
companyBo
=
commonService
.
getOneCompany
(
model
.
getReceiveCompanyCode
());
deviceList
.
forEach
(
obj
->
{
deviceList
.
forEach
(
obj
->
{
JgMaintainNoticeEq
jgRelationEquip
=
new
JgMaintainNoticeEq
();
JgMaintainNoticeEq
jgRelationEquip
=
new
JgMaintainNoticeEq
();
JgMaintainNotice
dto
=
new
JgMaintainNotice
();
JgMaintainNotice
dto
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
applyNoList
.
get
(
i
);
String
applyNo
=
applyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
dto
.
setApplyNo
(
applyNo
);
// 统计使用
// 统计使用
dto
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
dto
.
setReceiveCompanyOrgCode
(
companyBo
.
getOrgCode
());
dto
.
setNoticeDate
(
new
Date
());
dto
.
setNoticeDate
(
new
Date
());
dto
.
setEquCategory
(
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
)));
dto
.
setEquCategory
(
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
)));
dto
.
setEquListCode
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST_CODE"
)));
dto
.
setEquListCode
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST_CODE"
)));
dto
.
setCreateUserCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
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
))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
workflowResultDtoList
.
get
(
i
).
getNextExecutorRoleIds
());
buildTask
(
list
,
workflowResultDtoList
,
Boolean
.
TRUE
);
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
{
}
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"
)));
List
<
JgMaintainNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
dto
.
setSupervisoryCode
(
String
.
valueOf
(
obj
.
get
(
"SUPERVISORY_CODE"
)));
List
<
JgMaintainNotice
>
collect
=
list
.
stream
().
filter
(
JgMaintainNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgMaintainNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgMaintainNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
this
.
updateRedisBatch
(
list
);
return
list
;
dto
.
setCreateUserName
(
reginParams
.
getUserModel
().
getRealName
());
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
dto
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
log
.
error
(
e
.
getMessage
(),
e
);
DataDictionary
dictionary
=
iDataDictionaryService
.
getByCode
(
dto
.
getMaintainType
(),
"WXLX"
);
this
.
rollBackForDelRedisData
();
dto
.
setMaintainTypeDesc
(
dictionary
.
getName
());
throw
e
;
dto
.
setFullAddress
(
dto
.
getProvinceName
()
+
dto
.
getCityName
()
+
dto
.
getCountyName
()
+
dto
.
getStreetName
()
+
dto
.
getAddress
());
}
catch
(
Exception
e
)
{
list
.
add
(
dto
);
log
.
error
(
e
.
getMessage
(),
e
);
equipList
.
add
(
jgRelationEquip
);
this
.
rollBackForDelRedisData
();
});
throw
new
BadRequest
(
"安装告知保存失败!"
);
jgMaintainNoticeMapper
.
insertBatchSomeColumn
(
list
);
}
finally
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
FlowingEquipRedisContext
.
clean
();
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
;
}
}
private
void
updateRedisBatch
(
List
<
JgMaintainNotice
>
jgMaintainNotices
)
{
private
void
updateRedisBatch
(
List
<
JgMaintainNotice
>
jgMaintainNotices
)
{
...
@@ -542,7 +606,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -542,7 +606,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
taskMessageDto
.
setNextTaskId
(
item
.
getNextTaskId
());
taskMessageDto
.
setNextTaskId
(
item
.
getNextTaskId
());
taskModelDto
.
setModel
(
taskMessageDto
);
taskModelDto
.
setModel
(
taskMessageDto
);
taskModelDto
.
setNextExecuteUser
(
item
.
getNextExecuteIds
());
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
);
taskModelDtoList
.
add
(
taskModelDto
);
if
(
bool
)
{
if
(
bool
)
{
// 删除暂存时生成的待办
// 删除暂存时生成的待办
...
@@ -574,7 +638,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -574,7 +638,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
}
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
private
void
convertField
(
JgMaintainNoticeDto
model
)
{
private
void
convertField
(
JgMaintainNoticeDto
model
)
{
if
(
null
==
model
)
{
if
(
null
==
model
)
{
...
@@ -722,6 +786,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -722,6 +786,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
commonService
.
rollbackTask
(
jgMaintainNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
rollbackTask
(
jgMaintainNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgMaintainNotice
));
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgMaintainNotice
));
this
.
delRepeatUseEquipData
(
jgMaintainNotice
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
...
@@ -864,10 +929,10 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
...
@@ -864,10 +929,10 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
taskModelDto
.
setPageType
(
"edit"
);
taskModelDto
.
setPageType
(
"edit"
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
jgMaintainNotice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
jgMaintainNotice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
jgMaintainNotice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNotice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgMaintainNoticeMapper
.
updateById
(
jgMaintainNotice
);
jgMaintainNoticeMapper
.
updateById
(
jgMaintainNotice
);
this
.
delRepeatUseEquipData
(
jgMaintainNotice
);
}
}
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgMaintainNotice
));
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgMaintainNotice
));
}
catch
(
InterruptedException
e
)
{
}
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 @
e55cb9bf
...
@@ -13,22 +13,26 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
...
@@ -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.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
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.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgReformNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
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.enums.BusinessTypeEnum
;
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.JgReformNoticeEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgReformNoticeMapper
;
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.mapper.JgRegistrationHistoryMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgReformNoticeService
;
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.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.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
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.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo
;
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.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
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.systemctl.model.TaskV2Model
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
...
@@ -175,86 +179,99 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
...
@@ -175,86 +179,99 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
*/
*/
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
public
JgReformNoticeDto
updateInstallationNotice
(
String
submitType
,
JgReformNoticeDto
noticeDto
,
String
op
)
{
public
JgReformNoticeDto
updateInstallationNotice
(
String
submitType
,
JgReformNoticeDto
noticeDto
,
String
op
)
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
try
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
}
throw
new
IllegalArgumentException
(
"参数不能为空"
);
// 字段转换
}
this
.
convertField
(
noticeDto
);
// 字段转换
JgReformNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
this
.
convertField
(
noticeDto
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
JgReformNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
// 发起流程
this
.
checkRepeatUsed
(
submitType
,
notice
);
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
// 发起流程
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
dto
.
setBusinessKey
(
noticeDto
.
getSequenceNbr
().
toString
());
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
noticeDto
.
getSequenceNbr
().
toString
());
dto
.
setNextExecuteUserCompanyCode
(
noticeDto
.
getReceiveCompanyCode
());
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
list
.
add
(
dto
);
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
actWorkflowBatchDTO
.
setProcess
(
list
);
dto
.
setNextExecuteUserCompanyCode
(
noticeDto
.
getReceiveCompanyCode
());
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
list
.
add
(
dto
);
// 提取节点等信息
actWorkflowBatchDTO
.
setProcess
(
list
);
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
ProcessTaskDTO
processTaskDTO
=
cmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
// 提取节点等信息
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
WorkflowResultDto
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
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
{
}
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
());
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
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
{
}
else
{
TaskResultDTO
dto
=
new
TaskResultDTO
();
JgReformNotice
bean
=
new
JgReformNotice
();
dto
.
setResultCode
(
"approvalStatus"
);
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
dto
.
setTaskId
(
notice
.
getNextTaskId
());
jgReformNoticeMapper
.
updateById
(
bean
);
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
);
}
}
commonService
.
saveExecuteFlowData2Redis
(
notice
.
getInstanceId
(),
this
.
buildInstanceRuntimeData
(
notice
));
return
noticeDto
;
}
else
{
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
JgReformNotice
bean
=
new
JgReformNotice
();
log
.
error
(
e
.
getMessage
(),
e
);
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
this
.
rollBackForDelRedisData
();
jgReformNoticeMapper
.
updateById
(
bean
);
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
...
@@ -307,7 +324,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
Collection
<
JgReformNotice
>
JgReformNotices
=
this
.
listByIds
(
Arrays
.
asList
(
sequenceNbrs
));
Collection
<
JgReformNotice
>
JgReformNotices
=
this
.
listByIds
(
Arrays
.
asList
(
sequenceNbrs
));
JgReformNotices
.
forEach
(
notice
->
{
JgReformNotices
.
forEach
(
notice
->
{
// 删除代办 + 中止流程
// 删除代办 + 中止流程
commonService
.
deleteTaskModel
(
String
.
valueOf
(
notice
.
getSequenceNbr
()),
notice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
String
.
valueOf
(
notice
.
getSequenceNbr
()),
notice
.
getInstanceId
());
// 删除单子
// 删除单子
this
.
baseMapper
.
deleteById
(
notice
.
getSequenceNbr
());
this
.
baseMapper
.
deleteById
(
notice
.
getSequenceNbr
());
// 删除对应eq
// 删除对应eq
...
@@ -354,94 +371,139 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
...
@@ -354,94 +371,139 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgReformNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
JgReformNoticeDtoMap
,
ReginParams
reginParams
)
{
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
);
try
{
convertField
(
model
);
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
))
{
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
throw
new
BadRequest
(
"请选择设备!"
);
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
}
throw
new
BadRequest
(
"请选择设备!"
);
// 获取告知单号
}
ResponseModel
<
List
<
String
>>
codeResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
GZGZ
.
getCode
(),
deviceList
.
size
());
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请) todo 回滚异常未写
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
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
WorkflowResultDto
workflowResult
=
workflowResultList
.
get
(
i
);
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
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
());
ResponseModel
<
List
<
String
>>
codeResult
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
GZGZ
.
getCode
(),
deviceList
.
size
());
dto
.
setEntrustingUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
List
<
String
>
applyNoList
=
null
;
dto
.
setEntrustingUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
if
(
codeResult
!=
null
&&
!
ValidationUtil
.
isEmpty
(
codeResult
.
getResult
()))
{
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
applyNoList
=
codeResult
.
getResult
();
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
());
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
list
.
add
(
dto
);
throw
new
BadRequest
(
"申请单编号生成失败,请稍后重试!"
);
equipList
.
add
(
jgRelationEquip
);
}
});
// 启动工作流
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
))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
buildTask
(
list
,
workflowResultList
);
// 流程中校验
}
else
{
LambdaQueryWrapper
<
JgReformNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
this
.
saveTempReformNotice
(
list
);
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
();
* 删除 redis校验重复引用设备的数据
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
*/
}).
collect
(
Collectors
.
toList
());
private
void
delRepeatUseEquipData
(
JgReformNotice
notice
)
{
jgReformNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
LambdaQueryWrapper
<
JgReformNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
this
.
updateRedisBatch
(
list
);
queryWrapper
.
eq
(
JgReformNoticeEq:
:
getEquipTransferId
,
notice
.
getSequenceNbr
());
return
list
;
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
)
{
private
void
updateRedisBatch
(
List
<
JgReformNotice
>
jgReformNotices
)
{
...
@@ -680,6 +742,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
...
@@ -680,6 +742,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
jsonObject
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
ROLLBACK
.
getName
());
jsonObject
.
put
(
"flowStatusLabel"
,
FlowStatusEnum
.
ROLLBACK
.
getName
());
commonService
.
rollbackTask
(
notice
.
getInstanceId
(),
jsonObject
);
commonService
.
rollbackTask
(
notice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
notice
));
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
notice
));
this
.
delRepeatUseEquipData
(
notice
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
...
@@ -788,6 +851,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
...
@@ -788,6 +851,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
taskV2Model
=
this
.
updateLastTodo
(
jgReformNotice
,
FlowStatusEnum
.
REJECTED
);
taskV2Model
=
this
.
updateLastTodo
(
jgReformNotice
,
FlowStatusEnum
.
REJECTED
);
this
.
createNewTodo
(
jgReformNotice
,
workflowResultDto
,
taskV2Model
,
FlowStatusEnum
.
REJECTED
);
this
.
createNewTodo
(
jgReformNotice
,
workflowResultDto
,
taskV2Model
,
FlowStatusEnum
.
REJECTED
);
jgReformNoticeMapper
.
updateById
(
jgReformNotice
);
jgReformNoticeMapper
.
updateById
(
jgReformNotice
);
this
.
delRepeatUseEquipData
(
jgReformNotice
);
}
}
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgReformNotice
));
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgReformNotice
));
}
catch
(
InterruptedException
e
)
{
}
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 @
e55cb9bf
...
@@ -24,6 +24,9 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
...
@@ -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.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService
;
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.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.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
...
@@ -141,7 +144,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -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
()));
transferNotice
.
put
(
"constructionContractList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
}
else
if
(
"otherAccessories"
.
equalsIgnoreCase
(
s
))
{
}
else
if
(
"otherAccessories"
.
equalsIgnoreCase
(
s
))
{
transferNotice
.
put
(
"otherAccessoriesList"
,
ObjectUtils
.
isEmpty
(
transferNotice
.
get
(
s
))
?
new
JSONArray
()
:
JSON
.
parseArray
(
transferNotice
.
get
(
s
).
toString
()));
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
()));
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
...
@@ -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
)
{
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
>
detail
=
equipmentInfos
.
get
(
0
);
Map
<
String
,
Object
>
equInfo
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
detail
.
get
(
"equId"
).
toString
());
Map
<
String
,
Object
>
equInfo
=
idxBizJgRegisterInfoService
.
getDetailFieldCamelCaseByRecord
(
detail
.
get
(
"equId"
).
toString
());
...
@@ -199,7 +235,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -199,7 +235,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
for
(
Long
sequenceNbr
:
sequenceNbrs
)
{
// 删除待办 及 中止流程
// 删除待办 及 中止流程
JgTransferNotice
jgTransferNotice
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
JgTransferNotice
jgTransferNotice
=
this
.
getBaseMapper
().
selectById
(
sequenceNbr
);
commonService
.
deleteTaskModel
(
String
.
valueOf
(
sequenceNbr
),
jgTransferNotice
.
getInstanceId
());
commonService
.
deleteTaskModel
(
String
.
valueOf
(
sequenceNbr
),
jgTransferNotice
.
getInstanceId
());
// 删除业务单
// 删除业务单
this
.
getBaseMapper
().
deleteById
(
sequenceNbr
);
this
.
getBaseMapper
().
deleteById
(
sequenceNbr
);
// 删除对应eq
// 删除对应eq
...
@@ -251,126 +287,138 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -251,126 +287,138 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@SuppressWarnings
({
"rawtypes"
,
"Duplicates"
})
@Transactional
@Transactional
public
JgTransferNoticeDto
updateTransferNotice
(
String
submitType
,
JgTransferNoticeDto
noticeDto
,
String
op
)
{
public
JgTransferNoticeDto
updateTransferNotice
(
String
submitType
,
JgTransferNoticeDto
noticeDto
,
String
op
)
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
try
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
throw
new
IllegalArgumentException
(
"参数不能为空"
);
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
{
}
throw
new
IllegalArgumentException
(
"参数不能为空"
);
// 字段转换
}
this
.
convertField
(
noticeDto
);
// 字段转换
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
this
.
convertField
(
noticeDto
);
noticeDto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
JgTransferNotice
notice
=
this
.
getById
(
noticeDto
.
getSequenceNbr
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
this
.
checkRepeatUsed
(
submitType
,
notice
);
//校验设备是否在流程中
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
if
(!
StringUtils
.
hasText
(
noticeDto
.
getInstanceId
()))
{
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
// 发起流程
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
// 如果没有实例ID,说明是启动并执行一步
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
// 如果没有实例ID,说明是启动并执行一步
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setBusinessKey
(
String
.
valueOf
(
noticeDto
.
getSequenceNbr
()));
//下一节点执行人单位(下节点接收机构code)
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
//下一节点执行人单位(下节点接收机构code)
list
.
add
(
dto
);
dto
.
setNextExecuteUserCompanyCode
(
notice
.
getReceiveOrgCode
());
actWorkflowBatchDTO
.
setProcess
(
list
);
list
.
add
(
dto
);
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
actWorkflowBatchDTO
.
setProcess
(
list
);
// 提取节点等信息
processTaskDTO
=
iCmWorkflowService
.
startBatch
(
actWorkflowBatchDTO
).
get
(
0
);
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
// 提取节点等信息
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
workflowResultDto
=
commonService
.
buildWorkFlowInfo
(
Collections
.
singletonList
(
processTaskDTO
)).
get
(
0
);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
}
else
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
workflowResultDto
.
getNextExecutorRoleIds
());
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
}
else
{
}
notice
.
setInstanceStatus
(
workflowResultDto
.
getNextExecutorRoleIds
());
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
}
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
workflowResultDto
.
getNextExecutorRoleIds
()));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setNextExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
notice
.
setInstanceId
(
workflowResultDto
.
getInstanceId
());
notice
.
setNextTaskId
(
workflowResultDto
.
getNextTaskId
());
jgTransferNoticeMapper
.
updateById
(
notice
);
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
))
{
// 如果为保存并提交,则创建代办
// 如果为保存并提交,则创建代办
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
FALS
E
);
buildTask
(
Collections
.
singletonList
(
notice
),
Collections
.
singletonList
(
workflowResultDto
),
Boolean
.
TRU
E
);
}
else
{
}
else
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
ProcessTaskDTO
processTaskDTO
=
new
ProcessTaskDTO
();
BeanUtils
.
copyProperties
(
taskV2Model
,
taskModelDto
);
WorkflowResultDto
workflowResultDto
=
new
WorkflowResultDto
();
// 创建新的代办
// 只调用执行API,返回下个节点信息,用于填充业务字段
taskModelDto
.
setTaskName
(
workflowResultDto
.
getNextTaskName
());
//组装信息
taskModelDto
.
setExecuteUserIds
(
workflowResultDto
.
getNextExecutorUserIds
());
TaskResultDTO
dto
=
new
TaskResultDTO
();
taskModelDto
.
setFlowStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
dto
.
setResultCode
(
"approvalStatus"
);
taskModelDto
.
setFlowStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
dto
.
setTaskId
(
notice
.
getNextTaskId
());
taskModelDto
.
setFlowCode
(
notice
.
getNextTaskId
());
HashMap
<
String
,
Object
>
commMap
=
new
HashMap
<>();
taskModelDto
.
setNextExecuteUser
(
workflowResultDto
.
getNextExecutorRoleIds
());
if
(
notice
.
getNoticeStatus
().
equals
(
"6614"
)
||
notice
.
getNoticeStatus
().
equals
(
"6615"
))
{
TaskMessageDto
taskMessageDto
=
new
TaskMessageDto
();
commMap
.
put
(
"approvalStatus"
,
"提交"
);
BeanUtils
.
copyProperties
(
notice
,
taskMessageDto
);
}
else
{
taskModelDto
.
setModel
(
taskMessageDto
);
commMap
.
put
(
"approvalStatus"
,
op
);
commonService
.
buildTaskModel
(
Collections
.
singletonList
(
taskModelDto
));
}
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
));
return
noticeDto
;
}
else
{
}
catch
(
BadRequest
|
LocalBadRequest
e
)
{
JgTransferNotice
bean
=
new
JgTransferNotice
();
log
.
error
(
e
.
getMessage
(),
e
);
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
this
.
rollBackForDelRedisData
();
jgTransferNoticeMapper
.
updateById
(
bean
);
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
this
.
rollBackForDelRedisData
();
throw
new
BadRequest
(
"安装告知保存失败!"
);
}
finally
{
FlowingEquipRedisContext
.
clean
();
}
}
return
noticeDto
;
}
}
/**
/**
* 分页查询
* 分页查询
*/
*/
@Override
@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
();
String
orgCode
=
reginParams
.
getCompany
().
getCompanyCode
();
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
SortVo
sortMap
=
commonService
.
sortFieldConversion
(
sort
);
model
.
setTransferToUserIds
(
reginParams
.
getUserModel
().
getUserId
());
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
->
{
List
<
Map
<
String
,
Object
>>
mappedRecords
=
noticePage
.
getRecords
().
stream
().
peek
(
notice
->
{
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
Optional
<
Long
>
noticeStatusOpt
=
Optional
.
ofNullable
((
String
)
notice
.
get
(
"noticeStatus"
)).
map
(
Long:
:
valueOf
);
...
@@ -388,41 +436,57 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -388,41 +436,57 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
JgTransferNotice
>
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgTransferNoticeDtoMap
,
ReginParams
reginParams
)
{
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
);
try
{
// 字段转换
JgTransferNoticeDto
model
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
jgTransferNoticeDtoMap
.
get
(
TABLE_PAGE_ID
)),
JgTransferNoticeDto
.
class
);
convertField
(
model
);
// 字段转换
// 获取告知设备列表
convertField
(
model
);
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
// 获取告知设备列表
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
return
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
}
return
new
ArrayList
<>();
// 获取告知单号
}
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请)
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
return
new
ArrayList
<>();
this
.
repeatUsedEquipCheck
(
deviceList
,
reginParams
.
getCompany
().
getCompanyCode
());
}
}
// 启动工作流并返回信息
// 获取告知单号
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
ResponseModel
<
List
<
String
>>
responseModel
=
tzsServiceFeignClient
.
applicationFormCode
(
ApplicationFormTypeEnum
.
YZGZ
.
getCode
(),
deviceList
.
size
());
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
responseModel
.
getResult
()))
{
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
return
new
ArrayList
<>();
//业务数据组装等
}
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
responseModel
,
workflowResultList
,
list
,
equipList
);
// 启动工作流并返回信息
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
List
<
WorkflowResultDto
>
workflowResultList
=
workFlowInfo
(
submitType
,
deviceList
,
model
.
getReceiveCompanyCode
());
// 如果为保存并提交,则创建代办
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
buildTask
(
list
,
workflowResultList
,
Boolean
.
TRUE
);
//业务数据组装等
}
else
{
businessData
(
submitType
,
reginParams
,
model
,
deviceList
,
responseModel
,
workflowResultList
,
list
,
equipList
);
// 暂存任务
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
buildTaskDraft
(
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
)
{
private
void
updateRedisBatch
(
List
<
JgTransferNotice
>
jgTransferNotices
)
{
...
@@ -685,6 +749,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
...
@@ -685,6 +749,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jsonObject
.
put
(
"nextTaskId"
,
jgTransferNotice
.
getNextTaskId
());
jsonObject
.
put
(
"nextTaskId"
,
jgTransferNotice
.
getNextTaskId
());
commonService
.
rollbackTask
(
jgTransferNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
rollbackTask
(
jgTransferNotice
.
getInstanceId
(),
jsonObject
);
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgTransferNotice
));
commonService
.
saveExecuteFlowData2Redis
(
instanceId
,
this
.
buildInstanceRuntimeData
(
jgTransferNotice
));
this
.
delRepeatUseEquipData
(
jgTransferNotice
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
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 @
e55cb9bf
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 @
e55cb9bf
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 @
e55cb9bf
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 @
e55cb9bf
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"name"
:
"移装告知"
,
"name"
:
"移装告知"
,
"code"
:
"GZ_YZ"
,
"code"
:
"GZ_YZ"
,
"image"
:
"upload/tzs/common/image/移装告知.png"
,
"image"
:
"upload/tzs/common/image/移装告知.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
}
}
],
],
"DJGL"
:
[
"DJGL"
:
[
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
"name"
:
"移装变更登记"
,
"name"
:
"移装变更登记"
,
"code"
:
"DJ_YZ"
,
"code"
:
"DJ_YZ"
,
"image"
:
"upload/tzs/common/image/移装变更登记.png"
,
"image"
:
"upload/tzs/common/image/移装变更登记.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
},
},
{
{
"name"
:
"单位变更登记"
,
"name"
:
"单位变更登记"
,
...
@@ -88,16 +88,16 @@
...
@@ -88,16 +88,16 @@
"image"
:
"upload/tzs/common/image/注销报废.png"
"image"
:
"upload/tzs/common/image/注销报废.png"
},
},
{
{
"name"
:
"
设备
启用"
,
"name"
:
"启用"
,
"code"
:
"SB_QY"
,
"code"
:
"SB_QY"
,
"image"
:
"upload/tzs/common/image/设备启用.png"
,
"image"
:
"upload/tzs/common/image/设备启用.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
},
},
{
{
"name"
:
"
设备
停用"
,
"name"
:
"停用"
,
"code"
:
"SB_TY"
,
"code"
:
"SB_TY"
,
"image"
:
"upload/tzs/common/image/设备停用.png"
,
"image"
:
"upload/tzs/common/image/设备停用.png"
,
"disabled"
:
tru
e
"disabled"
:
fals
e
}
}
],
],
"XZSB"
:
[
"XZSB"
:
[
...
...
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
View file @
e55cb9bf
...
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
...
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
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.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -108,6 +109,7 @@ public class DPSubServiceImpl {
...
@@ -108,6 +109,7 @@ public class DPSubServiceImpl {
map
=
new
JSONObject
();
map
=
new
JSONObject
();
map
.
put
(
"columns"
,
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.modelTableColumns"
));
map
.
put
(
"columns"
,
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.modelTableColumns"
));
map
.
put
(
"dataList"
,
apiResult
);
map
.
put
(
"dataList"
,
apiResult
);
map
.
put
(
"showPage"
,
true
);
content
.
put
(
tab
.
getString
(
"key"
),
map
);
content
.
put
(
tab
.
getString
(
"key"
),
map
);
}
}
}
}
...
@@ -261,12 +263,26 @@ public class DPSubServiceImpl {
...
@@ -261,12 +263,26 @@ public class DPSubServiceImpl {
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
){
public
JSONObject
buildContentData
(
JSONObject
map
,
List
<
Object
>
mergedArray
,
JSONObject
apiResult
){
JSONArray
datas
=
new
JSONArray
();
JSONArray
datas
=
new
JSONArray
();
// 二维码
//
处理
二维码
mergedArray
.
stream
().
filter
(
x
->
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
findFirst
().
ifPresent
(
x
->
{
mergedArray
.
stream
().
filter
(
x
->
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"componentKey"
,
null
))).
findFirst
().
ifPresent
(
x
->
{
JSONObject
qrcode
=
map
.
getJSONObject
(
"qrcode"
);
JSONObject
qrcode
=
map
.
getJSONObject
(
"qrcode"
);
qrcode
.
put
(
"text"
,
apiResult
.
get
(
"problemTime"
));
String
problemTime
=
apiResult
.
getString
(
"problemTime"
);
qrcode
.
put
(
"value"
,
!
ValidationUtil
.
isEmpty
(
apiResult
.
get
(
"userCode"
))
?
apiResult
.
get
(
"userCode"
)
:
apiResult
.
get
(
"USE_ORG_CODE"
));
String
problemStatus
=
apiResult
.
getString
(
"problemStatus"
);
qrcode
.
put
(
"status"
,
apiResult
.
get
(
"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
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"visualParams"
,
"visualParams.componentKey"
))).
collect
(
Collectors
.
toList
());
...
@@ -380,6 +396,7 @@ public class DPSubServiceImpl {
...
@@ -380,6 +396,7 @@ public class DPSubServiceImpl {
return
jsonObject
;
return
jsonObject
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
subObj
.
put
(
"showPage"
,
false
);
subObj
.
put
(
"columns"
,
columns
);
subObj
.
put
(
"columns"
,
columns
);
subObj
.
put
(
"dataList"
,
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.fieldKey"
)));
subObj
.
put
(
"dataList"
,
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.fieldKey"
)));
...
...
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 @
e55cb9bf
...
@@ -275,8 +275,11 @@ public class TzBaseEnterpriseInfoServiceImpl
...
@@ -275,8 +275,11 @@ public class TzBaseEnterpriseInfoServiceImpl
resultMap
.
remove
(
"regUnitInfoDto"
);
resultMap
.
remove
(
"regUnitInfoDto"
);
resultMap
.
remove
(
"tzsBaseInstitution"
);
resultMap
.
remove
(
"tzsBaseInstitution"
);
resultMap
.
put
(
"problemTime"
,
problemInfo
.
get
(
"problem_time"
));
resultMap
.
put
(
"unitAddress"
,
resultMap
.
get
(
"province"
)
+
"/"
+
resultMap
.
get
(
"city"
)
+
"/"
+
resultMap
.
get
(
"district"
));
resultMap
.
put
(
"problemStatus"
,
ProblemStatusEnum
.
getName
.
get
(
resultMap
.
get
(
"status"
)));
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
;
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