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
779395ff
Commit
779395ff
authored
Nov 18, 2020
by
hzc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改试运行清表逻辑
parent
5ebd189e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
21 deletions
+100
-21
DriveIndCalResultCtrl.java
...obile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
+1
-1
TestDriveIndCalResultDefMapper.java
.../model/mapper/testrun/TestDriveIndCalResultDefMapper.java
+3
-0
TestObjScoreCalResultMapper.java
...ors/model/mapper/testrun/TestObjScoreCalResultMapper.java
+3
-0
TaskServiceImpl.java
...le/indicators/service/dataenter/impl/TaskServiceImpl.java
+1
-0
DriveIndCalResultService.java
...ndicators/service/hytobacco/DriveIndCalResultService.java
+27
-11
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+31
-9
TestDriveIndCalResultDefMapper.xml
...ources/mybatis/mapping/TestDriveIndCalResultDefMapper.xml
+17
-0
TestObjScoreCalResultMapper.xml
...resources/mybatis/mapping/TestObjScoreCalResultMapper.xml
+17
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
View file @
779395ff
...
@@ -93,7 +93,7 @@ public class DriveIndCalResultCtrl {
...
@@ -93,7 +93,7 @@ public class DriveIndCalResultCtrl {
public
void
deleteCompareUnitData
(
@RequestParam
List
<
String
>
compareIds
,
public
void
deleteCompareUnitData
(
@RequestParam
List
<
String
>
compareIds
,
@RequestParam
Integer
currentDate
,
@RequestParam
Integer
sameDate
,
@RequestParam
Integer
currentDate
,
@RequestParam
Integer
sameDate
,
@RequestParam
String
code
)
{
@RequestParam
String
code
)
{
driveIndCalResultService
.
deleteCompareUnitData
(
compareIds
,
currentDate
,
sameDate
,
code
);
driveIndCalResultService
.
deleteCompareUnitData
(
compareIds
,
currentDate
,
sameDate
,
code
,
"1"
);
}
}
...
...
src/main/java/com/keymobile/indicators/model/mapper/testrun/TestDriveIndCalResultDefMapper.java
View file @
779395ff
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
testrun
;
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
testrun
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -25,4 +26,6 @@ public interface TestDriveIndCalResultDefMapper extends BaseMapper<TestDriveIndC
...
@@ -25,4 +26,6 @@ public interface TestDriveIndCalResultDefMapper extends BaseMapper<TestDriveIndC
public
void
batchSave
(
@Param
(
"datas"
)
List
<
TestDriveIndCalResultDef
>
datas
);
public
void
batchSave
(
@Param
(
"datas"
)
List
<
TestDriveIndCalResultDef
>
datas
);
//批量修改
//批量修改
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
TestDriveIndCalResultDef
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
TestDriveIndCalResultDef
>
datas
);
void
deleteByCompareIdInAndDateIn
(
Map
<
String
,
Object
>
param2
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/testrun/TestObjScoreCalResultMapper.java
View file @
779395ff
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
testrun
;
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
testrun
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -17,4 +18,6 @@ public interface TestObjScoreCalResultMapper extends BaseMapper<TestObjScoreCalR
...
@@ -17,4 +18,6 @@ public interface TestObjScoreCalResultMapper extends BaseMapper<TestObjScoreCalR
public
void
batchSave
(
@Param
(
"datas"
)
List
<
TestObjScoreCalResult
>
datas
);
public
void
batchSave
(
@Param
(
"datas"
)
List
<
TestObjScoreCalResult
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
TestObjScoreCalResult
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
TestObjScoreCalResult
>
datas
);
void
deleteByCompareIdInAndDateIn
(
Map
<
String
,
Object
>
param2
);
}
}
src/main/java/com/keymobile/indicators/service/dataenter/impl/TaskServiceImpl.java
View file @
779395ff
...
@@ -516,6 +516,7 @@ public class TaskServiceImpl implements TaskService {
...
@@ -516,6 +516,7 @@ public class TaskServiceImpl implements TaskService {
for
(
TaskIndicator
indicator
:
needSumInds
)
{
for
(
TaskIndicator
indicator
:
needSumInds
)
{
for
(
AuthModel
model
:
models
)
{
for
(
AuthModel
model
:
models
)
{
TaskIndValue
value
=
new
TaskIndValue
();
TaskIndValue
value
=
new
TaskIndValue
();
value
.
setId
(
IdWorker
.
getStrId
());
value
.
setIndId
(
indicator
.
getIndId
());
value
.
setIndId
(
indicator
.
getIndId
());
value
.
setIndName
(
indicator
.
getIndName
());
value
.
setIndName
(
indicator
.
getIndName
());
value
.
setValueTime
(
task
.
getValueTime
());
value
.
setValueTime
(
task
.
getValueTime
());
...
...
src/main/java/com/keymobile/indicators/service/hytobacco/DriveIndCalResultService.java
View file @
779395ff
...
@@ -6,6 +6,8 @@ import java.util.List;
...
@@ -6,6 +6,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog
;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog
;
import
com.keymobile.indicators.model.mapper.testrun.TestDriveIndCalResultDefMapper
;
import
com.keymobile.indicators.model.mapper.testrun.TestObjScoreCalResultMapper
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
com.keymobile.indicators.utils.SystemUserUtil
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -40,6 +42,12 @@ public class DriveIndCalResultService {
...
@@ -40,6 +42,12 @@ public class DriveIndCalResultService {
private
ReportTwoMapper
reportTwoMapper
;
private
ReportTwoMapper
reportTwoMapper
;
@Autowired
@Autowired
private
CompareUnitCalLogService
compareUnitCalLogService
;
private
CompareUnitCalLogService
compareUnitCalLogService
;
@Autowired
private
TestDriveIndCalResultDefMapper
testDriveIndCalResultDefMapper
;
@Autowired
private
TestObjScoreCalResultMapper
testObjScoreCalResultMapper
;
public
int
saveOrUpdate
(
DriveIndCalResultDef
driveIndCalResult
)
{
public
int
saveOrUpdate
(
DriveIndCalResultDef
driveIndCalResult
)
{
if
(
driveIndCalResult
.
getId
()==
null
)
{
if
(
driveIndCalResult
.
getId
()==
null
)
{
...
@@ -106,9 +114,9 @@ public class DriveIndCalResultService {
...
@@ -106,9 +114,9 @@ public class DriveIndCalResultService {
compareIds
.
add
(
unitDef
.
getCompareId
());
compareIds
.
add
(
unitDef
.
getCompareId
());
sameDate
=
date
;
sameDate
=
date
;
}
}
//对标运算前先删除相关旧数据
//对标运算前先删除相关旧数据
this
.
deleteCompareUnitData
(
compareIds
,
currentDate
,
sameDate
,
code
);
this
.
deleteCompareUnitData
(
compareIds
,
currentDate
,
sameDate
,
code
,
isTest
);
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
//新增运行日志记录
//新增运行日志记录
CompareUnitCalLog
compCalLog
=
new
CompareUnitCalLog
(
path
,
currentDate
,
CompareUnitCalLog
compCalLog
=
new
CompareUnitCalLog
(
path
,
currentDate
,
...
@@ -133,10 +141,10 @@ public class DriveIndCalResultService {
...
@@ -133,10 +141,10 @@ public class DriveIndCalResultService {
logger
.
info
(
"开始对标单元综合计算..."
);
logger
.
info
(
"开始对标单元综合计算..."
);
}
}
}
}
//删除对应对标单元的数据,便于重新计算
//删除对应对标单元的数据,便于重新计算
public
void
deleteCompareUnitData
(
List
<
String
>
compareIds
,
public
void
deleteCompareUnitData
(
List
<
String
>
compareIds
,
Integer
currentDate
,
Integer
sameDate
,
String
code
)
{
Integer
currentDate
,
Integer
sameDate
,
String
code
,
String
isTest
)
{
if
(
StringUtils
.
isNotBlank
(
code
)
&&
!
compareIds
.
isEmpty
()
&&
if
(
StringUtils
.
isNotBlank
(
code
)
&&
!
compareIds
.
isEmpty
()
&&
currentDate
!=
null
&&
sameDate
!=
null
)
{
currentDate
!=
null
&&
sameDate
!=
null
)
{
List
<
Integer
>
param1Dates
=
new
ArrayList
<>();
List
<
Integer
>
param1Dates
=
new
ArrayList
<>();
...
@@ -153,12 +161,20 @@ public class DriveIndCalResultService {
...
@@ -153,12 +161,20 @@ public class DriveIndCalResultService {
param2
.
put
(
"code"
,
code
);
param2
.
put
(
"code"
,
code
);
param2
.
put
(
"compareIds"
,
compareIds
);
param2
.
put
(
"compareIds"
,
compareIds
);
param2
.
put
(
"dates"
,
param2Dates
);
param2
.
put
(
"dates"
,
param2Dates
);
//删除数据
reportOneMapper
.
deleteByCompareIdInAndDateIn
(
param1
);
if
(
"1"
.
equals
(
isTest
)){
reportTwoMapper
.
deleteByCompareIdInAndDateIn
(
param1
);
//删除数据
driveIndCalResultDefMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
reportOneMapper
.
deleteByCompareIdInAndDateIn
(
param1
);
objScoreCalResultMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
reportTwoMapper
.
deleteByCompareIdInAndDateIn
(
param1
);
driveIndCalResultDefMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
objScoreCalResultMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
}
else
if
(
"0"
.
equals
(
isTest
)){
testDriveIndCalResultDefMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
testObjScoreCalResultMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
}
}
}
}
}
...
...
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
779395ff
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.*
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -205,9 +198,37 @@ public class CalculateUtils {
...
@@ -205,9 +198,37 @@ public class CalculateUtils {
}
}
return
calValue
;
return
calValue
;
}
}
/**
* 2020-11-17取消特殊处理。排名123的全部显示出来
*user@hzc
* */
//根据地区特定顺序处理并列排名情况
//根据地区特定顺序处理并列排名情况
public
static
Map
<
String
,
Object
>
rankByObjSort
(
Map
<
String
,
Integer
>
rankMap
,
Map
<
String
,
Integer
>
objSort
){
public
static
Map
<
String
,
Object
>
rankByObjSort
(
Map
<
String
,
Integer
>
rankMap
,
Map
<
String
,
Integer
>
objSort
){
//
// Map<String,Object> result = new HashMap<>();
// Iterator<Integer> iterator = rankMap.values().iterator();
// int firstValue = 0;
// int nextValue = 0;
// int row=0;
// if(iterator.hasNext()){
// firstValue = iterator.next();
// row++;
// }
// while (iterator.hasNext()){
// nextValue = iterator.next();
// if(Math.abs(firstValue-nextValue)>2){
// break;
// }else{
// row++;
// }
// }
// result.put("rankNum", row);
// result.put("rankMap", rankMap);
// return result;
////
////
////
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
//排名分类
//排名分类
Map
<
Integer
,
List
<
String
>>
rankClassifyMap
=
new
LinkedHashMap
<>();
//修改为插入顺序的map
Map
<
Integer
,
List
<
String
>>
rankClassifyMap
=
new
LinkedHashMap
<>();
//修改为插入顺序的map
...
@@ -261,6 +282,7 @@ public class CalculateUtils {
...
@@ -261,6 +282,7 @@ public class CalculateUtils {
result
.
put
(
"rankMap"
,
rankMap
);
result
.
put
(
"rankMap"
,
rankMap
);
}
}
return
result
;
return
result
;
}
}
private
static
Comparator
<
Map
.
Entry
>
comparatorByValueAsc
=
(
Map
.
Entry
o1
,
Map
.
Entry
o2
)
->
{
private
static
Comparator
<
Map
.
Entry
>
comparatorByValueAsc
=
(
Map
.
Entry
o1
,
Map
.
Entry
o2
)
->
{
...
...
src/main/resources/mybatis/mapping/TestDriveIndCalResultDefMapper.xml
View file @
779395ff
...
@@ -105,4 +105,20 @@
...
@@ -105,4 +105,20 @@
where id = ${val.id}
where id = ${val.id}
</foreach>
</foreach>
</update>
</update>
<delete
id=
"deleteByCompareIdInAndDateIn"
parameterType=
"map"
>
delete
from
test_drive_ind_cal_result_def
where
code = #{code} and
compare_id in
<foreach
item=
"compareId"
collection=
"compareIds"
open=
"("
close=
")"
separator=
","
>
#{compareId}
</foreach>
and
date in
<foreach
item=
"date"
collection=
"dates"
open=
"("
close=
")"
separator=
","
>
#{date}
</foreach>
</delete>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/TestObjScoreCalResultMapper.xml
View file @
779395ff
...
@@ -61,4 +61,20 @@
...
@@ -61,4 +61,20 @@
where id = ${val.id}
where id = ${val.id}
</foreach>
</foreach>
</update>
</update>
<delete
id=
"deleteByCompareIdInAndDateIn"
parameterType=
"map"
>
delete
from
test_obj_score_cal_result
where
code = #{code} and
compare_id in
<foreach
item=
"compareId"
collection=
"compareIds"
open=
"("
close=
")"
separator=
","
>
#{compareId}
</foreach>
and
date in
<foreach
item=
"date"
collection=
"dates"
open=
"("
close=
")"
separator=
","
>
#{date}
</foreach>
</delete>
</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