Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
e682790d
Commit
e682790d
authored
Oct 15, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资源下载
parent
79d851fa
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1128 additions
and
130 deletions
+1128
-130
CommonEnum.java
...om/yeejoin/amos/boot/module/hygf/api/Enum/CommonEnum.java
+96
-0
BasicGridAuditingMapper.java
.../boot/module/hygf/api/mapper/BasicGridAuditingMapper.java
+1
-0
FinancingAuditingMapper.java
.../boot/module/hygf/api/mapper/FinancingAuditingMapper.java
+1
-1
HygfWorkOrderStationAuditingMapper.java
...e/hygf/api/mapper/HygfWorkOrderStationAuditingMapper.java
+1
-0
PowerStationMapper.java
.../amos/boot/module/hygf/api/mapper/PowerStationMapper.java
+2
-0
BasicGridAuditingMapper.xml
...c/main/resources/mapper/mysql/BasicGridAuditingMapper.xml
+5
-0
FinancingAuditingMapper.xml
...c/main/resources/mapper/mysql/FinancingAuditingMapper.xml
+3
-0
HygfWorkOrderStationAuditingMapper.xml
...urces/mapper/mysql/HygfWorkOrderStationAuditingMapper.xml
+4
-0
PowerStationMapper.xml
...pi/src/main/resources/mapper/mysql/PowerStationMapper.xml
+3
-0
CommonController.java
...mos/boot/module/hygf/biz/controller/CommonController.java
+17
-2
CommonServiceImpl.java
.../boot/module/hygf/biz/service/impl/CommonServiceImpl.java
+960
-93
SurveyInformationServiceImpl.java
...e/hygf/biz/service/impl/SurveyInformationServiceImpl.java
+32
-32
application.properties
...module-hygf-biz/src/main/resources/application.properties
+3
-2
informationTemp.xlsx
...ygf-biz/src/main/resources/templates/informationTemp.xlsx
+0
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/Enum/CommonEnum.java
0 → 100644
View file @
e682790d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
@Getter
@AllArgsConstructor
public
enum
CommonEnum
{
居民
(
"居民"
,
"jm"
,
"业主类型"
),
非居民
(
"非居民"
,
"fjm"
,
"业主类型"
),
自建资产
(
"自建资产"
,
"zx"
,
"电站类型"
),
经销商代建
(
"经销商代建"
,
"fzx"
,
"电站类型"
),
平顶屋
(
"平顶屋"
,
"pdw"
,
"屋顶类型"
),
斜顶屋
(
"斜顶屋"
,
"xdw"
,
"屋顶类型"
),
庭院
(
"ty"
,
"other"
,
"屋顶类型"
),
别墅
(
"别墅"
,
"bs"
,
"房屋整体情况"
),
普通民房
(
"普通民房"
,
"pymf"
,
"房屋整体情况"
),
单门独院
(
"单门独院"
,
"dmdy"
,
"房屋整体情况"
),
一栋多户
(
"一栋多户"
,
"yddh"
,
"房屋整体情况"
),
一户一表
(
"一户一表"
,
"yhyb"
,
"电表位置"
),
集中电表
(
"集中电表"
,
"jzdb"
,
"电表位置"
),
南偏东
(
"南偏东"
,
"npd"
,
"房屋偏向"
),
南偏西
(
"南偏西"
,
"npx"
,
"房屋偏向"
),
正南
(
"正南"
,
"zn"
,
"房屋偏向"
),
移除遮挡物
(
"移除遮挡物"
,
"yczdw"
,
"解决措施"
),
设计规避
(
"设计规避"
,
"sjgb"
,
"解决措施"
),
公共共有
(
"公共共有"
,
"gy"
,
"房屋产权情况"
),
按份共有
(
"按份共有"
,
"br"
,
"房屋产权情况"
),
单独所有
(
"单独所有"
,
"dy"
,
"房屋产权情况"
),
高树
(
"高树"
,
"gs"
,
"周边障碍物"
),
建筑物
(
"建筑物"
,
"jzw"
,
"周边障碍物"
),
电线杆
(
"电线杆"
,
"dxg"
,
"周边障碍物"
),
带电线路
(
"带电线路"
,
"ddxl"
,
"周边障碍物"
),
变压器
(
"变压器"
,
"byq"
,
"周边障碍物"
),
阳台
(
"阳台"
,
"yt"
,
"上至屋顶通道"
),
孔洞
(
"孔洞"
,
"kd"
,
"上至屋顶通道"
),
楼梯间
(
"楼梯间"
,
"ltj"
,
"上至屋顶通道"
),
女儿墙
(
"女儿墙"
,
"nrq"
,
"屋面遮挡物"
),
热水器
(
"热水器"
,
"rsq"
,
"屋面遮挡物"
),
烟囱
(
"烟囱"
,
"yc"
,
"屋面遮挡物"
),
老虎窗
(
"老虎窗"
,
"lhc"
,
"屋面遮挡物"
),
水箱
(
"水箱"
,
"sx"
,
"屋面遮挡物"
),
无
(
"无"
,
"wu"
,
"屋面遮挡物"
),
无需防滑雪措施
(
"无需防滑雪措施"
,
"wxfhxcs"
,
"防滑雪措施"
),
预留防滑雪缓冲通道
(
"预留防滑雪缓冲通道"
,
"ylfhxhctd"
,
"防滑雪措施"
),
安装挡雪夹具
(
"安装挡雪夹具"
,
"azdxjj"
,
"防滑雪措施"
),
自然人
(
"自然人"
,
"zrr"
,
"商务类型"
),
非自然人
(
"非自然人"
,
"fzrr"
,
"商务类型"
),
宅基地农户屋顶
(
"宅基地农户屋顶"
,
"zjdnhw"
,
"法务类型"
),
法人私有的宅基地建筑屋顶
(
"法人私有的宅基地建筑屋顶"
,
"frsydzjd"
,
"法务类型"
),
其他
(
"其他"
,
"other"
,
"公用"
);
/**
* 名称,描述
*/
private
String
name
;
/**
* 编码
*/
private
String
code
;
/**
* 编码
*/
private
String
type
;
public
static
String
getNameByCode
(
String
code
)
{
String
name
=
null
;
for
(
CommonEnum
obj:
CommonEnum
.
values
())
{
if
(
obj
.
getCode
().
equals
(
code
))
{
name
=
obj
.
getName
();
break
;
}
}
return
StringUtils
.
isEmpty
(
name
)?
code:
name
;
}
public
static
String
getNameByCodeList
(
List
<
String
>
codes
)
{
String
name
=
null
;
for
(
String
code
:
codes
)
{
for
(
CommonEnum
obj:
CommonEnum
.
values
())
{
if
(
obj
.
getCode
().
equals
(
code
))
{
name
=
name
==
null
?
obj
.
getName
():
name
+
","
+
obj
.
getName
()
;
}
}
}
return
StringUtils
.
isEmpty
(
name
)?
String
.
valueOf
(
codes
)
:
name
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/BasicGridAuditingMapper.java
View file @
e682790d
...
...
@@ -10,5 +10,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2024-08-21
*/
public
interface
BasicGridAuditingMapper
extends
BaseMapper
<
BasicGridAuditing
>
{
String
getInstanceIdByhouseId
(
String
peasantHouseholdId
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/FinancingAuditingMapper.java
View file @
e682790d
...
...
@@ -11,5 +11,5 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.FinancingAuditing;
* @date 2024-04-01
*/
public
interface
FinancingAuditingMapper
extends
BaseMapper
<
FinancingAuditing
>
{
String
getInstanceIdByhouseId
(
String
peasantHouseholdId
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/HygfWorkOrderStationAuditingMapper.java
View file @
e682790d
...
...
@@ -10,5 +10,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2024-08-08
*/
public
interface
HygfWorkOrderStationAuditingMapper
extends
BaseMapper
<
HygfWorkOrderStationAuditing
>
{
String
getInstanceIdByhouseId
(
String
peasantHouseholdId
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/PowerStationMapper.java
View file @
e682790d
...
...
@@ -22,4 +22,6 @@ public interface PowerStationMapper extends BaseMapper<PowerStation> {
@Param
(
"ownersName"
)
String
ownersName
,
@Param
(
"serviceAgent"
)
String
serviceAgent
,
@Param
(
"regionalCompaniesName"
)
String
regionalCompaniesName
,
@Param
(
"processStatus"
)
String
processStatus
,
@Param
(
"province"
)
String
province
);
String
getInstanceIdByhouseId
(
String
peasantHouseholdId
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/BasicGridAuditingMapper.xml
View file @
e682790d
...
...
@@ -2,4 +2,9 @@
<!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.hygf.api.mapper.BasicGridAuditingMapper"
>
<select
id=
"getInstanceIdByhouseId"
resultType=
"java.lang.String"
>
select instance_id From hygf_basic_grid_auditing where peasant_household_id = #{peasantHouseholdId} Limit 1
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/FinancingAuditingMapper.xml
View file @
e682790d
<?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.hygf.api.mapper.FinancingAuditingMapper"
>
<select
id=
"getInstanceIdByhouseId"
resultType=
"java.lang.String"
>
select instance_id From hygf_financing_auditing where peasant_household_id = #{peasantHouseholdId} Limit 1
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/HygfWorkOrderStationAuditingMapper.xml
View file @
e682790d
...
...
@@ -2,4 +2,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.hygf.api.mapper.HygfWorkOrderStationAuditingMapper"
>
<select
id=
"getInstanceIdByhouseId"
resultType=
"java.lang.String"
>
select instance_id From hygf_work_order_station_auditing where power_station_id = #{peasantHouseholdId} Limit 1
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/PowerStationMapper.xml
View file @
e682790d
...
...
@@ -39,4 +39,7 @@
<!-- GROUP BY hygf_peasant_household.sequence_nbr-->
ORDER BY hygf_power_station.rec_date desc
</select>
<select
id=
"getInstanceIdByhouseId"
resultType=
"java.lang.String"
>
select process_instance_id From hygf_power_station where peasant_household_id = #{peasantHouseholdId}
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/CommonController.java
View file @
e682790d
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.google.common.net.HttpHeaders
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.CommerceInfoDto
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.FinancingInfoServiceImpl
;
...
...
@@ -48,12 +49,26 @@ public class CommonController {
@RequestParam
(
required
=
false
)
String
peasantHouseholdId
,
@RequestParam
(
required
=
false
)
String
processInstanceId
)
throws
IOException
{
commonService
.
downZiliao
(
surveyInformationId
,
peasantHouseholdId
,
processInstanceId
);
// 设置响应头
response
.
setContentType
(
"application/zip"
);
commonService
.
downZiliao
(
surveyInformationId
,
peasantHouseholdId
,
processInstanceId
,
response
);
}
/**
* 设备信息下载
*
* @return
*/
@GetMapping
(
value
=
"/getSchedule"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"资料下载进度获取"
,
notes
=
"资料下载进度获取"
)
public
Object
getSchedule
(
String
peasantHouseholdId
)
{
return
commonService
.
getSchedule
(
peasantHouseholdId
);
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/CommonServiceImpl.java
View file @
e682790d
...
...
@@ -2,56 +2,66 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
cn.hutool.core.map.MapBuilder
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.google.common.reflect.TypeToken
;
import
com.google.gson.Gson
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.google.common.net.HttpHeaders
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.FlowKeyTodoEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto
;
import
com.yeejoin.amos.boot.module.hygf.api.util.JsonUtils
;
import
com.yeejoin.amos.boot.module.hygf.biz.feign.TaskV2FeignService
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.CommonEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.*
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.*
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAuditingMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.FinancingAuditingMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.HygfWorkOrderStationAuditingMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper
;
import
com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.util.MapHelper
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.reflect.FieldUtils
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.XSSFClientAnchor
;
import
org.apache.poi.xssf.usermodel.XSSFDrawing
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Type
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.net.URL
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
...
...
@@ -77,12 +87,23 @@ public class CommonServiceImpl {
RedisUtils
redisUtil
;
@Autowired
private
AmosRequestContext
amosRequestContext
;
private
static
final
String
BASE_INFO_FOLDER
=
"基本信息"
;
private
static
final
String
ZIP_FILE_PATH
=
"基本信息.zip"
;
@Value
(
"${urlHttp}"
)
private
String
urlPath
;
@Autowired
WorkflowFeignClient
workflowFeignClient
;
@Autowired
PowerStationMapper
powerStationMapper
;
@Autowired
HygfWorkOrderStationAuditingMapper
workOrderStationAuditingMapper
;
@Autowired
BasicGridAuditingMapper
basicGridAuditingMapper
;
@Autowired
FinancingAuditingMapper
financingAuditingMapper
;
private
static
final
String
TEMP_DIR_NAME
=
"temp"
;
private
static
final
String
TEMPLATE_FILE_PATH
=
"
F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\test
.xlsx"
;
// 模版文件路径
private
static
final
String
TEMPLATE_FILE_PATH
=
"
templates/informationTemp
.xlsx"
;
// 模版文件路径
private
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
private
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
// 创建固定大小的线程池
// private static String toQueryParams2(JSONObject jsonObject) {
// StringBuilder sb = new StringBuilder();
// Set<String> keys = jsonObject.keySet();
...
...
@@ -459,15 +480,55 @@ public class CommonServiceImpl {
return
jsonArray
;
}
public
void
downZiliao
(
String
surveyInformationId
,
String
peasantHouseholdId
,
String
processInstanceId
)
throws
IOException
{
public
void
downZiliao
(
String
surveyInformationId
,
String
peasantHouseholdId
,
String
processInstanceId
,
HttpServletResponse
response
)
throws
IOException
{
SurveyInfoAllDto
returnDto
=
surveyInformationServiceImpl
.
querySurveyInfo
(
surveyInformationId
,
peasantHouseholdId
,
processInstanceId
,
null
);
int
current
=
0
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
current
).
build
());
String
powerStationInstanceId
=
powerStationMapper
.
getInstanceIdByhouseId
(
peasantHouseholdId
);
String
workOrderStationInstanceId
=
workOrderStationAuditingMapper
.
getInstanceIdByhouseId
(
peasantHouseholdId
);
String
basicGridInstanceId
=
basicGridAuditingMapper
.
getInstanceIdByhouseId
(
peasantHouseholdId
);
String
financingInstanceId
=
financingAuditingMapper
.
getInstanceIdByhouseId
(
peasantHouseholdId
);
List
<
LinkedHashMap
>
powerStationWorkLog
=
new
ArrayList
<>();
List
<
LinkedHashMap
>
workOrderStationWorkLog
=
new
ArrayList
<>();
List
<
LinkedHashMap
>
basicGridWorkLog
=
new
ArrayList
<>();
List
<
LinkedHashMap
>
financingWorkLog
=
new
ArrayList
<>();
List
<
LinkedHashMap
>
accptWorkLog
=
new
ArrayList
<>();
try
{
powerStationWorkLog
=
this
.
getWorkLog
(
powerStationInstanceId
);
workOrderStationWorkLog
=
this
.
getWorkLog
(
workOrderStationInstanceId
);
basicGridWorkLog
=
this
.
getWorkLog
(
basicGridInstanceId
);
financingWorkLog
=
this
.
getWorkLog
(
financingInstanceId
);
accptWorkLog
=
this
.
getWorkLog
(
returnDto
.
getAcceptanceCheck
().
getInstanceId
());
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
String
templatePath
=
"F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\test.xlsx"
;
String
outputPath
=
returnDto
.
getSurveyInformation
().
getOwnersName
()+
".xlsx"
;
Path
templateDir
=
Paths
.
get
(
TEMPLATE_FILE_PATH
).
getParent
();
System
.
out
.
println
(
"模版文件所在目录是: "
+
templateDir
);
Path
currentWorkingDir
=
Paths
.
get
(
""
);
// 获取当前工作目录
Path
rootDir
=
currentWorkingDir
;
Path
tempDir
=
rootDir
.
resolve
(
returnDto
.
getSurveyInformation
().
getOwnersName
());
try
{
Files
.
createDirectories
(
tempDir
);
// 创建临时目录
System
.
out
.
println
(
"Temporary directory created at: "
+
tempDir
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
;
}
String
templatePath
=
"templates/informationTemp.xlsx"
;
//String templatePath = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\informationTemp.xlsx";
// String outputPath = "F:\\work\\amos-boot-zx-biz\\amos-boot-system-jxiop\\amos-boot-module-hygf-biz\\src\\main\\resources\\templates\\temp\\"+returnDto.getSurveyInformation().getOwnersName()+".xlsx";
String
outputPath
=
returnDto
.
getSurveyInformation
().
getOwnersName
()+
"/"
+
returnDto
.
getSurveyInformation
().
getOwnersName
()+
".xlsx"
;
Workbook
workbook
=
null
;
try
(
FileInputStream
fis
=
new
FileInputStream
(
templatePath
))
{
try
(
InputStream
fis
=
new
ClassPathResource
(
templatePath
).
getInputStream
())
{
workbook
=
new
XSSFWorkbook
(
fis
);
Sheet
firstSheet
=
workbook
.
getSheetAt
(
0
);
...
...
@@ -476,6 +537,47 @@ public class CommonServiceImpl {
Sheet
secondSheet
=
workbook
.
getSheetAt
(
1
);
fillSheet
(
secondSheet
,
returnDto
.
getSurveyDetails
());
Sheet
secondSheet2
=
workbook
.
getSheetAt
(
2
);
fillSheet
(
secondSheet2
,
returnDto
.
getDesignInformation
());
Sheet
secondSheet3
=
workbook
.
getSheetAt
(
3
);
fillSheet
(
secondSheet3
,
returnDto
.
getCommercial
());
Sheet
secondSheet4
=
workbook
.
getSheetAt
(
4
);
fillSheet
(
secondSheet4
,
returnDto
.
getExtendedInformation
());
Sheet
secondSheet5
=
workbook
.
getSheetAt
(
5
);
fillSheet
(
secondSheet5
,
returnDto
.
getInformation
());
Sheet
secondSheet6
=
workbook
.
getSheetAt
(
6
);
fillSheet
(
secondSheet6
,
returnDto
.
getPowerStationEngineeringInfo
());
Sheet
secondSheet10
=
workbook
.
getSheetAt
(
7
);
fillSheet
(
secondSheet10
,
returnDto
.
getPowerStationConstructionData
());
Sheet
secondSheet7
=
workbook
.
getSheetAt
(
8
);
fillSheet
(
secondSheet7
,
returnDto
.
getHygfOnGrid
());
Sheet
secondSheet8
=
workbook
.
getSheetAt
(
9
);
fillSheet
(
secondSheet8
,
returnDto
.
getWorkOrder
());
Sheet
secondSheet9
=
workbook
.
getSheetAt
(
10
);
fillSheet
(
secondSheet9
,
returnDto
.
getAcceptanceCheck
());
Sheet
secondSheet11
=
workbook
.
getSheetAt
(
11
);
fillSheet
(
secondSheet11
,
powerStationWorkLog
);
Sheet
secondSheet12
=
workbook
.
getSheetAt
(
12
);
fillSheet
(
secondSheet12
,
workOrderStationWorkLog
);
Sheet
secondSheet13
=
workbook
.
getSheetAt
(
13
);
fillSheet
(
secondSheet13
,
basicGridWorkLog
);
Sheet
secondSheet14
=
workbook
.
getSheetAt
(
14
);
fillSheet
(
secondSheet14
,
accptWorkLog
);
Sheet
secondSheet15
=
workbook
.
getSheetAt
(
15
);
fillSheet
(
secondSheet15
,
financingWorkLog
);
// 写入到新的Excel文件中
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
outputPath
))
{
workbook
.
write
(
fos
);
...
...
@@ -483,9 +585,171 @@ public class CommonServiceImpl {
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
List
<
String
>
urls
=
extractUrls
(
returnDto
.
getSurveyInformation
());
downloadAndZipImages
(
returnDto
.
getSurveyInformation
());
current
=
current
+
15
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
current
).
build
());
List
<
HygfRectificationOrder
>
areaOrdersCon
=
Optional
.
ofNullable
(
returnDto
.
getPowerStationConstructionData
().
getAreaOrders
())
.
orElse
(
new
ArrayList
<>());
addNonNullList
(
areaOrdersCon
,
returnDto
.
getPowerStationConstructionData
().
getDesignOrders
());
addNonNullList
(
areaOrdersCon
,
returnDto
.
getPowerStationConstructionData
().
getEngineeringOrders
());
// 主方法或代码块
List
<
HygfRectificationOrder
>
areaOrders
=
Optional
.
ofNullable
(
returnDto
.
getHygfOnGrid
().
getAreaOrders
())
.
orElse
(
new
ArrayList
<>());
addNonNullList
(
areaOrders
,
returnDto
.
getHygfOnGrid
().
getDesignOrders
());
addNonNullList
(
areaOrders
,
returnDto
.
getHygfOnGrid
().
getEngineeringOrders
());
List
<
HygfRectificationOrder
>
areaOrdersAcc
=
Optional
.
ofNullable
(
returnDto
.
getAcceptanceCheck
().
getAreaOrders
())
.
orElse
(
new
ArrayList
<>());
addNonNullList
(
areaOrders
,
returnDto
.
getAcceptanceCheck
().
getLegalOrders
());
addNonNullList
(
areaOrders
,
returnDto
.
getAcceptanceCheck
().
getFinanceOrders
());
addNonNullList
(
areaOrders
,
returnDto
.
getAcceptanceCheck
().
getPropertyOrders
());
List
<
Future
<?>>
futures
=
new
ArrayList
<>();
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getSurveyInformation
(),
"基本信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getSurveyDetails
(),
"勘察信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getDesignInformation
(),
"设计信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getCommercial
(),
"商务信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getInformation
(),
"资料归档附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getPowerStationConstructionData
(),
"施工信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
areaOrdersCon
,
"施工信息整改单附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getHygfOnGrid
(),
"并网信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
areaOrders
,
"并网信息整改单附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
returnDto
.
getWorkOrder
(),
"派工单信息附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
futures
.
add
(
executorService
.
submit
(()
->
{
try
{
downloadAndZipImages
(
areaOrdersAcc
,
"验收信息整改单附件"
,
tempDir
,
urlPath
);
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
currentNum
=
(
Integer
)
map
.
get
(
"value"
)+
7
;
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
currentNum
).
build
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}));
// 等待所有任务完成
for
(
Future
<?>
future
:
futures
)
{
try
{
future
.
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
Throwable
cause
=
e
.
getCause
();
if
(
cause
instanceof
IOException
)
{
((
IOException
)
cause
).
printStackTrace
();
// 可以在这里记录日志或者采取其他补救措施
}
else
{
e
.
printStackTrace
();
}
// 根据具体情况,可以在这里选择终止程序或进行其他处理
return
;
}
}
redisUtils
.
set
(
peasantHouseholdId
,
MapBuilder
.<
String
,
Object
>
create
()
.
put
(
"value"
,
100
).
build
());
// response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename="+returnDto.getSurveyInformation().getOwnersName()+".zip");
String
encodedFilename
=
URLEncoder
.
encode
(
returnDto
.
getSurveyInformation
().
getOwnersName
()
+
".zip"
,
StandardCharsets
.
UTF_8
.
name
());
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename*=UTF-8''"
+
encodedFilename
);
createZipFile
(
tempDir
,
returnDto
.
getSurveyInformation
().
getOwnersName
(),
response
);
cleanup
(
tempDir
);
}
...
...
@@ -505,6 +769,339 @@ public class CommonServiceImpl {
}
}
}
// 添加对设计信息页面的特殊处理
if
(
"设计信息"
.
equals
(
sheet
.
getSheetName
()))
{
DesignInformationDto
designInformation
=
(
DesignInformationDto
)
data
;
int
startRowNum
=
5
;
if
(
null
!=
designInformation
.
getAssembly
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"组件"
;
String
[]
headersNames
=
{
"物联编码"
,
"物料名称"
,
"电池片规格"
,
"功率"
,
"类型"
,
"边框"
,
"总功率"
,
"单/双面"
,
"配置数量"
,
"金额"
};
String
[]
headers
=
{
"wlbm"
,
"wlmc"
,
"dcpgg"
,
"gl"
,
"lx"
,
"bk"
,
"zgl"
,
"dsm"
,
"pzsl"
,
"price"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
designInformation
.
getAssembly
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
designInformation
.
getInverter
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"逆变器"
;
String
[]
headersNames
=
{
"物联编码"
,
"物料名称"
,
"功率"
,
"系列"
,
"相位"
,
"配置数量"
,
"金额"
};
String
[]
headers
=
{
"wlbm"
,
"wlmc"
,
"gl"
,
"xl"
,
"xw"
,
"pzsl"
,
"price"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
designInformation
.
getInverter
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
designInformation
.
getElectricityMeter
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"并网箱"
;
String
[]
headersNames
=
{
"物联编码"
,
"物料名称"
,
"材质"
,
"功率"
,
"类型"
,
"功能"
,
"相位"
,
"上网模式"
,
"配置数量"
,
"金额"
};
String
[]
headers
=
{
"wlbm"
,
"wlmc"
,
"cz"
,
"gl"
,
"lx"
,
"gn"
,
"xw"
,
"swms"
,
"pzsl"
,
"price"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
designInformation
.
getElectricityMeter
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
designInformation
.
getCable
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"电缆"
;
String
[]
headersNames
=
{
"物联编码"
,
"物料名称"
,
"型号"
,
"规格"
,
"配置数量"
};
String
[]
headers
=
{
"wlbm"
,
"wlmc"
,
"xh"
,
"gg"
,
"pzsl"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
designInformation
.
getCable
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
}
// 添加对设计信息页面的特殊处理
if
(
"工程信息"
.
equals
(
sheet
.
getSheetName
()))
{
PowerStationEngineeringInfo
powerStationEngineeringInfo
=
(
PowerStationEngineeringInfo
)
data
;
int
startRowNum
=
3
;
if
(
null
!=
powerStationEngineeringInfo
.
getConstructionComponentInfo
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"组件序列号"
;
String
[]
headersNames
=
{
"序列号"
,
"功率"
,
"物联编码"
,
"物料名称"
,
"电池片规格"
,
"类型"
,
"边框"
,
"单/双面"
};
String
[]
headers
=
{
"xlh"
,
"gl"
,
"wlbm"
,
"wlmc"
,
"dcpgg"
,
"lx"
,
"bk"
,
"dsm"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
powerStationEngineeringInfo
.
getConstructionComponentInfo
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
powerStationEngineeringInfo
.
getConstructionInverterInfo
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"逆变器序列号"
;
String
[]
headersNames
=
{
"序列号"
,
"验证码"
,
"功率"
,
"物联编码"
,
"物料名称"
,
"系列"
,
"相位"
};
String
[]
headers
=
{
"xlh"
,
"yzm"
,
"gl"
,
"wlbm"
,
"wlmc"
,
"xl"
,
"xw"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
powerStationEngineeringInfo
.
getConstructionInverterInfo
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
powerStationEngineeringInfo
.
getConstructionGridBoxInfo
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"并网箱序列号"
;
String
[]
headersNames
=
{
"序列号"
,
"功率"
,
"物联编码"
,
"物料名称"
,
"材质"
,
"类型"
,
"功能"
,
"相位"
,
"上网模式"
};
String
[]
headers
=
{
"xlh"
,
"gl"
,
"wlbm"
,
"wlmc"
,
"cz"
,
"lx"
,
"gn"
,
"xw"
,
"swms"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
powerStationEngineeringInfo
.
getConstructionGridBoxInfo
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
powerStationEngineeringInfo
.
getConstructionCollectorBoxInfo
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
2
;
// 假设表头内容如下:
String
headerOne
=
"采集器序列号"
;
String
[]
headersNames
=
{
"序列号"
};
String
[]
headers
=
{
"xlh"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
powerStationEngineeringInfo
.
getConstructionCollectorBoxInfo
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
}
// 添加对设计信息页面的特殊处理
if
(
"扩展信息"
.
equals
(
sheet
.
getSheetName
()))
{
ExtendedInformationDto
extendedInformationDto
=
(
ExtendedInformationDto
)
data
;
int
startRowNum
=
3
;
if
(
null
!=
extendedInformationDto
.
getContacts
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"联系人"
;
String
[]
headersNames
=
{
"姓名"
,
"关系"
,
"联系电话"
,
"电子邮箱"
,
"QQ"
,
"微信"
};
String
[]
headers
=
{
"userName"
,
"relation"
,
"telephone"
,
"mailbox"
,
"dcpgg"
,
"qq"
,
"wechat"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertList
(
extendedInformationDto
.
getContacts
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
}
if
(
"施工信息"
.
equals
(
sheet
.
getSheetName
()))
{
PowerStationConstructionData
powerStationConstructionData
=
(
PowerStationConstructionData
)
data
;
int
startRowNum
=
3
;
if
(
null
!=
powerStationConstructionData
.
getAreaOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"片区运营整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
powerStationConstructionData
.
getAreaOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
powerStationConstructionData
.
getEngineeringOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"工程整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
powerStationConstructionData
.
getEngineeringOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
powerStationConstructionData
.
getDesignOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"设计整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
powerStationConstructionData
.
getDesignOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
}
// 添加对设计信息页面的特殊处理
if
(
"并网信息"
.
equals
(
sheet
.
getSheetName
()))
{
HygfOnGrid
hygfOnGrid
=
(
HygfOnGrid
)
data
;
int
startRowNum
=
3
;
if
(
null
!=
hygfOnGrid
.
getAreaOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"片区运营整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
hygfOnGrid
.
getAreaOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
hygfOnGrid
.
getEngineeringOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"工程整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
hygfOnGrid
.
getEngineeringOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
hygfOnGrid
.
getDesignOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"设计整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
hygfOnGrid
.
getDesignOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
}
if
(
"验收信息"
.
equals
(
sheet
.
getSheetName
()))
{
AcceptanceCheck
acceptanceCheck
=
(
AcceptanceCheck
)
data
;
int
startRowNum
=
3
;
if
(
null
!=
acceptanceCheck
.
getAreaOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"片区运营整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
acceptanceCheck
.
getAreaOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
acceptanceCheck
.
getFinanceOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"投融整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
acceptanceCheck
.
getFinanceOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
acceptanceCheck
.
getLegalOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"法务整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
acceptanceCheck
.
getLegalOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
if
(
null
!=
acceptanceCheck
.
getPropertyOrders
()){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"资产整改单"
;
String
[]
headersNames
=
{
"整改信息"
,
"整改结果"
,
"审核结果"
,
"审核意见"
,
"历史审核意见"
};
String
[]
headers
=
{
"rectificationIdeas"
,
"rectificationResultWeb"
,
"auditResult"
,
"auditIdea"
,
"rectificationHistoryWeb"
};
List
<
Map
<
String
,
Object
>>
maps
=
convertListToMap
(
acceptanceCheck
.
getPropertyOrders
());
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
maps
);
}
}
if
(
sheet
.
getSheetName
().
contains
(
"审核记录"
))
{
int
startRowNum
=
1
;
if
(
null
!=
data
){
int
headerRow
=
startRowNum
+
1
;
// 表头所在的行
int
headerOneRow
=
startRowNum
;
// 表头所在的行
int
dataStartRow
=
startRowNum
+
2
;
// 数据开始的行
startRowNum
=
dataStartRow
+
1
;
// 假设表头内容如下:
String
headerOne
=
"审核日志"
;
String
[]
headersNames
=
{
"审核节点"
,
"审核人"
,
"审核时间"
,
"审核状态"
,
"审核意见"
};
String
[]
headers
=
{
"taskName"
,
"operator"
,
"operateDate"
,
"approvalStatue"
,
"approvalSuggestion"
};
documentSpecialProcessing
(
sheet
,
headerRow
,
headerOneRow
,
dataStartRow
,
headersNames
,
headers
,
headerOne
,
(
List
<
Map
<
String
,
Object
>>)
data
);
}
}
}
private
String
removePlaceholders
(
String
fieldValue
)
{
...
...
@@ -540,7 +1137,14 @@ public class CommonServiceImpl {
field
.
setAccessible
(
true
);
// 设置为可访问私有字段
Object
value
=
field
.
get
(
data
);
if
(
value
!=
null
)
{
cell
.
setCellValue
(
value
.
toString
());
if
(
value
instanceof
List
){
cell
.
setCellValue
(
CommonEnum
.
getNameByCodeList
((
List
<
String
>)
value
));
}
else
if
(
value
instanceof
Date
){
String
s
=
DateUtils
.
date2LongStr
((
Date
)
value
);
cell
.
setCellValue
(
s
);
}
else
{
cell
.
setCellValue
(
CommonEnum
.
getNameByCode
(
value
.
toString
()));
}
}
else
{
cell
.
setCellValue
(
""
);
}
...
...
@@ -550,23 +1154,8 @@ public class CommonServiceImpl {
}
}
public
static
void
downloadAndZipImages
(
SurveyInformationDto
surveyInfo
)
throws
IOException
{
Path
templateDir
=
Paths
.
get
(
TEMPLATE_FILE_PATH
).
getParent
();
System
.
out
.
println
(
"模版文件所在目录是: "
+
templateDir
);
Path
tempDir
=
templateDir
.
resolve
(
TEMP_DIR_NAME
);
try
{
Files
.
createDirectories
(
tempDir
);
// 创建临时目录
System
.
out
.
println
(
"Temporary directory created at: "
+
tempDir
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
;
}
Path
baseInfoPath
=
tempDir
.
resolve
(
BASE_INFO_FOLDER
);
public
static
void
downloadAndZipImages
(
Object
obj
,
String
fileName
,
Path
tempDir
,
String
urlPath
)
throws
IOException
{
Path
baseInfoPath
=
tempDir
.
resolve
(
fileName
);
try
{
Files
.
createDirectories
(
baseInfoPath
);
System
.
out
.
println
(
"Base info directory created at: "
+
baseInfoPath
);
...
...
@@ -574,22 +1163,19 @@ public class CommonServiceImpl {
e
.
printStackTrace
();
return
;
}
List
<
Field
>
listFields
=
getAllListFields
(
surveyInfo
.
getClass
());
List
<
Field
>
listFields
=
getAllListFields
(
obj
.
getClass
());
for
(
Field
field
:
listFields
)
{
try
{
@SuppressWarnings
(
"unchecked"
)
List
<
Object
>
list
=
(
List
<
Object
>)
FieldUtils
.
readField
(
field
,
surveyInfo
,
true
);
// 读取字段值
for
(
Object
item
:
list
)
{
if
(
item
instanceof
Map
)
{
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
item
;
if
(
map
.
containsKey
(
"url"
)
&&
map
.
get
(
"url"
)
instanceof
String
)
{
String
imageUrl
=
"http://47.92.234.253:8088"
+(
String
)
map
.
get
(
"url"
);
downloadAndSaveImage
(
imageUrl
,
baseInfoPath
);
List
<
Object
>
list
=
(
List
<
Object
>)
FieldUtils
.
readField
(
field
,
obj
,
true
);
// 读取字段值
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
for
(
Object
item
:
list
)
{
if
(
item
instanceof
Map
)
{
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
item
;
if
(
map
.
containsKey
(
"url"
)
&&
map
.
get
(
"url"
)
instanceof
String
)
{
String
imageUrl
=
urlPath
+(
String
)
map
.
get
(
"url"
);
downloadAndSaveImage
(
imageUrl
,
baseInfoPath
);
}
}
}
}
...
...
@@ -597,12 +1183,6 @@ public class CommonServiceImpl {
e
.
printStackTrace
();
}
}
createZipFile
(
baseInfoPath
,
ZIP_FILE_PATH
);
cleanup
(
tempDir
);
}
...
...
@@ -617,39 +1197,71 @@ public class CommonServiceImpl {
}
private
static
void
createZipFile
(
Path
folderPath
,
String
zipFilePath
)
{
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
zipFilePath
);
ZipOutputStream
zos
=
new
ZipOutputStream
(
fos
))
{
private
static
void
createZipFile
(
Path
folderPath
,
String
zipFilePath
,
HttpServletResponse
response
)
{
try
(
ServletOutputStream
out
=
response
.
getOutputStream
(
);
ZipOutputStream
zos
=
new
ZipOutputStream
(
out
))
{
addFolderToZip
(
""
,
folderPath
,
zos
);
addFolderToZip
(
zipFilePath
,
folderPath
,
zos
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
private
static
void
addFilesToZip
(
File
sourceFile
,
ZipOutputStream
zipOut
,
String
baseFolder
)
throws
IOException
{
if
(
sourceFile
.
isDirectory
())
{
File
[]
files
=
sourceFile
.
listFiles
();
for
(
File
file
:
files
)
{
addFilesToZip
(
file
,
zipOut
,
baseFolder
);
}
}
else
{
FileInputStream
fin
=
new
FileInputStream
(
sourceFile
);
String
zipEntryName
=
sourceFile
.
getPath
().
substring
(
baseFolder
.
length
()
+
1
).
replace
(
"\\"
,
"/"
);
zipOut
.
putNextEntry
(
new
ZipEntry
(
zipEntryName
));
byte
[]
buffer
=
new
byte
[
1024
];
int
length
;
while
((
length
=
fin
.
read
(
buffer
))
>=
0
)
{
zipOut
.
write
(
buffer
,
0
,
length
);
}
zipOut
.
closeEntry
();
fin
.
close
();
}
}
private
static
void
addFolderToZip
(
String
relativePath
,
Path
folderPath
,
ZipOutputStream
zos
)
throws
IOException
{
if
(!
Files
.
exists
(
folderPath
))
{
return
;
}
try
{
// FileOutputStream fout = new FileOutputStream(relativePath);
File
folder
=
new
File
(
relativePath
);
addFilesToZip
(
folder
,
zos
,
folder
.
getName
());
Files
.
walk
(
folderPath
).
forEach
(
filePath
->
{
try
{
String
entryName
=
relativePath
+
folderPath
.
relativize
(
filePath
).
toString
();
ZipEntry
zipEntry
=
new
ZipEntry
(
entryName
);
zos
.
putNextEntry
(
zipEntry
);
try
(
FileInputStream
fis
=
new
FileInputStream
(
filePath
.
toFile
()))
{
IOUtils
.
copy
(
fis
,
zos
);
}
zos
.
close
();
// fout.close();
System
.
out
.
println
(
"ZIP file created successfully!"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
zos
.
closeEntry
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
});
// Files.walk(folderPath).forEach(filePath -> {
// try {
//
// String entryName = relativePath + folderPath.relativize(filePath).toString();
// ZipEntry zipEntry = new ZipEntry(entryName);
// zos.putNextEntry(zipEntry);
//
// try (FileInputStream fis = new FileInputStream(filePath.toFile())) {
// IOUtils.copy(fis, zos);
// }
//
// zos.closeEntry();
// } catch (IOException e) {
// e.printStackTrace();
// }
// });
}
...
...
@@ -722,8 +1334,263 @@ public class CommonServiceImpl {
return
fields
;
}
void
documentSpecialProcessing
(
Sheet
sheet
,
int
headerRow
,
int
headerOneRow
,
int
dataStartRow
,
String
[]
headersNames
,
String
[]
headers
,
String
headerOne
,
List
<
Map
<
String
,
Object
>>
data
){
// 创建表头样式
CellStyle
headerStyle
=
sheet
.
getWorkbook
().
createCellStyle
();
Font
headerFont
=
sheet
.
getWorkbook
().
createFont
();
headerFont
.
setBold
(
true
);
// 加粗字体
headerFont
.
setFontHeightInPoints
((
short
)
12
);
// 字体大小
headerStyle
.
setFillForegroundColor
(
IndexedColors
.
GREY_25_PERCENT
.
getIndex
());
headerStyle
.
setFillPattern
(
FillPatternType
.
SOLID_FOREGROUND
);
headerStyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
// 居中对齐
headerStyle
.
setFont
(
headerFont
);
// 设置字体样式
// 设置边框
headerStyle
.
setBorderTop
(
BorderStyle
.
THIN
);
headerStyle
.
setBorderBottom
(
BorderStyle
.
THIN
);
headerStyle
.
setBorderLeft
(
BorderStyle
.
THIN
);
headerStyle
.
setBorderRight
(
BorderStyle
.
THIN
);
// 写入表头
Row
headerRowObjectOne
=
sheet
.
getRow
(
headerOneRow
);
if
(
headerRowObjectOne
==
null
)
{
headerRowObjectOne
=
sheet
.
createRow
(
headerOneRow
);
Cell
cell
=
headerRowObjectOne
.
getCell
(
0
);
if
(
cell
==
null
)
{
cell
=
headerRowObjectOne
.
createCell
(
0
);
}
cell
.
setCellValue
(
headerOne
);
cell
.
setCellStyle
(
headerStyle
);
}
// 写入表头
Row
headerRowObject
=
sheet
.
getRow
(
headerRow
);
if
(
headerRowObject
==
null
)
{
headerRowObject
=
sheet
.
createRow
(
headerRow
);
}
for
(
int
i
=
0
;
i
<
headersNames
.
length
;
i
++)
{
Cell
headerCell
=
headerRowObject
.
getCell
(
i
);
if
(
headerCell
==
null
)
{
headerCell
=
headerRowObject
.
createCell
(
i
);
}
headerCell
.
setCellValue
(
headersNames
[
i
]);
headerCell
.
setCellStyle
(
headerStyle
);
}
// 从第四行开始填充数据
for
(
int
dataIndex
=
0
;
dataIndex
<
data
.
size
();
dataIndex
++)
{
Row
dataRow
=
sheet
.
createRow
(
dataStartRow
+
dataIndex
);
Map
<
String
,
Object
>
rowData
=
(
Map
<
String
,
Object
>)
data
.
get
(
dataIndex
).
get
(
"map"
);
for
(
int
i
=
0
;
i
<
headersNames
.
length
;
i
++)
{
Cell
dataCell
=
dataRow
.
createCell
(
i
);
if
(
rowData
.
containsKey
(
headers
[
i
]))
{
Object
value
=
rowData
.
get
(
headers
[
i
]);
if
(
value
instanceof
List
<?>)
{
List
<
String
>
urls
=
(
List
<
String
>)
value
;
if
(!
urls
.
isEmpty
())
{
try
{
XSSFDrawing
drawing
=
((
XSSFSheet
)
sheet
).
getDrawingPatriarch
();
if
(
drawing
==
null
)
{
drawing
=
((
XSSFSheet
)
sheet
).
createDrawingPatriarch
();
}
// 设置单元格为空
dataCell
.
setCellStyle
(
sheet
.
getWorkbook
().
createCellStyle
());
dataCell
.
setCellType
(
CellType
.
STRING
);
dataCell
.
setCellValue
(
""
);
// 计算第一个图片的位置
int
colWidth
=
0
;
int
rowHeight
=
0
;
int
pictureIdx
=
-
1
;
for
(
int
j
=
0
;
j
<
urls
.
size
();
j
++)
{
String
url
=
urls
.
get
(
j
);
InputStream
inputStream
=
new
URL
(
url
).
openStream
();
pictureIdx
=
((
XSSFWorkbook
)
sheet
.
getWorkbook
()).
addPicture
(
inputStream
,
XSSFWorkbook
.
PICTURE_TYPE_JPEG
);
// 输出调试信息
System
.
out
.
println
(
"Picture index: "
+
pictureIdx
);
// 创建图片对象
XSSFClientAnchor
anchor
=
new
XSSFClientAnchor
(
0
,
0
,
0
,
0
,
(
short
)
i
,
dataIndex
+
dataStartRow
,
(
short
)
(
i
+
colWidth
/
100
),
dataIndex
+
dataStartRow
+
rowHeight
/
100
);
Picture
pict
=
drawing
.
createPicture
(
anchor
,
pictureIdx
);
pict
.
resize
();
// 计算图片的宽度和高度
int
picWidth
=
100
;
// 图片宽度百分比
int
picHeight
=
100
;
// 图片高度百分比
colWidth
+=
picWidth
;
rowHeight
+=
picHeight
;
}
// 检查是否需要合并单元格
if
(
colWidth
>
100
)
{
// 合并单元格
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
dataIndex
+
dataStartRow
,
dataIndex
+
dataStartRow
,
i
,
i
+
(
colWidth
/
100
)
-
1
));
}
// 调整单元格的宽度和高度
sheet
.
setColumnWidth
(
i
,
(
colWidth
*
256
)
/
100
);
dataRow
.
setHeightInPoints
(
rowHeight
);
}
catch
(
Exception
e
)
{
// 处理异常情况
System
.
err
.
println
(
"Failed to download or insert images: "
+
value
);
e
.
printStackTrace
();
}
}
else
{
dataCell
.
setCellValue
(
""
);
// 假设所有数据都是字符串格式
}
}
else
{
dataCell
.
setCellValue
(
null
==
value
?
""
:
value
.
toString
());
// 假设所有数据都是字符串格式
}
}
else
{
dataCell
.
setCellValue
(
""
);
// 假设所有数据都是字符串格式
}
}
}
//原始方法
// for (int dataIndex = 0; dataIndex < data.size(); dataIndex++) {
// Row dataRow = sheet.createRow(dataStartRow + dataIndex);
// Map<String, Object> rowData = (Map<String, Object>) data.get(dataIndex).get("map");
// for (int i = 0; i < headersNames.length; i++) {
// Cell dataCell = dataRow.createCell(i);
// if (rowData.containsKey(headers[i])){
// dataCell.setCellValue(rowData.get(headers[i]).toString()); // 假设所有数据都是字符串格式
// }else {
// dataCell.setCellValue(""); // 假设所有数据都是字符串格式
//
// }
// }
// }
}
public
static
List
<
Map
<
String
,
Object
>>
convertList
(
List
<
Object
>
objectList
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
for
(
Object
obj
:
objectList
)
{
if
(
obj
!=
null
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Field
[]
fields
=
obj
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
field
.
setAccessible
(
true
);
// 允许访问私有字段(如果需要)
try
{
map
.
put
(
field
.
getName
(),
field
.
get
(
obj
));
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
// 可以选择记录日志或抛出异常
}
}
result
.
add
(
map
);
}
}
}
\ No newline at end of file
return
result
;
}
List
<
Map
<
String
,
Object
>>
convertListToMap
(
List
<?>
objects
){
List
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
for
(
Object
object
:
objects
)
{
Map
<
String
,
Object
>
map
=
BeanUtil
.
beanToMap
(
object
);
// if (map.containsKey("rectificationFile")){
// List<String> urls = new ArrayList<>();
//
// List<Map<String, String>> rectificationFile = (List<Map<String, String>>) map.get("rectificationFile");
// for (Map<String, String> stringStringMap : rectificationFile) {
// urls.add(stringStringMap.get("url"));
// }
// map.put("rectificationFileUrls",urls);
// }
// if (map.containsKey("resultFile")){
// List<String> urls = new ArrayList<>();
// List<Map<String, String>> resultFile = (List<Map<String, String>>) map.get("resultFile");
// for (Map<String, String> stringStringMap : resultFile) {
// urls.add(stringStringMap.get("url"));
// }
// map.put("resultFileUrls",urls);
// }
if
(
map
.
containsKey
(
"rectificationIdea"
)){
List
<
String
>
urls
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
rectificationIdeas
=
(
List
<
Map
<
String
,
Object
>>)
map
.
get
(
"rectificationIdea"
);
for
(
Map
<
String
,
Object
>
stringStringMap
:
rectificationIdeas
)
{
List
<
Map
<
String
,
String
>>
items
=
(
List
<
Map
<
String
,
String
>>)
stringStringMap
.
get
(
"items"
);
List
<
String
>
values
=
new
ArrayList
<>();
int
startNum
=
1
;
for
(
Map
<
String
,
String
>
item
:
items
)
{
values
.
add
(
startNum
++
+
"."
+
item
.
get
(
"value"
)+
"。"
)
;
}
urls
.
add
(
stringStringMap
.
get
(
"type"
)+
":"
+
String
.
join
(
""
,
values
));
}
map
.
put
(
"rectificationIdeas"
,
String
.
join
(
","
,
urls
));
}
maps
.
add
(
map
);
}
return
maps
;
}
private
static
<
T
>
void
addNonNullList
(
List
<
T
>
targetList
,
List
<
T
>
sourceList
)
{
if
(
sourceList
!=
null
)
{
targetList
.
addAll
(
sourceList
);
}
}
List
<
LinkedHashMap
>
getWorkLog
(
String
processInstanceId
){
if
(!
StringUtils
.
isEmpty
(
processInstanceId
))
{
return
null
;
}
List
<
LinkedHashMap
>
flowLoggernew
=
new
ArrayList
<>();
try
{
Map
<
String
,
Object
>
flowLoggerMap
=
workflowFeignClient
.
getFlowLogger
(
processInstanceId
).
getResult
();
List
<
LinkedHashMap
>
flowLogger
=
(
List
<
LinkedHashMap
>)
flowLoggerMap
.
get
(
"flowLogger"
);
if
(
flowLogger
.
size
()
>
0
)
{
Collections
.
reverse
(
flowLogger
);
}
for
(
LinkedHashMap
linkedHashMap
:
flowLogger
)
{
if
(
linkedHashMap
.
get
(
"operateDate"
)
!=
null
&&
!
linkedHashMap
.
get
(
"operateDate"
).
toString
().
isEmpty
())
{
LinkedHashMap
linke
=
new
LinkedHashMap
();
linke
.
put
(
"approvalStatue"
,
linkedHashMap
.
get
(
"approvalStatue"
).
toString
());
// 审核意见
List
<
LinkedHashMap
>
approvalSuggestion
=
(
List
<
LinkedHashMap
>)
linkedHashMap
.
get
(
"approvalSuggestion"
);
if
(
approvalSuggestion
!=
null
&&
!
approvalSuggestion
.
isEmpty
())
{
linke
.
put
(
"approvalSuggestion"
,
approvalSuggestion
.
get
(
0
).
get
(
"message"
));
}
linke
.
put
(
"taskName"
,
linkedHashMap
.
get
(
"taskName"
).
toString
());
linke
.
put
(
"operator"
,
linkedHashMap
.
get
(
"operator"
).
toString
());
linke
.
put
(
"operateDate"
,
linkedHashMap
.
get
(
"operateDate"
).
toString
());
flowLoggernew
.
add
(
linke
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
flowLoggernew
;
}
public
Object
getSchedule
(
String
peasantHouseholdId
)
{
if
(!
redisUtils
.
hasKey
(
peasantHouseholdId
)){
return
null
;
}
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
peasantHouseholdId
);
Integer
value
=
(
Integer
)
map
.
get
(
"value"
);
if
(
100
-
value
==
0
){
redisUtils
.
del
(
peasantHouseholdId
);
}
return
map
;
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/SurveyInformationServiceImpl.java
View file @
e682790d
...
...
@@ -769,38 +769,38 @@ public class SurveyInformationServiceImpl
}
surveyInfoAllDto
.
setAcceptanceCheck
(
acceptanceCheck
);
//
if (!StringUtils.isEmpty(processInstanceId)) {
//
try {
//
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
//
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
//
if (flowLogger.size() > 0) {
//
Collections.reverse(flowLogger);
//
}
//
List<LinkedHashMap> flowLoggernew = new ArrayList<>();
//
for (LinkedHashMap linkedHashMap : flowLogger) {
//
if (linkedHashMap.get("operateDate") != null
//
&& !linkedHashMap.get("operateDate").toString().isEmpty()) {
//
LinkedHashMap linke = new LinkedHashMap();
//
linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
//
// 审核意见
//
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
//
.get("approvalSuggestion");
//
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
//
linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
//
}
//
linke.put("taskName", linkedHashMap.get("taskName").toString());
//
linke.put("operator", linkedHashMap.get("operator").toString());
//
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
//
flowLoggernew.add(linke);
//
}
//
}
//
LoggerDto loggerDto = new LoggerDto();
//
loggerDto.setLogger(flowLoggernew);
//
surveyInfoAllDto.setOrderTracking(loggerDto);
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
}
if
(!
StringUtils
.
isEmpty
(
processInstanceId
))
{
try
{
Map
<
String
,
Object
>
flowLoggerMap
=
workflowFeignClient
.
getFlowLogger
(
processInstanceId
).
getResult
();
List
<
LinkedHashMap
>
flowLogger
=
(
List
<
LinkedHashMap
>)
flowLoggerMap
.
get
(
"flowLogger"
);
if
(
flowLogger
.
size
()
>
0
)
{
Collections
.
reverse
(
flowLogger
);
}
List
<
LinkedHashMap
>
flowLoggernew
=
new
ArrayList
<>();
for
(
LinkedHashMap
linkedHashMap
:
flowLogger
)
{
if
(
linkedHashMap
.
get
(
"operateDate"
)
!=
null
&&
!
linkedHashMap
.
get
(
"operateDate"
).
toString
().
isEmpty
())
{
LinkedHashMap
linke
=
new
LinkedHashMap
();
linke
.
put
(
"approvalStatue"
,
linkedHashMap
.
get
(
"approvalStatue"
).
toString
());
// 审核意见
List
<
LinkedHashMap
>
approvalSuggestion
=
(
List
<
LinkedHashMap
>)
linkedHashMap
.
get
(
"approvalSuggestion"
);
if
(
approvalSuggestion
!=
null
&&
!
approvalSuggestion
.
isEmpty
())
{
linke
.
put
(
"approvalSuggestion"
,
approvalSuggestion
.
get
(
0
).
get
(
"message"
));
}
linke
.
put
(
"taskName"
,
linkedHashMap
.
get
(
"taskName"
).
toString
());
linke
.
put
(
"operator"
,
linkedHashMap
.
get
(
"operator"
).
toString
());
linke
.
put
(
"operateDate"
,
linkedHashMap
.
get
(
"operateDate"
).
toString
());
flowLoggernew
.
add
(
linke
);
}
}
LoggerDto
loggerDto
=
new
LoggerDto
();
loggerDto
.
setLogger
(
flowLoggernew
);
surveyInfoAllDto
.
setOrderTracking
(
loggerDto
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
surveyInfoAllDto
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/application.properties
View file @
e682790d
...
...
@@ -87,4 +87,5 @@ exception.debug=true
feign.okhttp.enabled
=
true
workflow.feign.name
=
AMOS-API-WORKFLOW-CZ
repaymentCron
=
0 0 1 * * ?
\ No newline at end of file
repaymentCron
=
0 0 1 * * ?
urlHttp
=
http://47.92.234.253:8088
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/templates/informationTemp.xlsx
View file @
e682790d
No preview for this file type
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