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
bbaecc6f
Commit
bbaecc6f
authored
Sep 03, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加对标计算前删除相关对标单元数据逻辑处理
parent
bf92a8fa
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
145 additions
and
1 deletion
+145
-1
DriveIndCalResultCtrl.java
...obile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
+8
-0
DriveIndCalResultDefMapper.java
...rs/model/mapper/indmapper/DriveIndCalResultDefMapper.java
+3
-0
ObjScoreCalResultMapper.java
...ators/model/mapper/indmapper/ObjScoreCalResultMapper.java
+4
-0
ReportOneMapper.java
...obile/indicators/model/mapper/report/ReportOneMapper.java
+4
-0
ReportTwoMapper.java
...obile/indicators/model/mapper/report/ReportTwoMapper.java
+4
-0
DriveIndCalResultService.java
...ndicators/service/hytobacco/DriveIndCalResultService.java
+50
-1
DriveIndCalResultDefMapper.xml
.../resources/mybatis/mapping/DriveIndCalResultDefMapper.xml
+18
-0
ObjScoreCalResultMapper.xml
...ain/resources/mybatis/mapping/ObjScoreCalResultMapper.xml
+18
-0
ReportOneMapper.xml
src/main/resources/mybatis/mapping/ReportOneMapper.xml
+18
-0
ReportTwoMapper.xml
src/main/resources/mybatis/mapping/ReportTwoMapper.xml
+18
-0
No files found.
src/main/java/com/keymobile/indicators/api/hytobacco/DriveIndCalResultCtrl.java
View file @
bbaecc6f
...
...
@@ -78,4 +78,12 @@ public class DriveIndCalResultCtrl {
@RequestParam
Integer
date
){
return
driveIndCalResultService
.
findByCompareIdAndDate
(
compareId
,
date
);
}
@ApiOperation
(
value
=
"根据对标单元id和年份删除相关数据"
,
notes
=
"根据对标单元id和年份删除相关数据"
)
@PostMapping
(
value
=
"/deleteCompareUnitData"
)
public
void
deleteCompareUnitData
(
@RequestParam
List
<
String
>
compareIds
,
@RequestParam
Integer
currentDate
,
@RequestParam
Integer
sameDate
,
@RequestParam
String
code
)
{
driveIndCalResultService
.
deleteCompareUnitData
(
compareIds
,
currentDate
,
sameDate
,
code
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/indmapper/DriveIndCalResultDefMapper.java
View file @
bbaecc6f
...
...
@@ -63,4 +63,7 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult
//根据指标编号和对标单位根据对标时间降序获取指标考核结果
public
List
<
DriveIndCalResultDef
>
findByIndIdAndCompareObjOrderByDateDesc
(
@Param
(
"indId"
)
String
indId
,
@Param
(
"compareObj"
)
String
compareObj
,
@Param
(
"code"
)
String
code
);
//根据对标单元id和对标日期删除相关考核结果数据
public
void
deleteByCompareIdInAndDateIn
(
Map
<
String
,
Object
>
param
);
}
src/main/java/com/keymobile/indicators/model/mapper/indmapper/ObjScoreCalResultMapper.java
View file @
bbaecc6f
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
indmapper
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -17,4 +18,7 @@ public interface ObjScoreCalResultMapper extends BaseMapper<ObjScoreCalResult>{
public
void
batchSave
(
@Param
(
"datas"
)
List
<
ObjScoreCalResult
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
ObjScoreCalResult
>
datas
);
//根据对标单元id和对标日期删除相关单位评分结果数据
public
void
deleteByCompareIdInAndDateIn
(
Map
<
String
,
Object
>
param
);
}
src/main/java/com/keymobile/indicators/model/mapper/report/ReportOneMapper.java
View file @
bbaecc6f
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
report
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -18,4 +19,7 @@ public interface ReportOneMapper extends BaseMapper<IndicatorsReportOne>{
public
void
batchSave
(
@Param
(
"datas"
)
List
<
IndicatorsReportOne
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
IndicatorsReportOne
>
datas
);
//根据对标单元id和对标日期删除相关报表结果数据
public
void
deleteByCompareIdInAndDateIn
(
Map
<
String
,
Object
>
param
);
}
src/main/java/com/keymobile/indicators/model/mapper/report/ReportTwoMapper.java
View file @
bbaecc6f
package
com
.
keymobile
.
indicators
.
model
.
mapper
.
report
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -17,4 +18,7 @@ public interface ReportTwoMapper extends BaseMapper<IndicatorsReportTwo>{
public
void
batchSave
(
@Param
(
"datas"
)
List
<
IndicatorsReportTwo
>
datas
);
public
void
batchUpdate
(
@Param
(
"datas"
)
List
<
IndicatorsReportTwo
>
datas
);
//根据对标单元id和对标日期删除相关单位评分结果数据
public
void
deleteByCompareIdInAndDateIn
(
Map
<
String
,
Object
>
param
);
}
src/main/java/com/keymobile/indicators/service/hytobacco/DriveIndCalResultService.java
View file @
bbaecc6f
package
com
.
keymobile
.
indicators
.
service
.
hytobacco
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -13,6 +16,9 @@ import com.keymobile.indicators.akka.message.indicators.StartCompareUnitCalMsg;
import
com.keymobile.indicators.model.entity.indicators.CompareUnitDef
;
import
com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef
;
import
com.keymobile.indicators.model.mapper.indmapper.DriveIndCalResultDefMapper
;
import
com.keymobile.indicators.model.mapper.indmapper.ObjScoreCalResultMapper
;
import
com.keymobile.indicators.model.mapper.report.ReportOneMapper
;
import
com.keymobile.indicators.model.mapper.report.ReportTwoMapper
;
import
akka.actor.ActorRef
;
import
akka.actor.ActorSystem
;
...
...
@@ -24,6 +30,12 @@ public class DriveIndCalResultService {
@Autowired
private
DriveIndCalResultDefMapper
driveIndCalResultDefMapper
;
@Autowired
private
ObjScoreCalResultMapper
objScoreCalResultMapper
;
@Autowired
private
ReportOneMapper
reportOneMapper
;
@Autowired
private
ReportTwoMapper
reportTwoMapper
;
public
int
saveOrUpdate
(
DriveIndCalResultDef
driveIndCalResult
)
{
if
(
driveIndCalResult
.
getId
()==
null
)
{
...
...
@@ -73,15 +85,27 @@ public class DriveIndCalResultService {
return
driveIndCalResultDefMapper
.
findByCompareIdAndDate
(
compareId
,
date
);
}
public
void
compareUnitListCal
(
List
<
CompareUnitDef
>
compareUnitList
,
String
code
,
String
isTest
)
{
public
void
compareUnitListCal
(
List
<
CompareUnitDef
>
compareUnitList
,
String
code
,
String
isTest
)
throws
Exception
{
if
(!
compareUnitList
.
isEmpty
())
{
List
<
CompareUnitDef
>
sameCompareUnitList
=
new
ArrayList
<>();
List
<
String
>
compareIds
=
new
ArrayList
<>();
Integer
currentDate
=
null
;
Integer
sameDate
=
null
;
//将对标单元的日期改成同期
for
(
CompareUnitDef
unitDef
:
compareUnitList
)
{
Integer
date
=
unitDef
.
getDate
()-
100
;
unitDef
.
setDate
(
date
);
sameCompareUnitList
.
add
(
unitDef
);
compareIds
.
add
(
unitDef
.
getCompareId
());
currentDate
=
unitDef
.
getDate
();
sameDate
=
date
;
}
//对标运算前先删除相关旧数据
this
.
deleteCompareUnitData
(
compareIds
,
currentDate
,
sameDate
,
code
);
Thread
.
sleep
(
3000
);
//启动回流actor
final
ActorSystem
system
=
ActorSystem
.
create
(
"CompareUnitCalAkka"
);
//创建akka
StartCompareUnitCalMsg
startCompareUnitCalMsg
=
new
StartCompareUnitCalMsg
(
...
...
@@ -92,4 +116,29 @@ public class DriveIndCalResultService {
logger
.
info
(
"开始对标单元综合计算..."
);
}
}
//删除对应对标单元的数据,便于重新计算
public
void
deleteCompareUnitData
(
List
<
String
>
compareIds
,
Integer
currentDate
,
Integer
sameDate
,
String
code
)
{
if
(
StringUtils
.
isNotBlank
(
code
)
&&
!
compareIds
.
isEmpty
()
&&
currentDate
!=
null
&&
sameDate
!=
null
)
{
List
<
Integer
>
dates
=
new
ArrayList
<>();
Map
<
String
,
Object
>
param1
=
new
HashMap
<>();
Map
<
String
,
Object
>
param2
=
new
HashMap
<>();
dates
.
add
(
currentDate
);
param1
.
put
(
"code"
,
code
);
param1
.
put
(
"compareIds"
,
compareIds
);
param1
.
put
(
"dates"
,
dates
);
dates
.
add
(
sameDate
);
param2
.
put
(
"code"
,
code
);
param2
.
put
(
"compareIds"
,
compareIds
);
param2
.
put
(
"dates"
,
dates
);
//删除数据
reportOneMapper
.
deleteByCompareIdInAndDateIn
(
param1
);
reportTwoMapper
.
deleteByCompareIdInAndDateIn
(
param1
);
driveIndCalResultDefMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
objScoreCalResultMapper
.
deleteByCompareIdInAndDateIn
(
param2
);
}
}
}
src/main/resources/mybatis/mapping/DriveIndCalResultDefMapper.xml
View file @
bbaecc6f
...
...
@@ -236,4 +236,21 @@
code = #{code}
ORDER BY date desc
</select>
<delete
id=
"deleteByCompareIdInAndDateIn"
parameterType=
"map"
>
delete
from
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>
\ No newline at end of file
src/main/resources/mybatis/mapping/ObjScoreCalResultMapper.xml
View file @
bbaecc6f
...
...
@@ -61,4 +61,21 @@
where id = ${val.id}
</foreach>
</update>
<delete
id=
"deleteByCompareIdInAndDateIn"
parameterType=
"map"
>
delete
from
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>
\ No newline at end of file
src/main/resources/mybatis/mapping/ReportOneMapper.xml
View file @
bbaecc6f
...
...
@@ -101,4 +101,21 @@
where id = ${val.id}
</foreach>
</update>
<delete
id=
"deleteByCompareIdInAndDateIn"
parameterType=
"map"
>
delete
from
indicators_report_one
where
code = #{code} and
compare_unit_id in
<foreach
item=
"compareId"
collection=
"compareIds"
open=
"("
close=
")"
separator=
","
>
#{compareId}
</foreach>
and
compare_date in
<foreach
item=
"date"
collection=
"dates"
open=
"("
close=
")"
separator=
","
>
#{date}
</foreach>
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/mapping/ReportTwoMapper.xml
View file @
bbaecc6f
...
...
@@ -124,4 +124,21 @@
where id = ${val.id}
</foreach>
</update>
<delete
id=
"deleteByCompareIdInAndDateIn"
parameterType=
"map"
>
delete
from
indicators_report_two
where
code = #{code} and
compare_unit_id in
<foreach
item=
"compareId"
collection=
"compareIds"
open=
"("
close=
")"
separator=
","
>
#{compareId}
</foreach>
and
compare_date in
<foreach
item=
"date"
collection=
"dates"
open=
"("
close=
")"
separator=
","
>
#{date}
</foreach>
</delete>
</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