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
d772e68a
Commit
d772e68a
authored
Mar 16, 2019
by
chase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
税金计算表功能
parent
fb049e40
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
514 additions
and
180 deletions
+514
-180
POIUtil.java
atms-api/src/main/java/pwc/taxtech/atms/common/POIUtil.java
+85
-4
TaxesCalculateReportEnum.java
...taxtech/atms/constant/enums/TaxesCalculateReportEnum.java
+49
-0
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+14
-53
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+366
-123
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/POIUtil.java
View file @
d772e68a
...
@@ -2,14 +2,12 @@ package pwc.taxtech.atms.common;
...
@@ -2,14 +2,12 @@ package pwc.taxtech.atms.common;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.*
;
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.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.Iterator
;
import
java.util.Optional
;
import
java.util.Optional
;
public
class
POIUtil
{
public
class
POIUtil
{
...
@@ -119,6 +117,89 @@ public class POIUtil {
...
@@ -119,6 +117,89 @@ public class POIUtil {
return
row
;
return
row
;
}
}
public
static
Row
createAndCloneRow
(
Workbook
wb
,
Sheet
sheet
,
Integer
destRowIndex
,
Row
fromRow
)
{
Row
toRow
=
null
;
if
(
sheet
.
getRow
(
destRowIndex
)
!=
null
)
{
int
lastRowNo
=
sheet
.
getLastRowNum
();
sheet
.
shiftRows
(
destRowIndex
,
lastRowNo
,
1
);
}
toRow
=
sheet
.
createRow
(
destRowIndex
);
for
(
Iterator
cellIt
=
fromRow
.
cellIterator
();
cellIt
.
hasNext
();)
{
Cell
tmpCell
=
(
Cell
)
cellIt
.
next
();
Cell
newCell
=
toRow
.
createCell
(
tmpCell
.
getColumnIndex
());
copyCell
(
wb
,
tmpCell
,
newCell
,
false
);
}
return
toRow
;
}
public
static
void
copyCell
(
Workbook
wb
,
Cell
srcCell
,
Cell
distCell
,
boolean
copyValueFlag
)
{
CellStyle
newstyle
=
wb
.
createCellStyle
();
copyCellStyle
(
wb
,
srcCell
.
getCellStyle
(),
newstyle
);
if
(
srcCell
.
getColumnIndex
()==
7
){
newstyle
.
setLocked
(
false
);
}
// distCell.setEncoding(srcCell.getEncoding());
//样式
distCell
.
setCellStyle
(
newstyle
);
//评论
if
(
srcCell
.
getCellComment
()
!=
null
)
{
distCell
.
setCellComment
(
srcCell
.
getCellComment
());
}
// 不同数据类型处理
int
srcCellType
=
srcCell
.
getCellType
();
distCell
.
setCellType
(
srcCellType
);
if
(
copyValueFlag
)
{
if
(
srcCellType
==
Cell
.
CELL_TYPE_NUMERIC
)
{
if
(
DateUtil
.
isCellDateFormatted
(
srcCell
))
{
distCell
.
setCellValue
(
srcCell
.
getDateCellValue
());
}
else
{
distCell
.
setCellValue
(
srcCell
.
getNumericCellValue
());
}
}
else
if
(
srcCellType
==
Cell
.
CELL_TYPE_STRING
)
{
distCell
.
setCellValue
(
srcCell
.
getRichStringCellValue
());
}
else
if
(
srcCellType
==
Cell
.
CELL_TYPE_BLANK
)
{
// nothing21
}
else
if
(
srcCellType
==
Cell
.
CELL_TYPE_BOOLEAN
)
{
distCell
.
setCellValue
(
srcCell
.
getBooleanCellValue
());
}
else
if
(
srcCellType
==
Cell
.
CELL_TYPE_ERROR
)
{
distCell
.
setCellErrorValue
(
srcCell
.
getErrorCellValue
());
}
else
if
(
srcCellType
==
Cell
.
CELL_TYPE_FORMULA
)
{
distCell
.
setCellFormula
(
srcCell
.
getCellFormula
());
}
else
{
// nothing29
}
}
}
public
static
void
copyCellStyle
(
Workbook
wb
,
CellStyle
fromStyle
,
CellStyle
toStyle
)
{
toStyle
.
setAlignment
(
HorizontalAlignment
.
forInt
(
fromStyle
.
getAlignment
()));
//边框和边框颜色
toStyle
.
setBorderBottom
(
BorderStyle
.
valueOf
(
fromStyle
.
getBorderBottom
()));
toStyle
.
setBorderLeft
(
BorderStyle
.
valueOf
(
fromStyle
.
getBorderLeft
()));
toStyle
.
setBorderRight
(
BorderStyle
.
valueOf
(
fromStyle
.
getBorderRight
()));
toStyle
.
setBorderTop
(
BorderStyle
.
valueOf
(
fromStyle
.
getBorderTop
()));
toStyle
.
setTopBorderColor
(
fromStyle
.
getTopBorderColor
());
toStyle
.
setBottomBorderColor
(
fromStyle
.
getBottomBorderColor
());
toStyle
.
setRightBorderColor
(
fromStyle
.
getRightBorderColor
());
toStyle
.
setLeftBorderColor
(
fromStyle
.
getLeftBorderColor
());
//背景和前景
toStyle
.
setFillBackgroundColor
(
fromStyle
.
getFillBackgroundColor
());
toStyle
.
setFillForegroundColor
(
fromStyle
.
getFillForegroundColor
());
//
toStyle
.
setDataFormat
(
fromStyle
.
getDataFormat
());
toStyle
.
setFillPattern
(
FillPatternType
.
forInt
(
fromStyle
.
getFillPattern
()));
toStyle
.
setFont
(
wb
.
getFontAt
(
fromStyle
.
getFontIndex
()));
toStyle
.
setHidden
(
fromStyle
.
getHidden
());
toStyle
.
setIndention
(
fromStyle
.
getIndention
());
//首行缩进
toStyle
.
setLocked
(
fromStyle
.
getLocked
());
toStyle
.
setRotation
(
fromStyle
.
getRotation
());
//旋转
toStyle
.
setVerticalAlignment
(
VerticalAlignment
.
forInt
(
fromStyle
.
getVerticalAlignment
()));
toStyle
.
setWrapText
(
fromStyle
.
getWrapText
());
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/TaxesCalculateReportEnum.java
0 → 100644
View file @
d772e68a
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
TaxesCalculateReportEnum
{
public
enum
Column
{
Column_1
(
0
,
"序号"
),
Column_2
(
1
,
"收入类型名称"
),
Column_3
(
2
,
"税金项目"
),
Column_4
(
3
,
"账载收入-明细"
),
Column_5
(
4
,
"销项开票收入数-专票"
),
Column_6
(
5
,
"销项开票收入数-普票"
),
Column_7
(
6
,
"计税基数(应税收入)"
),
Column_8
(
7
,
"税率"
),
Column_9
(
8
,
"税额(元)"
),
Column_10
(
9
,
"收入类别"
),
Column_11
(
10
,
"计税方式"
),
Column_12
(
11
,
"备注"
)
;
private
Integer
index
;
private
String
name
;
public
static
final
Map
<
Integer
,
String
>
MAPPING
=
new
HashMap
<>();
Column
(
Integer
index
,
String
name
)
{
this
.
index
=
index
;
this
.
name
=
name
;
}
public
Integer
getIndex
()
{
return
index
;
}
public
String
getName
()
{
return
name
;
}
static
{
for
(
TaxesCalculateReportEnum
.
Column
accountType
:
TaxesCalculateReportEnum
.
Column
.
values
())
{
MAPPING
.
put
(
accountType
.
getIndex
(),
accountType
.
getName
());
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
d772e68a
...
@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
...
@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
import
pwc.taxtech.atms.common.POIUtil
;
import
pwc.taxtech.atms.common.POIUtil
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.enums.CellDataSourceType
;
import
pwc.taxtech.atms.constant.enums.CellDataSourceType
;
import
pwc.taxtech.atms.constant.enums.FileUploadEnum
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult
;
...
@@ -34,7 +33,10 @@ import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
...
@@ -34,7 +33,10 @@ import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.*
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.*
;
import
java.io.*
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
...
@@ -47,31 +49,32 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
...
@@ -47,31 +49,32 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component
@Component
public
class
ReportGeneratorImpl
{
public
class
ReportGeneratorImpl
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportGeneratorImpl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportGeneratorImpl
.
class
);
@
Autowired
@
Resource
private
ProjectMapper
projectMapper
;
private
ProjectMapper
projectMapper
;
@Autowired
@Autowired
private
HttpFileService
httpFileService
;
private
HttpFileService
httpFileService
;
@Autowired
@Autowired
private
FormulaAgent
formulaAgent
;
private
FormulaAgent
formulaAgent
;
@
Autowired
@
Resource
private
PeriodCellDataMapper
periodCellDataMapper
;
private
PeriodCellDataMapper
periodCellDataMapper
;
@
Autowired
@
Resource
private
PeriodFormulaBlockMapper
periodFormulaBlockMapper
;
private
PeriodFormulaBlockMapper
periodFormulaBlockMapper
;
@
Autowired
@
Resource
private
PeriodDataSourceMapper
periodDataSource
Mapper
;
private
RevenueConfigMapper
revenueConfig
Mapper
;
@
Autowired
@
Resource
private
PeriodCellTemplateConfigMapper
periodCellTemplateConfigMapper
;
private
PeriodCellTemplateConfigMapper
periodCellTemplateConfigMapper
;
@
Autowired
@
Resource
private
PeriodCellTemplateMapper
periodCellTemplateMapper
;
private
PeriodCellTemplateMapper
periodCellTemplateMapper
;
@
Autowired
@
Resource
private
PeriodTemplateMapper
periodTemplateMapper
;
private
PeriodTemplateMapper
periodTemplateMapper
;
@Autowired
@Autowired
private
DistributedIdService
distributedIdService
;
private
DistributedIdService
distributedIdService
;
@
Autowired
@
Resource
private
PeriodJobMapper
periodJobMapper
;
private
PeriodJobMapper
periodJobMapper
;
@Autowired
@Autowired
private
DidiFileUploadService
didiFileUploadService
;
private
DidiFileUploadService
didiFileUploadService
;
public
FormulaContext
initContext
(
PeriodResources
resources
,
Integer
period
)
{
public
FormulaContext
initContext
(
PeriodResources
resources
,
Integer
period
)
{
return
FormulaContext
.
extractContextFromProject
(
resources
.
getProject
()).
fixedFormula
(
period
,
resources
.
getTemplateGroupId
(),
return
FormulaContext
.
extractContextFromProject
(
resources
.
getProject
()).
fixedFormula
(
period
,
resources
.
getTemplateGroupId
(),
formulaAgent
);
formulaAgent
);
...
@@ -509,26 +512,7 @@ public class ReportGeneratorImpl {
...
@@ -509,26 +512,7 @@ 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
()));
POIUtil
.
cloneSheet
(
tWorkbook
.
getSheetAt
(
0
),
workbook
.
createSheet
(
a
.
getCode
()));
});
});
...
@@ -542,29 +526,6 @@ public class ReportGeneratorImpl {
...
@@ -542,29 +526,6 @@ 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-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
d772e68a
...
@@ -9,17 +9,20 @@ import com.google.common.collect.Sets;
...
@@ -9,17 +9,20 @@ import com.google.common.collect.Sets;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.FormulaEvaluator
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.
web.bind.annotation.RequestMapping
;
import
org.springframework.
transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.util.*
;
import
pwc.taxtech.atms.common.POIUtil
;
import
pwc.taxtech.atms.common.message.ErrorMessage
;
import
pwc.taxtech.atms.common.util.DataUtil
;
import
pwc.taxtech.atms.common.util.FileUploadUtil
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.dao.*
;
import
pwc.taxtech.atms.dao.*
;
...
@@ -27,24 +30,25 @@ import pwc.taxtech.atms.dpo.ReportDto;
...
@@ -27,24 +30,25 @@ import pwc.taxtech.atms.dpo.ReportDto;
import
pwc.taxtech.atms.dto.FileDto
;
import
pwc.taxtech.atms.dto.FileDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.ReportAttachDto
;
import
pwc.taxtech.atms.dto.ReportAttachDto
;
import
pwc.taxtech.atms.dto.revenuconf.RevenueConfResult
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam
;
import
pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.NotFoundException
;
import
pwc.taxtech.atms.exception.NotFoundException
;
import
pwc.taxtech.atms.service.impl.BaseService
;
import
pwc.taxtech.atms.exception.ServiceException
;
import
pwc.taxtech.atms.service.impl.CellConfigTranslater
;
import
pwc.taxtech.atms.service.impl.*
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
import
pwc.taxtech.atms.vat.dao.*
;
import
pwc.taxtech.atms.vat.dao.*
;
import
pwc.taxtech.atms.vat.dao.DataValidateLogMapper
;
import
pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto
;
import
pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto
;
import
pwc.taxtech.atms.vat.dpo.DataSourceExtendDto
;
import
pwc.taxtech.atms.vat.dpo.DataSourceExtendDto
;
import
pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto
;
import
pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.entity.DataValidateLog
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper
;
import
javax.annotation.Resource
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
...
@@ -60,69 +64,75 @@ public class ReportServiceImpl extends BaseService {
...
@@ -60,69 +64,75 @@ public class ReportServiceImpl extends BaseService {
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
private
BlockingQueue
<
PeriodJob
>
queue
=
new
LinkedBlockingQueue
<>();
private
BlockingQueue
<
PeriodJob
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
static
String
[]
functions
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"PC"
,
"JXFPMX"
,
private
final
static
String
[]
functions
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"PC"
,
"JXFPMX"
,
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"RSUMIF"
,
"TABLESUMIF"
,
"SUM"
};
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"RSUMIF"
,
"TABLESUMIF"
,
"SUM"
};
@Autowired
@Autowired
private
ReportGeneratorImpl
reportGenerator
;
private
ReportGeneratorImpl
reportGenerator
;
@
Autowired
@
Resource
private
PeriodTaxRuleSettingMapper
periodTaxRuleSettingMapper
;
private
PeriodTaxRuleSettingMapper
periodTaxRuleSettingMapper
;
@
Autowired
@
Resource
private
PeriodTaxPayerReportRuleMapper
periodTaxPayerReportRuleMapper
;
private
PeriodTaxPayerReportRuleMapper
periodTaxPayerReportRuleMapper
;
@
Autowired
@
Resource
private
PeriodEnterpriseAccountMapper
periodEnterpriseAccountMapper
;
private
PeriodEnterpriseAccountMapper
periodEnterpriseAccountMapper
;
@Autowired
@Autowired
private
InputVatInvoiceMapper
inputVATInvoiceMapper
;
private
InputVatInvoiceMapper
inputVATInvoiceMapper
;
@Autowired
@Autowired
private
OutputVatInvoiceMapper
outputVATInvoiceMapper
;
private
OutputVatInvoiceMapper
outputVATInvoiceMapper
;
@
Autowired
@
Resource
private
CustomsInvoiceMapper
customsInvoiceMapper
;
private
CustomsInvoiceMapper
customsInvoiceMapper
;
@
Autowired
@
Resource
private
PeriodCellDataSourceMapper
periodCellDataSourceMapper
;
private
PeriodCellDataSourceMapper
periodCellDataSourceMapper
;
@
Autowired
@
Resource
private
KeyValueConfigMapper
keyValueConfigMapper
;
private
KeyValueConfigMapper
keyValueConfigMapper
;
@
Autowired
@
Resource
private
PeriodModifiedReportCellMapper
periodModifiedReportCellMapper
;
private
PeriodModifiedReportCellMapper
periodModifiedReportCellMapper
;
@
Autowired
@
Resource
private
PeriodReportMapper
periodReportMapper
;
private
PeriodReportMapper
periodReportMapper
;
@
Autowired
@
Resource
private
EnterpriseAccountMapper
enterpriseAccountMapper
;
private
EnterpriseAccountMapper
enterpriseAccountMapper
;
@
Autowired
@
Resource
private
CellTemplateConfigMapper
cellTemplateConfigMapper
;
private
CellTemplateConfigMapper
cellTemplateConfigMapper
;
@
Autowired
@
Resource
private
CellTemplateMapper
cellTemplateMapper
;
private
CellTemplateMapper
cellTemplateMapper
;
@
Autowired
@
Resource
private
PeriodDataSourceDetailMapper
periodDataSourceDetailMapper
;
private
PeriodDataSourceDetailMapper
periodDataSourceDetailMapper
;
@
Autowired
@
Resource
private
PeriodDataSourceMapper
periodDataSourceMapper
;
private
PeriodDataSourceMapper
periodDataSourceMapper
;
@
Autowired
@
Resource
private
PeriodCellDataMapper
periodCellDataMapper
;
private
PeriodCellDataMapper
periodCellDataMapper
;
@
Autowired
@
Resource
private
PeriodFormulaBlockMapper
periodFormulaBlockMapper
;
private
PeriodFormulaBlockMapper
periodFormulaBlockMapper
;
@
Autowired
@
Resource
private
PeriodCellTemplateConfigMapper
periodCellTemplateConfigMapper
;
private
PeriodCellTemplateConfigMapper
periodCellTemplateConfigMapper
;
@
Autowired
@
Resource
private
PeriodCellTemplateMapper
periodCellTemplateMapper
;
private
PeriodCellTemplateMapper
periodCellTemplateMapper
;
@
Autowired
@
Resource
private
PeriodTemplateMapper
periodTemplateMapper
;
private
PeriodTemplateMapper
periodTemplateMapper
;
@
Autowired
@
Resource
private
TemplateMapper
templateMapper
;
private
TemplateMapper
templateMapper
;
@
Autowired
@
Resource
private
ProjectServiceTypeMapper
projectServiceTypeMapper
;
private
ProjectServiceTypeMapper
projectServiceTypeMapper
;
@
Autowired
@
Resource
private
TaxPayerReportRuleMapper
taxPayerReportRuleMapper
;
private
TaxPayerReportRuleMapper
taxPayerReportRuleMapper
;
@
Autowired
@
Resource
private
ProjectMapper
projectMapper
;
private
ProjectMapper
projectMapper
;
@
Autowired
@
Resource
private
DistributedIdService
distributedIdService
;
private
DistributedIdService
distributedIdService
;
@
Autowired
@
Resource
private
PeriodJobMapper
periodJobMapper
;
private
PeriodJobMapper
periodJobMapper
;
@
Autowired
@
Resource
private
PeriodApproveMapper
periodApprovalMapper
;
private
PeriodApproveMapper
periodApprovalMapper
;
@Resource
RevenueConfigMapper
revenueConfigMapper
;
@Autowired
private
HttpFileService
httpFileService
;
@Autowired
DidiFileUploadService
didiFileUploadService
;
public
OperationResultDto
<
List
<
ReportDto
>>
getFilterReportTemplate
(
String
projectId
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
public
OperationResultDto
<
List
<
ReportDto
>>
getFilterReportTemplate
(
String
projectId
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
OperationResultDto
<
List
<
ReportDto
>>
result
=
new
OperationResultDto
<>();
OperationResultDto
<
List
<
ReportDto
>>
result
=
new
OperationResultDto
<>();
CommonUtils
.
copyProperties
(
getReportTemplate
(
projectId
,
serviceType
,
periodParam
),
result
);
CommonUtils
.
copyProperties
(
getReportTemplate
(
projectId
,
serviceType
,
periodParam
),
result
);
if
(!
result
.
getResult
()
||
CollectionUtils
.
isEmpty
(
result
.
getData
()))
return
result
;
if
(!
result
.
getResult
()
||
CollectionUtils
.
isEmpty
(
result
.
getData
()))
return
result
;
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
periodTemplateExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
...
@@ -348,12 +358,187 @@ public class ReportServiceImpl extends BaseService {
...
@@ -348,12 +358,187 @@ public class ReportServiceImpl extends BaseService {
periodCellTemplateConfigList
.
add
(
periodCellTemplateConfig
);
periodCellTemplateConfigList
.
add
(
periodCellTemplateConfig
);
}
}
CommonUtils
.
subListWithLen
(
periodCellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
).
forEach
(
batch
->
{
CommonUtils
.
subListWithLen
(
periodCellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
).
forEach
(
batch
->
{
periodCellTemplateConfigMapper
.
batchInsert
(
batch
);
periodCellTemplateConfigMapper
.
batchInsert
(
batch
);
});
});
}
}
@Transactional
public
void
assemblePeriodTemplate
(
Template
template
,
Workbook
workbook
,
String
projectId
,
Integer
period
,
Integer
addRowIndex
)
throws
ServiceException
{
try
{
Date
now
=
new
Date
();
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
List
<
PeriodCellTemplate
>
cellTemplateList
=
Lists
.
newArrayList
();
List
<
PeriodCellTemplateConfig
>
cellTemplateConfigList
=
Lists
.
newArrayList
();
for
(
int
r
=
sheet
.
getFirstRowNum
();
r
<=
sheet
.
getLastRowNum
();
r
++)
{
Row
row
=
sheet
.
getRow
(
r
);
for
(
int
c
=
row
.
getFirstCellNum
();
c
<=
row
.
getLastCellNum
();
c
++)
{
Cell
cell
=
row
.
getCell
(
c
);
if
(
cell
==
null
)
{
continue
;
//todo cell == null 如何处理
}
//查询原来行cell是否有CellTemplate
CellTemplateExample
cellTemplateExample
=
new
CellTemplateExample
();
cellTemplateExample
.
createCriteria
().
andReportTemplateIdEqualTo
(
template
.
getId
()).
andRowIndexEqualTo
(
r
-
addRowIndex
).
andColumnIndexEqualTo
(
c
);
List
<
CellTemplate
>
cellTemplates
=
cellTemplateMapper
.
selectByExample
(
cellTemplateExample
);
if
(
CollectionUtils
.
isNotEmpty
(
cellTemplates
))
{
CellTemplate
cellTemplate
=
cellTemplates
.
get
(
0
);
PeriodCellTemplate
periodCellTemplate
=
new
PeriodCellTemplate
();
CommonUtils
.
copyProperties
(
cellTemplate
,
periodCellTemplate
);
periodCellTemplate
.
setId
(
distributedIdService
.
nextId
());
periodCellTemplate
.
setPeriod
(
period
);
periodCellTemplate
.
setReportTemplateId
(
template
.
getId
());
periodCellTemplate
.
setRowIndex
(
r
);
periodCellTemplate
.
setRowName
(
cellTemplate
.
getRowName
());
periodCellTemplate
.
setColumnIndex
(
c
);
periodCellTemplate
.
setColumnName
(
cellTemplate
.
getColumnName
());
periodCellTemplate
.
setComment
(
cellTemplate
.
getComment
());
periodCellTemplate
.
setCreateTime
(
cellTemplate
.
getCreateTime
());
periodCellTemplate
.
setUpdateTime
(
cellTemplate
.
getUpdateTime
());
periodCellTemplate
.
setCellTemplateId
(
cellTemplate
.
getId
());
periodCellTemplate
.
setDataType
(
cellTemplate
.
getDataType
());
periodCellTemplate
.
setIsReadOnly
(
cellTemplate
.
getIsReadOnly
()
?
1
:
0
);
periodCellTemplate
.
setCopyFromId
(
cellTemplate
.
getCopyFromId
());
periodCellTemplate
.
setCreateBy
(
StringUtils
.
isBlank
(
cellTemplate
.
getCreateBy
())
?
"admin"
:
cellTemplate
.
getCreateBy
());
periodCellTemplate
.
setUpdateBy
(
StringUtils
.
isBlank
(
cellTemplate
.
getUpdateBy
())
?
"admin"
:
cellTemplate
.
getUpdateBy
());
periodCellTemplate
.
setProjectId
(
projectId
);
cellTemplateList
.
add
(
periodCellTemplate
);
CellTemplateConfigExample
configExample
=
new
CellTemplateConfigExample
();
configExample
.
createCriteria
().
andCellTemplateIdEqualTo
(
cellTemplate
.
getId
());
List
<
CellTemplateConfig
>
configs
=
cellTemplateConfigMapper
.
selectByExample
(
configExample
);
if
(
CollectionUtils
.
isNotEmpty
(
configs
))
{
for
(
CellTemplateConfig
cellTemplateConfig
:
configs
)
{
PeriodCellTemplateConfig
periodCellTemplateConfig
=
new
PeriodCellTemplateConfig
();
CommonUtils
.
copyProperties
(
cellTemplateConfig
,
periodCellTemplateConfig
);
periodCellTemplateConfig
.
setId
(
distributedIdService
.
nextId
());
periodCellTemplateConfig
.
setPeriod
(
period
);
periodCellTemplateConfig
.
setCellTemplateId
(
cellTemplateConfig
.
getCellTemplateId
());
periodCellTemplateConfig
.
setReportTemplateId
(
template
.
getId
());
periodCellTemplateConfig
.
setDataSourceType
(
cellTemplateConfig
.
getDataSourceType
());
periodCellTemplateConfig
.
setFormula
(
StringUtils
.
isBlank
(
cellTemplateConfig
.
getFormula
())
?
null
:
cellTemplateConfig
.
getFormula
());
periodCellTemplateConfig
.
setParsedFormula
(
null
);
periodCellTemplateConfig
.
setFormulaDescription
(
cellTemplateConfig
.
getFormulaDescription
());
periodCellTemplateConfig
.
setAccountCodes
(
cellTemplateConfig
.
getAccountCodes
());
periodCellTemplateConfig
.
setInvoiceType
(
cellTemplateConfig
.
getInvoiceType
());
periodCellTemplateConfig
.
setTaxRate
(
cellTemplateConfig
.
getTaxRate
());
periodCellTemplateConfig
.
setInvoiceAmountType
(
cellTemplateConfig
.
getInvoiceAmountType
());
periodCellTemplateConfig
.
setModelIds
(
cellTemplateConfig
.
getModelIds
());
periodCellTemplateConfig
.
setCreateBy
(
StringUtils
.
isBlank
(
cellTemplateConfig
.
getCreateBy
())
?
"admin"
:
cellTemplateConfig
.
getCreateBy
());
periodCellTemplateConfig
.
setCreateTime
(
cellTemplateConfig
.
getCreateTime
());
periodCellTemplateConfig
.
setUpdateBy
(
StringUtils
.
isBlank
(
cellTemplateConfig
.
getUpdateBy
())
?
"admin"
:
cellTemplateConfig
.
getUpdateBy
());
periodCellTemplateConfig
.
setUpdateTime
(
cellTemplateConfig
.
getUpdateTime
());
periodCellTemplateConfig
.
setInvoiceCategory
(
cellTemplateConfig
.
getInvoiceCategory
());
periodCellTemplateConfig
.
setFormulaDataSource
(
cellTemplateConfig
.
getFormulaDataSource
());
periodCellTemplateConfig
.
setValidation
(
cellTemplateConfig
.
getValidation
());
periodCellTemplateConfig
.
setParsedValidation
(
null
);
periodCellTemplateConfig
.
setValidationDescription
(
cellTemplateConfig
.
getValidationDescription
());
periodCellTemplateConfig
.
setVoucherKeyword
(
cellTemplateConfig
.
getVoucherKeyword
());
periodCellTemplateConfig
.
setCellTemplateConfigId
(
cellTemplateConfig
.
getId
());
periodCellTemplateConfig
.
setKeyValueParsedFormula
(
null
);
periodCellTemplateConfig
.
setProjectId
(
projectId
);
fixedParsedFormula
(
periodCellTemplateConfig
);
fixedAccountCode
(
periodCellTemplateConfig
);
cellTemplateConfigList
.
add
(
periodCellTemplateConfig
);
}
}
}
else
{
Long
cellTemplateId
=
distributedIdService
.
nextId
();
PeriodCellTemplate
cellTemplate
=
new
PeriodCellTemplate
();
cellTemplate
.
setPeriod
(
period
);
cellTemplate
.
setProjectId
(
projectId
);
cellTemplate
.
setColumnIndex
(
c
);
cellTemplate
.
setCreateTime
(
now
);
cellTemplate
.
setCellTemplateId
(
cellTemplateId
);
cellTemplate
.
setUpdateTime
(
now
);
cellTemplate
.
setRowIndex
(
r
);
cellTemplate
.
setReportTemplateId
(
template
.
getId
());
cellTemplate
.
setId
(
distributedIdService
.
nextId
());
if
(
cell
.
getCellComment
()
!=
null
)
{
cellTemplate
.
setComment
(
cell
.
getCellComment
().
getString
().
getString
());
}
cellTemplate
.
setIsReadOnly
(
cell
.
getCellStyle
().
getLocked
()
?
1
:
0
);
cellTemplateList
.
add
(
cellTemplate
);
//todo: 这里没有Config数据只有在上传模板以后,在界面里面可以配置公式
if
(
hasKeyIn
(
cell
))
{
cell
.
setCellValue
(
StringUtils
.
EMPTY
);
addManualConfig
(
template
.
getId
(),
cell
,
now
,
cellTemplateConfigList
);
}
else
if
(!
cell
.
getCellStyle
().
getLocked
()
&&
StringUtils
.
isNotBlank
(
POIUtil
.
getCellFormulaString
(
cell
)))
{
PeriodCellTemplateConfig
periodCellTemplateConfig
=
new
PeriodCellTemplateConfig
();
periodCellTemplateConfig
.
setCellTemplateId
(
cellTemplateId
);
periodCellTemplateConfig
.
setId
(
distributedIdService
.
nextId
());
periodCellTemplateConfig
.
setPeriod
(
period
);
periodCellTemplateConfig
.
setCellTemplateId
(
cellTemplateId
);
periodCellTemplateConfig
.
setReportTemplateId
(
template
.
getId
());
periodCellTemplateConfig
.
setDataSourceType
(
1
);
periodCellTemplateConfig
.
setFormula
(
POIUtil
.
getCellFormulaString
(
cell
));
periodCellTemplateConfig
.
setParsedFormula
(
null
);
// periodCellTemplateConfig.setCreateBy(authUserHelper.getCurrentUserId());
periodCellTemplateConfig
.
setCreateTime
(
now
);
// periodCellTemplateConfig.setUpdateBy(authUserHelper.getCurrentUserId());
periodCellTemplateConfig
.
setUpdateTime
(
now
);
periodCellTemplateConfig
.
setFormulaDataSource
(
"报表数据"
);
periodCellTemplateConfig
.
setKeyValueParsedFormula
(
null
);
periodCellTemplateConfig
.
setProjectId
(
projectId
);
fixedParsedFormula
(
periodCellTemplateConfig
);
fixedAccountCode
(
periodCellTemplateConfig
);
cellTemplateConfigList
.
add
(
periodCellTemplateConfig
);
addManualConfig
(
template
.
getId
(),
cell
,
now
,
cellTemplateConfigList
);
}
}
}
}
List
<
List
<
PeriodCellTemplate
>>
tmpList
=
CommonUtils
.
subListWithLen
(
cellTemplateList
,
CommonUtils
.
BATCH_NUM
);
// tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
tmpList
.
forEach
(
list
->
periodCellTemplateMapper
.
batchInsert
(
list
));
//todo 批量插入优化
List
<
List
<
PeriodCellTemplateConfig
>>
tmpConfigList
=
CommonUtils
.
subListWithLen
(
cellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
);
tmpConfigList
.
forEach
(
list
->
periodCellTemplateConfigMapper
.
batchInsert
(
list
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"importTemplateExcelFile error."
,
e
);
throw
new
ServiceException
(
ErrorMessage
.
SystemError
);
}
}
private
void
addManualConfig
(
Long
templateId
,
Cell
cell
,
Date
now
,
List
<
PeriodCellTemplateConfig
>
list
)
{
PeriodCellTemplateConfig
configManual
=
new
PeriodCellTemplateConfig
();
configManual
.
setId
(
distributedIdService
.
nextId
());
// configManual.setCellTemplateId(cellTemplate.getId());
configManual
.
setReportTemplateId
(
templateId
);
configManual
.
setDataSourceType
(
CellDataSourceType
.
KeyIn
.
getCode
());
configManual
.
setFormula
(
POIUtil
.
getCellFormulaString
(
cell
));
// config.setFormula(cell.getCellFormula());
// configManual.setFormulaDataSource("报表数据"); //todo KV相关
configManual
.
setUpdateTime
(
now
);
// configManual.setUpdateBy(authUserHelper.getCurrentUserId());
list
.
add
(
configManual
);
}
/**
* 替换占位符
*
* @param cell cell
* @return Boolean
*/
private
Boolean
hasKeyIn
(
Cell
cell
)
{
if
(
null
==
cell
)
{
return
false
;
}
CellType
cellType
=
cell
.
getCellTypeEnum
();
if
(!
CellType
.
STRING
.
equals
(
cellType
))
{
return
false
;
}
String
v
=
cell
.
getStringCellValue
();
if
(
StringUtils
.
isBlank
(
v
))
{
return
false
;
}
return
StringUtils
.
equals
(
v
,
Constant
.
ReplaceKeyword
.
KEY_IN
);
}
private
void
fixedAccountCode
(
PeriodCellTemplateConfig
pctc
)
{
private
void
fixedAccountCode
(
PeriodCellTemplateConfig
pctc
)
{
if
(
StringUtils
.
isNotBlank
(
pctc
.
getAccountCodes
()))
{
if
(
StringUtils
.
isNotBlank
(
pctc
.
getAccountCodes
()))
{
...
@@ -434,7 +619,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -434,7 +619,7 @@ public class ReportServiceImpl extends BaseService {
periodCellTemplateList
.
add
(
periodCellTemplate
);
periodCellTemplateList
.
add
(
periodCellTemplate
);
}
}
CommonUtils
.
subListWithLen
(
periodCellTemplateList
,
CommonUtils
.
BATCH_NUM
).
forEach
(
batch
->
{
CommonUtils
.
subListWithLen
(
periodCellTemplateList
,
CommonUtils
.
BATCH_NUM
).
forEach
(
batch
->
{
periodCellTemplateMapper
.
batchInsert
(
batch
);
periodCellTemplateMapper
.
batchInsert
(
batch
);
});
});
...
@@ -472,21 +657,75 @@ public class ReportServiceImpl extends BaseService {
...
@@ -472,21 +657,75 @@ public class ReportServiceImpl extends BaseService {
periodTemplate
.
setCreateBy
(
StringUtils
.
isBlank
(
template
.
getCreateBy
())
?
"admin"
:
template
.
getCreateBy
());
periodTemplate
.
setCreateBy
(
StringUtils
.
isBlank
(
template
.
getCreateBy
())
?
"admin"
:
template
.
getCreateBy
());
periodTemplate
.
setUpdateBy
(
StringUtils
.
isBlank
(
template
.
getUpdateBy
())
?
"admin"
:
template
.
getUpdateBy
());
periodTemplate
.
setUpdateBy
(
StringUtils
.
isBlank
(
template
.
getUpdateBy
())
?
"admin"
:
template
.
getUpdateBy
());
periodTemplate
.
setProjectId
(
projectId
);
periodTemplate
.
setProjectId
(
projectId
);
//TODO 当是税金计算表时动态添加行
if
(
"VAT020"
.
equals
(
periodTemplate
.
getCode
()))
{
ByteArrayOutputStream
bout
=
new
ByteArrayOutputStream
();
InputStream
is
=
null
;
try
{
DidiFileIUploadParam
fileParam
=
new
DidiFileIUploadParam
();
fileParam
.
setUuids
(
Arrays
.
asList
(
periodTemplate
.
getPath
()));
PageInfo
<
DidiFileUploadDetailResult
>
uploadDetail
=
didiFileUploadService
.
queryPage
(
fileParam
);
Map
<
String
,
String
>
urlMap
=
null
;
is
=
httpFileService
.
getUserTemplate
(
uploadDetail
.
getList
().
get
(
0
).
getViewHttpUrl
());
Workbook
tWorkbook
=
WorkbookFactory
.
create
(
is
);
tWorkbook
=
assembleTaxWorkBook
(
template
,
tWorkbook
,
projectId
,
period
);
tWorkbook
.
write
(
bout
);
FileUpload
fileUpload
=
didiFileUploadService
.
uploadFile
(
bout
.
toByteArray
(),
template
.
getCode
()
+
"_"
+
template
.
getName
()
+
".xlsx"
,
FileUploadEnum
.
BizSource
.
PERIOD_REPORT_TEMPLATE_UPLOAD
.
name
());
periodTemplate
.
setPath
(
fileUpload
.
getUid
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
is
.
close
();
bout
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
else
{
copyPeriodCellTemplateFromCellTemplate
(
projectId
,
template
.
getId
(),
period
);
copyPeriodConfigFromCellTemplateConfig
(
projectId
,
template
.
getId
(),
period
);
}
periodTemplateList
.
add
(
periodTemplate
);
periodTemplateList
.
add
(
periodTemplate
);
copyPeriodCellTemplateFromCellTemplate
(
projectId
,
template
.
getId
(),
period
);
copyPeriodConfigFromCellTemplateConfig
(
projectId
,
template
.
getId
(),
period
);
}
}
periodTemplateMapper
.
batchInsert
(
periodTemplateList
);
periodTemplateMapper
.
batchInsert
(
periodTemplateList
);
}
}
public
Workbook
assembleTaxWorkBook
(
Template
template
,
Workbook
tWorkbook
,
String
projectId
,
Integer
period
)
{
Sheet
sheet
=
tWorkbook
.
getSheetAt
(
0
);
RevenueConfigExample
example
=
new
RevenueConfigExample
();
List
<
RevenueConfig
>
dataList
=
revenueConfigMapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
int
rowIndex
=
1
;
Row
sourceRow
=
sheet
.
getRow
(
3
);
for
(
RevenueConfig
config
:
dataList
)
{
Row
row
=
POIUtil
.
createAndCloneRow
(
tWorkbook
,
sheet
,
1
,
sourceRow
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_1
.
getIndex
()).
setCellValue
(
"1-"
+
rowIndex
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_2
.
getIndex
()).
setCellValue
(
""
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_3
.
getIndex
()).
setCellValue
(
config
.
getName
());
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_4
.
getIndex
()).
setCellValue
(
"YYYY-MM"
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_5
.
getIndex
()).
setCellValue
(
""
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_6
.
getIndex
()).
setCellValue
(
""
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_7
.
getIndex
()).
setCellValue
(
""
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_8
.
getIndex
()).
setCellValue
(
"BB(\"VAT005\",\"M\",8,0,0)"
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_9
.
getIndex
()).
setCellValue
(
config
.
getTaxRate
().
multiply
(
new
BigDecimal
(
100
)).
intValue
()
+
"%"
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_10
.
getIndex
()).
setCellValue
(
0
);
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_11
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
RevenueType
.
MAPPING
.
get
(
config
.
getRevenueType
()));
row
.
getCell
(
TaxesCalculateReportEnum
.
Column
.
Column_12
.
getIndex
()).
setCellValue
(
RevenueConfEnum
.
TaxType
.
MAPPING
.
get
(
config
.
getTaxType
()));
rowIndex
++;
}
}
assemblePeriodTemplate
(
template
,
tWorkbook
,
projectId
,
period
,
dataList
.
size
());
return
tWorkbook
;
}
public
OperationResultDto
generateData
(
String
projectId
,
EnumServiceType
serviceType
,
Boolean
isMergeManualData
,
public
OperationResultDto
generateData
(
String
projectId
,
EnumServiceType
serviceType
,
Boolean
isMergeManualData
,
Integer
periodParam
,
Integer
reportType
,
Optional
<
String
>
generator
)
{
Integer
periodParam
,
Integer
reportType
,
Optional
<
String
>
generator
)
{
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
MyAsserts
.
assertNull
(
periodJobMapper
.
getRunningJob
(
projectId
,
periodParam
),
Exceptions
.
TASK_HAS_BEGINNING
);
MyAsserts
.
assertNull
(
periodJobMapper
.
getRunningJob
(
projectId
,
periodParam
),
Exceptions
.
TASK_HAS_BEGINNING
);
String
status
=
periodApprovalMapper
.
getStatusByProjectIdAndPeriod
(
projectId
,
periodParam
);
String
status
=
periodApprovalMapper
.
getStatusByProjectIdAndPeriod
(
projectId
,
periodParam
);
MyAsserts
.
assertTrue
(
status
==
null
||
!
status
.
equals
(
Constant
.
APPROVAL_COMMITTED
),
Exceptions
.
REPORT_IN_PROCESS_OR_AGREED_EXCEPTION
);
MyAsserts
.
assertTrue
(
status
==
null
||
!
status
.
equals
(
Constant
.
APPROVAL_COMMITTED
),
Exceptions
.
REPORT_IN_PROCESS_OR_AGREED_EXCEPTION
);
try
{
try
{
...
@@ -495,7 +734,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -495,7 +734,7 @@ public class ReportServiceImpl extends BaseService {
return
operationResultDto
;
return
operationResultDto
;
}
}
List
<
Template
>
templates
=
getTemplatesByProjectId
(
projectId
);
List
<
Template
>
templates
=
getTemplatesByProjectId
(
projectId
);
List
<
String
>
dataValidateArray
=
new
ArrayList
<
String
>();
List
<
String
>
dataValidateArray
=
new
ArrayList
<
String
>();
/*dataValidateArray.add("DA001");
/*dataValidateArray.add("DA001");
dataValidateArray.add("DA002");
dataValidateArray.add("DA002");
dataValidateArray.add("DA003");*/
dataValidateArray.add("DA003");*/
...
@@ -509,7 +748,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -509,7 +748,7 @@ public class ReportServiceImpl extends BaseService {
try
{
try
{
updateConfig
(
projectId
,
periodParam
,
isMergeManualData
,
templates
,
genJob
);
updateConfig
(
projectId
,
periodParam
,
isMergeManualData
,
templates
,
genJob
);
//进行数据校验
//进行数据校验
DataValidation
(
periodParam
,
projectId
,
genJob
);
DataValidation
(
periodParam
,
projectId
,
genJob
);
PeriodResources
resources
=
reportGenerator
.
getPeriodResources
(
projectId
,
periodParam
,
PeriodResources
resources
=
reportGenerator
.
getPeriodResources
(
projectId
,
periodParam
,
templates
.
stream
().
map
(
Template:
:
getId
).
collect
(
Collectors
.
toList
()));
templates
.
stream
().
map
(
Template:
:
getId
).
collect
(
Collectors
.
toList
()));
...
@@ -522,12 +761,12 @@ public class ReportServiceImpl extends BaseService {
...
@@ -522,12 +761,12 @@ public class ReportServiceImpl extends BaseService {
evaluator
.
evaluateAll
();
evaluator
.
evaluateAll
();
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
isMergeManualData
,
genJob
);
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
isMergeManualData
,
genJob
);
setStatus
(
genJob
,
STATUS_END
);
setStatus
(
genJob
,
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
setStatus
(
genJob
,
STATUS_ERROR
);
setStatus
(
genJob
,
STATUS_ERROR
);
e
.
printStackTrace
();
e
.
printStackTrace
();
genJob
.
setErrorMsg
(
"Sever error "
+
e
.
getClass
().
getName
());
genJob
.
setErrorMsg
(
"Sever error "
+
e
.
getClass
().
getName
());
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
}
}
}
}
...
@@ -541,21 +780,23 @@ public class ReportServiceImpl extends BaseService {
...
@@ -541,21 +780,23 @@ public class ReportServiceImpl extends BaseService {
}
}
return
operationResultDto
;
return
operationResultDto
;
}
}
@Autowired
@Resource
private
TrialBalanceMapper
trialBalanceMapper
;
private
TrialBalanceMapper
trialBalanceMapper
;
@
Autowired
@
Resource
private
AdjustmentTableMapper
adjustmentTableMapper
;
private
AdjustmentTableMapper
adjustmentTableMapper
;
@
Autowired
@
Resource
private
ProfitLossStatementMapper
profitLossStatementMapper
;
private
ProfitLossStatementMapper
profitLossStatementMapper
;
@
Autowired
@
Resource
private
JournalEntryMapper
journalEntryMapper
;
private
JournalEntryMapper
journalEntryMapper
;
@Autowired
@Autowired
private
DataUtil
dataUtil
;
private
DataUtil
dataUtil
;
/* @Autowired
private CitJour*/
/* @Autowired
private CitJour*/
//数据校验
//数据校验
private
void
DataValidation
(
Integer
periodParam
,
String
projectId
,
PeriodJob
genJob
)
{
private
void
DataValidation
(
Integer
periodParam
,
String
projectId
,
PeriodJob
genJob
)
{
setStatus
(
genJob
,
"DA004"
,
STATUS_BEGIN
);
setStatus
(
genJob
,
"DA004"
,
STATUS_BEGIN
);
//本期余额表
//本期余额表
/* TrialBalanceExample trialBalanceExample = new TrialBalanceExample();
/* TrialBalanceExample trialBalanceExample = new TrialBalanceExample();
...
@@ -575,18 +816,18 @@ public class ReportServiceImpl extends BaseService {
...
@@ -575,18 +816,18 @@ public class ReportServiceImpl extends BaseService {
Map
<
String
,
Object
>
map1
=
new
HashedMap
();
Map
<
String
,
Object
>
map1
=
new
HashedMap
();
map1
.
put
(
"projectId"
,
projectId
);
map1
.
put
(
"projectId"
,
projectId
);
map1
.
put
(
"period"
,
periodParam
);
map1
.
put
(
"period"
,
periodParam
);
if
((
periodParam
+
""
).
length
()
==
1
)
{
if
((
periodParam
+
""
).
length
()
==
1
)
{
map1
.
put
(
"period"
,
"0"
+
periodParam
);
map1
.
put
(
"period"
,
"0"
+
periodParam
);
}
else
{
}
else
{
map1
.
put
(
"period"
,
""
+
periodParam
);
map1
.
put
(
"period"
,
""
+
periodParam
);
}
}
List
<
AdjustmentTable
>
adjustmentTables
=
adjustmentTableMapper
.
selectBeforeAdjustData
(
map1
);
List
<
AdjustmentTable
>
adjustmentTables
=
adjustmentTableMapper
.
selectBeforeAdjustData
(
map1
);
Map
<
String
,
Object
>
map2
=
new
HashedMap
();
Map
<
String
,
Object
>
map2
=
new
HashedMap
();
map2
.
put
(
"projectId"
,
projectId
);
map2
.
put
(
"projectId"
,
projectId
);
if
((
periodParam
+
""
).
length
()
==
1
)
{
if
((
periodParam
+
""
).
length
()
==
1
)
{
map2
.
put
(
"period"
,
"0"
+
periodParam
);
map2
.
put
(
"period"
,
"0"
+
periodParam
);
}
else
{
}
else
{
map2
.
put
(
"period"
,
""
+
periodParam
);
map2
.
put
(
"period"
,
""
+
periodParam
);
}
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -596,36 +837,36 @@ public class ReportServiceImpl extends BaseService {
...
@@ -596,36 +837,36 @@ public class ReportServiceImpl extends BaseService {
map
.
put
(
"companyCode"
,
mapProject
.
get
(
"code"
));
map
.
put
(
"companyCode"
,
mapProject
.
get
(
"code"
));
map
.
put
(
"companyName"
,
mapProject
.
get
(
"name"
));
map
.
put
(
"companyName"
,
mapProject
.
get
(
"name"
));
List
<
JournalEntry
>
journalEntries
=
journalEntryMapper
.
selectNowAdjustData
(
map2
);
List
<
JournalEntry
>
journalEntries
=
journalEntryMapper
.
selectNowAdjustData
(
map2
);
for
(
int
i
=
0
;
i
<
adjustmentTables
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
adjustmentTables
.
size
();
i
++)
{
for
(
int
j
=
0
;
j
<
journalEntries
.
size
();
j
++){
for
(
int
j
=
0
;
j
<
journalEntries
.
size
();
j
++)
{
JournalEntry
journalEntry
=
journalEntries
.
get
(
j
);
JournalEntry
journalEntry
=
journalEntries
.
get
(
j
);
AdjustmentTable
adjustmentTable
=
adjustmentTables
.
get
(
j
);
AdjustmentTable
adjustmentTable
=
adjustmentTables
.
get
(
j
);
if
(
journalEntry
.
getSegment3
().
equals
(
adjustmentTable
.
getSegment3
())
&&
if
(
journalEntry
.
getSegment3
().
equals
(
adjustmentTable
.
getSegment3
())
&&
journalEntry
.
getSegment5
().
equals
(
adjustmentTable
.
getSegment5
())&&
journalEntry
.
getSegment5
().
equals
(
adjustmentTable
.
getSegment5
())
&&
journalEntry
.
getSegment6
().
equals
(
adjustmentTable
.
getSegment6
())
&&
journalEntry
.
getPeriodJrMinDr
()
!=
adjustmentTable
.
getPeriodDrMixCr
()
){
journalEntry
.
getSegment6
().
equals
(
adjustmentTable
.
getSegment6
())
&&
journalEntry
.
getPeriodJrMinDr
()
!=
adjustmentTable
.
getPeriodDrMixCr
())
{
setStatus
(
genJob
,
STATUS_ERROR
);
setStatus
(
genJob
,
STATUS_ERROR
);
Constant
.
ReportDataValidateLog
reportDataValidateLog
=
new
Constant
.
ReportDataValidateLog
(
journalEntries
.
get
(
j
).
getSegment3
(),
journalEntries
.
get
(
j
).
getSegment5
(),
journalEntries
.
get
(
j
).
getSegment6
());
Constant
.
ReportDataValidateLog
reportDataValidateLog
=
new
Constant
.
ReportDataValidateLog
(
journalEntries
.
get
(
j
).
getSegment3
(),
journalEntries
.
get
(
j
).
getSegment5
(),
journalEntries
.
get
(
j
).
getSegment6
());
//记录校验结果
//记录校验结果
//
//
map
.
put
(
"result"
,
reportDataValidateLog
.
getResult
(
false
));
map
.
put
(
"result"
,
reportDataValidateLog
.
getResult
(
false
));
map
.
put
(
"validateResult"
,
"error"
);
map
.
put
(
"validateResult"
,
"error"
);
map
.
put
(
"tmsPeriod"
,
journalEntry
.
getTmsPeriod
());
map
.
put
(
"tmsPeriod"
,
journalEntry
.
getTmsPeriod
());
map
.
put
(
"organizationId"
,
journalEntry
.
getOrganizationId
());
map
.
put
(
"organizationId"
,
journalEntry
.
getOrganizationId
());
insertDataValidateResult
(
map
);
insertDataValidateResult
(
map
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
return
;
return
;
}
}
}
}
}
}
setStatus
(
genJob
,
STATUS_END
);
setStatus
(
genJob
,
STATUS_END
);
map
.
put
(
"validateResult"
,
"success"
);
map
.
put
(
"validateResult"
,
"success"
);
map
.
put
(
"result"
,
""
);
map
.
put
(
"result"
,
""
);
if
(
journalEntries
.
size
()==
0
)
{
if
(
journalEntries
.
size
()
==
0
)
{
map
.
put
(
"tmsPeriod"
,
0
);
map
.
put
(
"tmsPeriod"
,
0
);
}
else
{
}
else
{
map
.
put
(
"tmsPeriod"
,
journalEntries
.
get
(
0
).
getTmsPeriod
());
map
.
put
(
"tmsPeriod"
,
journalEntries
.
get
(
0
).
getTmsPeriod
());
}
}
map
.
put
(
"organizationId"
,
mapProject
.
get
(
"organizationId"
));
map
.
put
(
"organizationId"
,
mapProject
.
get
(
"organizationId"
));
...
@@ -637,16 +878,16 @@ public class ReportServiceImpl extends BaseService {
...
@@ -637,16 +878,16 @@ public class ReportServiceImpl extends BaseService {
@Autowired
@Autowired
private
DataValidateLogMapper
dataValidateLogMapper
;
private
DataValidateLogMapper
dataValidateLogMapper
;
public
void
insertDataValidateResult
(
Map
map
){
public
void
insertDataValidateResult
(
Map
map
)
{
DataValidateLog
dataValidateLog
=
new
DataValidateLog
();
DataValidateLog
dataValidateLog
=
new
DataValidateLog
();
dataValidateLog
.
setCreateTime
(
new
Date
());
dataValidateLog
.
setCreateTime
(
new
Date
());
dataValidateLog
.
setPeriod
((
Integer
)
map
.
get
(
"period"
));
dataValidateLog
.
setPeriod
((
Integer
)
map
.
get
(
"period"
));
dataValidateLog
.
setProjectId
((
String
)
map
.
get
(
"projectId"
));
dataValidateLog
.
setProjectId
((
String
)
map
.
get
(
"projectId"
));
dataValidateLog
.
setValidateResult
((
String
)
map
.
get
(
"validateResult"
));
dataValidateLog
.
setValidateResult
((
String
)
map
.
get
(
"validateResult"
));
dataValidateLog
.
setResult
((
String
)
map
.
get
(
"result"
));
dataValidateLog
.
setResult
((
String
)
map
.
get
(
"result"
));
dataValidateLog
.
setOrganizationId
((
String
)
map
.
get
(
"organizationId"
));
dataValidateLog
.
setOrganizationId
((
String
)
map
.
get
(
"organizationId"
));
dataValidateLog
.
setCompanyCode
((
String
)
map
.
get
(
"companyCode"
));
dataValidateLog
.
setCompanyCode
((
String
)
map
.
get
(
"companyCode"
));
dataValidateLog
.
setCompanyName
((
String
)
map
.
get
(
"companyName"
));
dataValidateLog
.
setCompanyName
((
String
)
map
.
get
(
"companyName"
));
dataValidateLog
.
setTmsPeriod
((
Integer
)
map
.
get
(
"tmsPeriod"
));
dataValidateLog
.
setTmsPeriod
((
Integer
)
map
.
get
(
"tmsPeriod"
));
dataValidateLogMapper
.
insert
(
dataValidateLog
);
dataValidateLogMapper
.
insert
(
dataValidateLog
);
}
}
...
@@ -776,7 +1017,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -776,7 +1017,7 @@ public class ReportServiceImpl extends BaseService {
dataSourceDto
.
setDataSourceType
(
CellDataSourceType
.
InputInvoice
.
getCode
());
dataSourceDto
.
setDataSourceType
(
CellDataSourceType
.
InputInvoice
.
getCode
());
}
else
if
(
a
.
getType
().
equals
(
FormulaDataSourceType
.
Voucher
.
getCode
()))
{
}
else
if
(
a
.
getType
().
equals
(
FormulaDataSourceType
.
Voucher
.
getCode
()))
{
dataSourceDto
.
setDataSourceType
(
CellDataSourceType
.
Voucher
.
getCode
());
dataSourceDto
.
setDataSourceType
(
CellDataSourceType
.
Voucher
.
getCode
());
}
else
if
(
a
.
getType
().
equals
(
FormulaDataSourceType
.
OutputInvoice
.
getCode
()))
{
}
else
if
(
a
.
getType
().
equals
(
FormulaDataSourceType
.
OutputInvoice
.
getCode
()))
{
dataSourceDto
.
setDataSourceType
(
CellDataSourceType
.
OutputInvoice
.
getCode
());
dataSourceDto
.
setDataSourceType
(
CellDataSourceType
.
OutputInvoice
.
getCode
());
}
else
{
}
else
{
dataSourceDto
.
setDataSourceType
(
0
);
dataSourceDto
.
setDataSourceType
(
0
);
...
@@ -817,12 +1058,12 @@ public class ReportServiceImpl extends BaseService {
...
@@ -817,12 +1058,12 @@ public class ReportServiceImpl extends BaseService {
if
(
z
.
getItem2
().
getItems
()
!=
null
&&
!
z
.
getItem2
().
getItems
().
isEmpty
()
&&
z
.
getItem2
().
getItems
().
get
(
0
).
contains
(
"tag"
))
{
if
(
z
.
getItem2
().
getItems
()
!=
null
&&
!
z
.
getItem2
().
getItems
().
isEmpty
()
&&
z
.
getItem2
().
getItems
().
get
(
0
).
contains
(
"tag"
))
{
z
.
getItem2
().
getItems
().
forEach
(
m
->
{
z
.
getItem2
().
getItems
().
forEach
(
m
->
{
ReportCellDataSourceDto
dto
=
JSON
.
parseObject
(
m
,
ReportCellDataSourceDto
.
class
);
ReportCellDataSourceDto
dto
=
JSON
.
parseObject
(
m
,
ReportCellDataSourceDto
.
class
);
if
(
dto
!=
null
&&
dto
.
getReportTemplateId
()
!=
null
&&
!
Pattern
.
compile
(
"\\D"
).
matcher
(
dto
.
getReportTemplateId
()).
find
())
{
if
(
dto
!=
null
&&
dto
.
getReportTemplateId
()
!=
null
&&
!
Pattern
.
compile
(
"\\D"
).
matcher
(
dto
.
getReportTemplateId
()).
find
())
{
PeriodTemplateExample
periodTemplateExample1
=
new
PeriodTemplateExample
();
PeriodTemplateExample
periodTemplateExample1
=
new
PeriodTemplateExample
();
periodTemplateExample1
.
createCriteria
().
andTemplateIdEqualTo
(
Long
.
parseLong
(
dto
.
getReportTemplateId
()))
periodTemplateExample1
.
createCriteria
().
andTemplateIdEqualTo
(
Long
.
parseLong
(
dto
.
getReportTemplateId
()))
.
andPeriodEqualTo
(
report
.
getPeriod
());
.
andPeriodEqualTo
(
report
.
getPeriod
());
Optional
<
PeriodTemplate
>
optional
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample1
).
stream
().
findFirst
();
Optional
<
PeriodTemplate
>
optional
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample1
).
stream
().
findFirst
();
if
(
optional
.
isPresent
())
{
if
(
optional
.
isPresent
())
{
dto
.
setReportName
(
optional
.
get
().
getName
());
dto
.
setReportName
(
optional
.
get
().
getName
());
}
}
}
}
...
@@ -1016,12 +1257,12 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1016,12 +1257,12 @@ public class ReportServiceImpl extends BaseService {
data
.
setCellId
(
cellData
.
getId
());
data
.
setCellId
(
cellData
.
getId
());
}
else
{
}
else
{
PeriodCellData
cellData
=
periodCellDataMapper
.
selectByPrimaryKey
(
data
.
getCellId
());
PeriodCellData
cellData
=
periodCellDataMapper
.
selectByPrimaryKey
(
data
.
getCellId
());
if
(
StringUtils
.
isNotBlank
(
data
.
getKeyinData
()))
{
if
(
StringUtils
.
isNotBlank
(
data
.
getKeyinData
()))
{
cellData
.
setKeyinData
(
data
.
getKeyinData
());
cellData
.
setKeyinData
(
data
.
getKeyinData
());
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
()))
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
()))
cellData
.
setFormulaExp
(
data
.
getKeyinData
());
cellData
.
setFormulaExp
(
data
.
getKeyinData
());
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
else
if
(
data
.
getAmount
()
!=
null
&&
cellData
.
getData
()
!=
data
.
getAmount
().
toString
())
{
}
else
if
(
data
.
getAmount
()
!=
null
&&
cellData
.
getData
()
!=
data
.
getAmount
().
toString
())
{
cellData
.
setData
(
data
.
getAmount
().
toString
());
cellData
.
setData
(
data
.
getAmount
().
toString
());
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
()))
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
()))
cellData
.
setFormulaExp
(
data
.
getAmount
().
toString
());
cellData
.
setFormulaExp
(
data
.
getAmount
().
toString
());
...
@@ -1042,7 +1283,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1042,7 +1283,7 @@ public class ReportServiceImpl extends BaseService {
PeriodDataSource
dataSourceModel
=
null
;
PeriodDataSource
dataSourceModel
=
null
;
if
(
dataSourceExtendDtos
.
size
()
>
0
)
{
if
(
dataSourceExtendDtos
.
size
()
>
0
)
{
dataSourceModel
=
dataSourceExtendDtos
.
get
(
0
).
getDataSource
();
dataSourceModel
=
dataSourceExtendDtos
.
get
(
0
).
getDataSource
();
if
(
StringUtils
.
isBlank
(
data
.
getKeyinData
()))
if
(
StringUtils
.
isBlank
(
data
.
getKeyinData
()))
updateCellValueForDataSourceChange
(
dataSourceModel
,
data
.
getAmount
());
updateCellValueForDataSourceChange
(
dataSourceModel
,
data
.
getAmount
());
originalAmount
=
dataSourceModel
.
getAmount
()
!=
null
?
dataSourceModel
.
getAmount
()
:
new
BigDecimal
(
"0"
);
originalAmount
=
dataSourceModel
.
getAmount
()
!=
null
?
dataSourceModel
.
getAmount
()
:
new
BigDecimal
(
"0"
);
dataSourceModel
.
setName
(
data
.
getName
());
dataSourceModel
.
setName
(
data
.
getName
());
...
@@ -1124,7 +1365,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1124,7 +1365,7 @@ public class ReportServiceImpl extends BaseService {
dataSource
.
setUpdateTime
(
new
Date
());
dataSource
.
setUpdateTime
(
new
Date
());
periodDataSourceMapper
.
updateByPrimaryKeySelective
(
dataSource
);
periodDataSourceMapper
.
updateByPrimaryKeySelective
(
dataSource
);
if
(!
cellData
.
getData
().
equals
(
"#VALUE!"
))
{
if
(!
cellData
.
getData
().
equals
(
"#VALUE!"
))
{
if
(
StringUtils
.
isBlank
(
cellData
.
getData
()))
cellData
.
setData
(
"0"
);
if
(
StringUtils
.
isBlank
(
cellData
.
getData
()))
cellData
.
setData
(
"0"
);
cellData
.
setData
(
new
BigDecimal
(
cellData
.
getData
()).
add
(
changeValue
).
toString
());
cellData
.
setData
(
new
BigDecimal
(
cellData
.
getData
()).
add
(
changeValue
).
toString
());
}
else
{
}
else
{
cellData
.
setData
(
new
BigDecimal
(
"0.0"
).
add
(
changeValue
).
toString
());
cellData
.
setData
(
new
BigDecimal
(
"0.0"
).
add
(
changeValue
).
toString
());
...
@@ -1132,7 +1373,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1132,7 +1373,7 @@ public class ReportServiceImpl extends BaseService {
//cellData.setFormulaExp(cellData.getData());
//cellData.setFormulaExp(cellData.getData());
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setUpdateTime
(
new
Date
());
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
else
if
(
dataSource
.
getDescription
().
equals
(
cellName
)
&&
StringUtils
.
isNotBlank
(
data
.
getKeyinData
()))
{
}
else
if
(
dataSource
.
getDescription
().
equals
(
cellName
)
&&
StringUtils
.
isNotBlank
(
data
.
getKeyinData
()))
{
dataSource
.
setKeyinData
(
data
.
getKeyinData
());
dataSource
.
setKeyinData
(
data
.
getKeyinData
());
dataSource
.
setUpdateBy
(
"admin"
);
dataSource
.
setUpdateBy
(
"admin"
);
dataSource
.
setUpdateTime
(
new
Date
());
dataSource
.
setUpdateTime
(
new
Date
());
...
@@ -1259,7 +1500,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1259,7 +1500,7 @@ public class ReportServiceImpl extends BaseService {
operationResultDto
.
setResult
(
false
);
operationResultDto
.
setResult
(
false
);
return
operationResultDto
;
return
operationResultDto
;
}
}
if
(
StringUtils
.
isEmpty
(
datasourceEntity
.
getKeyinData
()))
if
(
StringUtils
.
isEmpty
(
datasourceEntity
.
getKeyinData
()))
updateCellValueForDataSourceChange
(
datasourceEntity
,
dataSource
.
getAmount
());
updateCellValueForDataSourceChange
(
datasourceEntity
,
dataSource
.
getAmount
());
periodDataSourceMapper
.
updateByPrimaryKeySelective
(
datasourceEntity
);
periodDataSourceMapper
.
updateByPrimaryKeySelective
(
datasourceEntity
);
//todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater);
//todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater);
...
@@ -1421,31 +1662,32 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1421,31 +1662,32 @@ public class ReportServiceImpl extends BaseService {
}
}
public
OperationResultDto
doUploadAttach
(
MultipartFile
file
,
String
remarks
){
public
OperationResultDto
doUploadAttach
(
MultipartFile
file
,
String
remarks
)
{
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
try
{
try
{
FileDto
fileDto
=
new
FileDto
();
FileDto
fileDto
=
new
FileDto
();
int
i
=
file
.
getOriginalFilename
().
lastIndexOf
(
"."
);
int
i
=
file
.
getOriginalFilename
().
lastIndexOf
(
"."
);
fileDto
.
setFileName
(
file
.
getOriginalFilename
());
fileDto
.
setFileName
(
file
.
getOriginalFilename
());
if
(
remarks
!=
null
)
{
if
(
remarks
!=
null
)
{
fileDto
.
setRemarks
(
remarks
);
fileDto
.
setRemarks
(
remarks
);
}
}
fileDto
.
setFileUrl
(
FileUploadUtil
.
upload
(
file
,
true
));
fileDto
.
setFileUrl
(
FileUploadUtil
.
upload
(
file
,
true
));
//绑定
//绑定
fileDto
.
setSize
(
String
.
valueOf
(
file
.
getSize
()/
1024
)
+
"KB"
);
fileDto
.
setSize
(
String
.
valueOf
(
file
.
getSize
()
/
1024
)
+
"KB"
);
fileDto
.
setUploadUser
(
authUserHelper
.
getCurrentAuditor
().
get
());
fileDto
.
setUploadUser
(
authUserHelper
.
getCurrentAuditor
().
get
());
fileDto
.
setCreateTime
(
new
Date
());
fileDto
.
setCreateTime
(
new
Date
());
operationResultDto
.
setData
(
fileDto
);
operationResultDto
.
setData
(
fileDto
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
operationResultDto
.
setResultMsg
(
"error"
);
operationResultDto
.
setResultMsg
(
"error"
);
}
}
return
operationResultDto
;
return
operationResultDto
;
}
}
@Autowired
@Autowired
private
PwcReportAttachMapper
pwcReportAttachMapper
;
private
PwcReportAttachMapper
pwcReportAttachMapper
;
public
void
bindPwcAttach
(
Long
activeCol
,
Long
activeRow
,
String
activeTemplateId
,
FileDto
file
)
{
public
void
bindPwcAttach
(
Long
activeCol
,
Long
activeRow
,
String
activeTemplateId
,
FileDto
file
)
{
PwcReportAttach
pwcReportAttach
=
new
PwcReportAttach
();
PwcReportAttach
pwcReportAttach
=
new
PwcReportAttach
();
pwcReportAttach
.
setCol
(
activeCol
);
pwcReportAttach
.
setCol
(
activeCol
);
...
@@ -1471,11 +1713,12 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1471,11 +1713,12 @@ public class ReportServiceImpl extends BaseService {
example
.
setOrderByClause
(
"create_time DESC"
);
example
.
setOrderByClause
(
"create_time DESC"
);
/* PageInfo<PwcReportAttach> pageInfo = new PageInfo<PwcReportAttach>();
/* PageInfo<PwcReportAttach> pageInfo = new PageInfo<PwcReportAttach>();
pageInfo.setTotal(page.getTotal());*/
pageInfo.setTotal(page.getTotal());*/
return
pwcReportAttachMapper
.
selectByExample
(
example
);
return
pwcReportAttachMapper
.
selectByExample
(
example
);
}
}
/**
/**
* 删除附件
* 删除附件
*
* @param id
* @param id
* @return
* @return
*/
*/
...
@@ -1484,9 +1727,9 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1484,9 +1727,9 @@ public class ReportServiceImpl extends BaseService {
OperationResultDto
<
Object
>
objectOperationResultDto
=
new
OperationResultDto
<>();
OperationResultDto
<
Object
>
objectOperationResultDto
=
new
OperationResultDto
<>();
example
.
createCriteria
().
andIdEqualTo
(
id
);
example
.
createCriteria
().
andIdEqualTo
(
id
);
int
i
=
pwcReportAttachMapper
.
deleteByExample
(
example
);
int
i
=
pwcReportAttachMapper
.
deleteByExample
(
example
);
if
(
i
>
0
)
{
if
(
i
>
0
)
{
objectOperationResultDto
.
setResultMsg
(
"success"
);
objectOperationResultDto
.
setResultMsg
(
"success"
);
}
}
return
objectOperationResultDto
;
return
objectOperationResultDto
;
}
}
}
}
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