Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fulixin
dsk-operate-sys-cscec
Commits
abc41225
Commit
abc41225
authored
Feb 27, 2024
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/V20231129-中建一局二公司' into V20231129-中建一局二公司
parents
02f7aa3e
1cde5845
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
372 additions
and
31 deletions
+372
-31
CbSceneExpenseConstants.java
.../java/com/dsk/cscec/constant/CbSceneExpenseConstants.java
+27
-0
CbSceneExpenseChildrenController.java
...sk/cscec/controller/CbSceneExpenseChildrenController.java
+34
-3
CbSceneExpenseChildren.java
...ain/java/com/dsk/cscec/domain/CbSceneExpenseChildren.java
+40
-24
CbSceneExpenseChildrenDataBo.java
...com/dsk/cscec/domain/bo/CbSceneExpenseChildrenDataBo.java
+24
-0
CbSceneExpenseChildrenImportBo.java
...m/dsk/cscec/domain/bo/CbSceneExpenseChildrenImportBo.java
+31
-0
CbSceneExpenseChildrenService.java
.../com/dsk/cscec/service/CbSceneExpenseChildrenService.java
+27
-0
CbProjectRecordServiceImpl.java
...om/dsk/cscec/service/impl/CbProjectRecordServiceImpl.java
+4
-4
CbSceneExpenseChildrenServiceImpl.java
...cscec/service/impl/CbSceneExpenseChildrenServiceImpl.java
+185
-0
No files found.
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/constant/CbSceneExpenseConstants.java
0 → 100644
View file @
abc41225
package
com
.
dsk
.
cscec
.
constant
;
/**
* 二期项目常量信息
*
* @author sxk
* @date 2024.02.05
* @time 15:29
*/
public
interface
CbSceneExpenseConstants
{
/**
* 菜单来源:文件表
*/
Integer
MENU_SOURCE_FILE_TABLE
=
0
;
/**
* 菜单来源:财务一体化系统
*/
Integer
MENU_SOURCE_FINANCE_SYSTEM
=
1
;
/**
* 菜单层级一级(顶级)
*/
Integer
MENU_LEVEL1
=
1
;
/**
* 菜单层级二级
*/
Integer
MENU_LEVEL2
=
2
;
}
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/controller/CbSceneExpenseChildrenController.java
View file @
abc41225
package
com
.
dsk
.
cscec
.
controller
;
package
com
.
dsk
.
cscec
.
controller
;
import
com.dsk.common.core.controller.BaseController
;
import
com.dsk.common.core.controller.BaseController
;
import
com.dsk.common.core.domain.R
;
import
com.dsk.common.helper.LoginHelper
;
import
com.dsk.cscec.domain.CbSceneExpenseChildren
;
import
com.dsk.cscec.domain.bo.CbSceneExpenseChildrenDataBo
;
import
com.dsk.cscec.domain.vo.CbSceneExpenseMenuVo
;
import
com.dsk.cscec.service.CbSceneExpenseChildrenService
;
import
com.dsk.cscec.service.CbSceneExpenseChildrenService
;
import
org.springframework.
web.bind.annotation.RequestMapping
;
import
org.springframework.
validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.
RestController
;
import
org.springframework.web.bind.annotation.
*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)表控制层
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)表控制层
...
@@ -22,6 +30,29 @@ public class CbSceneExpenseChildrenController extends BaseController {
...
@@ -22,6 +30,29 @@ public class CbSceneExpenseChildrenController extends BaseController {
@Resource
@Resource
private
CbSceneExpenseChildrenService
baseService
;
private
CbSceneExpenseChildrenService
baseService
;
/**
* 获取现场经费菜单
*/
@GetMapping
(
"/getMenuList/{projectId}"
)
public
R
<
List
<
CbSceneExpenseMenuVo
>>
getMenuList
(
@NotNull
(
message
=
"项目ID不能为空"
)
@PathVariable
Long
projectId
)
{
return
R
.
ok
(
baseService
.
getMenuList
(
projectId
));
}
}
/**
* 现场经费二级分类数据解析
*/
@GetMapping
(
"/parseChildrenData/{projectId}"
)
public
R
<
Void
>
parseSceneExpenseChildrenData
(
@PathVariable
Long
projectId
)
throws
Exception
{
String
username
=
Objects
.
requireNonNull
(
LoginHelper
.
getLoginUser
()).
getUsername
();
baseService
.
parseSceneExpenseChildrenData
(
projectId
,
1
,
username
);
return
R
.
ok
();
}
/**
* 获取现场经费二级分类数据
*/
@GetMapping
(
"/getChildrenData"
)
public
R
<
List
<
CbSceneExpenseChildren
>>
getChildrenData
(
@Validated
@RequestBody
CbSceneExpenseChildrenDataBo
childrenDataBo
)
{
return
R
.
ok
(
baseService
.
getChildrenData
(
childrenDataBo
));
}
}
\ No newline at end of file
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/domain/CbSceneExpenseChildren.java
View file @
abc41225
package
com
.
dsk
.
cscec
.
domain
;
package
com
.
dsk
.
cscec
.
domain
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.dsk.common.
core.domain.BaseEntity
;
import
com.dsk.common.
annotation.Excel
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)实体类
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)实体类
...
@@ -14,9 +16,8 @@ import java.io.Serializable;
...
@@ -14,9 +16,8 @@ import java.io.Serializable;
* @author sxk
* @author sxk
* @since 2024-02-22 09:59:00
* @since 2024-02-22 09:59:00
*/
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Data
public
class
CbSceneExpenseChildren
extends
BaseEntity
implements
Serializable
{
public
class
CbSceneExpenseChildren
implements
Serializable
{
private
static
final
long
serialVersionUID
=
895279707061984760L
;
private
static
final
long
serialVersionUID
=
895279707061984760L
;
/**
/**
* 主键ID
* 主键ID
...
@@ -28,64 +29,73 @@ public class CbSceneExpenseChildren extends BaseEntity implements Serializable {
...
@@ -28,64 +29,73 @@ public class CbSceneExpenseChildren extends BaseEntity implements Serializable {
*/
*/
private
Long
projectId
;
private
Long
projectId
;
/**
/**
*
成本阶段(0:标前成本、1:标后成本、2:转固成本)
*
项目文件ID
*/
*/
private
Integer
cbStage
;
private
Long
projectFileId
;
/**
* 父级ID
*/
private
Long
parentId
;
/**
/**
* 序号
* 序号
*/
*/
@Excel
(
name
=
"序号"
)
private
String
number
;
private
String
number
;
/**
* 排序
*/
private
Integer
sort
;
/**
* 数据类型(0:工资统筹、1:现场管理费、2:其他费用)
*/
private
Integer
dataType
;
/**
/**
* 名称
* 名称
*/
*/
@Excel
(
name
=
"名称"
)
private
String
expenseName
;
private
String
expenseName
;
/**
/**
* 单位
* 单位
*/
*/
@Excel
(
name
=
"单位"
)
private
String
unit
;
private
String
unit
;
/**
/**
* 成本数量-工资统筹表
* 成本数量-工资统筹表
*/
*/
private
Integer
cbCount
;
@Excel
(
name
=
"成本数量"
)
private
String
cbCount
;
/**
/**
* 使用时间-其他费用表
* 使用时间-其他费用表
*/
*/
private
Integer
useTime
;
@Excel
(
name
=
"使用时间"
)
private
String
useTime
;
/**
/**
* 工程量-现场管理费表
* 工程量-现场管理费表
*/
*/
@Excel
(
name
=
"工程量"
)
private
String
engineeringVolume
;
private
String
engineeringVolume
;
/**
* 增值税税率-现场管理费表
*/
@Excel
(
name
=
"增值税税率"
)
private
String
addedTaxRate
;
/**
/**
* 公司单价/不含税单价
* 公司单价/不含税单价
*/
*/
@Excel
(
name
=
"公司单价"
)
private
String
unitPrice
;
private
String
unitPrice
;
/**
/**
* 目标成本合价(不含税)/不含税合价
* 目标成本合价(不含税)/不含税合价
*/
*/
private
String
excludeTaxSumPrice
;
@Excel
(
name
=
"目标成本合价(不含税)"
)
private
String
targetCbSumPriceExcludeTax
;
/**
/**
* 目标成本合价(含税)/含税合价
* 目标成本合价(含税)/含税合价
*/
*/
private
String
includeTaxSumPrice
;
@Excel
(
name
=
"目标成本合价(含税)"
)
private
String
targetCbSumPriceIncludeTax
;
/**
* 备注
*/
@Excel
(
name
=
"备注"
)
private
String
remark
;
/**
/**
* 成本科目
* 成本科目
*/
*/
@Excel
(
name
=
"成本科目"
)
private
String
cbSubject
;
private
String
cbSubject
;
/**
/**
* 税金类型
* 税金类型
*/
*/
@Excel
(
name
=
"税金类型"
)
private
String
taxType
;
private
String
taxType
;
/**
/**
* 删除状态(0:否、2:是)
* 删除状态(0:否、2:是)
...
@@ -93,7 +103,13 @@ public class CbSceneExpenseChildren extends BaseEntity implements Serializable {
...
@@ -93,7 +103,13 @@ public class CbSceneExpenseChildren extends BaseEntity implements Serializable {
@TableLogic
(
value
=
"0"
,
delval
=
"2"
)
@TableLogic
(
value
=
"0"
,
delval
=
"2"
)
private
Integer
delFlag
;
private
Integer
delFlag
;
/**
/**
*
备注
*
创建者
*/
*/
private
String
remark
;
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
String
createBy
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
createTime
;
}
}
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/domain/bo/CbSceneExpenseChildrenDataBo.java
0 → 100644
View file @
abc41225
package
com
.
dsk
.
cscec
.
domain
.
bo
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
/**
* @author sxk
* @date 2024.02.22
* @time 15:22
*/
@Data
public
class
CbSceneExpenseChildrenDataBo
{
/**
* 项目ID
*/
@NotNull
(
message
=
"项目ID不能为空"
)
private
Long
projectId
;
/**
* 项目文件ID
*/
@NotNull
(
message
=
"文件ID不能为空"
)
private
Long
fileId
;
}
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/domain/bo/CbSceneExpenseChildrenImportBo.java
0 → 100644
View file @
abc41225
package
com
.
dsk
.
cscec
.
domain
.
bo
;
import
com.dsk.common.annotation.Excel
;
import
com.dsk.cscec.domain.CbSceneExpenseChildren
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* @author sxk
* @date 2024.02.26
* @time 16:38
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
CbSceneExpenseChildrenImportBo
extends
CbSceneExpenseChildren
{
/**
* 公司单价/不含税单价
*/
@Excel
(
name
=
"不含税单价(元)"
)
private
String
excludeTaxUnitPrice
;
/**
* 目标成本合价(不含税)/不含税合价
*/
@Excel
(
name
=
"不含税合价(元)"
)
private
String
excludeTaxSumPrice
;
/**
* 目标成本合价(含税)/含税合价
*/
@Excel
(
name
=
"含税合价(元)"
)
private
String
includeTaxSumPrice
;
}
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/service/CbSceneExpenseChildrenService.java
View file @
abc41225
...
@@ -2,6 +2,10 @@ package com.dsk.cscec.service;
...
@@ -2,6 +2,10 @@ package com.dsk.cscec.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.dsk.cscec.domain.CbSceneExpenseChildren
;
import
com.dsk.cscec.domain.CbSceneExpenseChildren
;
import
com.dsk.cscec.domain.bo.CbSceneExpenseChildrenDataBo
;
import
com.dsk.cscec.domain.vo.CbSceneExpenseMenuVo
;
import
java.util.List
;
/**
/**
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)表服务接口
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)表服务接口
...
@@ -10,5 +14,28 @@ import com.dsk.cscec.domain.CbSceneExpenseChildren;
...
@@ -10,5 +14,28 @@ import com.dsk.cscec.domain.CbSceneExpenseChildren;
* @since 2024-02-22 09:59:01
* @since 2024-02-22 09:59:01
*/
*/
public
interface
CbSceneExpenseChildrenService
extends
IService
<
CbSceneExpenseChildren
>
{
public
interface
CbSceneExpenseChildrenService
extends
IService
<
CbSceneExpenseChildren
>
{
/**
* 获取现场经费菜单
*
* @param projectId 项目ID
* @return 菜单
*/
List
<
CbSceneExpenseMenuVo
>
getMenuList
(
Long
projectId
);
/**
* 现场经费二级分类数据解析
*
* @param projectId 项目ID
* @param cbStage 成本阶段
* @param username 用户名
*/
void
parseSceneExpenseChildrenData
(
Long
projectId
,
Integer
cbStage
,
String
username
)
throws
Exception
;
/**
* 获取现场经费二级分类数据
*
* @param childrenDataBo 查询体
* @return 现场经费二级分类数据
*/
List
<
CbSceneExpenseChildren
>
getChildrenData
(
CbSceneExpenseChildrenDataBo
childrenDataBo
);
}
}
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/service/impl/CbProjectRecordServiceImpl.java
View file @
abc41225
...
@@ -22,10 +22,7 @@ import com.dsk.cscec.domain.vo.CbProjectCbStageNotDraftVo;
...
@@ -22,10 +22,7 @@ import com.dsk.cscec.domain.vo.CbProjectCbStageNotDraftVo;
import
com.dsk.cscec.domain.vo.CbProjectRecordSearchVo
;
import
com.dsk.cscec.domain.vo.CbProjectRecordSearchVo
;
import
com.dsk.cscec.mapper.CbProjectFileMapper
;
import
com.dsk.cscec.mapper.CbProjectFileMapper
;
import
com.dsk.cscec.mapper.CbProjectRecordMapper
;
import
com.dsk.cscec.mapper.CbProjectRecordMapper
;
import
com.dsk.cscec.service.CbProjectExpenseSummaryService
;
import
com.dsk.cscec.service.*
;
import
com.dsk.cscec.service.CbProjectOtherService
;
import
com.dsk.cscec.service.CbProjectRecordService
;
import
com.dsk.cscec.service.CbSummaryService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -54,6 +51,8 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
...
@@ -54,6 +51,8 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
@Resource
@Resource
private
CbProjectExpenseSummaryService
projectExpenseSummaryService
;
private
CbProjectExpenseSummaryService
projectExpenseSummaryService
;
@Resource
@Resource
private
CbSceneExpenseChildrenService
sceneExpenseChildrenService
;
@Resource
private
CbProjectOtherService
projectOtherService
;
private
CbProjectOtherService
projectOtherService
;
/**
/**
...
@@ -134,6 +133,7 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
...
@@ -134,6 +133,7 @@ public class CbProjectRecordServiceImpl extends ServiceImpl<CbProjectRecordMappe
projectOtherService
.
projectOtherDataAnalysis
(
projectBaseBo
);
projectOtherService
.
projectOtherDataAnalysis
(
projectBaseBo
);
//现场经费
//现场经费
projectExpenseSummaryService
.
parseSceneExpenseSummaryData
(
projectId
,
cbStage
,
username
);
projectExpenseSummaryService
.
parseSceneExpenseSummaryData
(
projectId
,
cbStage
,
username
);
sceneExpenseChildrenService
.
parseSceneExpenseChildrenData
(
projectId
,
cbStage
,
username
);
//成本汇总
//成本汇总
cbSummaryService
.
importCbSummary
(
projectId
);
cbSummaryService
.
importCbSummary
(
projectId
);
}
}
...
...
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/service/impl/CbSceneExpenseChildrenServiceImpl.java
View file @
abc41225
package
com
.
dsk
.
cscec
.
service
.
impl
;
package
com
.
dsk
.
cscec
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.lang.Assert
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.dsk.common.excel.ExcelUtils
;
import
com.dsk.common.utils.StringUtils
;
import
com.dsk.cscec.constant.CbProjectConstants
;
import
com.dsk.cscec.constant.CbSceneExpenseConstants
;
import
com.dsk.cscec.domain.CbProjectFile
;
import
com.dsk.cscec.domain.CbProjectRecord
;
import
com.dsk.cscec.domain.CbSceneExpenseChildren
;
import
com.dsk.cscec.domain.CbSceneExpenseChildren
;
import
com.dsk.cscec.domain.bo.CbSceneExpenseChildrenDataBo
;
import
com.dsk.cscec.domain.bo.CbSceneExpenseChildrenImportBo
;
import
com.dsk.cscec.domain.vo.CbSceneExpenseMenuVo
;
import
com.dsk.cscec.mapper.CbProjectFileMapper
;
import
com.dsk.cscec.mapper.CbProjectRecordMapper
;
import
com.dsk.cscec.mapper.CbSceneExpenseChildrenMapper
;
import
com.dsk.cscec.mapper.CbSceneExpenseChildrenMapper
;
import
com.dsk.cscec.service.CbSceneExpenseChildrenService
;
import
com.dsk.cscec.service.CbSceneExpenseChildrenService
;
import
com.dsk.system.service.ISysOssService
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.support.TransactionTemplate
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)表服务实现类
* 现场经费-工资统筹、其他费用、现场管理费表(CbSceneExpenseChildren)表服务实现类
...
@@ -18,5 +41,167 @@ import javax.annotation.Resource;
...
@@ -18,5 +41,167 @@ import javax.annotation.Resource;
public
class
CbSceneExpenseChildrenServiceImpl
extends
ServiceImpl
<
CbSceneExpenseChildrenMapper
,
CbSceneExpenseChildren
>
implements
CbSceneExpenseChildrenService
{
public
class
CbSceneExpenseChildrenServiceImpl
extends
ServiceImpl
<
CbSceneExpenseChildrenMapper
,
CbSceneExpenseChildren
>
implements
CbSceneExpenseChildrenService
{
@Resource
@Resource
private
CbSceneExpenseChildrenMapper
baseMapper
;
private
CbSceneExpenseChildrenMapper
baseMapper
;
@Resource
private
CbProjectRecordMapper
projectRecordMapper
;
@Resource
private
CbProjectFileMapper
projectFileMapper
;
@Resource
private
ISysOssService
ossService
;
@Resource
private
TransactionTemplate
transactionTemplate
;
/**
* 获取现场经费菜单
*
* @param projectId 项目ID
* @return 菜单
*/
@Override
public
List
<
CbSceneExpenseMenuVo
>
getMenuList
(
Long
projectId
)
{
//校验项目是否存在
this
.
checkProjectExist
(
projectId
);
//TODO:菜单来源分为两部分,1、导入的文件,2、财务一体化系统
//从导入文件获取菜单
List
<
CbSceneExpenseMenuVo
>
menuList
=
projectFileMapper
.
getSceneExpenseMenuFromFile
(
projectId
,
CbProjectConstants
.
DELETE_FLAG_EXIST
,
CbProjectConstants
.
CB_TYPE_SCENE_EXPENSE
,
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_SUCCESS
);
menuList
.
forEach
(
menu
->
{
//菜单名称去除文件格式尾缀
menu
.
setMenuName
(
menu
.
getMenuName
().
substring
(
0
,
menu
.
getMenuName
().
lastIndexOf
(
"."
)));
//若是现场经费汇总,则是一级,否则均为二级
if
(
CbProjectConstants
.
CB_TYPE_SCENE_EXPENSE_NAME
.
equals
(
menu
.
getMenuName
()))
{
menu
.
setMenuLevel
(
CbSceneExpenseConstants
.
MENU_LEVEL1
);
}
else
{
menu
.
setMenuLevel
(
CbSceneExpenseConstants
.
MENU_LEVEL2
);
}
//菜单来源
menu
.
setMenuSource
(
CbSceneExpenseConstants
.
MENU_SOURCE_FILE_TABLE
);
});
//TODO:从财务一体化系统获取菜单
return
menuList
;
}
/**
* 现场经费二级分类数据解析
*
* @param projectId 项目ID
* @param cbStage 成本阶段
* @param username 用户名
*/
@Override
@Async
public
void
parseSceneExpenseChildrenData
(
Long
projectId
,
Integer
cbStage
,
String
username
)
throws
Exception
{
//查找该项目下所有相关文件
List
<
CbProjectFile
>
projectFileList
=
projectFileMapper
.
selectAnalysisList
(
projectId
,
CbProjectConstants
.
CB_TYPE_SCENE_EXPENSE
,
cbStage
);
//待解析文件
List
<
CbProjectFile
>
waitParseList
=
new
ArrayList
<>();
//提取非现场经费汇总文件
projectFileList
.
forEach
(
projectFile
->
{
if
(!
CbProjectConstants
.
CB_TYPE_SCENE_EXPENSE_NAME
.
equals
(
projectFile
.
getFileName
().
substring
(
0
,
projectFile
.
getFileName
().
lastIndexOf
(
"."
))))
{
//待解析文件
waitParseList
.
add
(
projectFile
);
}
});
//处理待解析文件
for
(
CbProjectFile
projectFile
:
waitParseList
)
{
if
(
ObjectUtil
.
isNull
(
projectFile
))
{
continue
;
}
//文件下载
InputStream
inputStream
=
ossService
.
downFileIO
(
projectFile
.
getFileOssId
());
if
(
ObjectUtil
.
isNull
(
inputStream
))
{
projectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_FAIL
);
projectFile
.
setFailRemark
(
"文件数据不存在"
);
projectFileMapper
.
updateById
(
projectFile
);
continue
;
}
//解析数据
List
<
CbSceneExpenseChildrenImportBo
>
importList
=
new
ExcelUtils
<>(
CbSceneExpenseChildrenImportBo
.
class
).
importExcelAllSheet
(
inputStream
,
0
);
if
(
importList
.
isEmpty
())
{
projectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_FAIL
);
projectFile
.
setFailRemark
(
"表格中不存在待导入数据"
);
projectFileMapper
.
updateById
(
projectFile
);
continue
;
}
//筛选有效数据
List
<
CbSceneExpenseChildrenImportBo
>
summaryList
=
importList
.
stream
().
parallel
()
//筛选名称列不为空数据
.
filter
(
item
->
StringUtils
.
isNotBlank
(
item
.
getExpenseName
()))
.
peek
(
item
->
{
item
.
setProjectId
(
projectId
);
item
.
setProjectFileId
(
projectFile
.
getId
());
//因为现场管理费Excel表中字段名称不一样,所以做以下单独映射
//公司单价/不含税单价
if
(
StringUtils
.
isNotBlank
(
item
.
getExcludeTaxUnitPrice
()))
{
item
.
setUnitPrice
(
item
.
getExcludeTaxUnitPrice
());
}
//目标成本合价(不含税)/不含税合价
if
(
StringUtils
.
isNotBlank
(
item
.
getExcludeTaxSumPrice
()))
{
item
.
setTargetCbSumPriceExcludeTax
(
item
.
getExcludeTaxSumPrice
());
}
//目标成本合价(含税)/含税合价
if
(
StringUtils
.
isNotBlank
(
item
.
getIncludeTaxSumPrice
()))
{
item
.
setTargetCbSumPriceIncludeTax
(
item
.
getIncludeTaxSumPrice
());
}
item
.
setCreateBy
(
username
);
item
.
setCreateTime
(
new
Date
());
})
.
collect
(
Collectors
.
toList
());
if
(
summaryList
.
size
()
!=
importList
.
size
())
{
projectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_FAIL
);
projectFile
.
setFailRemark
(
"表格中存在\"名称\"列为空数据!"
);
projectFileMapper
.
updateById
(
projectFile
);
continue
;
}
transactionTemplate
.
execute
(
status
->
{
try
{
//批量插入数据
CbSceneExpenseChildrenServiceImpl
impl
=
new
CbSceneExpenseChildrenServiceImpl
();
Assert
.
isTrue
(
impl
.
saveBatch
(
BeanUtil
.
copyToList
(
summaryList
,
CbSceneExpenseChildren
.
class
)),
"数据插入失败"
);
//更新文件状态
projectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_SUCCESS
);
Assert
.
isTrue
(
projectFileMapper
.
updateById
(
projectFile
)
>
0
,
"解析成功后文件状态更新失败"
);
}
catch
(
Exception
e
)
{
status
.
setRollbackOnly
();
projectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_FAIL
);
projectFile
.
setFailRemark
(
e
.
getMessage
());
projectFileMapper
.
updateById
(
projectFile
);
}
return
Boolean
.
TRUE
;
});
}
}
/**
* 获取现场经费二级分类数据
*
* @param childrenDataBo 查询体
* @return 现场经费二级分类数据
*/
@Override
public
List
<
CbSceneExpenseChildren
>
getChildrenData
(
CbSceneExpenseChildrenDataBo
childrenDataBo
)
{
//校验项目是否存在
this
.
checkProjectExist
(
childrenDataBo
.
getProjectId
());
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
CbSceneExpenseChildren
>()
.
eq
(
CbSceneExpenseChildren:
:
getProjectId
,
childrenDataBo
.
getProjectId
())
.
eq
(
CbSceneExpenseChildren:
:
getProjectFileId
,
childrenDataBo
.
getFileId
()));
}
/**
* 校验项目是否存在
*
* @param projectId 项目ID
* @return 项目实体
*/
private
CbProjectRecord
checkProjectExist
(
Long
projectId
)
{
CbProjectRecord
projectRecord
=
projectRecordMapper
.
selectById
(
projectId
);
Assert
.
notNull
(
projectRecord
,
"该项目不存在"
);
return
projectRecord
;
}
}
}
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