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
6c47c95e
Commit
6c47c95e
authored
Dec 20, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工行代扣下载接口修改
parent
18a592a5
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
333 additions
and
51 deletions
+333
-51
pom.xml
amos-boot-system-jxiop/amos-boot-module-hygf-api/pom.xml
+6
-0
UploadStatusEnum.java
...join/amos/boot/module/hygf/api/Enum/UploadStatusEnum.java
+14
-0
IcbcWithholdRecordDto.java
.../amos/boot/module/hygf/api/dto/IcbcWithholdRecordDto.java
+59
-15
IcbcWithholdRecordMapper.java
...boot/module/hygf/api/mapper/IcbcWithholdRecordMapper.java
+1
-1
FileUtil.java
.../com/yeejoin/amos/boot/module/hygf/api/util/FileUtil.java
+0
-1
FileUtils.java
...com/yeejoin/amos/boot/module/hygf/api/util/FileUtils.java
+128
-0
HygfIcbcRecordMapper.xml
.../src/main/resources/mapper/mysql/HygfIcbcRecordMapper.xml
+17
-15
IcbcWithholdRecordMapper.xml
.../main/resources/mapper/mysql/IcbcWithholdRecordMapper.xml
+7
-4
IcbcWithholdController.java
...ot/module/hygf/biz/controller/IcbcWithholdController.java
+16
-4
IcbcWithholdRecordController.java
...ule/hygf/biz/controller/IcbcWithholdRecordController.java
+40
-0
IcbcWithholdRecordServiceImpl.java
.../hygf/biz/service/impl/IcbcWithholdRecordServiceImpl.java
+21
-7
IcbcWithholdServiceImpl.java
...module/hygf/biz/service/impl/IcbcWithholdServiceImpl.java
+24
-4
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/pom.xml
View file @
6c47c95e
...
...
@@ -34,6 +34,12 @@
<artifactId>
bcpkix-jdk15on
</artifactId>
<version>
1.70
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-mock
</artifactId>
<version>
2.0.8
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<dependencyManagement>
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/Enum/UploadStatusEnum.java
View file @
6c47c95e
...
...
@@ -11,12 +11,26 @@ public enum UploadStatusEnum {
未生成
(
"未生成"
,
"未生成"
),
成功
(
"成功"
,
"成功"
),
失败
(
"失败"
,
"失败"
),
代扣成功
(
"成功"
,
"0"
),
代扣失败
(
"失败"
,
"1"
),
代扣中
(
"处理中"
,
"99"
),
代扣处理中
(
"代扣处理中"
,
"代扣处理中"
);
private
String
name
;
private
String
code
;
public
static
UploadStatusEnum
getNodeByCode
(
String
code
)
{
UploadStatusEnum
anEnum
=
null
;
for
(
UploadStatusEnum
type
:
UploadStatusEnum
.
values
())
{
if
(
type
.
getCode
()
==
code
)
{
anEnum
=
type
;
break
;
}
}
return
anEnum
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/IcbcWithholdRecordDto.java
View file @
6c47c95e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
*
*
* @author system_generator
* @date 2024-12-06
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"IcbcWithholdRecordDto"
,
description
=
""
)
public
class
IcbcWithholdRecordDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModel
(
value
=
"IcbcWithholdRecordDto"
,
description
=
""
)
public
class
IcbcWithholdRecordDto
extends
BaseDto
{
@ExcelIgnore
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"农户姓名"
)
@ExcelIgnore
protected
Long
sequenceNbr
;
@ExcelProperty
(
value
=
"户主姓名"
,
index
=
0
)
@ApiModelProperty
(
value
=
"户主姓名"
)
private
String
custName
;
/**
* 身份证号
*/
@ExcelProperty
(
value
=
"区域公司"
,
index
=
1
)
@ApiModelProperty
(
value
=
"区域公司"
)
private
String
regionalCompaniesName
;
/**
* 手机号码
*/
@ExcelProperty
(
value
=
"手机号"
,
index
=
2
)
@ApiModelProperty
(
value
=
"手机号码"
)
private
String
phone
;
@ExcelProperty
(
value
=
"身份证号"
,
index
=
3
)
@ApiModelProperty
(
value
=
"身份证号"
)
private
String
idCard
;
private
String
phone
;
/**
* 聚富通电子账户账号
*/
@ExcelProperty
(
value
=
"银行卡号"
,
index
=
4
)
@ApiModelProperty
(
value
=
"聚富通电子账户账号"
)
private
String
mediumId
;
/**
* 开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败
*/
@ExcelProperty
(
value
=
"开户状态"
,
index
=
5
)
@ApiModelProperty
(
value
=
"开户状态, 00-初始,01-开户中,02-开户成功,03-开户失败"
)
private
String
openAccountStatus
;
/**
* 协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认
*/
@ExcelProperty
(
value
=
"协议状态"
,
index
=
6
)
@ApiModelProperty
(
value
=
"协议状态, 0-未生效,1-已生效,2-过期,3-作废,4-待短信确认"
)
private
String
protocolStatus
;
@ExcelProperty
(
value
=
"协议状态"
,
index
=
7
)
@ApiModelProperty
(
value
=
"批次号"
)
private
String
batchNo
;
@ApiModelProperty
(
value
=
"聚富通电子账户账号"
)
private
String
mediumId
;
@ExcelProperty
(
value
=
"项目编号"
,
index
=
8
)
@ApiModelProperty
(
value
=
"项目编号"
)
private
String
projectId
;
@ExcelProperty
(
value
=
"付款金额"
,
index
=
9
)
@ApiModelProperty
(
value
=
"付款金额"
)
private
int
paymentAmount
;
private
double
paymentAmount
;
@ExcelProperty
(
value
=
"代扣状态"
,
index
=
10
)
@ApiModelProperty
(
value
=
"代扣状态"
)
private
String
withholdStatus
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"上传时间"
)
private
Date
withholdTime
;
@ExcelProperty
(
value
=
"缴费时间"
,
index
=
11
)
@ApiModelProperty
(
value
=
"缴费时间"
)
private
Date
paymentTime
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"缴费开始时间"
)
private
String
paymentStartTime
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"缴费结束时间"
)
private
String
paymentEndTime
;
@ExcelIgnore
private
String
outUserId
;
@ExcelIgnore
private
String
amosUserId
;
@ExcelIgnore
private
String
regionalCompaniesCode
;
/*
* 区域公司名称
* */
private
String
regionalCompaniesName
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/IcbcWithholdRecordMapper.java
View file @
6c47c95e
...
...
@@ -17,5 +17,5 @@ import java.util.List;
*/
public
interface
IcbcWithholdRecordMapper
extends
BaseMapper
<
IcbcWithholdRecord
>
{
@UserEmpower
(
field
=
{
"ph.regional_companies_code"
},
dealerField
=
{
"ph.developer_code"
,
"ph.regional_companies_code"
,
"ph.developer_user_id"
},
fieldConditions
=
{
"in"
,
"in"
,
"in"
},
relationship
=
"and"
,
specific
=
false
)
List
<
IcbcWithholdRecordDto
>
exportTotal
(
String
developerCode
,
String
regionalCompaniesCode
,
String
province
,
String
city
,
String
district
,
String
year
,
String
month
,
List
<
String
>
quarter
,
@Param
(
"dto"
)
IcbcWithholdRecordDto
dto
);
List
<
IcbcWithholdRecordDto
>
exportTotal
(
String
developerCode
,
String
regionalCompaniesCode
,
String
province
,
String
city
,
String
district
,
String
year
,
String
month
,
List
<
String
>
quarter
s
,
@Param
(
"dto"
)
IcbcWithholdRecordDto
dto
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/FileUtil.java
View file @
6c47c95e
...
...
@@ -17,7 +17,6 @@ public class FileUtil {
InputStream
fileInputStream
=
null
;
try
{
response
.
reset
();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"content-Type"
,
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/FileUtils.java
View file @
6c47c95e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
util
;
import
com.yeejoin.amos.component.robot.BadRequest
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.util.FileCopyUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileChannel.MapMode
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
import
java.util.zip.ZipOutputStream
;
public
class
FileUtils
{
...
...
@@ -250,5 +260,122 @@ public class FileUtils {
}
}
public
static
void
createZipFile
(
Path
folderPath
,
String
zipFilePath
,
HttpServletResponse
response
)
{
try
(
ServletOutputStream
out
=
response
.
getOutputStream
();
ZipOutputStream
zos
=
new
ZipOutputStream
(
out
))
{
addFolderToZip
(
folderPath
.
toFile
(),
""
,
zos
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
private
static
void
addFolderToZip
(
File
folder
,
String
parentFolder
,
ZipOutputStream
zos
)
throws
IOException
{
File
[]
files
=
folder
.
listFiles
();
if
(
files
!=
null
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isDirectory
())
{
addFolderToZip
(
file
,
parentFolder
+
file
.
getName
()
+
"/"
,
zos
);
}
else
{
addFileToZip
(
file
,
parentFolder
,
zos
);
}
}
}
}
private
static
void
addFileToZip
(
File
sourceFile
,
String
parentFolder
,
ZipOutputStream
zipOut
)
throws
IOException
{
FileInputStream
fin
=
new
FileInputStream
(
sourceFile
);
String
zipEntryName
=
parentFolder
+
sourceFile
.
getName
();
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
();
}
public
static
MultipartFile
convertZipToMultipartFile
(
File
zipFile
)
throws
IOException
{
try
(
FileInputStream
input
=
new
FileInputStream
(
zipFile
))
{
return
new
MockMultipartFile
(
zipFile
.
getName
(),
// name
zipFile
.
getName
(),
// originalFilename
"application/zip"
,
// contentType
FileCopyUtils
.
copyToByteArray
(
input
)
// bytes
);
}
}
public
static
boolean
unzipAndUpload
(
String
localZipFilePath
,
HttpServletResponse
response
)
throws
Exception
{
boolean
success
=
false
;
File
tempDir
=
null
;
try
{
// 创建临时目录用于解压
tempDir
=
Files
.
createTempDirectory
(
"unzip_temp_"
).
toFile
();
tempDir
.
deleteOnExit
();
// 确保 JVM 退出时删除临时目录
// 解压本地 ZIP 文件到临时目录
unzipLocalFile
(
localZipFilePath
,
tempDir
.
getAbsolutePath
());
// 获取解压后的文件列表
File
[]
files
=
tempDir
.
listFiles
();
if
(
files
==
null
||
files
.
length
==
0
)
{
throw
new
IOException
(
"No files found after unzipping."
);
}
createZipFile
(
tempDir
.
toPath
(),
tempDir
.
getPath
(),
response
);
success
=
true
;
}
catch
(
Exception
e
)
{
throw
e
;
}
finally
{
// 清理临时文件和断开连接
if
(
tempDir
!=
null
)
{
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
util
.
FileUtils
.
cleanup
(
tempDir
.
toPath
());
}
}
return
success
;
}
private
static
void
unzipLocalFile
(
String
zipFilePath
,
String
destDir
)
throws
IOException
{
byte
[]
buffer
=
new
byte
[
1024
];
Path
zipFilePathObj
=
Paths
.
get
(
zipFilePath
);
Path
destDirObj
=
Paths
.
get
(
destDir
);
try
(
ZipInputStream
zis
=
new
ZipInputStream
(
new
FileInputStream
(
zipFilePathObj
.
toFile
())))
{
ZipEntry
zipEntry
=
zis
.
getNextEntry
();
while
(
zipEntry
!=
null
)
{
Path
newFilePath
=
destDirObj
.
resolve
(
zipEntry
.
getName
());
if
(!
zipEntry
.
isDirectory
())
{
// 如果是文件,则创建新文件并写入内容
Files
.
createDirectories
(
newFilePath
.
getParent
());
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
newFilePath
.
toFile
()))
{
int
len
;
while
((
len
=
zis
.
read
(
buffer
))
>
0
)
{
fos
.
write
(
buffer
,
0
,
len
);
}
}
}
else
{
// 如果是目录,则创建目录
Files
.
createDirectories
(
newFilePath
);
}
zipEntry
=
zis
.
getNextEntry
();
}
zis
.
closeEntry
();
}
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/HygfIcbcRecordMapper.xml
View file @
6c47c95e
...
...
@@ -184,21 +184,23 @@
FROM
`hygf_peasant_household` ph
LEFT JOIN hygf_icbc_record re ON re.amos_user_id = ph.amos_user_id
<if
test=
"developerCode != null and developerCode != ''"
>
AND ph.developer_code = #{developerCode}
</if>
<if
test=
"regionalCompaniesCode != null and regionalCompaniesCode != ''"
>
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if
test=
"province != null and province != ''"
>
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if
test=
"city != null and city != ''"
>
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if
test=
"district != null and district != ''"
>
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
<where>
<if
test=
"developerCode != null and developerCode != ''"
>
AND ph.developer_code = #{developerCode}
</if>
<if
test=
"regionalCompaniesCode != null and regionalCompaniesCode != ''"
>
AND ph.regional_companies_code = #{regionalCompaniesCode}
</if>
<if
test=
"province != null and province != ''"
>
AND ph.project_address LIKE CONCAT ('%',#{province},'%')
</if>
<if
test=
"city != null and city != ''"
>
AND ph.project_address LIKE CONCAT ('%',#{city},'%')
</if>
<if
test=
"district != null and district != ''"
>
AND ph.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
ph.amos_user_id
</select>
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/IcbcWithholdRecordMapper.xml
View file @
6c47c95e
...
...
@@ -107,11 +107,12 @@
</if>
<if
test=
"month != null and month != ''"
>
AND
EXTRACT(MONTH FROM re.withhold_time
) = #{month}
AND
TO_CHAR(re.withhold_time, 'YYYY-MM'
) = #{month}
</if>
<if
test=
"quarter != null and quarter.size() > 1"
>
AND ph.withhold_time BETWEEN
<foreach
collection=
"quarter"
item=
"item"
separator=
"and"
>
<if
test=
"quarters != null and quarters.size() > 1"
>
AND TO_CHAR(re.withhold_time, 'YYYY-MM') in
<foreach
collection=
"quarters"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</if>
...
...
@@ -122,7 +123,9 @@
<if
test=
"dto.batchNo != null and dto.batchNo != ''"
>
AND re.batch_no = #{dto.batchNo}
</if>
<if
test=
"dto.withholdStatus != null and dto.withholdStatus != ''"
>
AND re.withhold_status = #{dto.withholdStatus}
</if>
<if
test=
"dto.paymentStartTime != null and dto.paymentStartTime != ''"
>
AND re.payment_time > #{dto.paymentStartTime}
</if>
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/IcbcWithholdController.java
View file @
6c47c95e
...
...
@@ -103,7 +103,7 @@ public class IcbcWithholdController extends BaseController {
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 聚富通代扣信息表分页查询"
,
notes
=
" 聚富通代扣信息表分页查询"
)
public
ResponseModel
<
Page
<
IcbcWithholdDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
...
...
@@ -124,7 +124,7 @@ public class IcbcWithholdController extends BaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/test"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 聚富通代扣信息表分页查询"
,
notes
=
" 聚富通代扣信息表分页查询"
)
public
ResponseModel
<
Page
<
IcbcWithholdDto
>>
test
()
{
...
...
@@ -189,7 +189,7 @@ public class IcbcWithholdController extends BaseController {
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 聚富通代扣信息回盘文件获取"
,
notes
=
" 聚富通代扣信息回盘文件获取"
)
@GetMapping
(
value
=
"/updateWithholdStatus"
)
public
ResponseModel
updateWithholdStatus
(
)
throws
Exception
{
...
...
@@ -202,11 +202,23 @@ public class IcbcWithholdController extends BaseController {
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"批次人员信息下载"
,
notes
=
"批次人员信息下载"
)
@PostMapping
(
value
=
"/export"
)
public
void
downTemplate
(
HttpServletResponse
response
,
@RequestBody
IcbcWithhold
model
)
{
icbcWithholdServiceImpl
.
exportData
(
response
,
model
);
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"文件下载"
,
notes
=
"文件下载"
)
@GetMapping
(
value
=
"/downloadFile"
)
public
void
downTemplate
(
HttpServletResponse
response
,
String
fileUrl
,
String
batchNo
,
String
type
)
throws
Exception
{
icbcWithholdServiceImpl
.
downloadAndSaveZipFile
(
fileUrl
,
batchNo
,
type
,
response
);
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/IcbcWithholdRecordController.java
View file @
6c47c95e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.hygf.api.config.UserLimits
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.IcbcWithholdRecordServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdRecordDto
;
...
...
@@ -112,4 +117,39 @@ public class IcbcWithholdRecordController extends BaseController {
public
ResponseModel
<
List
<
IcbcWithholdRecordDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
icbcWithholdRecordServiceImpl
.
queryForIcbcWithholdRecordList
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/exportTotal"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"导出聚富通开卡统计"
,
notes
=
"导出聚富通开卡统计"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
exportTotal
(
@ApiParam
(
value
=
"经销商公司code"
,
example
=
"87*253*775"
)
@RequestParam
(
required
=
false
)
String
developerCode
,
@ApiParam
(
value
=
"区域公司code"
,
example
=
"87*253*652"
)
@RequestParam
(
required
=
false
)
String
regionalCompaniesCode
,
@ApiParam
(
value
=
"省份"
,
example
=
"610000"
)
@RequestParam
(
required
=
false
)
String
province
,
@ApiParam
(
value
=
"市"
,
example
=
"610700"
)
@RequestParam
(
required
=
false
)
String
city
,
@ApiParam
(
value
=
"区"
,
example
=
"610116"
)
@RequestParam
(
required
=
false
)
String
district
,
@RequestParam
(
required
=
false
)
String
year
,
@RequestParam
(
required
=
false
)
String
month
,
@RequestParam
(
required
=
false
)
String
quarter
)
{
return
ResponseHelper
.
buildResponse
(
icbcWithholdRecordServiceImpl
.
paymentAmount
(
developerCode
,
regionalCompaniesCode
,
province
,
city
,
district
,
year
,
month
,
quarter
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"存量合同电站下载"
,
notes
=
"存量合同电站下载"
)
@GetMapping
(
value
=
"/export"
)
public
void
exportData
(
HttpServletResponse
response
,
@ApiParam
(
value
=
"经销商公司code"
,
example
=
"87*253*775"
)
@RequestParam
(
required
=
false
)
String
developerCode
,
@ApiParam
(
value
=
"区域公司code"
,
example
=
"87*253*652"
)
@RequestParam
(
required
=
false
)
String
regionalCompaniesCode
,
@ApiParam
(
value
=
"省份"
,
example
=
"610000"
)
@RequestParam
(
required
=
false
)
String
province
,
@ApiParam
(
value
=
"市"
,
example
=
"610700"
)
@RequestParam
(
required
=
false
)
String
city
,
@ApiParam
(
value
=
"区"
,
example
=
"610116"
)
@RequestParam
(
required
=
false
)
String
district
,
@RequestParam
(
required
=
false
)
String
year
,
@RequestParam
(
required
=
false
)
String
month
,
@RequestParam
(
required
=
false
)
String
quarter
)
{
icbcWithholdRecordServiceImpl
.
exportData
(
response
,
developerCode
,
regionalCompaniesCode
,
province
,
city
,
district
,
year
,
month
,
quarter
);
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/IcbcWithholdRecordServiceImpl.java
View file @
6c47c95e
...
...
@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.IcbcWithholdRecord;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.IcbcWithholdRecordMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IIcbcWithholdRecordService
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.IcbcWithholdRecordDto
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -63,9 +64,15 @@ public class IcbcWithholdRecordServiceImpl extends BaseService<IcbcWithholdRecor
}
public
void
exportData
(
HttpServletResponse
response
,
String
developerCode
,
String
regionalCompaniesCode
,
String
province
,
String
city
,
String
district
,
String
year
,
String
month
,
List
<
String
>
quarter
){
List
<
IcbcWithholdRecordDto
>
dtos
=
this
.
getBaseMapper
().
exportTotal
(
developerCode
,
regionalCompaniesCode
,
province
,
city
,
district
,
year
,
month
,
quarter
,
null
);
public
void
exportData
(
HttpServletResponse
response
,
String
developerCode
,
String
regionalCompaniesCode
,
String
province
,
String
city
,
String
district
,
String
year
,
String
month
,
String
quarter
){
List
<
String
>
quarters
=
null
;
if
(
StringUtils
.
isNotEmpty
(
quarter
)){
String
[]
split
=
quarter
.
split
(
"-"
);
quarters
=
DateUtils
.
getMonthsInQuarterAsString
(
Integer
.
parseInt
(
split
[
0
]),
Integer
.
parseInt
(
split
[
1
]));
}
IcbcWithholdRecordDto
dto
=
new
IcbcWithholdRecordDto
();
dto
.
setWithholdStatus
(
"成功"
);
List
<
IcbcWithholdRecordDto
>
dtos
=
this
.
getBaseMapper
().
exportTotal
(
developerCode
,
regionalCompaniesCode
,
province
,
city
,
district
,
year
,
month
,
quarters
,
dto
);
if
(
CollectionUtil
.
isNotEmpty
(
dtos
)){
ExcelUtil
.
createTemplate
(
response
,
"结算金额"
,
"结算金额"
,
dtos
,
IcbcWithholdRecordDto
.
class
,
null
,
false
);
}
...
...
@@ -73,10 +80,17 @@ public class IcbcWithholdRecordServiceImpl extends BaseService<IcbcWithholdRecor
}
public
Map
<
String
,
Object
>
paymentAmount
(
String
developerCode
,
String
regionalCompaniesCode
,
String
province
,
String
city
,
String
district
,
String
year
,
String
month
,
List
<
String
>
quarter
){
List
<
IcbcWithholdRecordDto
>
dtos
=
this
.
getBaseMapper
().
exportTotal
(
developerCode
,
regionalCompaniesCode
,
province
,
city
,
district
,
year
,
month
,
quarter
,
null
);
int
totalPaymentAmount
=
dtos
.
stream
()
.
mapToInt
(
IcbcWithholdRecordDto:
:
getPaymentAmount
)
public
Map
<
String
,
Object
>
paymentAmount
(
String
developerCode
,
String
regionalCompaniesCode
,
String
province
,
String
city
,
String
district
,
String
year
,
String
month
,
String
quarter
){
List
<
String
>
quarters
=
null
;
if
(
StringUtils
.
isNotEmpty
(
quarter
)){
String
[]
split
=
quarter
.
split
(
"-"
);
quarters
=
DateUtils
.
getMonthsInQuarterAsString
(
Integer
.
parseInt
(
split
[
0
]),
Integer
.
parseInt
(
split
[
1
]));
}
IcbcWithholdRecordDto
dto
=
new
IcbcWithholdRecordDto
();
dto
.
setWithholdStatus
(
"成功"
);
List
<
IcbcWithholdRecordDto
>
dtos
=
this
.
getBaseMapper
().
exportTotal
(
developerCode
,
regionalCompaniesCode
,
province
,
city
,
district
,
year
,
month
,
quarters
,
dto
);
double
totalPaymentAmount
=
dtos
.
stream
()
.
mapToDouble
(
IcbcWithholdRecordDto:
:
getPaymentAmount
)
.
sum
();
Map
<
String
,
Object
>
paymentAmount
=
MapBuilder
.<
String
,
Object
>
create
().
put
(
"paymentAmount"
,
totalPaymentAmount
).
build
();
return
paymentAmount
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/IcbcWithholdServiceImpl.java
View file @
6c47c95e
...
...
@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.hygf.api.util.SFTPUtil;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -50,6 +51,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.*
;
import
java.lang.reflect.Field
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
...
...
@@ -137,6 +139,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
WithholdLoopField
withholdLoopField
=
new
WithholdLoopField
();
withholdLoopField
.
setBillNo
(++
billNo
);
recordDTO
.
setBatchNo
(
batchNo
);
recordDTO
.
setProjectId
(
projectId
);
withholdLoopField
.
setBusiCode
(
recordDTO
.
getOutUserId
());
withholdLoopField
.
setBusiAcct
(
recordDTO
.
getMediumId
());
withholdLoopField
.
setBusiName
(
recordDTO
.
getCustName
());
...
...
@@ -179,7 +182,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
addFileToZip
(
dirPath
.
toString
()
+
"/"
+
fileName
+
".sign"
,
fileName
+
".sign"
,
zos
);
addFileToZip
(
dirPath
.
toString
()
+
"/"
+
fileName
+
".check"
,
fileName
+
".check"
,
zos
);
MultipartFile
multipartFile
=
file
ToMultipartFile
(
new
File
(
dirPath
.
toString
()
+
"/"
+
fileName
+
".zip"
));
MultipartFile
multipartFile
=
convertZip
ToMultipartFile
(
new
File
(
dirPath
.
toString
()
+
"/"
+
fileName
+
".zip"
));
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
multipartFile
);
if
(
result
!=
null
)
{
for
(
String
url
:
result
.
getResult
().
keySet
())
{
...
...
@@ -200,7 +203,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
model
.
setUploadFileName
(
fileName
);
model
.
setProjectNumber
(
model
.
getRecordDTOS
().
get
(
0
).
getProjectId
());
model
.
getRecordDTOS
().
stream
().
forEach
(
e
->
e
.
setSequenceNbr
(
null
));
if
(
!
Objects
.
isNull
(
model
.
getSequenceNbr
())){
if
(
Objects
.
isNull
(
model
.
getSequenceNbr
())){
icbcWithholdRecordService
.
saveBatch
(
model
.
getRecordDTOS
());
}
this
.
saveOrUpdate
(
model
);
...
...
@@ -217,8 +220,10 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
model
.
getRecordDTOS
().
forEach
(
e
->{
e
.
setSequenceNbr
(
null
);
e
.
setBatchNo
(
batch
);
e
.
setProjectId
(
projectId
);
});
icbcWithholdRecordService
.
saveBatch
(
model
.
getRecordDTOS
());
model
.
setProjectNumber
(
projectId
);
model
.
setIcbcRecordInfos
(
JSONObject
.
toJSONString
(
model
.
getRecordDTOS
()));
model
.
setBatchNo
(
batch
);
model
.
setUploadStatus
(
UploadStatusEnum
.
未生成
.
getName
());
...
...
@@ -522,7 +527,7 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
// bizContent.setBatchNo("20241216JO00400005");//批次号
bizContent
.
setCorpCis
(
"211590000183323"
);
// bizContent.setBillNo("1");//序号
bizContent
.
setTrxDate
(
"2024-12-17"
);
//交易日期
bizContent
.
setTrxDate
(
DateUtils
.
getDateNowShortStr
()
);
//交易日期
// bizContent.setBusiCode("14948822");
bizContent
.
setCurPage
(
"1"
);
//查询页码
request
.
setBizContent
(
bizContent
);
...
...
@@ -536,8 +541,9 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
LambdaUpdateWrapper
<
IcbcWithholdRecord
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IcbcWithholdRecord:
:
getBatchNo
,
e
.
getBatchNo
());
updateWrapper
.
eq
(
IcbcWithholdRecord:
:
getOutUserId
,
e
.
getBusiCode
());
updateWrapper
.
set
(
IcbcWithholdRecord:
:
getWithholdStatus
,
e
.
getStatus
());
updateWrapper
.
set
(
IcbcWithholdRecord:
:
getWithholdStatus
,
UploadStatusEnum
.
getNodeByCode
(
e
.
getStatus
()).
getName
());
updateWrapper
.
set
(
IcbcWithholdRecord:
:
getWithholdTime
,
e
.
getTrxTime
());
updateWrapper
.
set
(
IcbcWithholdRecord:
:
getPaymentTime
,
e
.
getTrxTime
());
icbcWithholdRecordService
.
getBaseMapper
().
update
(
null
,
updateWrapper
);
});
}
else
{
...
...
@@ -568,4 +574,17 @@ public class IcbcWithholdServiceImpl extends BaseService<IcbcWithholdDto,IcbcWit
}
}
public
void
downloadAndSaveZipFile
(
String
fileUrl
,
String
batchNo
,
String
type
,
HttpServletResponse
response
)
throws
Exception
{
Path
currentWorkingDir
=
Paths
.
get
(
""
);
Path
dirPath
=
currentWorkingDir
.
resolve
(
batchNo
);
downloadAndSaveZipFile
(
fileUrl
,
dirPath
);
response
.
setContentType
(
"application/zip"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
batchNo
+
"-"
+
type
+
".zip"
,
"UTF-8"
));
unzipAndUpload
(
dirPath
.
toString
()+
"/"
+
fileUrl
.
substring
(
fileUrl
.
lastIndexOf
(
'/'
)
+
1
),
response
);
}
}
\ 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