Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
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
zhangkb
indicators
Commits
56646b51
Commit
56646b51
authored
Feb 27, 2023
by
dengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权重数据填报功能
parent
2b585dc7
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1622 additions
and
1 deletion
+1622
-1
WeightDataEnterCtrl.java
...ymobile/indicators/api/hytobacco/WeightDataEnterCtrl.java
+525
-0
WeightExcelTempCtrl.java
...ymobile/indicators/api/hytobacco/WeightExcelTempCtrl.java
+246
-0
Constants.java
...ain/java/com/keymobile/indicators/constant/Constants.java
+2
-0
ObjScoreIndWeightDetail.java
...dicators/model/entity/weight/ObjScoreIndWeightDetail.java
+70
-0
WeightExcelIndicator.java
.../indicators/model/entity/weight/WeightExcelIndicator.java
+54
-0
WeightExcelObj.java
...mobile/indicators/model/entity/weight/WeightExcelObj.java
+49
-0
WeightExcelTemplate.java
...e/indicators/model/entity/weight/WeightExcelTemplate.java
+58
-0
WeightIndValue.java
...mobile/indicators/model/entity/weight/WeightIndValue.java
+78
-0
ObjScoreIndWeightDetailMapper.java
...rs/model/mapper/weight/ObjScoreIndWeightDetailMapper.java
+25
-0
WeightExcelIndicatorMapper.java
...ators/model/mapper/weight/WeightExcelIndicatorMapper.java
+25
-0
WeightExcelObjMapper.java
.../indicators/model/mapper/weight/WeightExcelObjMapper.java
+25
-0
WeightExcelTemplateMapper.java
...cators/model/mapper/weight/WeightExcelTemplateMapper.java
+28
-0
WeightIndValueMapper.java
.../indicators/model/mapper/weight/WeightIndValueMapper.java
+38
-0
ObjScoreIndWeightCfgServiceImpl.java
...icators/service/impl/ObjScoreIndWeightCfgServiceImpl.java
+35
-0
WeightExcelTemplateService.java
...s/service/weightDataEnter/WeightExcelTemplateService.java
+12
-0
WeightIndValueService.java
...cators/service/weightDataEnter/WeightIndValueService.java
+13
-0
WeightExcelTemplateServiceImpl.java
.../weightDataEnter/impl/WeightExcelTemplateServiceImpl.java
+118
-0
WeightIndValueServiceImpl.java
...rvice/weightDataEnter/impl/WeightIndValueServiceImpl.java
+96
-0
ModelPathEnum.java
...in/java/com/keymobile/indicators/utils/ModelPathEnum.java
+2
-1
ObjScoreIndWeightDetailMapper.xml
...sources/mybatis/mapping/ObjScoreIndWeightDetailMapper.xml
+23
-0
WeightExcelIndicatorMapper.xml
.../resources/mybatis/mapping/WeightExcelIndicatorMapper.xml
+20
-0
WeightExcelObjMapper.xml
src/main/resources/mybatis/mapping/WeightExcelObjMapper.xml
+20
-0
WeightExcelTemplateMapper.xml
...n/resources/mybatis/mapping/WeightExcelTemplateMapper.xml
+24
-0
WeightIndValueMapper.xml
src/main/resources/mybatis/mapping/WeightIndValueMapper.xml
+36
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/WeightDataEnterCtrl.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.support.ExcelTypeEnum
;
import
com.alibaba.excel.write.builder.ExcelWriterBuilder
;
import
com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.AuthModel
;
import
com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelIndicator
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelObj
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
com.keymobile.indicators.model.entity.dataenter.Task
;
import
com.keymobile.indicators.model.entity.dataenter.TaskIndValue
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.ObjScoreIndWeightCfgService
;
import
com.keymobile.indicators.service.SystemAuthService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService
;
import
com.keymobile.indicators.service.weightDataEnter.WeightExcelTemplateService
;
import
com.keymobile.indicators.service.weightDataEnter.WeightIndValueService
;
import
com.keymobile.indicators.utils.DateUtils
;
import
com.keymobile.indicators.utils.ExcelUtil
;
import
com.keymobile.indicators.utils.IdWorker
;
import
com.keymobile.indicators.utils.LogManager
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author DW
* @date 2023-02-22-0022 15:24
* @description 权重数据填报
*/
@Api
(
tags
={
"权重配置-在线填报、excel导入"
})
@RestController
@RequestMapping
(
value
=
"/weightDataEnter"
)
@Slf4j
public
class
WeightDataEnterCtrl
{
@Autowired
private
WeightExcelTemplateService
excelTemplateService
;
@Autowired
private
TaskRuleGroupObjService
taskRuleGroupObjService
;
@Autowired
private
SystemAuthService
systemAuthService
;
@Autowired
private
ObjScoreIndWeightCfgService
weightCfgService
;
@Autowired
private
WeightIndValueService
weightIndValueService
;
@ApiOperation
(
"获取需要在线填报的数据项(填报任务点击)"
)
@GetMapping
(
"/findToEdit"
)
public
List
<
WeightIndValue
>
findToEdit
(
@RequestParam
(
"weightId"
)
Integer
weightId
)
{
List
<
WeightIndValue
>
list
=
new
ArrayList
<>();
// 查询weight_ind_value表查看是否已经填报过数据
List
<
WeightIndValue
>
values
=
weightIndValueService
.
findByWeightId
(
weightId
);
// 填报过数据直接可以从表里面获取数据
if
(
values
!=
null
&&
values
.
size
()
>
0
)
{
list
.
addAll
(
values
);
}
else
{
// 首次填报,通过权重配置的指标和单位拼装需要填报的数据项
ObjScoreIndWeightCfg
weightCfg
=
weightCfgService
.
getById
(
weightId
);
List
<
TaskRuleIndicator
>
taskIndicators
=
weightCfg
.
getIndicators
();
if
(
CollectionUtils
.
isNotEmpty
(
taskIndicators
))
{
// 两烟区单位
TaskRuleGroupObj
twoGroupObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightTwoUnit
());
// 纯销区单位
TaskRuleGroupObj
oneGroupObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightOneUnit
());
// 权重单位集合(两烟区+纯销区)
List
<
AuthModel
>
twoModels
=
new
ArrayList
<>();
List
<
AuthModel
>
oneModels
=
new
ArrayList
<>();
if
(
twoGroupObj
!=
null
)
{
List
<
AuthModel
>
objs
=
getObjs
(
twoGroupObj
);
if
(
objs
.
isEmpty
())
{
log
.
error
(
"两烟区没有可用的填报单位信息"
);
}
else
{
twoModels
.
addAll
(
objs
);
}
}
if
(
oneGroupObj
!=
null
)
{
List
<
AuthModel
>
objs
=
getObjs
(
oneGroupObj
);
if
(
objs
.
isEmpty
())
{
log
.
error
(
"纯销区没有可用的填报单位信息"
);
}
else
{
oneModels
.
addAll
(
objs
);
}
}
if
(
twoModels
.
size
()
>
0
)
{
list
=
generateEditObjects
(
weightCfg
,
twoModels
,
"2"
);
}
if
(
oneModels
.
size
()
>
0
)
{
list
.
addAll
(
generateEditObjects
(
weightCfg
,
oneModels
,
"1"
));
}
}
}
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_WEIGHT_DATA_ENTER_API
,
"获取权重配置中需要在线填报的数据项(填报任务点击){}"
,
weightId
);
return
list
;
}
@ApiOperation
(
"填报数据保存"
)
@PostMapping
(
"/saveData"
)
public
Result
saveData
(
@RequestBody
List
<
WeightIndValue
>
values
,
@RequestParam
(
"weightId"
)
Integer
weightId
)
{
Date
now
=
new
Date
();
String
userId
=
SystemUserUtil
.
getCurrentUserId
();
for
(
WeightIndValue
value
:
values
)
{
value
.
setWeightId
(
weightId
);
value
.
setState
(
Constants
.
DATA_STATE_A
);
value
.
setCreateTime
(
now
);
value
.
setCreator
(
userId
);
value
.
setUpdater
(
userId
);
value
.
setUpdateTime
(
now
);
}
weightIndValueService
.
saveWeightValues
(
values
,
weightId
);
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_WEIGHT_DATA_ENTER_API
,
"填报数据保存,在线编辑{}"
,
""
);
return
Result
.
genOkResult
();
}
@ApiOperation
(
"填报数据保存"
)
@PostMapping
(
"/importData"
)
public
Result
importData
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@ApiParam
(
"所属权重"
)
@RequestParam
(
"weightId"
)
String
weightId
)
{
String
userId
=
SystemUserUtil
.
getCurrentUserId
();
Result
result
;
Date
now
=
new
Date
();
ObjScoreIndWeightCfg
weightCfg
=
weightCfgService
.
getById
(
Integer
.
parseInt
(
weightId
));
// 两烟区单位
TaskRuleGroupObj
twoGroupObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightTwoUnit
());
try
{
InputStream
is
=
file
.
getInputStream
();
XSSFWorkbook
xssfWorkbook
=
new
XSSFWorkbook
(
is
);
XSSFSheet
sheet
=
xssfWorkbook
.
getSheetAt
(
0
);
WeightExcelTemplate
template
=
excelTemplateService
.
getByWeightId
(
weightId
);
List
<
WeightExcelIndicator
>
inds
=
template
.
getInds
();
List
<
WeightExcelObj
>
objs
=
template
.
getObjs
();
int
startRow
;
int
startColumn
=
1
;
List
<
WeightIndValue
>
weightIndValues
=
new
ArrayList
<>();
if
(
template
.
getCtype
()
==
1
)
{
// 指标是列值
startRow
=
2
;
for
(
int
i
=
0
;
i
<
objs
.
size
();
i
++)
{
int
t
=
i
+
startRow
;
XSSFRow
row
=
sheet
.
getRow
(
t
);
WeightExcelObj
obj
=
objs
.
get
(
i
);
int
start
=
startColumn
;
for
(
int
j
=
0
;
j
<
inds
.
size
();
j
++)
{
WeightExcelIndicator
ind
=
inds
.
get
(
j
);
String
val1
=
ExcelUtil
.
getXSSFCellValue
(
row
.
getCell
(
j
+
start
));
String
val2
=
ExcelUtil
.
getXSSFCellValue
(
row
.
getCell
(
j
+
start
+
1
));
WeightIndValue
value
;
// 判断该单位是否是两烟区(不是两烟区就是纯销区)
if
(
StringUtils
.
contains
(
twoGroupObj
.
getDetailNames
(),
obj
.
getObjName
()))
{
// 两烟区
value
=
this
.
doGenWeightIndValue
(
val1
,
val2
,
weightCfg
.
getWeightTwo
(),
obj
,
ind
,
template
.
getId
(),
weightId
,
userId
,
now
);
}
else
{
// 纯销区
value
=
this
.
doGenWeightIndValue
(
val1
,
val2
,
weightCfg
.
getWeightOne
(),
obj
,
ind
,
template
.
getId
(),
weightId
,
userId
,
now
);
}
weightIndValues
.
add
(
value
);
start
++;
}
}
}
else
{
startRow
=
2
;
for
(
int
i
=
0
;
i
<
inds
.
size
();
i
++)
{
int
t
=
i
+
startRow
;
XSSFRow
row
=
sheet
.
getRow
(
t
);
WeightExcelIndicator
ind
=
inds
.
get
(
i
);
int
start
=
startColumn
;
for
(
int
j
=
0
;
j
<
objs
.
size
();
j
++)
{
WeightExcelObj
obj
=
objs
.
get
(
j
);
String
val1
=
ExcelUtil
.
getXSSFCellValue
(
row
.
getCell
(
j
+
start
));
String
val2
=
ExcelUtil
.
getXSSFCellValue
(
row
.
getCell
(
j
+
start
+
1
));
WeightIndValue
value
;
// 判断该单位是否是两烟区(不是两烟区就是纯销区)
if
(
StringUtils
.
contains
(
twoGroupObj
.
getDetailNames
(),
obj
.
getObjName
()))
{
// 两烟区
value
=
this
.
doGenWeightIndValue
(
val1
,
val2
,
weightCfg
.
getWeightTwo
(),
obj
,
ind
,
template
.
getId
(),
weightId
,
userId
,
now
);
}
else
{
value
=
this
.
doGenWeightIndValue
(
val1
,
val2
,
weightCfg
.
getWeightOne
(),
obj
,
ind
,
template
.
getId
(),
weightId
,
userId
,
now
);
}
// 纯销区
weightIndValues
.
add
(
value
);
start
++;
}
}
}
weightIndValueService
.
saveWeightValues
(
weightIndValues
,
Integer
.
parseInt
(
weightId
));
//成功
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"权重填报数据保存,excel导入"
,
""
);
result
=
Result
.
genOkResult
();
}
catch
(
Exception
e
)
{
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"权重填报数据保存,excel导入失败{}"
,
""
);
log
.
error
(
"数据填报导入出错:weightId="
+
weightId
,
e
);
result
=
Result
.
genFailedResult
(
"导入excel出错"
);
}
return
result
;
}
@ApiOperation
(
"根据任务id导出excel"
)
@GetMapping
(
"/exportToExcel"
)
public
void
exportToExcel
(
@RequestParam
(
"weightId"
)
String
weightId
,
HttpServletResponse
response
)
throws
IOException
{
try
{
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
WeightExcelTemplate
template
=
excelTemplateService
.
getByWeightId
(
weightId
);
List
<
List
<
String
>>
headers
=
new
ArrayList
<>();
List
<
List
<
String
>>
datas
=
new
ArrayList
<>();
ObjScoreIndWeightCfg
weightCfg
=
weightCfgService
.
getById
(
Integer
.
parseInt
(
weightId
));
String
fileName
=
URLEncoder
.
encode
(
weightCfg
.
getName
(),
"UTF-8"
);
ExcelWriterBuilder
writerBuilder
=
EasyExcel
.
write
(
response
.
getOutputStream
());
List
<
WeightIndValue
>
values
=
weightIndValueService
.
findByWeightId
(
Integer
.
parseInt
(
weightId
));;
if
(
template
==
null
)
{
List
<
String
>
header
=
new
ArrayList
<>();
header
.
add
(
"指标名称"
);
headers
.
add
(
header
);
List
<
String
>
header2
=
new
ArrayList
<>();
header2
.
add
(
"单位"
);
headers
.
add
(
header2
);
List
<
String
>
header3
=
new
ArrayList
<>();
header3
.
add
(
"归属区域"
);
headers
.
add
(
header3
);
List
<
String
>
header4
=
new
ArrayList
<>();
header4
.
add
(
"综合评价权重"
);
headers
.
add
(
header4
);
List
<
String
>
header5
=
new
ArrayList
<>();
header5
.
add
(
"改善提升权重"
);
headers
.
add
(
header5
);
List
<
String
>
header6
=
new
ArrayList
<>();
header6
.
add
(
"维度权重"
);
headers
.
add
(
header6
);
for
(
WeightIndValue
value
:
values
)
{
List
<
String
>
data
=
new
ArrayList
<>();
data
.
add
(
value
.
getIndName
());
data
.
add
(
value
.
getIndUnit
());
data
.
add
(
value
.
getObjName
());
if
(
value
.
getSynthesizeWeight
()
!=
null
&&
StringUtils
.
isNotBlank
(
value
.
getSynthesizeWeight
().
toString
()))
{
data
.
add
(
Double
.
toString
(
value
.
getSynthesizeWeight
().
doubleValue
()));
}
else
{
data
.
add
(
""
);
}
if
(
value
.
getImproveWeight
()
!=
null
&&
StringUtils
.
isNotBlank
(
value
.
getImproveWeight
().
toString
()))
{
data
.
add
(
Double
.
toString
(
value
.
getImproveWeight
().
doubleValue
()));
}
else
{
data
.
add
(
""
);
}
if
(
value
.
getDimensionWeight
()
!=
null
&&
StringUtils
.
isNotBlank
(
value
.
getDimensionWeight
().
toString
()))
{
data
.
add
(
Double
.
toString
(
value
.
getDimensionWeight
().
doubleValue
()));
}
else
{
data
.
add
(
""
);
}
datas
.
add
(
data
);
}
}
else
{
List
<
WeightExcelIndicator
>
inds
=
template
.
getInds
();
List
<
WeightExcelObj
>
objs
=
template
.
getObjs
();
List
<
OnceAbsoluteMergeStrategy
>
merges
=
new
ArrayList
<>();
if
(
template
.
getCtype
()
==
1
)
{
// 列类型:1、指标 2 考核对象
List
<
String
>
column1
=
new
ArrayList
<>();
column1
.
add
(
""
);
headers
.
add
(
column1
);
for
(
WeightExcelIndicator
indicator
:
inds
)
{
List
<
String
>
header
=
new
ArrayList
<>();
headers
.
add
(
header
);
header
.
add
(
indicator
.
getIndName
());
header
.
add
(
"综合评价权重"
);
List
<
String
>
header2
=
new
ArrayList
<>();
headers
.
add
(
header2
);
header2
.
add
(
indicator
.
getIndName
());
header2
.
add
(
"改善提升权重"
);
List
<
String
>
header3
=
new
ArrayList
<>();
headers
.
add
(
header3
);
header3
.
add
(
indicator
.
getIndName
());
header3
.
add
(
"维度权重"
);
}
//如果有同期值需要占据两行
column1
.
add
(
""
);
for
(
WeightExcelObj
obj
:
objs
)
{
List
<
String
>
data
=
new
ArrayList
<>();
data
.
add
(
obj
.
getObjName
());
for
(
WeightExcelIndicator
indicator
:
inds
)
{
generateData
(
values
,
indicator
,
obj
,
data
);
}
datas
.
add
(
data
);
}
}
else
{
for
(
WeightExcelIndicator
indicator
:
inds
)
{
List
<
String
>
data
=
new
ArrayList
<>();
datas
.
add
(
data
);
data
.
add
(
indicator
.
getIndName
());
for
(
WeightExcelObj
obj
:
objs
)
{
generateData
(
values
,
indicator
,
obj
,
data
);
}
}
List
<
String
>
column1
=
new
ArrayList
<>();
column1
.
add
(
""
);
headers
.
add
(
column1
);
for
(
WeightExcelObj
obj
:
objs
)
{
List
<
String
>
header
=
new
ArrayList
<>();
header
.
add
(
obj
.
getObjName
());
headers
.
add
(
header
);
header
.
add
(
"综合评价权重"
);
List
<
String
>
header2
=
new
ArrayList
<>();
headers
.
add
(
header2
);
header2
.
add
(
obj
.
getObjName
());
header2
.
add
(
"改善提升权重"
);
List
<
String
>
header3
=
new
ArrayList
<>();
headers
.
add
(
header3
);
header3
.
add
(
obj
.
getObjName
());
header3
.
add
(
"维度权重"
);
}
//如果有同期值需要占据两行
column1
.
add
(
""
);
}
if
(
merges
.
size
()
>
0
)
{
for
(
OnceAbsoluteMergeStrategy
mergeStrategy
:
merges
)
{
writerBuilder
.
registerWriteHandler
(
mergeStrategy
);
}
}
}
LogManager
.
logInfo
(
Constants
.
LOG_INDICATOR_TASK_AUDIT_API
,
"导出权重填报数据excel成功,id:{}"
,
weightId
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
fileName
+
".xlsx"
);
writerBuilder
.
excelType
(
ExcelTypeEnum
.
XLSX
).
head
(
headers
)
.
autoCloseStream
(
false
).
sheet
(
"权重数据填报"
).
doWrite
(
datas
);
}
catch
(
Exception
e
)
{
log
.
error
(
"生成excel模板出错"
,
e
);
response
.
reset
();
response
.
setContentType
(
"application/json"
);
response
.
setCharacterEncoding
(
"utf-8"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>(
4
);
map
.
put
(
"status"
,
"failure"
);
map
.
put
(
"message"
,
"导出数据失败:"
+
e
.
getMessage
());
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"导出权重填报数据excel错误,id:{}"
,
weightId
);
Gson
gson
=
new
Gson
();
response
.
getWriter
().
write
(
gson
.
toJson
(
map
));
}
}
/**
* 生成excel导出的填报值
* @param values
* @param indicator
* @param obj
* @param data
*/
private
void
generateData
(
List
<
WeightIndValue
>
values
,
WeightExcelIndicator
indicator
,
WeightExcelObj
obj
,
List
<
String
>
data
)
{
for
(
WeightIndValue
value
:
values
)
{
if
(
indicator
.
getIndId
().
equals
(
value
.
getIndId
())
&&
obj
.
getObjId
().
equals
(
value
.
getObjId
()))
{
if
(
value
.
getSynthesizeWeight
()
!=
null
&&
StringUtils
.
isNotBlank
(
value
.
getSynthesizeWeight
().
toString
()))
{
data
.
add
(
Double
.
toString
(
value
.
getSynthesizeWeight
().
doubleValue
()));
}
else
{
data
.
add
(
""
);
}
if
(
value
.
getImproveWeight
()
!=
null
&&
StringUtils
.
isNotBlank
(
value
.
getImproveWeight
().
toString
()))
{
data
.
add
(
Double
.
toString
(
value
.
getImproveWeight
().
doubleValue
()));
}
else
{
data
.
add
(
""
);
}
if
(
value
.
getDimensionWeight
()
!=
null
&&
StringUtils
.
isNotBlank
(
value
.
getDimensionWeight
().
toString
()))
{
data
.
add
(
Double
.
toString
(
value
.
getDimensionWeight
().
doubleValue
()));
}
else
{
data
.
add
(
""
);
}
break
;
}
}
}
/**
* 生成指标值对象
* @param synthesizeWeight
* @param improveWeight
* @param dimensionWeight
* @param obj
* @param ind
* @param tempId
* @param weightId
* @param userId
* @param now
* @return
*/
private
WeightIndValue
doGenWeightIndValue
(
String
synthesizeWeight
,
String
improveWeight
,
BigDecimal
dimensionWeight
,
WeightExcelObj
obj
,
WeightExcelIndicator
ind
,
Integer
tempId
,
String
weightId
,
String
userId
,
Date
now
)
{
WeightIndValue
value
=
new
WeightIndValue
();
value
.
setWeightId
(
Integer
.
parseInt
(
weightId
));
value
.
setTempId
(
tempId
);
value
.
setObjType
(
obj
.
getObjType
());
value
.
setObjName
(
obj
.
getObjName
());
value
.
setObjId
(
obj
.
getObjId
());
value
.
setIndId
(
ind
.
getIndId
());
value
.
setIndUnit
(
ind
.
getIndUnit
());
// 设置综合评价权重
value
.
setSynthesizeWeight
(
new
BigDecimal
(
synthesizeWeight
));
// 设置改善提升权重
value
.
setImproveWeight
(
new
BigDecimal
(
improveWeight
));
// 设置维度权重
value
.
setDimensionWeight
(
dimensionWeight
);
String
indName
=
ind
.
getIndName
();
//模板保存时指标名字加上了单位,去掉 hzc
if
(
StringUtils
.
isNotBlank
(
ind
.
getIndName
())){
int
i
=
indName
.
lastIndexOf
(
"("
);
if
(
i
!=-
1
){
indName
=
indName
.
substring
(
0
,
i
);
}
}
value
.
setIndName
(
indName
);
value
.
setIndSource
(
ind
.
getIndSource
());
value
.
setCreator
(
userId
);
value
.
setUpdater
(
userId
);
value
.
setUpdateTime
(
now
);
value
.
setCreateTime
(
now
);
value
.
setState
(
Constants
.
DATA_STATE_A
);
return
value
;
}
/**
* 生成填写对象
* @param weightCfg
* @param objs
* @param isTwo 是否是两烟区
* @return
*/
private
List
<
WeightIndValue
>
generateEditObjects
(
ObjScoreIndWeightCfg
weightCfg
,
List
<
AuthModel
>
objs
,
String
isTwo
)
{
List
<
WeightIndValue
>
list
=
new
ArrayList
<>();
List
<
TaskRuleIndicator
>
taskIndicators
=
weightCfg
.
getIndicators
();
for
(
TaskRuleIndicator
indicator
:
taskIndicators
)
{
for
(
AuthModel
obj
:
objs
)
{
WeightIndValue
value
=
new
WeightIndValue
();
value
.
setWeightId
(
weightCfg
.
getId
());
value
.
setIndId
(
indicator
.
getIndId
());
value
.
setIndName
(
indicator
.
getIndName
());
value
.
setIndUnit
(
indicator
.
getIndUnit
());
value
.
setObjId
(
obj
.
getId
());
value
.
setObjName
(
obj
.
getName
());
value
.
setObjType
(
obj
.
getObjType
());
// 设置维度权重
if
(
StringUtils
.
equals
(
isTwo
,
"2"
))
{
value
.
setDimensionWeight
(
weightCfg
.
getWeightTwo
());
}
else
{
value
.
setDimensionWeight
(
weightCfg
.
getWeightOne
());
}
list
.
add
(
value
);
}
}
return
list
;
}
/**
* 通过任务单位定义信息获取两烟区单位或纯销区单位包含的机构单位
* @param groupObj 任务单位定义信息
* @return 机构单位
*/
List
<
AuthModel
>
getObjs
(
TaskRuleGroupObj
groupObj
)
{
List
<
AuthModel
>
objs
=
new
ArrayList
<>();
String
[]
ids
=
StringUtils
.
split
(
groupObj
.
getDetail
(),
Constants
.
SEP_COMMA
);
List
<
String
>
idList
=
Arrays
.
asList
(
ids
);
switch
(
groupObj
.
getObjType
())
{
case
Constants
.
OBJ_TYPE_ORG
:
List
<
JSONObject
>
orgs
=
systemAuthService
.
getOrgByNos
(
idList
);
for
(
JSONObject
jo
:
orgs
)
{
AuthModel
authModel
=
new
AuthModel
();
authModel
.
setObjType
(
Constants
.
OBJ_TYPE_ORG
);
authModel
.
setName
(
jo
.
getString
(
"name"
));
authModel
.
setId
(
jo
.
getString
(
"no"
));
objs
.
add
(
authModel
);
}
break
;
case
Constants
.
OBJ_TYPE_OTHER
:
List
<
JSONObject
>
others
=
systemAuthService
.
getStandardObjByIds
(
idList
);
for
(
JSONObject
jo
:
others
)
{
AuthModel
authModel
=
new
AuthModel
();
authModel
.
setObjType
(
Constants
.
OBJ_TYPE_OTHER
);
authModel
.
setName
(
jo
.
getString
(
"name"
));
authModel
.
setId
(
jo
.
getString
(
"id"
));
objs
.
add
(
authModel
);
}
break
;
}
return
objs
;
}
}
src/main/java/com/keymobile/indicators/api/hytobacco/WeightExcelTempCtrl.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
api
.
hytobacco
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.builder.ExcelWriterBuilder
;
import
com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.AuthModel
;
import
com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelIndicator
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelObj
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
com.keymobile.indicators.model.entity.dataenter.Task
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
com.keymobile.indicators.result.Result
;
import
com.keymobile.indicators.service.ObjScoreIndWeightCfgService
;
import
com.keymobile.indicators.service.SystemAuthService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService
;
import
com.keymobile.indicators.service.weightDataEnter.WeightExcelTemplateService
;
import
com.keymobile.indicators.utils.LogManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author DW
* @date 2023-02-23-0023 15:32
* @description
*/
@Api
(
tags
={
"权重数据填报-填报excel模板管理"
})
@RestController
@RequestMapping
(
value
=
"/weightExcel"
)
@Slf4j
public
class
WeightExcelTempCtrl
{
@Autowired
private
WeightExcelTemplateService
weightExcelTemplateService
;
@Autowired
private
ObjScoreIndWeightCfgService
weightCfgService
;
@Autowired
private
SystemAuthService
systemAuthService
;
@Autowired
private
TaskRuleGroupObjService
taskRuleGroupObjService
;
@ApiOperation
(
"根据权重id获取excel模板"
)
@GetMapping
(
"/findByWeightId"
)
public
WeightExcelTemplate
findByWeightId
(
@ApiParam
(
name
=
"weightId"
)
@RequestParam
(
"weightId"
)
String
weightId
)
{
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"根据权重id获取excel模板,id:{}"
,
weightId
);
return
weightExcelTemplateService
.
getByWeightId
(
weightId
);
}
@ApiOperation
(
"根据权重id获取需要填报的数据项(配置excel模板用)"
)
@GetMapping
(
"/findWeightDataInds"
)
public
List
<
TaskRuleIndicator
>
findWeightDataInds
(
@ApiParam
(
name
=
"weightId"
)
@RequestParam
(
"weightId"
)
String
weightId
)
{
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"根据权重id获取的数据项,id:{}"
,
weightId
);
return
weightCfgService
.
getById
(
Integer
.
parseInt
(
weightId
)).
getIndicators
();
}
@ApiOperation
(
"根据权重id获取单位明细(配置excel模板用)"
)
@GetMapping
(
"/findWeightObjs"
)
public
List
<
AuthModel
>
findWeightObjs
(
@ApiParam
(
name
=
"weightId"
)
@RequestParam
(
"weightId"
)
String
weightId
)
{
List
<
AuthModel
>
list
=
new
ArrayList
<>();
// 查询权重配置信息
ObjScoreIndWeightCfg
weightCfg
=
weightCfgService
.
getById
(
Integer
.
parseInt
(
weightId
));
// 获取两烟区单位信息
TaskRuleGroupObj
twoObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightTwoUnit
());
// 获取纯销区单位信息
TaskRuleGroupObj
oneObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightOneUnit
());;
List
<
AuthModel
>
two
=
getAuthModels
(
twoObj
);
List
<
AuthModel
>
one
=
getAuthModels
(
oneObj
);
list
.
addAll
(
two
);
list
.
addAll
(
one
);
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"根据权重id获取单位,id:{}"
,
weightId
);
return
list
;
}
@ApiOperation
(
"保存权重数据填报的excel模板"
)
@PostMapping
(
"/save"
)
public
Result
save
(
@RequestBody
WeightExcelTemplate
template
)
{
ObjScoreIndWeightCfg
weightCfg
=
weightCfgService
.
getById
(
template
.
getWeightId
());
template
.
setOrgNo
(
weightCfg
.
getOrgNo
());
weightExcelTemplateService
.
create
(
template
);
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"保存excel模板{}"
,
""
);
return
Result
.
genOkResult
();
}
@ApiOperation
(
"根据id导出excel"
)
@GetMapping
(
"/exportToExcel"
)
public
void
exportExcelTemplate
(
@RequestParam
(
"id"
)
Integer
id
,
HttpServletResponse
response
)
throws
IOException
{
try
{
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
WeightExcelTemplate
template
=
weightExcelTemplateService
.
getById
(
id
);
List
<
WeightExcelIndicator
>
inds
=
template
.
getInds
();
List
<
WeightExcelObj
>
objs
=
template
.
getObjs
();
String
fileName
=
URLEncoder
.
encode
(
template
.
getName
(),
"UTF-8"
);
List
<
List
<
String
>>
datas
=
new
ArrayList
<>();
List
<
OnceAbsoluteMergeStrategy
>
merges
=
new
ArrayList
<>();
List
<
List
<
String
>>
headers
=
new
ArrayList
<>();
if
(
template
.
getCtype
()
==
1
)
{
// 列类型:1、指标 2 考核对象
List
<
String
>
column1
=
new
ArrayList
<>();
column1
.
add
(
""
);
headers
.
add
(
column1
);
for
(
WeightExcelIndicator
indicator
:
inds
)
{
List
<
String
>
header
=
new
ArrayList
<>();
headers
.
add
(
header
);
header
.
add
(
indicator
.
getIndName
());
header
.
add
(
"综合评价权重"
);
List
<
String
>
header2
=
new
ArrayList
<>();
headers
.
add
(
header2
);
header2
.
add
(
indicator
.
getIndName
());
header2
.
add
(
"改善提升权重"
);
}
//如果有同期值需要占据两行
column1
.
add
(
""
);
for
(
WeightExcelObj
obj
:
objs
)
{
List
<
String
>
data
=
new
ArrayList
<>();
data
.
add
(
obj
.
getObjName
());
datas
.
add
(
data
);
}
}
else
{
int
i
=
1
;
for
(
WeightExcelIndicator
indicator
:
inds
)
{
List
<
String
>
data
=
new
ArrayList
<>();
datas
.
add
(
data
);
data
.
add
(
indicator
.
getIndName
());
}
List
<
String
>
column1
=
new
ArrayList
<>();
column1
.
add
(
""
);
headers
.
add
(
column1
);
for
(
WeightExcelObj
obj
:
objs
)
{
List
<
String
>
header
=
new
ArrayList
<>();
header
.
add
(
obj
.
getObjName
());
headers
.
add
(
header
);
header
.
add
(
"综合评价权重"
);
List
<
String
>
header2
=
new
ArrayList
<>();
headers
.
add
(
header2
);
header2
.
add
(
obj
.
getObjName
());
header2
.
add
(
"改善提升权重"
);
}
//如果有同期值需要占据两行
column1
.
add
(
""
);
}
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
fileName
+
".xlsx"
);
ExcelWriterBuilder
writerBuilder
=
EasyExcel
.
write
(
response
.
getOutputStream
());
if
(
merges
.
size
()
>
0
)
{
for
(
OnceAbsoluteMergeStrategy
mergeStrategy
:
merges
)
{
writerBuilder
.
registerWriteHandler
(
mergeStrategy
);
}
}
ExcelWriter
build
=
writerBuilder
.
build
();
//EasyExcel.writerSheet()
WriteSheet
one
=
EasyExcel
.
writerSheet
(
0
,
"权重数据填报"
).
head
(
headers
).
build
();
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"根据id导出excel模板,id:{}"
,
id
);
build
.
write
(
datas
,
one
);
build
.
finish
();
}
catch
(
Exception
e
)
{
log
.
error
(
"生成权重填报excel模板出错"
,
e
);
response
.
reset
();
response
.
setContentType
(
"application/json"
);
response
.
setCharacterEncoding
(
"utf-8"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>(
4
);
map
.
put
(
"status"
,
"failure"
);
map
.
put
(
"message"
,
"导出模板失败"
);
LogManager
.
logInfo
(
Constants
.
LOG_CONTEXT_API
,
"导出模板失败,id:{}"
,
id
);
Gson
gson
=
new
Gson
();
response
.
getWriter
().
write
(
gson
.
toJson
(
map
));
}
}
private
List
<
AuthModel
>
getAuthModels
(
TaskRuleGroupObj
obj
)
{
List
<
AuthModel
>
list
=
new
ArrayList
<>();
int
objType
=
obj
.
getObjType
();
if
(
obj
.
getDetail
()
!=
null
)
{
List
<
String
>
objIds
=
Arrays
.
asList
(
StringUtils
.
split
(
obj
.
getDetail
(),
Constants
.
SEP_COMMA
));
switch
(
objType
)
{
case
Constants
.
OBJ_TYPE_ORG
:
//组织
List
<
JSONObject
>
orgs
=
systemAuthService
.
getOrgByNos
(
objIds
);
for
(
String
oid
:
objIds
)
{
for
(
JSONObject
jo
:
orgs
)
{
String
id
=
jo
.
getString
(
"no"
);
if
(
oid
.
equals
(
id
))
{
AuthModel
authModel
=
new
AuthModel
();
authModel
.
setObjType
(
Constants
.
OBJ_TYPE_ORG
);
authModel
.
setName
(
jo
.
getString
(
"name"
));
authModel
.
setId
(
id
);
list
.
add
(
authModel
);
break
;
}
}
}
break
;
case
Constants
.
OBJ_TYPE_OTHER
:
//其他
List
<
JSONObject
>
others
=
systemAuthService
.
getStandardObjByIds
(
objIds
);
for
(
String
oid
:
objIds
)
{
for
(
JSONObject
jo
:
others
)
{
String
id
=
jo
.
getString
(
"id"
);
if
(
oid
.
equals
(
id
))
{
AuthModel
authModel
=
new
AuthModel
();
authModel
.
setObjType
(
Constants
.
OBJ_TYPE_OTHER
);
authModel
.
setName
(
jo
.
getString
(
"name"
));
authModel
.
setId
(
id
);
list
.
add
(
authModel
);
}
}
}
break
;
default
:
break
;
}
}
return
list
;
}
}
src/main/java/com/keymobile/indicators/constant/Constants.java
View file @
56646b51
...
...
@@ -60,6 +60,8 @@ public class Constants {
*/
public
static
final
String
LOG_INDICATOR_WEIGHTCFG_API
=
"indicator.weightcfg"
;
public
static
final
String
LOG_INDICATOR_WEIGHT_DATA_ENTER_API
=
"indicator.weightdataenter"
;
/**
*短板管理结果汇总
**/
...
...
src/main/java/com/keymobile/indicators/model/entity/weight/ObjScoreIndWeightDetail.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
/**
* @author DW
* @date 2023-02-26-0026 16:07
* @description 对标主体得分指标权重明细表
*/
@Data
@Table
(
name
=
"obj_score_ind_weight_detail"
)
public
class
ObjScoreIndWeightDetail
{
// 表主键ID有问题
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
// 配置主表ID
private
Integer
cfgId
;
// 租户组织CODE,区分不同单位
private
String
code
;
// 配置级别
private
String
levelName
;
// 配置周期
private
String
dataValue
;
// 对标主体CODE
private
String
orgNo
;
// 对标主体name
private
String
orgName
;
// 对标主体类型-两烟区-纯销区
private
String
orgType
;
// 指标ID
private
String
indId
;
// 指标名称
private
String
indName
;
// 权重
private
BigDecimal
weight
;
// 指标综合评价权重
private
BigDecimal
indWeight
;
// 指标改善提升权重
private
BigDecimal
indImproveWeight
;
// 两烟区大类权重
private
BigDecimal
weightTwo
;
// 纯销区大类权重
private
BigDecimal
weightOne
;
// 大类权重
private
BigDecimal
bigWeight
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightExcelIndicator.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* @author DW
* @date 2023-02-23-0023 15:10
* @description
*/
@Data
@Table
(
name
=
"weight_data_excel_ind"
)
public
class
WeightExcelIndicator
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 关联模板id
*/
private
Integer
tempId
;
/**
* 关联指标id
*/
private
String
indId
;
/**
* 指标名称
*/
private
String
indName
;
/**
* 指标单位
*/
private
String
indUnit
;
/**
* 指标数量来源:1 Excel导入 2 手工录入
*/
private
Integer
indSource
;
/**
* 顺序号
*/
private
Integer
orderNum
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightExcelObj.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
/**
* @author DW
* @date 2023-02-23-0023 15:11
* @description
*/
@Data
@Table
(
name
=
"weight_data_excel_obj"
)
public
class
WeightExcelObj
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 关联模板id
*/
private
Integer
tempId
;
/**
* 对象id
*/
private
String
objId
;
/**
* 对象名
*/
private
String
objName
;
/**
* 对象类型:1、组织 2、人员 3、数据项
*/
private
Integer
objType
;
/**
* 顺序号
*/
private
Integer
orderNum
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightExcelTemplate.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
java.util.List
;
/**
* @author DW
* @date 2023-02-23-0023 15:09
* @description
*/
@Data
@Table
(
name
=
"weight_data_excel_temp"
)
@ApiModel
(
"excel模板定义"
)
public
class
WeightExcelTemplate
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
@ApiModelProperty
(
"权重ID"
)
private
Integer
weightId
;
/**
* 模板名字
*/
@ApiModelProperty
(
"模板名字"
)
private
String
name
;
/**
* 列类型
*/
@ApiModelProperty
(
"列类型:1、指标 2 考核对象"
)
private
Integer
ctype
;
/**
* 所属组织机构
*/
@ApiModelProperty
(
"所属组织机构"
)
private
String
orgNo
;
@ApiModelProperty
(
"数据项列表"
)
@Transient
private
List
<
WeightExcelIndicator
>
inds
;
@ApiModelProperty
(
"考核对象列表"
)
@Transient
private
List
<
WeightExcelObj
>
objs
;
}
src/main/java/com/keymobile/indicators/model/entity/weight/WeightIndValue.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
entity
.
weight
;
import
com.keymobile.indicators.model.entity.BaseModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
/**
* @author DW
* @date 2023-02-22-0022 15:35
* @description 权重指标数据实体-用于权重配置中在线填报功能使用
*/
@Data
@Table
(
name
=
"weight_ind_value"
)
public
class
WeightIndValue
extends
BaseModel
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
// 权重配置ID
private
Integer
weightId
;
// 考核指标ID
private
String
indId
;
// 考核指标名称
private
String
indName
;
// 考核指标单位
private
String
indUnit
;
/**
* 指标数量来源:1 Excel导入 2 手工录入
*/
private
Integer
indSource
;
// 综合评价权重
private
BigDecimal
synthesizeWeight
;
// 改善提升权重
private
BigDecimal
improveWeight
;
// 维度权重
private
BigDecimal
dimensionWeight
;
/**
* 数据对象id
*/
@ApiModelProperty
(
"数据对象id"
)
private
String
objId
;
/**
* 数据对象类型:1、组织机构 2、人员
*/
@ApiModelProperty
(
"数据对象类型:1、组织机构 2、人员 3、岗位"
)
private
Integer
objType
;
/**
* 数据项对象名称
*/
@ApiModelProperty
(
"数据对象名称"
)
private
String
objName
;
@ApiModelProperty
(
"备注"
)
private
String
description
;
/**
* excel导入对应的excel模板id
*/
private
Integer
tempId
;
}
src/main/java/com/keymobile/indicators/model/mapper/weight/ObjScoreIndWeightDetailMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.ObjScoreIndWeightDetail
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
ObjScoreIndWeightDetailMapper
extends
BaseMapper
<
ObjScoreIndWeightDetail
>
{
/**
* 批量插入填报值
* @param valueList
*/
void
batchInsert
(
@Param
(
"valueList"
)
List
<
ObjScoreIndWeightDetail
>
valueList
);
/**
* 根据权重配置ID删除权重数据填报
* @param cfgId 权重配置ID
*/
void
deleteByCfgId
(
@Param
(
"cfgId"
)
Integer
cfgId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelIndicatorMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
WeightExcelIndicatorMapper
extends
BaseMapper
<
WeightExcelIndicator
>
{
/**
* 查询模板关联的指标信息
* @param tempId
* @return
*/
List
<
WeightExcelIndicator
>
getByTempId
(
Integer
tempId
);
/**
* 根据模板id删除指标信息
* @param tempId
*/
void
deleteByTempId
(
Integer
tempId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelObjMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
WeightExcelObjMapper
extends
BaseMapper
<
WeightExcelObj
>
{
/**
* 查询模板关联的考核对象信息
* @param tempId
* @return
*/
List
<
WeightExcelObj
>
getByTempId
(
Integer
tempId
);
/**
* 根据模板id删除考核对象信息
* @param tempId
*/
void
deleteByTempId
(
Integer
tempId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightExcelTemplateMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
org.apache.ibatis.annotations.Mapper
;
import
tk.mybatis.mapper.common.BaseMapper
;
@Mapper
public
interface
WeightExcelTemplateMapper
extends
BaseMapper
<
WeightExcelTemplate
>
{
/**
* 逻辑删除模板
* @param id
*/
void
deleteById
(
Integer
id
);
/**
* 根据权重id获取excel模板
* @param weightId
* @return
*/
WeightExcelTemplate
getByWeightId
(
Integer
weightId
);
/**
* 根据权重ID删除权重模板
* @param weightId 权重ID
*/
void
deleteByWeightId
(
Integer
weightId
);
}
src/main/java/com/keymobile/indicators/model/mapper/weight/WeightIndValueMapper.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
weight
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.BaseMapper
;
import
java.util.List
;
@Mapper
public
interface
WeightIndValueMapper
extends
BaseMapper
<
WeightIndValue
>
{
/**
* 批量插入填报值
* @param valueList
*/
void
batchInsert
(
@Param
(
"valueList"
)
List
<
WeightIndValue
>
valueList
);
/**
* 根据 指标id 机构编码 时间维度删除
* @param newValues
**/
void
batchDelete
(
@Param
(
"newValues"
)
List
<
WeightIndValue
>
newValues
);
/**
* 根据权重配置ID删除权重数据填报
* @param weightId 权重配置ID
*/
void
deleteByWeightId
(
@Param
(
"weightId"
)
Integer
weightId
);
/**
* 根据权重配置ID查询权重数据填报
* @param weightId 权重配置ID
* @return 权重数据填报集合
*/
List
<
WeightIndValue
>
findByWeightId
(
@Param
(
"weightId"
)
Integer
weightId
);
}
src/main/java/com/keymobile/indicators/service/impl/ObjScoreIndWeightCfgServiceImpl.java
View file @
56646b51
...
...
@@ -2,11 +2,16 @@ package com.keymobile.indicators.service.impl;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleGroupObj
;
import
com.keymobile.indicators.model.entity.dataenter.TaskRuleIndicator
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper
;
import
com.keymobile.indicators.service.ObjScoreIndWeightCfgService
;
import
com.keymobile.indicators.service.dataenter.TaskRuleGroupObjService
;
import
com.keymobile.indicators.service.weightDataEnter.WeightIndValueService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -34,6 +39,12 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
private
ObjScoreIndWeightCfgMapper
weightCfgMapper
;
@Autowired
private
DriveIndDefMapper
driveIndDefMapper
;
@Autowired
private
WeightIndValueMapper
weightIndValueMapper
;
@Autowired
private
TaskRuleGroupObjService
taskRuleGroupObjService
;
@Autowired
private
WeightIndValueService
weightIndValueService
;
@Override
public
void
deleteById
(
Integer
id
)
{
...
...
@@ -82,6 +93,30 @@ public class ObjScoreIndWeightCfgServiceImpl implements ObjScoreIndWeightCfgServ
public
void
updateWeight
(
ObjScoreIndWeightCfg
weightCfg
)
{
weightCfg
.
setState
(
Constants
.
DATA_STATE_A
);
weightCfgMapper
.
updateByPrimaryKey
(
setIndMsg
(
weightCfg
));
updateWeightIndValue
(
weightCfg
);
}
/**
* 根据权重配置更新数据填报结果表
* @param weightCfg 权重配置信息
*/
private
void
updateWeightIndValue
(
ObjScoreIndWeightCfg
weightCfg
)
{
List
<
WeightIndValue
>
values
=
weightIndValueMapper
.
findByWeightId
(
weightCfg
.
getId
());
// 判断权重是否已经填报过数据,没有填报过数据的权重无需此操作
// 填报过的权重配置需要同步更新维度权重
if
(
values
!=
null
&&
values
.
size
()
>
0
)
{
// 获取两烟区单位
// 两烟区单位
TaskRuleGroupObj
twoGroupObj
=
taskRuleGroupObjService
.
getById
(
weightCfg
.
getWeightTwoUnit
());
for
(
WeightIndValue
value
:
values
)
{
if
(
StringUtils
.
contains
(
twoGroupObj
.
getDetailNames
(),
value
.
getObjName
()))
{
value
.
setDimensionWeight
(
weightCfg
.
getWeightTwo
());
}
else
{
value
.
setDimensionWeight
(
weightCfg
.
getWeightOne
());
}
}
weightIndValueService
.
saveWeightValues
(
values
,
weightCfg
.
getId
());
}
}
/**
...
...
src/main/java/com/keymobile/indicators/service/weightDataEnter/WeightExcelTemplateService.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
public
interface
WeightExcelTemplateService
{
WeightExcelTemplate
getByWeightId
(
String
weightId
);
WeightExcelTemplate
getById
(
Integer
id
);
void
create
(
WeightExcelTemplate
template
);
}
src/main/java/com/keymobile/indicators/service/weightDataEnter/WeightIndValueService.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
java.util.List
;
public
interface
WeightIndValueService
{
void
saveWeightValues
(
List
<
WeightIndValue
>
values
,
Integer
weightId
);
List
<
WeightIndValue
>
findByWeightId
(
Integer
weightId
);
}
src/main/java/com/keymobile/indicators/service/weightDataEnter/impl/WeightExcelTemplateServiceImpl.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
.
impl
;
import
com.keymobile.indicators.constant.Constants
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelIndicator
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelObj
;
import
com.keymobile.indicators.model.entity.dataenter.ExcelTemplate
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelIndicator
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelObj
;
import
com.keymobile.indicators.model.entity.weight.WeightExcelTemplate
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper
;
import
com.keymobile.indicators.service.weightDataEnter.WeightExcelTemplateService
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author DW
* @date 2023-02-23-0023 15:31
* @description
*/
@Service
public
class
WeightExcelTemplateServiceImpl
implements
WeightExcelTemplateService
{
@Autowired
private
WeightExcelIndicatorMapper
excelIndicatorMapper
;
@Autowired
private
WeightExcelObjMapper
excelObjMapper
;
@Autowired
private
WeightExcelTemplateMapper
excelTemplateMapper
;
@Override
public
WeightExcelTemplate
getByWeightId
(
String
weightId
)
{
WeightExcelTemplate
template
=
excelTemplateMapper
.
getByWeightId
(
Integer
.
parseInt
(
weightId
));
if
(
template
!=
null
)
{
List
<
WeightExcelObj
>
objs
=
excelObjMapper
.
getByTempId
(
template
.
getId
());
List
<
WeightExcelIndicator
>
inds
=
excelIndicatorMapper
.
getByTempId
(
template
.
getId
());
template
.
setObjs
(
objs
);
template
.
setInds
(
inds
);
}
return
template
;
}
@Override
public
WeightExcelTemplate
getById
(
Integer
id
)
{
WeightExcelTemplate
template
=
excelTemplateMapper
.
selectByPrimaryKey
(
id
);
if
(
template
!=
null
)
{
List
<
WeightExcelObj
>
objs
=
excelObjMapper
.
getByTempId
(
id
);
List
<
WeightExcelIndicator
>
inds
=
excelIndicatorMapper
.
getByTempId
(
id
);
template
.
setObjs
(
objs
);
template
.
setInds
(
inds
);
}
return
template
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
WeightExcelTemplate
template
)
{
// 需要保证weight_data_excel_temp表中weight_id关联的数据唯一
// 先删除(将表数据state修改为3-废弃),再添加
excelTemplateMapper
.
deleteByWeightId
(
template
.
getWeightId
());
Date
now
=
new
Date
();
String
currentUserId
=
SystemUserUtil
.
getCurrentUserId
();
template
.
setUpdater
(
currentUserId
);
template
.
setCreator
(
currentUserId
);
template
.
setUpdateTime
(
now
);
template
.
setCreateTime
(
now
);
template
.
setState
(
Constants
.
DATA_STATE_A
);
excelTemplateMapper
.
insert
(
template
);
insertIndAndObj
(
template
,
now
,
currentUserId
);
}
/**
* 插入指标和对象信息
* @param template
* @param now
* @param currentUserId
*/
private
void
insertIndAndObj
(
WeightExcelTemplate
template
,
Date
now
,
String
currentUserId
)
{
List
<
WeightExcelObj
>
objs
=
template
.
getObjs
();
if
(
CollectionUtils
.
isNotEmpty
(
objs
))
{
int
o
=
1
;
for
(
WeightExcelObj
obj
:
objs
)
{
obj
.
setId
(
null
);
obj
.
setTempId
(
template
.
getId
());
obj
.
setUpdater
(
currentUserId
);
obj
.
setCreator
(
currentUserId
);
obj
.
setUpdateTime
(
now
);
obj
.
setOrderNum
(
o
++);
obj
.
setCreateTime
(
now
);
obj
.
setState
(
Constants
.
DATA_STATE_A
);
excelObjMapper
.
insert
(
obj
);
}
}
List
<
WeightExcelIndicator
>
inds
=
template
.
getInds
();
if
(
CollectionUtils
.
isNotEmpty
(
inds
))
{
int
o
=
1
;
for
(
WeightExcelIndicator
indicator
:
inds
)
{
indicator
.
setId
(
null
);
indicator
.
setUpdater
(
currentUserId
);
indicator
.
setCreator
(
currentUserId
);
indicator
.
setUpdateTime
(
now
);
indicator
.
setCreateTime
(
now
);
indicator
.
setOrderNum
(
o
++);
indicator
.
setState
(
Constants
.
DATA_STATE_A
);
indicator
.
setTempId
(
template
.
getId
());
indicator
.
setIndSource
(
1
);
excelIndicatorMapper
.
insert
(
indicator
);
}
}
}
}
src/main/java/com/keymobile/indicators/service/weightDataEnter/impl/WeightIndValueServiceImpl.java
0 → 100644
View file @
56646b51
package
com
.
keymobile
.
indicators
.
service
.
weightDataEnter
.
impl
;
import
com.keymobile.indicators.model.entity.ObjScoreIndWeightCfg
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndDef
;
import
com.keymobile.indicators.model.entity.weight.ObjScoreIndWeightDetail
;
import
com.keymobile.indicators.model.entity.weight.WeightIndValue
;
import
com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper
;
import
com.keymobile.indicators.model.mapper.indicators.ObjScoreIndWeightCfgMapper
;
import
com.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper
;
import
com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper
;
import
com.keymobile.indicators.service.weightDataEnter.WeightIndValueService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author DW
* @date 2023-02-22-0022 18:13
* @description
*/
@Service
@Slf4j
public
class
WeightIndValueServiceImpl
implements
WeightIndValueService
{
@Autowired
private
WeightIndValueMapper
weightIndValueMapper
;
@Autowired
private
ObjScoreIndWeightDetailMapper
weightDetailMapper
;
@Autowired
private
ObjScoreIndWeightCfgMapper
weightCfgMapper
;
@Autowired
private
DriveIndDefMapper
driveIndDefMapper
;
@Override
public
void
saveWeightValues
(
List
<
WeightIndValue
>
values
,
Integer
weightId
)
{
log
.
info
(
weightId
+
",正在批量清楚历史数据。。。"
);
weightIndValueMapper
.
deleteByWeightId
(
weightId
);
log
.
info
(
weightId
+
",保存excel数据。。。"
);
weightIndValueMapper
.
batchInsert
(
values
);
// 同时将权重结果数据填充到obj_score_ind_weight_detail表中
saveDetail
(
values
,
weightId
);
}
/**
* 将权重结果数据填充到obj_score_ind_weight_detail表中
* @param values
* @param weightId
*/
private
void
saveDetail
(
List
<
WeightIndValue
>
values
,
Integer
weightId
)
{
ObjScoreIndWeightCfg
weightCfg
=
weightCfgMapper
.
getById
(
weightId
);
// 先清除表里面的数据
weightDetailMapper
.
deleteByCfgId
(
weightId
);
List
<
ObjScoreIndWeightDetail
>
details
=
new
ArrayList
<>();
for
(
WeightIndValue
indValue
:
values
)
{
DriveIndDef
indDef
=
driveIndDefMapper
.
selectByPrimaryKey
(
indValue
.
getIndId
());
ObjScoreIndWeightDetail
weightDetail
=
new
ObjScoreIndWeightDetail
();
weightDetail
.
setCfgId
(
weightId
);
weightDetail
.
setCode
(
weightCfg
.
getOrgNo
());
weightDetail
.
setLevelName
(
weightCfg
.
getLevelName
());
weightDetail
.
setDataValue
(
weightCfg
.
getDateValue
());
weightDetail
.
setOrgNo
(
indValue
.
getObjId
());
weightDetail
.
setOrgName
(
indValue
.
getObjName
());
weightDetail
.
setIndId
(
indValue
.
getIndId
());
weightDetail
.
setIndName
(
indValue
.
getIndName
());
if
(
StringUtils
.
isNotBlank
(
indDef
.
getComprehensiveEvaluation
()))
{
weightDetail
.
setWeight
(
new
BigDecimal
(
indDef
.
getComprehensiveEvaluation
()));
}
else
{
weightDetail
.
setWeight
(
new
BigDecimal
(
0
));
}
weightDetail
.
setIndWeight
(
indValue
.
getSynthesizeWeight
());
weightDetail
.
setIndImproveWeight
(
indValue
.
getImproveWeight
());
weightDetail
.
setWeightTwo
(
weightCfg
.
getWeightTwo
());
weightDetail
.
setWeightOne
(
weightCfg
.
getWeightOne
());
if
(
weightCfg
.
getWeightTwo
().
equals
(
indValue
.
getDimensionWeight
()))
{
weightDetail
.
setOrgType
(
"两烟区"
);
}
else
{
weightDetail
.
setOrgType
(
"纯销区"
);
}
weightDetail
.
setBigWeight
(
indValue
.
getDimensionWeight
());
details
.
add
(
weightDetail
);
}
weightDetailMapper
.
batchInsert
(
details
);
}
@Override
public
List
<
WeightIndValue
>
findByWeightId
(
Integer
weightId
)
{
return
weightIndValueMapper
.
findByWeightId
(
weightId
);
}
}
src/main/java/com/keymobile/indicators/utils/ModelPathEnum.java
View file @
56646b51
...
...
@@ -25,7 +25,8 @@ public enum ModelPathEnum {
LOG_INDICATOR_CONFIG_INFO
(
"indicator.config.info"
,
"系统管理/配置项管理"
),
LOG_INDICATOR_LOG
(
"indicator.log"
,
"系统管理/操作日志"
),
LOG_INDICATOR_AUDIT_ROLE_API
(
"indicator.audit.role"
,
"系统管理/填报审核角色配置管理 "
),
LOG_INDICATOR_WEIGHTCFG_API
(
"indicator.weightcfg"
,
"数据填报/权重配置"
);
LOG_INDICATOR_WEIGHTCFG_API
(
"indicator.weightcfg"
,
"数据填报/权重配置"
),
LOG_INDICATOR_WEIGHT_DATA_ENTER_API
(
"indicator.weightdataenter"
,
"数据填报/权重配置-数据填报"
);
private
String
modelName
;
private
String
modelPath
;
...
...
src/main/resources/mybatis/mapping/ObjScoreIndWeightDetailMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.ObjScoreIndWeightDetailMapper"
>
<insert
id=
"batchInsert"
parameterType=
"list"
>
insert into obj_score_ind_weight_detail
(cfg_id, code, level_name, date_value, org_no, org_name, org_type, ind_id, ind_name, weight, ind_weight, ind_improve_weight,
weight_two, weight_one , big_weight)
values
<foreach
collection=
"valueList"
item=
"val"
separator=
","
>
(#{val.cfgId}, #{val.code}, #{val.levelName}, #{val.dataValue}, #{val.orgNo}, #{val.orgName}, #{val.orgType},
#{val.indId}, #{val.indName}, #{val.weight}, #{val.indWeight}, #{val.indImproveWeight},
#{val.weightTwo}, #{val.weightOne}, #{val.bigWeight})
</foreach>
</insert>
<delete
id=
"deleteByCfgId"
parameterType=
"java.lang.Integer"
>
delete from obj_score_ind_weight_detail where cfg_id = #{cfgId}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelIndicatorMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightExcelIndicatorMapper"
>
<select
id=
"getByTempId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightExcelIndicator"
>
select *
from weight_data_excel_ind
where temp_id = #{tempId} and state = 1
order by order_num asc
</select>
<delete
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
delete
from weight_data_excel_ind
where temp_id = #{tempId}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelObjMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightExcelObjMapper"
>
<select
id=
"getByTempId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightExcelObj"
>
select *
from weight_data_excel_obj
where temp_id = #{tempId} and state = 1
order by order_num asc
</select>
<delete
id=
"deleteByTempId"
parameterType=
"java.lang.Integer"
>
delete
from weight_data_excel_obj
where temp_id = #{tempId}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightExcelTemplateMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightExcelTemplateMapper"
>
<update
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
update weight_data_excel_temp
set state = 3
where id = #{id}
</update>
<select
id=
"getByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightExcelTemplate"
>
select *
from weight_data_excel_temp
where state = 1 and weight_id = #{weightId}
</select>
<update
id=
"deleteByWeightId"
parameterType=
"java.lang.Integer"
>
update weight_data_excel_temp
set state = 3
where state = 1 and weight_id = #{weightId}
</update>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/WeightIndValueMapper.xml
0 → 100644
View file @
56646b51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.weight.WeightIndValueMapper"
>
<insert
id=
"batchInsert"
parameterType=
"list"
>
insert into weight_ind_value
(weight_id, ind_id,ind_name,ind_unit,ind_source, synthesize_weight, improve_weight, dimension_weight, obj_id,obj_name,obj_type,temp_id,
state,creator ,updater,create_time,update_time)
values
<foreach
collection=
"valueList"
item=
"val"
separator=
","
>
(#{val.weightId}, #{val.indId}, #{val.indName}, #{val.indUnit}, #{val.indSource},#{val.synthesizeWeight},#{val.improveWeight},
#{val.dimensionWeight},#{val.objId},#{val.objName},#{val.objType}, #{val.tempId},
#{val.state},#{val.creator},#{val.updater},#{val.createTime}, #{val.updateTime}
)
</foreach>
</insert>
<delete
id=
"batchDelete"
parameterType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
<foreach
collection=
"newValues"
item=
"val"
separator=
";"
>
delete from weight_ind_value
where weight_id=#{val.weightId} and ind_id = #{val.indId} and obj_id = #{val.objId}
</foreach>
</delete>
<delete
id=
"deleteByWeightId"
parameterType=
"java.lang.Integer"
>
delete from weight_ind_value where weight_id = #{weightId}
</delete>
<select
id=
"findByWeightId"
parameterType=
"java.lang.Integer"
resultType=
"com.keymobile.indicators.model.entity.weight.WeightIndValue"
>
select * from weight_ind_value where weight_id = #{weightId}
</select>
</mapper>
\ 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