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
cb44ec4b
Commit
cb44ec4b
authored
Dec 21, 2023
by
王果
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
维修告知接口调整
parent
d6314708
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
240 additions
and
172 deletions
+240
-172
JgMaintainNoticeDto.java
...join/amos/boot/module/jg/api/dto/JgMaintainNoticeDto.java
+7
-0
JgMaintainNotice.java
...join/amos/boot/module/jg/api/entity/JgMaintainNotice.java
+9
-0
JgMaintainNoticeMapper.xml
...-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
+73
-68
JgMaintainNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgMaintainNoticeServiceImpl.java
+151
-104
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/JgMaintainNoticeDto.java
View file @
cb44ec4b
...
...
@@ -196,4 +196,11 @@ public class JgMaintainNoticeDto extends BaseDto {
@ApiModelProperty
(
value
=
"设备类别名称"
)
private
String
equCategory
;
private
List
<
String
>
roleIds
;
private
String
dataType
;
@ApiModelProperty
(
value
=
"状态"
)
private
String
status
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/entity/JgMaintainNotice.java
View file @
cb44ec4b
...
...
@@ -304,4 +304,13 @@ public class JgMaintainNotice extends BaseEntity {
*/
@TableField
(
value
=
"equ_category"
)
private
String
equCategory
;
/**
* 状态
*/
@TableField
(
"status"
)
private
String
status
;
@TableField
(
"next_execute_ids"
)
private
String
nextExecuteIds
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
View file @
cb44ec4b
...
...
@@ -8,92 +8,95 @@
<select
id=
"queryForPage"
resultType=
"com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice"
>
select
tjmn.sequence_nbr AS sequenceNbr,
tjmn.apply_no AS applyNo,
tjmn.notice_date AS noticeDate,
tjmn.use_unit_name AS useUnitName,
tjmn.receive_org_name AS receiveOrgName,
tjmn.address AS address,
tjmn.notice_status AS noticeStatus,
tjmn.install_unit_name AS installUnitName,
tjmn.province,
tjmn.city,
tjmn.county,
tjmn.factory_use_site_street,
tjmn.street_name,
tjmn.street,
tjmn.maintain_type,
tjmn.plan_date,
tjmn.notice_report_url,
tjmn.province_name AS provinceName,
tjmn.city_name AS cityName,
tjmn.county_name AS countyName,
tjmn.promoter,
tjmn.equ_category AS equCategory,
tjmn.equ_list_code AS equListCode,
tjmn.instance_id AS instanceId
isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
isn.notice_date AS noticeDate,
isn.use_unit_name AS useUnitName,
isn.receive_org_name AS receiveOrgName,
isn.address AS address,
isn.notice_status AS noticeStatus,
isn.install_unit_name AS installUnitName,
isn.province,
isn.city,
isn.county,
isn.factory_use_site_street,
isn.street_name,
isn.street,
isn.maintain_type,
isn.plan_date,
isn.notice_report_url,
isn.province_name AS provinceName,
isn.city_name AS cityName,
isn.county_name AS countyName,
isn.promoter,
isn.equ_category AS equCategory,
isn.equ_list_code AS equListCode,
isn.instance_id AS instanceId,
isn.accept_date AS acceptDate
FROM
tzs_jg_maintain_notice
tjm
n
tzs_jg_maintain_notice
is
n
<where>
tjm
n.is_delete = 0
is
n.is_delete = 0
<if
test=
"param != null "
>
<if
test=
"param.applyNo != null and param.applyNo != ''"
>
AND
tjm
n.apply_no LIKE CONCAT('%', #{param.applyNo}, '%')
AND
is
n.apply_no LIKE CONCAT('%', #{param.applyNo}, '%')
</if>
<if
test=
"param.receiveOrg
Name != null and param.receiveOrgNam
e != ''"
>
AND
tjmn.receive_org_name LIKE CONCAT('%', #{param.receiveOrgName}, '%')
<if
test=
"param.receiveOrg
Code != null and param.receiveOrgCod
e != ''"
>
AND
isn.receive_org_code = #{param.receiveOrgCode}
</if>
<if
test=
"param.useUnitName != null and param.useUnitName != ''"
>
AND
tjm
n.use_unit_name LIKE CONCAT('%', #{param.useUnitName}, '%')
AND
is
n.use_unit_name LIKE CONCAT('%', #{param.useUnitName}, '%')
</if>
<if
test=
"param.installUnitName != null and param.installUnitName != ''"
>
AND
tjm
n.install_unit_name LIKE CONCAT('%', #{param.installUnitName}, '%')
AND
is
n.install_unit_name LIKE CONCAT('%', #{param.installUnitName}, '%')
</if>
<if
test=
"param.noticeStatus != null and param.noticeStatus != ''"
>
AND
tjm
n.notice_status = #{param.noticeStatus}
AND
is
n.notice_status = #{param.noticeStatus}
</if>
<if
test=
"param.maintainType != null and param.maintainType != ''"
>
AND
tjm
n.maintain_type = #{param.maintainType}
AND
is
n.maintain_type = #{param.maintainType}
</if>
</if>
<if
test=
"type == 'supervision'"
>
AND (
tjm
n.notice_status in ('6612', '6614', '6616') )
AND
tjm
n.receive_org_code = #{orgCode}
AND (
is
n.notice_status in ('6612', '6614', '6616') )
AND
is
n.receive_org_code = #{orgCode}
</if>
<if
test=
"type == 'enterprise'"
>
AND
tjm
n.install_unit_credit_code = #{orgCode}
AND
is
n.install_unit_credit_code = #{orgCode}
</if>
</where>
ORDER BY
tjmn.create_date
DESC
isn.apply_no
DESC
</select>
<select
id=
"queryEquipInformation"
resultType=
"java.util.Map"
>
select
tjmn.sequence_nbr AS sequenceNbr,
tjmn.apply_no AS applyNo,
tjmn.notice_date AS noticeDate,
tjmn.use_unit_name AS useUnitName,
tjmn.receive_org_name AS receiveOrgName,
tjmn.address AS address,
tjmn.notice_status AS noticeStatus,
tjmn.install_unit_name AS installUnitName,
tjmn.province,
tjmn.city,
tjmn.county,
tjmn.factory_use_site_street AS factoryUseSiteStreet,
tjmn.street_name AS streetName,
tjmn.street,
tjmn.maintain_type AS maintainType,
tjmn.plan_date AS planDate,
tjmn.notice_report_url AS noticeReportUrl,
tjmn.province_name AS provinceName,
tjmn.city_name AS cityName,
tjmn.county_name AS countyName,
tjmn.instance_id AS instanceId,
tjmn.promoter,
tjmn.equ_category AS equCategory,
tjmn.equ_list_code AS equListCode,
isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
isn.notice_date AS noticeDate,
isn.use_unit_name AS useUnitName,
isn.receive_org_name AS receiveOrgName,
isn.address AS address,
isn.notice_status AS noticeStatus,
isn.install_unit_name AS installUnitName,
isn.province,
isn.city,
isn.county,
isn.factory_use_site_street AS factoryUseSiteStreet,
isn.street_name AS streetName,
isn.street,
isn.maintain_type AS maintainType,
isn.notice_report_url AS noticeReportUrl,
isn.province_name AS provinceName,
isn.city_name AS cityName,
isn.county_name AS countyName,
isn.instance_id AS instanceId,
isn.promoter,
isn.equ_category AS equCategory,
isn.equ_list_code AS equListCode,
isn.plan_date AS installStartDate,
isn.construction_manager AS installLeaderName,
isn.construction_manager_phone AS installLeaderPhone,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
...
...
@@ -116,7 +119,8 @@
fi.produce_unit_credit_code AS produceUnitCreditCode,
fi.produce_unit_name AS produceUnitName,
fi.produce_license_num AS produceLicenseNum,
fi.factory_num AS factoryNum,
fi.FACTORY_NUM AS produceCode,
fi.FACTORY_NUM AS factoryNum,
fi.produce_date AS produceDate,
fi.imported AS imported,
fi.produce_country AS produceCountry,
...
...
@@ -124,21 +128,22 @@
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ui.safety_manager AS safetyManager,
ui.phone AS safetyManagerPhone
,
ui.PROVINCE_NAME AS useUnitProvinceNam
e,
ei.legal_person AS safetyManager
,
ei.legal_phone AS safetyManagerPhon
e,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
u
i.ADDRESS AS useUnitAddress
e
i.ADDRESS AS useUnitAddress
FROM
tzs_jg_maintain_notice
tjm
n
LEFT JOIN tzs_jg_maintain_notice_eq re ON re.equip_transfer_id =
tjm
n.sequence_nbr
tzs_jg_maintain_notice
is
n
LEFT JOIN tzs_jg_maintain_notice_eq re ON re.equip_transfer_id =
is
n.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = isn.use_unit_credit_code
WHERE
tjm
n.sequence_nbr = #{sequenceNbr}
is
n.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgMaintainNoticeServiceImpl.java
View file @
cb44ec4b
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.aspose.words.SaveFormat
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -10,7 +11,6 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgMaintainNoticeDto
;
...
...
@@ -22,7 +22,6 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgMaintainNoticeService;
import
com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
...
...
@@ -132,7 +131,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
maintainInfo
.
put
(
"city"
,
notice
.
getCity
()
+
"_"
+
notice
.
getCityName
());
maintainInfo
.
put
(
"constructionManagerId"
,
notice
.
getConstructionManagerId
()
+
"_"
+
notice
.
getConstructionManager
());
maintainInfo
.
put
(
"county"
,
notice
.
getCounty
()
+
"_"
+
notice
.
getCountyName
());
maintainInfo
.
put
(
"fullAddress"
,
notice
.
getProvinceName
()
+
notice
.
getCityName
()
+
notice
.
getC
ityName
()
+
notice
.
getStreetName
()
+
notice
.
getAddress
());
maintainInfo
.
put
(
"fullAddress"
,
notice
.
getProvinceName
()
+
notice
.
getCityName
()
+
notice
.
getC
ounty
()
+
notice
.
getStreetName
()
+
notice
.
getAddress
());
maintainInfo
.
put
(
"useUnitCreditCode"
,
notice
.
getUseUnitCreditCode
()
+
"_"
+
notice
.
getUseUnitName
());
maintainInfo
.
put
(
"receiveOrgCode"
,
notice
.
getReceiveOrgCode
()
+
"_"
+
notice
.
getReceiveOrgName
());
if
(!
ValidationUtil
.
isEmpty
(
notice
.
getInspectionUnitCreditCode
())
&&
!
ValidationUtil
.
isEmpty
(
notice
.
getInspectionUnitName
()))
{
...
...
@@ -167,10 +166,11 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
public
JgMaintainNoticeDto
updateMaintainNotice
(
String
submitType
,
JgMaintainNoticeDto
noticeDto
,
String
op
)
{
if
(
Objects
.
isNull
(
noticeDto
)
||
StringUtils
.
isEmpty
(
submitType
))
throw
new
IllegalArgumentException
(
"参数不能为空"
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// 字段转换
this
.
convertField
(
noticeDto
);
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListSecond
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
AjaxResult
ajaxResult
;
// 发起流程
...
...
@@ -182,36 +182,31 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
noticeDto
.
setInstanceId
(
instanceId
);
// 查询下节点任务
getNext
(
roleListFirst
,
instanceId
,
taskName
);
noticeDto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
}
catch
(
Exception
e
)
{
log
.
error
(
"JgMaintainNoticeServiceImpl.updateMaintainNotice启动失败:{}"
,
e
);
throw
new
RuntimeException
(
e
);
}
}
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
noticeDto
.
getInstanceId
());
JSONObject
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
String
taskId
=
dataObject
.
getString
(
"id"
);
//组装信息
TaskResultDTO
taskResultDTO
=
new
TaskResultDTO
();
taskResultDTO
.
setResultCode
(
"approvalStatus"
);
taskResultDTO
.
setTaskId
(
taskId
);
taskResultDTO
.
setComment
(
"提交流程"
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
op
);
taskResultDTO
.
setVariable
(
map
);
//执行流程
AjaxResult
ajaxResult1
;
try
{
ajaxResult1
=
Workflow
.
taskClient
.
completeByTask
(
taskId
,
taskResultDTO
);
if
(
ajaxResult1
.
get
(
"code"
).
equals
(
200
))
{
noticeDto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
JgMaintainNotice
bean
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
bean
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgMaintainNoticeMapper
.
updateById
(
bean
);
JgMaintainNotice
notice
=
new
JgMaintainNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
notice
);
boolean
submit
=
submit
(
notice
,
op
);
if
(
submit
)
{
// 查询下节点任务
getNext
(
roleListSecond
,
notice
.
getInstanceId
(),
taskName
);
notice
.
setStatus
(
taskName
[
0
]);
if
(!
ObjectUtils
.
isEmpty
(
notice
.
getInstanceStatus
()))
{
notice
.
setInstanceStatus
(
notice
.
getInstanceStatus
()
+
","
+
roleListSecond
);
}
else
{
notice
.
setInstanceStatus
(
String
.
join
(
","
,
roleListSecond
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"JgMaintainNoticeServiceImpl.updateMaintainNotice执行失败:{}"
,
e
);
throw
new
RuntimeException
(
e
);
notice
.
setPromoter
(
RequestContext
.
getExeUserId
());
notice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
notice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
updateById
(
notice
);
}
}
else
{
JgMaintainNotice
bean
=
new
JgMaintainNotice
();
...
...
@@ -291,14 +286,16 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
*/
@Override
public
String
generateMaintainNoticeReport
(
Long
sequenceNbr
)
{
if
(
Objects
.
isNull
(
sequenceNbr
))
if
(
Objects
.
isNull
(
sequenceNbr
))
{
throw
new
IllegalArgumentException
(
"参数不能为空"
);
JgMaintainNotice
jgMaintainNotice
=
this
.
getById
(
sequenceNbr
);
}
JgMaintainNotice
JgMaintainNotice
=
this
.
getById
(
sequenceNbr
);
List
<
Map
<
String
,
Object
>>
informationList
=
jgMaintainNoticeMapper
.
queryEquipInformation
(
sequenceNbr
);
if
(
Objects
.
isNull
(
jgMaintainNotice
)
||
CollectionUtils
.
isEmpty
(
informationList
))
if
(
Objects
.
isNull
(
JgMaintainNotice
)
||
CollectionUtils
.
isEmpty
(
informationList
))
{
throw
new
IllegalArgumentException
(
"维修告知单不存在"
);
Map
<
String
,
Object
>
maintain
=
informationList
.
get
(
0
);
Function
<
String
,
String
>
getValue
=
key
->
maintain
.
getOrDefault
(
key
,
""
).
toString
();
}
Map
<
String
,
Object
>
installation
=
informationList
.
get
(
0
);
Function
<
String
,
String
>
getValue
=
key
->
installation
.
getOrDefault
(
key
,
""
).
toString
();
// 组装模板变量
Map
<
String
,
Object
>
placeholders
=
new
HashMap
<>();
placeholders
.
put
(
"sequenceNbr"
,
getValue
.
apply
(
"sequenceNbr"
));
...
...
@@ -306,18 +303,18 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
placeholders
.
put
(
"applyNo"
,
getValue
.
apply
(
"applyNo"
));
placeholders
.
put
(
"productName"
,
getValue
.
apply
(
"productName"
));
placeholders
.
put
(
"equipType"
,
getValue
.
apply
(
"equType"
));
placeholders
.
put
(
"equipCode"
,
""
);
placeholders
.
put
(
"produceCode"
,
getValue
.
apply
(
"produceCode"
));
// TODO: 制造编号
placeholders
.
put
(
"equipCode"
,
getValue
.
apply
(
"equRegisterCode"
)
);
placeholders
.
put
(
"produceCode"
,
getValue
.
apply
(
"produceCode"
));
// TODO: 制造编号
- 设备出厂编号
placeholders
.
put
(
"produceUnitName"
,
getValue
.
apply
(
"produceUnitName"
));
placeholders
.
put
(
"produceLicenseNum"
,
getValue
.
apply
(
"produceLicenseNum"
));
placeholders
.
put
(
"fullAddress"
,
getValue
.
apply
(
"provinceName"
)
+
getValue
.
apply
(
"cityName"
)
+
getValue
.
apply
(
"countyName"
)
+
getValue
.
apply
(
"address"
));
placeholders
.
put
(
"installStartDate"
,
""
);
placeholders
.
put
(
"installType"
,
"
"
);
placeholders
.
put
(
"installStartDate"
,
getValue
.
apply
(
"installStartDate"
)
);
placeholders
.
put
(
"installType"
,
"
维修"
);
// TODO: 施工类别
placeholders
.
put
(
"installLicenseNo"
,
""
);
placeholders
.
put
(
"installLicenseExpirationDate"
,
""
);
placeholders
.
put
(
"installLeaderName"
,
""
);
placeholders
.
put
(
"installLeaderPhone"
,
""
);
placeholders
.
put
(
"installUnitAddress"
,
""
);
placeholders
.
put
(
"installLeaderName"
,
getValue
.
apply
(
"installLeaderName"
));
// 施工负责人
placeholders
.
put
(
"installLeaderPhone"
,
getValue
.
apply
(
"installLeaderPhone"
));
// 施工负责人手机
placeholders
.
put
(
"installUnitAddress"
,
getValue
.
apply
(
"provinceName"
)
+
getValue
.
apply
(
"cityName"
)
+
getValue
.
apply
(
"countyName"
)
+
getValue
.
apply
(
"address"
));
// TODO: 施工单位地址
placeholders
.
put
(
"useUnitName"
,
getValue
.
apply
(
"useUnitName"
));
placeholders
.
put
(
"useUnitLeaderName"
,
getValue
.
apply
(
"safetyManager"
));
placeholders
.
put
(
"useUnitLeaderPhone"
,
getValue
.
apply
(
"safetyManagerPhone"
));
...
...
@@ -330,6 +327,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
try
{
pdfFile
=
this
.
wordToPdf
(
"installation-notification-report.ftl"
,
placeholders
);
}
catch
(
Exception
e
)
{
log
.
error
(
"word转pdf失败:{}"
,
e
);
throw
new
RuntimeException
(
e
);
}
// 上传pdf至文件服务器
...
...
@@ -338,11 +336,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
try
{
Files
.
deleteIfExists
(
pdfFile
.
toPath
());
}
catch
(
IOException
e
)
{
log
.
error
(
"JgMaintainNoticeServiceImpl.generateMaintainNoticeReport删除临时文件失败:{}"
,
e
);
log
.
error
(
"删除临时文件失败:{}"
,
e
);
throw
new
RuntimeException
(
e
);
}
//更新到数据库
j
gMaintainNotice
.
setNoticeReportUrl
(
url
);
this
.
updateById
(
j
gMaintainNotice
);
//
更新到数据库
J
gMaintainNotice
.
setNoticeReportUrl
(
url
);
this
.
updateById
(
J
gMaintainNotice
);
return
url
;
}
...
...
@@ -380,43 +379,81 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveNotice
(
String
submitType
,
Map
<
String
,
JgMaintainNoticeDto
>
jgMaintainNoticeDtoMap
,
ReginParams
reginParams
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
JgMaintainNoticeDto
model
=
jgMaintainNoticeDtoMap
.
get
(
TABLE_PAGE_ID
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
return
;
}
// 获取告知单号
List
<
String
>
applyNoList
=
iCreateCodeService
.
createApplicationFormCode
(
ApplicationFormTypeEnum
.
WXGZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
return
;
}
ArrayList
<
String
>
roleListFirst
=
new
ArrayList
<>();
ArrayList
<
String
>
roleListSecond
=
new
ArrayList
<>();
// 判断当前是否为提交
List
<
String
>
instanceIdList
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
// ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++
)
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
i
));
dto
.
setCompleteFirstTask
(
true
);
//
dto.setCompleteFirstTask(true);
list
.
add
(
dto
);
}
actWorkflowBatchDTO
.
setProcess
(
list
);
try
{
FeignClientResult
result
=
Workflow
.
taskV2Client
.
startByVariableBatch
(
actWorkflowBatchDTO
);
List
<
Object
>
returnList
=
(
List
<
Object
>)
result
.
getResult
();
for
(
Object
obj
:
returnList
)
{
for
(
Object
obj
:
returnList
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSONObject
.
toJSONString
(
obj
));
instanceIdList
.
add
(
jsonObject
.
getString
(
"id"
));
String
instanceId
=
jsonObject
.
getString
(
"id"
);
instanceIdList
.
add
(
instanceId
);
// 查询下节点任务
if
(
returnList
.
get
(
0
).
equals
(
obj
))
{
getNext
(
roleListFirst
,
instanceId
,
taskName
);
}
// 推动下一个节点
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
JSONObject
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
String
taskId
=
dataObject
.
getString
(
"id"
);
// 组装信息
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResultCode
(
"approvalStatus"
);
dto
.
setTaskId
(
taskId
);
dto
.
setComment
(
"提交流程"
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"approvalStatus"
,
"0"
);
dto
.
setVariable
(
map
);
// 执行流程
AjaxResult
ajaxResult1
=
null
;
try
{
ajaxResult1
=
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto
);
if
(
ajaxResult1
.
get
(
"code"
).
equals
(
200
))
{
getNext
(
roleListSecond
,
instanceId
,
taskName
);
}
else
{
log
.
error
(
"提交失败"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"JgMaintainNoticeServiceImpl.saveNotice发起流程失败
"
,
e
);
throw
new
RuntimeException
(
e
);
log
.
error
(
"提交失败:{}
"
,
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
}
}
List
<
JgMaintainNotice
>
list
=
new
ArrayList
<>();
List
<
JgMaintainNoticeEq
>
equipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
obj
->
{
...
...
@@ -426,9 +463,13 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
applyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
dto
.
setEquCategory
(
String
.
valueOf
(
obj
.
get
(
"EQU_CATEGORY"
)));
dto
.
setEquListCode
(
String
.
valueOf
(
obj
.
get
(
"EQU_LIST_CODE"
)));
dto
.
setNoticeDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
dto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setStatus
(
taskName
[
0
]);
}
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
...
...
@@ -436,20 +477,39 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if
(!
CollectionUtils
.
isEmpty
(
instanceIdList
))
{
dto
.
setInstanceId
(
instanceIdList
.
get
(
i
));
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
}
else
{
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
jgMaintainNoticeMapper
.
insertBatchSomeColumn
(
list
);
List
<
JgMaintainNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgMaintainNotice
>
collect
=
list
.
stream
().
filter
(
jgMaintainNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
j
gMaintainNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
List
<
JgMaintainNotice
>
collect
=
list
.
stream
().
filter
(
JgMaintainNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
J
gMaintainNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgMaintainNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
}
void
getNext
(
ArrayList
<
String
>
roleListFirst
,
String
instanceId
,
String
[]
taskName
)
{
AjaxResult
aj
=
Workflow
.
taskClient
.
getTaskNoAuth
(
instanceId
);
JSONObject
taskNoAuth
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
aj
.
get
(
"data"
)));
if
(!
ObjectUtils
.
isEmpty
(
taskNoAuth
))
{
String
nextTaskId
=
taskNoAuth
.
getString
(
"id"
);
AjaxResult
taskGroupName
=
Workflow
.
taskClient
.
getTaskGroupName
(
nextTaskId
);
taskName
[
0
]
=
taskNoAuth
.
getString
(
"name"
);
JSONArray
data
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
taskGroupName
.
get
(
"data"
)));
for
(
Object
datum
:
data
)
{
if
(((
Map
)
datum
).
containsKey
(
"groupId"
))
{
roleListFirst
.
add
(((
Map
)
datum
).
get
(
"groupId"
).
toString
());
}
}
}
}
private
void
convertField
(
JgMaintainNoticeDto
model
)
{
...
...
@@ -534,14 +594,6 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
}
private
String
convertImageUrl
(
List
<
Map
<
String
,
String
>>
urlList
)
{
String
urls
=
""
;
if
(!
CollectionUtils
.
isEmpty
(
urlList
))
{
urls
=
urlList
.
stream
().
map
(
map
->
map
.
get
(
"url"
)).
collect
(
Collectors
.
joining
(
","
));
}
return
urls
;
}
public
boolean
submit
(
JgMaintainNotice
notice
,
String
op
)
{
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
notice
.
getInstanceId
());
JSONObject
dataObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
ajaxResult
.
get
(
"data"
)));
...
...
@@ -570,75 +622,69 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
public
void
cancel
(
JgMaintainNoticeDto
noticeDto
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
FeignClientResult
ajaxResult
=
Workflow
.
taskV2Client
.
rollBack
(
noticeDto
.
getInstanceId
());
JgMaintainNotice
jgMaintainNotice
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
JgMaintainNotice
jgInstallationNotice
=
this
.
baseMapper
.
selectById
(
noticeDto
.
getSequenceNbr
());
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
if
(
ajaxResult
.
getStatus
()
==
200
)
{
jgMaintainNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
ROLLBACK
.
getCode
()));
jgMaintainNoticeMapper
.
updateById
(
jgMaintainNotice
);
getNext
(
roleList
,
noticeDto
.
getInstanceId
(),
taskName
);
jgInstallationNotice
.
setStatus
(
taskName
[
0
]);
jgInstallationNotice
.
setPromoter
(
""
);
jgInstallationNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleList
));
jgInstallationNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
updateById
(
jgInstallationNotice
);
}
}
@Transactional
public
void
accept
(
JgMaintainNoticeDto
dto
,
String
op
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
String
userId
=
RequestContext
.
getExeUserId
();
JgMaintainNotice
jgMaintainNotice
=
this
.
jgMaintainNoticeMapper
.
selectById
(
dto
.
getSequenceNbr
());
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
// 组装设备注册代码
StringBuffer
stringBuffer
=
new
StringBuffer
();
String
ym
=
null
;
try
{
ym
=
DateUtils
.
dateFormat
(
new
Date
(),
DateUtils
.
DATE_PATTERN_MM
);
}
catch
(
ParseException
e
)
{
log
.
error
(
"
JgMaintainNoticeServiceImpl.accept
日期转换失败:{}"
,
e
);
log
.
error
(
"日期转换失败:{}"
,
e
);
}
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
boolean
submit
=
submit
(
jgMaintainNotice
,
op
);
if
(
submit
)
{
getNext
(
roleList
,
dto
.
getInstanceId
(),
taskName
);
jgMaintainNotice
.
setStatus
(
taskName
[
0
]);
if
(
"0"
.
equals
(
op
))
{
if
(
roleList
.
size
()
==
0
)
{
LambdaQueryWrapper
<
JgMaintainNoticeEq
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
JgMaintainNoticeEq:
:
getEquipTransferId
,
dto
.
getSequenceNbr
());
JgMaintainNoticeEq
jgRelationEquip
=
jgMaintainNoticeEqMapper
.
selectOne
(
queryWrapper
);
LambdaQueryWrapper
<
OtherInfo
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
eq
(
OtherInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
// OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper
<
RegistrationInfo
>
queryWrapper2
=
new
LambdaQueryWrapper
<>();
queryWrapper2
.
eq
(
RegistrationInfo:
:
getRecord
,
jgRelationEquip
.
getEquId
());
RegistrationInfo
tzsJgRegistrationInfo
=
tzsJgRegistrationInfoMapper
.
selectOne
(
queryWrapper2
);
stringBuffer
.
append
(
tzsJgRegistrationInfo
.
getEquCategory
()).
append
(
jgMaintainNotice
.
getCity
()).
append
(
ym
);
// String equCode = stringBuffer.toString();
// String deviceRegistrationCode = iCreateCodeService.createDeviceRegistrationCode(equCode);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cityCode"
,
jgMaintainNotice
.
getCity
());
map
.
put
(
"countyCode"
,
jgMaintainNotice
.
getCounty
());
map
.
put
(
"equCategory"
,
tzsJgRegistrationInfo
.
getEquCategory
());
// map.put("isXiXian", jgMaintainNotice.getIsXixian() == null ? "0" : jgMaintainNotice.getIsXixian());
// Map<String, Object> mapCode;
// ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
// mapCode = code.getResult();
// LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
// queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode, mapCode.get("superviseCode").toString());
// SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
// supervisoryCodeInfo.setStatus("1");
// supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
boolean
submit
=
submit
(
jgMaintainNotice
,
op
);
if
(
submit
)
{
if
(
"0"
.
equals
(
op
))
{
jgMaintainNotice
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
jgMaintainNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()));
jgMaintainNotice
.
setAcceptDate
(
new
Date
());
this
.
generateMaintainNoticeReport
(
jgMaintainNotice
.
getSequenceNbr
());
// // 更新其他业务表
// tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
// tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
// tzsJgRegistrationInfo.setEquCode(deviceRegistrationCode);
// jgMaintainNotice.setEquRegisterCode(deviceRegistrationCode);
// jgMaintainNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
// tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
// tzsJgRegistrationInfoMapper.updateById(tzsJgRegistrationInfo);
generateMaintainNoticeReport
(
jgMaintainNotice
.
getSequenceNbr
());
jgMaintainNotice
.
setPromoter
(
""
);
}
else
{
jgMaintainNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
roleList
));
if
(!
ObjectUtils
.
isEmpty
(
jgMaintainNotice
.
getInstanceStatus
()))
{
jgMaintainNotice
.
setInstanceStatus
(
jgMaintainNotice
.
getInstanceStatus
()
+
","
+
String
.
join
(
","
,
roleList
));
}
else
{
//驳回
jgMaintainNotice
.
setInstanceStatus
(
String
.
join
(
","
,
roleList
));
}
jgMaintainNotice
.
setPromoter
(
userId
);
jgMaintainNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
}
else
{
jgMaintainNotice
.
setPromoter
(
""
);
jgMaintainNotice
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
REJECTED
.
getCode
()));
jgMaintainNotice
.
setInstanceStatus
(
String
.
valueOf
(
FlowStatusEnum
.
REJECTED
.
getCode
()));
jgMaintainNoticeMapper
.
updatePromoter
(
jgMaintainNotice
.
getSequenceNbr
());
}
updateById
(
jgMaintainNotice
);
jgMaintainNoticeMapper
.
updateById
(
jgMaintainNotice
);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment