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
c4c70b6a
Commit
c4c70b6a
authored
Jul 22, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交整合考核指标报表2数据代码
parent
94282e26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
281 additions
and
20 deletions
+281
-20
IndicatorReportCtrl.java
.../keymobile/indicators/api/report/IndicatorReportCtrl.java
+8
-0
BaseIndDef.java
...mobile/indicators/model/entity/indicators/BaseIndDef.java
+1
-1
DriveIndDef.java
...obile/indicators/model/entity/indicators/DriveIndDef.java
+1
-1
IndicatorsReportOne.java
...e/indicators/model/entity/report/IndicatorsReportOne.java
+1
-1
IndicatorsReportTwo.java
...e/indicators/model/entity/report/IndicatorsReportTwo.java
+1
-0
ReportTwoMapper.java
...obile/indicators/model/mapper/report/ReportTwoMapper.java
+6
-0
IndicatorsReportService.java
...le/indicators/service/report/IndicatorsReportService.java
+116
-17
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+39
-0
ReportTwoMapper.xml
src/main/resources/mybatis/mapping/ReportTwoMapper.xml
+108
-0
No files found.
src/main/java/com/keymobile/indicators/api/report/IndicatorReportCtrl.java
View file @
c4c70b6a
...
@@ -33,4 +33,12 @@ public class IndicatorReportCtrl {
...
@@ -33,4 +33,12 @@ public class IndicatorReportCtrl {
indicatorsReportService
.
dealBaseIndReportOneData
(
date
,
compareObjs
);
indicatorsReportService
.
dealBaseIndReportOneData
(
date
,
compareObjs
);
return
"基础项本期同期报表数据开始整合..."
;
return
"基础项本期同期报表数据开始整合..."
;
}
}
@ApiOperation
(
value
=
"整合考核指标报表数据2"
,
notes
=
"整合考核指标报表数据2"
)
@PostMapping
(
value
=
"/dealDriveReportTwo"
)
public
String
dealDriveReportTwo
(
@RequestParam
String
compareUnitId
,
@RequestParam
List
<
String
>
indIds
,
@RequestParam
List
<
String
>
compareObjs
,
@RequestParam
Integer
date
)
{
indicatorsReportService
.
dealDriveIndReportTwoData
(
compareUnitId
,
indIds
,
compareObjs
,
date
);
return
"整合考核指标报表数据2开始整合..."
;
}
}
}
src/main/java/com/keymobile/indicators/model/entity/indicators/BaseIndDef.java
View file @
c4c70b6a
...
@@ -24,7 +24,7 @@ public class BaseIndDef {
...
@@ -24,7 +24,7 @@ public class BaseIndDef {
private
String
indUnit
;
//数据项单位
private
String
indUnit
;
//数据项单位
private
String
indDesc
;
//说明
private
String
indDesc
;
//说明
private
Integer
indSource
;
//数据项来源 1:excel导入 2:手工填报
private
Integer
indSource
;
//数据项来源 1:excel导入 2:手工填报
private
String
indFrequency
;
//数据源频度 0:月度 1:季度 2:年度
private
String
indFrequency
;
//数据源频度 0:月度 1:季度 2:年度
3:半年度
private
String
indFormat
;
//指标公式
private
String
indFormat
;
//指标公式
private
String
indFormatDesc
;
//指标公式描述
private
String
indFormatDesc
;
//指标公式描述
private
String
creater
;
private
String
creater
;
...
...
src/main/java/com/keymobile/indicators/model/entity/indicators/DriveIndDef.java
View file @
c4c70b6a
...
@@ -28,7 +28,7 @@ public class DriveIndDef {
...
@@ -28,7 +28,7 @@ public class DriveIndDef {
private
Integer
indCalScoreRule
;
//计分规则
private
Integer
indCalScoreRule
;
//计分规则
private
String
indCalScoreRuleDesc
;
//计分规则描述
private
String
indCalScoreRuleDesc
;
//计分规则描述
private
String
isUnitCalScore
;
//是否参与单位得分计算 是:1 否:0
private
String
isUnitCalScore
;
//是否参与单位得分计算 是:1 否:0
private
String
indFrequency
;
//指标频度 0:月度给数 1:季度给数 2:年度给数
private
String
indFrequency
;
//指标频度 0:月度给数 1:季度给数 2:年度给数
3:半年度
private
String
growCalType
;
//增幅计算类型 0:本期-同期 1:(本期-同期)/同期*100
private
String
growCalType
;
//增幅计算类型 0:本期-同期 1:(本期-同期)/同期*100
private
String
version
;
//版本号
private
String
version
;
//版本号
private
String
code
;
//标识编码
private
String
code
;
//标识编码
...
...
src/main/java/com/keymobile/indicators/model/entity/report/IndicatorsReportOne.java
View file @
c4c70b6a
...
@@ -25,7 +25,7 @@ public class IndicatorsReportOne {
...
@@ -25,7 +25,7 @@ public class IndicatorsReportOne {
private
String
compareType
;
//对标类型: 1:日 2:月 3:季 4:年
private
String
compareType
;
//对标类型: 1:日 2:月 3:季 4:年
private
String
unit
;
//指标单位
private
String
unit
;
//指标单位
private
String
depart
;
//指标归属部门
private
String
depart
;
//指标归属部门
private
String
catalogType
;
//指标归属类别
private
Integer
catalogType
;
//指标归属类别
private
String
currentValue
;
//本期值
private
String
currentValue
;
//本期值
private
String
lastSameValue
;
// 同期值
private
String
lastSameValue
;
// 同期值
private
String
valueRate
;
//同比
private
String
valueRate
;
//同比
...
...
src/main/java/com/keymobile/indicators/model/entity/report/IndicatorsReportTwo.java
View file @
c4c70b6a
...
@@ -24,6 +24,7 @@ public class IndicatorsReportTwo {
...
@@ -24,6 +24,7 @@ public class IndicatorsReportTwo {
private
Integer
compareDate
;
//对标时间
private
Integer
compareDate
;
//对标时间
private
String
compareType
;
//对标类型
private
String
compareType
;
//对标类型
private
String
unit
;
//单位
private
String
unit
;
//单位
private
Integer
catalogType
;
//指标归属类别
private
String
currentActualAverage
;
//本期全省平均值
private
String
currentActualAverage
;
//本期全省平均值
private
String
sameActualAverage
;
//同期全省平均值
private
String
sameActualAverage
;
//同期全省平均值
private
String
averageRate
;
//全省平均分同比
private
String
averageRate
;
//全省平均分同比
...
...
src/main/java/com/keymobile/indicators/model/mapper/report/ReportTwoMapper.java
View file @
c4c70b6a
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
report
;
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
report
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -11,4 +13,8 @@ import tk.mybatis.mapper.common.BaseMapper;
...
@@ -11,4 +13,8 @@ import tk.mybatis.mapper.common.BaseMapper;
public
interface
ReportTwoMapper
extends
BaseMapper
<
IndicatorsReportTwo
>{
public
interface
ReportTwoMapper
extends
BaseMapper
<
IndicatorsReportTwo
>{
public
IndicatorsReportTwo
getDataByParam
(
@Param
(
"indId"
)
String
indId
,
@Param
(
"compareUnitId"
)
String
compareUnitId
,
public
IndicatorsReportTwo
getDataByParam
(
@Param
(
"indId"
)
String
indId
,
@Param
(
"compareUnitId"
)
String
compareUnitId
,
@Param
(
"date"
)
Integer
date
,
@Param
(
"type"
)
String
type
);
@Param
(
"date"
)
Integer
date
,
@Param
(
"type"
)
String
type
);
public
void
batchSave
(
@Param
(
"datas"
)
List
<
IndicatorsReportTwo
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
IndicatorsReportTwo
>
datas
);
}
}
src/main/java/com/keymobile/indicators/service/report/IndicatorsReportService.java
View file @
c4c70b6a
This diff is collapsed.
Click to expand it.
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
c4c70b6a
package
com
.
keymobile
.
indicators
.
utils
;
package
com
.
keymobile
.
indicators
.
utils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -227,6 +230,41 @@ public class CalculateUtils {
...
@@ -227,6 +230,41 @@ public class CalculateUtils {
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
e1
,
e2
)
->
e2
,
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
e1
,
e2
)
->
e2
,
LinkedHashMap:
:
new
));
LinkedHashMap:
:
new
));
}
}
//type:0从小到大 1从大到小
public
static
Map
<
String
,
Integer
>
sortMapByValue
(
Map
<
String
,
Integer
>
oriMap
,
Integer
type
)
{
if
(
oriMap
==
null
||
oriMap
.
isEmpty
())
{
return
null
;
}
Map
<
String
,
Integer
>
sortedMap
=
new
LinkedHashMap
<
String
,
Integer
>();
List
<
Map
.
Entry
<
String
,
Integer
>>
entryList
=
new
ArrayList
<
Map
.
Entry
<
String
,
Integer
>>(
oriMap
.
entrySet
());
Collections
.
sort
(
entryList
,
new
MapValueComparator
(
type
));
Iterator
<
Map
.
Entry
<
String
,
Integer
>>
iter
=
entryList
.
iterator
();
Map
.
Entry
<
String
,
Integer
>
tmpEntry
=
null
;
while
(
iter
.
hasNext
())
{
tmpEntry
=
iter
.
next
();
sortedMap
.
put
(
tmpEntry
.
getKey
(),
tmpEntry
.
getValue
());
}
return
sortedMap
;
}
public
static
class
MapValueComparator
implements
Comparator
<
Map
.
Entry
<
String
,
Integer
>>
{
private
Integer
type
;
//0:从小到大 1:从大到小
public
MapValueComparator
(
Integer
type
)
{
this
.
type
=
type
;
}
@Override
public
int
compare
(
Entry
<
String
,
Integer
>
me1
,
Entry
<
String
,
Integer
>
me2
)
{
if
(
type
==
0
)
{
return
me1
.
getValue
().
compareTo
(
me2
.
getValue
());
//按照从小到大
}
return
me2
.
getValue
().
compareTo
(
me1
.
getValue
());
//按照从大到小
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
...
@@ -240,6 +278,7 @@ public class CalculateUtils {
...
@@ -240,6 +278,7 @@ public class CalculateUtils {
map
.
put
(
"1008"
,
"-6"
);
map
.
put
(
"1008"
,
"-6"
);
CalculateUtils
cal
=
new
CalculateUtils
();
CalculateUtils
cal
=
new
CalculateUtils
();
Map
<
String
,
Integer
>
result
=
cal
.
rankValue
(
map
,
"0"
);
Map
<
String
,
Integer
>
result
=
cal
.
rankValue
(
map
,
"0"
);
result
=
cal
.
sortMapByValue
(
result
,
1
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
//
//
// String formula = "([1001]+[1002])/2";
// String formula = "([1001]+[1002])/2";
...
...
src/main/resources/mybatis/mapping/ReportTwoMapper.xml
View file @
c4c70b6a
...
@@ -10,4 +10,111 @@
...
@@ -10,4 +10,111 @@
compare_date = #{date} and
compare_date = #{date} and
compare_type = #{type}
compare_type = #{type}
</select>
</select>
<insert
id=
"batchSave"
parameterType=
"java.util.List"
>
insert into indicators_report_two(
ind_id,ind_name,compare_unit_id,compare_unit_name,compare_date,compare_type,unit,catalog_type,current_actual_average,
same_actual_average,average_rate,trend,current_average,best_unit,best_unit_desc,best_unit_value,
best_average_units,same_improve_units,rank_head_three,rank_head_three_desc,rank_after_three,
rank_after_three_desc,same_improve_head_three,same_improve_head_three_desc,same_improve_after_three,
same_improve_after_three_desc)
values
<foreach
collection=
"datas"
item=
"val"
separator=
","
>
(
#{val.indId}, #{val.indName}, #{val.compareUnitId}, #{val.compareUnitName}, #{val.compareDate},
#{val.compareType},#{val.unit},#{val.catalogType},#{val.currentActualAverage},#{val.sameActualAverage},#{val.averageRate},
#{val.trend},#{val.currentAverage},#{val.bestUnit},#{val.bestUnitDesc},#{val.bestUnitValue},
#{val.bestAverageUnits},#{val.sameImproveUnits},#{val.rankHeadThree},#{val.rankHeadThreeDesc},
#{val.rankAfterThree},#{val.rankAfterThreeDesc},#{val.sameImproveHeadThree},#{val.sameImproveHeadThreeDesc},
#{val.sameImproveAfterThree},#{val.sameImproveAfterThreeDesc}
)
</foreach>
</insert>
<update
id=
"batchUpdate"
parameterType=
"java.util.List"
>
<foreach
collection=
"datas"
item=
"val"
separator=
";"
>
update indicators_report_two
<set>
<if
test=
"val.indId != null"
>
ind_id = #{val.indId},
</if>
<if
test=
"val.indName != null"
>
ind_name = #{val.indName},
</if>
<if
test=
"val.compareUnitId != null"
>
compare_unit_id = #{val.compareUnitId},
</if>
<if
test=
"val.compareUnitName != null"
>
compare_unit_name = #{val.compareUnitName},
</if>
<if
test=
"val.compareDate != null"
>
compare_date = #{val.compareDate},
</if>
<if
test=
"val.compareType != null"
>
compare_type = #{val.compareType},
</if>
<if
test=
"val.unit != null"
>
unit = #{val.unit},
</if>
<if
test=
"val.catalogType != null"
>
catalog_type = #{val.catalogType},
</if>
<if
test=
"val.currentActualAverage != null"
>
current_actual_average = #{val.currentActualAverage},
</if>
<if
test=
"val.sameActualAverage != null"
>
same_actual_average = #{val.sameActualAverage},
</if>
<if
test=
"val.averageRate != null"
>
average_rate = #{val.averageRate},
</if>
<if
test=
"val.trend != null"
>
trend = #{val.trend},
</if>
<if
test=
"val.currentAverage != null"
>
current_average = #{val.currentAverage},
</if>
<if
test=
"val.bestUnit != null"
>
best_unit = #{val.bestUnit},
</if>
<if
test=
"val.bestUnitDesc != null"
>
best_unit_desc = #{val.bestUnitDesc},
</if>
<if
test=
"val.bestUnitValue != null"
>
best_unit_value = #{val.bestUnitValue},
</if>
<if
test=
"val.bestAverageUnits != null"
>
best_average_units = #{val.bestAverageUnits},
</if>
<if
test=
"val.sameImproveUnits != null"
>
same_improve_units = #{val.sameImproveUnits},
</if>
<if
test=
"val.rankHeadThree != null"
>
rank_head_three = #{val.rankHeadThree},
</if>
<if
test=
"val.rankHeadThreeDesc != null"
>
rank_head_three_desc = #{val.rankHeadThreeDesc},
</if>
<if
test=
"val.rankAfterThree != null"
>
rank_after_three = #{val.rankAfterThree},
</if>
<if
test=
"val.rankAfterThreeDesc != null"
>
rank_after_three_desc = #{val.rankAfterThreeDesc},
</if>
<if
test=
"val.sameImproveHeadThree != null"
>
same_improve_head_three = #{val.sameImproveHeadThree},
</if>
<if
test=
"val.sameImproveHeadThreeDesc != null"
>
same_improve_head_three_desc = #{val.sameImproveHeadThreeDesc},
</if>
<if
test=
"val.sameImproveAfterThree != null"
>
same_improve_after_three = #{val.sameImproveAfterThree},
</if>
<if
test=
"val.sameImproveAfterThreeDesc != null"
>
same_improve_after_three_desc = #{val.sameImproveAfterThreeDesc},
</if>
</set>
where id = ${val.id}
</foreach>
</update>
</mapper>
</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