Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
38332bbe
Commit
38332bbe
authored
Mar 14, 2019
by
chase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改报表模板上传滴滴服务器
parent
351c62a3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
231 additions
and
75 deletions
+231
-75
POIUtil.java
atms-api/src/main/java/pwc/taxtech/atms/common/POIUtil.java
+17
-8
FileUploadEnum.java
.../java/pwc/taxtech/atms/constant/enums/FileUploadEnum.java
+3
-1
DidiFileUploadController.java
...pwc/taxtech/atms/controller/DidiFileUploadController.java
+0
-42
TemplateGroupDto.java
.../src/main/java/pwc/taxtech/atms/dto/TemplateGroupDto.java
+10
-0
DidiFileUploadService.java
.../pwc/taxtech/atms/service/impl/DidiFileUploadService.java
+46
-0
HttpFileService.java
...n/java/pwc/taxtech/atms/service/impl/HttpFileService.java
+8
-10
TemplateGroupServiceImpl.java
...c/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
+9
-4
TemplateServiceImpl.java
...va/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
+24
-3
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+68
-5
declaration-form-configuration.ctrl.js
...nFormConfiguration/declaration-form-configuration.ctrl.js
+1
-0
edit-templategroup-modal.ctrl.js
...edit-templategroup-modal/edit-templategroup-modal.ctrl.js
+11
-2
edit-templategroup-modal.html
...ls/edit-templategroup-modal/edit-templategroup-modal.html
+9
-0
edit-templategroup-modal.less
...ls/edit-templategroup-modal/edit-templategroup-modal.less
+25
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/POIUtil.java
View file @
38332bbe
...
...
@@ -2,18 +2,14 @@ package pwc.taxtech.atms.common;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
public
class
POIUtil
{
...
...
@@ -112,4 +108,17 @@ public class POIUtil {
return
Optional
.
empty
();
}
}
public
static
Row
createRow
(
Sheet
sheet
,
Integer
rowIndex
)
{
Row
row
=
null
;
if
(
sheet
.
getRow
(
rowIndex
)
!=
null
)
{
int
lastRowNo
=
sheet
.
getLastRowNum
();
sheet
.
shiftRows
(
rowIndex
,
lastRowNo
,
1
);
}
row
=
sheet
.
createRow
(
rowIndex
);
return
row
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/FileUploadEnum.java
View file @
38332bbe
...
...
@@ -10,7 +10,9 @@ public class FileUploadEnum {
*/
public
enum
BizSource
{
REPORT_UPLOAD
(
"REPORT_UPLOAD"
,
"历史报表归档上传"
),
RECORD_UPLOAD
(
"RECORD_UPLOAD"
,
"档案管理上传"
);
RECORD_UPLOAD
(
"RECORD_UPLOAD"
,
"档案管理上传"
),
REPORT_TEMPLATE_UPLOAD
(
"REPORT_TEMPLATE_UPLOAD"
,
"报表模板上传"
),
PERIOD_REPORT_TEMPLATE_UPLOAD
(
"PERIOD_REPORT_TEMPLATE_UPLOAD"
,
"期间报表模板上传"
),;
private
String
code
;
private
String
name
;
public
static
final
Map
<
String
,
String
>
MAPPING
=
new
HashMap
<>();
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/DidiFileUploadController.java
deleted
100644 → 0
View file @
351c62a3
package
pwc
.
taxtech
.
atms
.
controller
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
pwc.taxtech.atms.common.message.ErrorMessage
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.exception.ServiceException
;
import
pwc.taxtech.atms.service.impl.DidiFileUploadService
;
@RestController
@RequestMapping
(
"/api/v1/DidiFileUpload"
)
public
class
DidiFileUploadController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DidiFileUploadController
.
class
);
@Autowired
private
DidiFileUploadService
didiFileUploadService
;
@ResponseBody
// @ApiOperation(value = "导入模板")
@RequestMapping
(
value
=
"importTemplateGroupExcelFile"
,
method
=
RequestMethod
.
POST
)
public
OperationResultDto
uploadFile
(
@RequestParam
MultipartFile
file
)
{
try
{
if
(
null
==
file
)
{
return
OperationResultDto
.
error
(
ErrorMessage
.
NoFile
);
}
return
OperationResultDto
.
success
();
}
catch
(
ServiceException
e
)
{
return
OperationResultDto
.
error
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"uploadFile error."
,
e
);
}
return
OperationResultDto
.
error
(
ErrorMessage
.
SystemError
);
}
// @PostMapping("queryPage")
// public CamelPagingResultDto<DidiFileUploadDetailResult> queryPage(@RequestBody DidiFileIUploadParam param) {
// return new CamelPagingResultDto<>(revenueDetailService.queryPage(param));
// }
}
atms-api/src/main/java/pwc/taxtech/atms/dto/TemplateGroupDto.java
View file @
38332bbe
...
...
@@ -16,11 +16,21 @@ public class TemplateGroupDto {
private
String
copyFrom
;
private
String
industryIds
;
private
Integer
payTaxType
;
private
Integer
reportType
;
private
Integer
groupType
;
private
Boolean
isSystemType
;
private
List
<
TemplateFormulaDto
>
changedFormulas
;
private
List
<
String
>
sheetNameList
;
public
Integer
getReportType
()
{
return
reportType
;
}
public
void
setReportType
(
Integer
reportType
)
{
this
.
reportType
=
reportType
;
}
public
String
getId
()
{
return
id
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/DidiFileUploadService.java
View file @
38332bbe
...
...
@@ -122,6 +122,52 @@ public class DidiFileUploadService extends BaseService {
throw
new
ServiceException
(
"uploadFile error."
);
}
public
FileUpload
uploadFile
(
byte
[]
bytes
,
String
fileName
,
String
bizSource
)
throws
ServiceException
{
CloseableHttpClient
httpClient
=
null
;
String
requestKey
=
CommonUtils
.
getUUID
();
String
requestUrl
=
upload_post_url
+
"/"
+
requestKey
;
FileUploadLog
uploadLog
=
new
FileUploadLog
();
uploadLog
.
setRequestId
(
requestKey
);
uploadLog
.
setRequestUrl
(
requestUrl
);
uploadLog
.
setUid
(
CommonUtils
.
getUUID
());
try
{
httpClient
=
HttpClients
.
createDefault
();
HttpPost
httpPost
=
new
HttpPost
(
requestUrl
);
ByteArrayBody
byteBody
=
new
ByteArrayBody
(
bytes
,
ContentType
.
MULTIPART_FORM_DATA
,
fileName
);
HttpEntity
httpEntity
=
MultipartEntityBuilder
.
create
().
addPart
(
"filecontent"
,
byteBody
).
build
();
httpPost
.
setEntity
(
httpEntity
);
HttpResponse
httpResponse
=
httpClient
.
execute
(
httpPost
);
JSONObject
resultDto
=
JSON
.
parseObject
(
IOUtils
.
toString
(
httpResponse
.
getEntity
().
getContent
(),
"UTF-8"
));
uploadLog
.
setResponsJson
(
resultDto
.
toJSONString
());
FileUpload
fileUpload
=
null
;
if
(
HTTP_SUCCESS_CODE
.
equals
(
resultDto
.
getString
(
"status_code"
)))
{
fileUpload
=
new
FileUpload
();
fileUpload
.
setBizSource
(
bizSource
);
fileUpload
.
setUid
(
CommonUtils
.
getUUID
());
fileUpload
.
setFileName
(
fileName
);
fileUpload
.
setResourceKey
(
requestKey
);
assemblyModel
(
resultDto
,
fileUpload
);
uploadLog
.
setFileUploadId
(
fileUpload
.
getUid
());
fileUploadMapper
.
insert
(
fileUpload
);
}
fileUploadLogMapper
.
insert
(
uploadLog
);
return
fileUpload
;
}
catch
(
Exception
e
)
{
uploadLog
.
setResponsJson
(
e
.
getMessage
());
fileUploadLogMapper
.
insert
(
uploadLog
);
logger
.
error
(
"uploadFile error."
,
e
);
}
finally
{
if
(
null
!=
httpClient
)
{
try
{
httpClient
.
close
();
}
catch
(
IOException
e
)
{
logger
.
error
(
"close httpClient error."
,
e
);
}
}
}
throw
new
ServiceException
(
"uploadFile error."
);
}
public
static
String
getFileMD5String
(
MultipartFile
file
)
throws
Exception
{
MessageDigest
messagedigest
=
MessageDigest
.
getInstance
(
"MD5"
);
messagedigest
.
update
(
file
.
getBytes
());
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/HttpFileService.java
View file @
38332bbe
...
...
@@ -2,21 +2,16 @@ package pwc.taxtech.atms.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.commons.io.Charsets
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.CharSet
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.Consts
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpHeaders
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.BasicHttpEntity
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.entity.mime.MultipartEntityBuilder
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -30,10 +25,6 @@ import pwc.taxtech.atms.exception.ServiceException;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* version 2.0
...
...
@@ -112,7 +103,14 @@ public class HttpFileService extends BaseService {
}
if
(
StringUtils
.
isNotBlank
(
config
.
getServerUrl
()))
{
CloseableHttpClient
client
=
HttpClients
.
createDefault
();
HttpGet
httpGet
=
new
HttpGet
(
StringUtils
.
appendIfMissing
(
config
.
getServerUrl
(),
"/"
)
+
filePath
);
//先判断下是否是全域名 全域名代表是didi服务器url
String
url
;
if
(
filePath
.
indexOf
(
"http"
)>=
0
){
url
=
filePath
;
}
else
{
url
=
StringUtils
.
appendIfMissing
(
config
.
getServerUrl
(),
"/"
)
+
filePath
;
}
HttpGet
httpGet
=
new
HttpGet
(
url
);
CloseableHttpResponse
response
=
null
;
try
{
response
=
client
.
execute
(
httpGet
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
View file @
38332bbe
...
...
@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.message.ErrorMessage;
import
pwc.taxtech.atms.common.message.TemplateMessage
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.CellDataSourceType
;
import
pwc.taxtech.atms.constant.enums.FileUploadEnum
;
import
pwc.taxtech.atms.constant.enums.TemplateGroupType
;
import
pwc.taxtech.atms.dao.CellTemplateConfigDao
;
import
pwc.taxtech.atms.dao.CellTemplateConfigMapper
;
...
...
@@ -38,6 +39,7 @@ import pwc.taxtech.atms.entity.TemplateGroup;
import
pwc.taxtech.atms.entity.TemplateGroupExample
;
import
pwc.taxtech.atms.exception.ServiceException
;
import
pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper
;
import
pwc.taxtech.atms.vat.entity.FileUpload
;
import
pwc.taxtech.atms.vat.entity.PeriodDataSource
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -68,7 +70,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
private
CellTemplateConfigDao
cellTemplateConfigDao
;
@Autowired
private
PeriodDataSourceMapper
periodDataSourceMapper
;
@Autowired
private
DidiFileUploadService
didiFileUploadService
;
public
List
<
TemplateGroupDto
>
get
()
{
List
<
TemplateGroup
>
templateGroups
=
templateGroupMapper
.
selectByExample
(
new
TemplateGroupExample
());
List
<
TemplateGroupDto
>
templateGroupDtos
=
new
ArrayList
<>();
...
...
@@ -221,19 +224,21 @@ public class TemplateGroupServiceImpl extends AbstractService {
}
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
optional
.
get
().
write
(
bos
);
String
tmpPath
=
httpFileService
.
uploadTemplate
(
newName
,
file
);
//上传didi服务器文件
FileUpload
fileUpload
=
didiFileUploadService
.
uploadFile
(
file
,
file
.
getOriginalFilename
(),
FileUploadEnum
.
BizSource
.
REPORT_TEMPLATE_UPLOAD
.
name
());
// String tmpPath = httpFileService.uploadTemplate(newName, file);
String
[]
arr
=
sheetName
.
split
(
"_"
);
String
name
=
arr
.
length
>=
2
?
arr
[
1
]
:
arr
[
0
];
Template
template
=
new
Template
();
template
.
setCode
(
arr
[
0
]);
template
.
setReportType
(
templateGroupDto
.
getReportType
());
template
.
setCreateTime
(
now
);
template
.
setId
(
distributedIdService
.
nextId
());
template
.
setIsActiveAssociation
(
true
);
template
.
setIsSystemType
(
false
);
template
.
setName
(
name
);
template
.
setOrderIndex
(
i
+
1
);
template
.
setPath
(
tmpPath
);
// template.setReportType(tmpPath);
template
.
setPath
(
fileUpload
.
getUid
());
template
.
setTemplateGroupId
(
templateGroupId
);
filePathList
.
add
(
template
);
templateMapper
.
insertSelective
(
template
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
View file @
38332bbe
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Lists
;
import
com.grapecity.documents.excel.C
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -13,12 +13,12 @@ import pwc.taxtech.atms.constant.enums.TemplateGroupType;
import
pwc.taxtech.atms.dpo.TemplateAndGroupDbDto
;
import
pwc.taxtech.atms.dpo.TemplateUniqDto
;
import
pwc.taxtech.atms.dto.*
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult
;
import
pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.vat.dao.PeriodReportMapper
;
import
pwc.taxtech.atms.vat.dao.PeriodTemplateMapper
;
import
pwc.taxtech.atms.vat.entity.PeriodReportExample
;
import
pwc.taxtech.atms.vat.entity.PeriodTemplateExample
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -31,6 +31,8 @@ public class TemplateServiceImpl extends AbstractService {
@Autowired
private
PeriodReportMapper
periodReportMapper
;
@Autowired
private
DidiFileUploadService
didiFileUploadService
;
public
void
addExistTemplate
(
TemplateAddExistDto
templateAddExistDto
){
TemplateExample
t
=
new
TemplateExample
();
t
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateAddExistDto
.
getTemplateGroupId
());
...
...
@@ -91,10 +93,20 @@ public class TemplateServiceImpl extends AbstractService {
List
<
Template
>
templates
=
templateMapper
.
selectByExample
(
example
);
List
<
TemplateDto
>
templateDtos
=
new
ArrayList
<>();
//从文件上传表转换path
DidiFileIUploadParam
fileParam
=
new
DidiFileIUploadParam
();
fileParam
.
setUuids
(
templates
.
stream
()
.
map
(
o
->
o
.
getPath
()).
collect
(
Collectors
.
toList
()));
PageInfo
<
DidiFileUploadDetailResult
>
uploadDetail
=
didiFileUploadService
.
queryPage
(
fileParam
);
Map
<
String
,
String
>
urlMap
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
uploadDetail
.
getList
())){
urlMap
=
uploadDetail
.
getList
().
stream
().
collect
(
Collectors
.
toMap
(
DidiFileUploadDetailResult:
:
getUid
,
didiFileUploadDetailResult
->
didiFileUploadDetailResult
.
getViewHttpUrl
()));
}
for
(
Template
template
:
templates
)
{
TemplateDto
dto
=
new
TemplateDto
();
CommonUtils
.
copyProperties
(
template
,
dto
);
dto
.
setId
(
template
.
getId
().
toString
());
dto
.
setPath
(
urlMap
.
get
(
template
.
getPath
()));
templateDtos
.
add
(
dto
);
}
return
templateDtos
;
...
...
@@ -111,6 +123,15 @@ public class TemplateServiceImpl extends AbstractService {
}
else
{
result
=
template
.
getPath
();
}
if
(
result
.
indexOf
(
"/"
)<=
0
){
DidiFileIUploadParam
fileParam
=
new
DidiFileIUploadParam
();
fileParam
.
setUuids
(
Arrays
.
asList
(
result
));
PageInfo
<
DidiFileUploadDetailResult
>
uploadDetail
=
didiFileUploadService
.
queryPage
(
fileParam
);
Map
<
String
,
String
>
urlMap
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
uploadDetail
.
getList
())){
result
=
uploadDetail
.
getList
().
get
(
0
).
getViewHttpUrl
();
}
}
}
return
result
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
38332bbe
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
...
...
@@ -17,10 +19,14 @@ import org.springframework.stereotype.Component;
import
pwc.taxtech.atms.common.POIUtil
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.enums.CellDataSourceType
;
import
pwc.taxtech.atms.constant.enums.FileUploadEnum
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult
;
import
pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto
;
import
pwc.taxtech.atms.dto.vatdto.PeriodResources
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.service.impl.DidiFileUploadService
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
import
pwc.taxtech.atms.service.impl.HttpFileService
;
import
pwc.taxtech.atms.vat.dao.*
;
...
...
@@ -28,9 +34,7 @@ import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.*
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.regex.Matcher
;
...
...
@@ -65,7 +69,8 @@ public class ReportGeneratorImpl {
private
DistributedIdService
distributedIdService
;
@Autowired
private
PeriodJobMapper
periodJobMapper
;
@Autowired
private
DidiFileUploadService
didiFileUploadService
;
public
FormulaContext
initContext
(
PeriodResources
resources
,
Integer
period
)
{
return
FormulaContext
.
extractContextFromProject
(
resources
.
getProject
()).
fixedFormula
(
period
,
resources
.
getTemplateGroupId
(),
...
...
@@ -466,6 +471,7 @@ public class ReportGeneratorImpl {
Workbook
tWorkbook
=
null
;
File
file
=
null
;
if
(
a
.
getIsSystemType
())
{
file
=
new
File
(
tempPath
+
a
.
getPath
());
try
{
tWorkbook
=
WorkbookFactory
.
create
(
file
);
...
...
@@ -477,7 +483,19 @@ public class ReportGeneratorImpl {
}
else
{
InputStream
is
=
null
;
try
{
is
=
httpFileService
.
getUserTemplate
(
a
.
getPath
());
String
path
=
""
;
if
(
a
.
getPath
().
indexOf
(
"/"
)
>
0
)
{
path
=
a
.
getPath
();
}
else
{
DidiFileIUploadParam
fileParam
=
new
DidiFileIUploadParam
();
fileParam
.
setUuids
(
Arrays
.
asList
(
a
.
getPath
()));
PageInfo
<
DidiFileUploadDetailResult
>
uploadDetail
=
didiFileUploadService
.
queryPage
(
fileParam
);
Map
<
String
,
String
>
urlMap
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
uploadDetail
.
getList
()))
{
path
=
uploadDetail
.
getList
().
get
(
0
).
getViewHttpUrl
();
}
}
is
=
httpFileService
.
getUserTemplate
(
path
);
tWorkbook
=
WorkbookFactory
.
create
(
is
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -491,7 +509,28 @@ public class ReportGeneratorImpl {
}
}
}
//TODO 当是税金计算表时动态添加行
if
(
"VAT8002"
.
equals
(
a
.
getCode
()))
{
tWorkbook
=
assembleTaxWorkBook
(
tWorkbook
);
//覆盖template地址
ByteArrayOutputStream
bout
=
new
ByteArrayOutputStream
();
try
{
tWorkbook
.
write
(
bout
);
FileUpload
fileUpload
=
didiFileUploadService
.
uploadFile
(
bout
.
toByteArray
(),
a
.
getCode
()
+
"_"
+
a
.
getName
()
+
".xlsx"
,
FileUploadEnum
.
BizSource
.
PERIOD_REPORT_TEMPLATE_UPLOAD
.
name
());
a
.
setPath
(
fileUpload
.
getUid
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
bout
.
close
();
}
catch
(
Exception
e
)
{
}
}
periodTemplateMapper
.
updateByPrimaryKey
(
a
);
}
POIUtil
.
cloneSheet
(
tWorkbook
.
getSheetAt
(
0
),
workbook
.
createSheet
(
a
.
getCode
()));
});
return
workbook
;
}
catch
(
Exception
e
)
{
...
...
@@ -503,6 +542,30 @@ public class ReportGeneratorImpl {
}
}
public
Workbook
assembleTaxWorkBook
(
Workbook
tWorkbook
)
{
Sheet
sheet
=
tWorkbook
.
getSheetAt
(
0
);
Row
row
=
POIUtil
.
createRow
(
sheet
,
3
);
Cell
cell
=
row
.
createCell
(
0
);
cell
.
setCellValue
(
"test"
);
return
tWorkbook
;
}
private
void
saveExcel
(
Workbook
wb
)
{
FileOutputStream
fileOut
;
try
{
fileOut
=
new
FileOutputStream
(
""
);
wb
.
write
(
fileOut
);
fileOut
.
close
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
/**
* 注册所有的自定义方法到工作簿
*
...
...
atms-web/src/main/webapp/app/admin/systemConfiguration/declarationFormConfiguration/declaration-form-configuration.ctrl.js
View file @
38332bbe
...
...
@@ -1825,6 +1825,7 @@ ng-show="hasEditPermission && ToggleSaveAs && editModel.hasModel"/>');
$scope
.
$apply
(
function
()
{
$scope
.
templateGroupModel
=
{};
$scope
.
templateGroupModel
.
reportTypeList
=
$scope
.
detailReportTypeList
$scope
.
templateGroupModel
.
serviceTypeID
=
$scope
.
curServiceTypeId
;
$scope
.
templateGroupModel
.
industryIDs
=
$scope
.
curIndustry
.
id
;
...
...
atms-web/src/main/webapp/app/common/controls/edit-templategroup-modal/edit-templategroup-modal.ctrl.js
View file @
38332bbe
...
...
@@ -453,13 +453,22 @@ controller('editTemplategroupModalController', ['$scope', '$log', '$translate',
newModel
:
function
()
{
var
editModel
=
$scope
.
objectModel
;
$scope
.
editModel
=
editModel
;
$scope
.
editModel
.
name
=
''
;
$scope
.
editModel
.
sheetSelectDxID
=
thisConstant
.
sheetSelectDxID
;
$scope
.
editModel
.
file
=
null
;
$scope
.
editModel
.
nameError
=
null
;
$scope
.
searchOptions
=
{
reportTypeOptions
:
{
displayExpr
:
'name'
,
valueExpr
:
'value'
,
bindingOptions
:
{
value
:
'editModel.reportType'
},
dataSource
:
$scope
.
objectModel
.
reportTypeList
.
dataSource
.
_array
}
};
$scope
.
editModel
.
reportTypeList
=
null
;
var
modalInstance
=
$uibModal
.
open
({
animation
:
false
,
ariaLabelledBy
:
'modal-title'
,
...
...
atms-web/src/main/webapp/app/common/controls/edit-templategroup-modal/edit-templategroup-modal.html
View file @
38332bbe
...
...
@@ -28,6 +28,15 @@
<
div
id
=
{{::
editModel
.
sheetSelectDxID
}}
><
/div
>
<
/div
>
<
/div
>
<
div
class
=
"form-group"
>
<
label
for
=
"telCode"
class
=
"col-sm-5 control-label"
><
span
class
=
"must-input"
>*<
/span>报表类型:</
label
>
<
div
class
=
"col-sm-5"
>
<
div
class
=
"tab-content-select reportType col-md-2"
dx
-
select
-
box
=
"searchOptions.reportTypeOptions"
>
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"form-group radio-wrapper"
>
<
label
for
=
"telCode"
class
=
"col-sm-4 normal-label"
>
<
input
type
=
"radio"
id
=
"allowManual"
><
span
>
允许手工录入
<
/span></
label
>
...
...
atms-web/src/main/webapp/app/common/controls/edit-templategroup-modal/edit-templategroup-modal.less
View file @
38332bbe
...
...
@@ -44,4 +44,28 @@
padding-right: 0px;
}
}
}
.form-group {
.tab-content-select {
margin-right: 10px;
outline: none;
display: inline-block;
&.industry {
width: 100px;
}
&.reportType {
width: 120px;
}
&.selectTemplateGroup {
width: 150px;
}
&.selectReport {
width: 150px;
}
}
}
\ 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