Commit 0b1f6dbc by hzc

优化报表三

parent 11d17979
......@@ -26,4 +26,6 @@ public interface DriveIndDefMapper extends BaseMapper<DriveIndDef>{
public List<DriveIndDef> getByIndFormatLike(@Param("indId")String indId);
public void deleteByIdIn(@Param("ids")List<String> ids);
List<DriveIndDef> selectByIds(@Param("indIds") List<String> indIds);
}
......@@ -21,4 +21,9 @@ public interface ReportThreeMapper extends BaseMapper<IndicatorsReportThree>{
public void batchUpdate(@Param("datas")List<IndicatorsReportThree> datas);
public void deleteByParam(Map<String,Object> param);
List<IndicatorsReportThree> selectByParamInCompareObj(
@Param("date")Integer date,@Param("type")String type,
@Param("code")String code,@Param("compareCatalog")String compareCatalog,
@Param("compareObjs") List<String> compareObjs);
}
......@@ -156,15 +156,19 @@ public class IndicatorsReportService {
**/
Map<String,Map<String,Integer>> rankMarkMap = new HashMap<>();
int fourCount=0;
for(String indId : indIds) {
//一次性获取指标--21-05-12 hzc
List<DriveIndDef> driveIndDefs= driveIndDefMapper.selectByIds(indIds);
for(DriveIndDef driveIndDef : driveIndDefs) {
//报表四数据
String indId = driveIndDef.getIndId();
List<IndicatorsReportFour> indicatorsReportFours = new ArrayList<>();
List<IndicatorsReportThree> dataList = new ArrayList<>();
Map<String,String> improveValue = new HashMap<>();//定义存储地区指标增幅,用于排名使用
String indRule = null;
String growCalType = null;
//根据indId获取指标信息
DriveIndDef driveIndDef = driveIndDefMapper.selectByPrimaryKey(indId);
//注释--21-05-12 hzc
// DriveIndDef driveIndDef = driveIndDefMapper.selectByPrimaryKey(indId);
if(driveIndDef!=null) {
//获取指标正反属性
indRule = driveIndDef.getIndRule();
......@@ -182,11 +186,22 @@ public class IndicatorsReportService {
**/
rankMarkMap= this.fillRankMarkMap(calResults, indRule);
}
//一次性获取报表三数据===start--21-05-12 hzc
List<String> compareObjs = new ArrayList<>();
for(DriveIndCalResultDef calResult : calResults){
compareObjs.add(calResult.getCompareObj());
}
Map<String,IndicatorsReportThree> tmp = new HashMap<>();
List<IndicatorsReportThree> threeList =reportThreeMapper.selectByParamInCompareObj(date, type, code, compareCatalog,compareObjs);
for (IndicatorsReportThree indicatorsReportThree : threeList) {
tmp.put(indicatorsReportThree.getCompareObj(),indicatorsReportThree);
}
//一次性获取报表三数据===end--21-05-12 hzc
for(DriveIndCalResultDef calResult : calResults) {
//判断是否存在
IndicatorsReportThree indReportData = reportThreeMapper.getByParam(
calResult.getCompareObj(), date, type, code, compareCatalog);
// IndicatorsReportThree indReportData = reportThreeMapper.getByParam(
// calResult.getCompareObj(), date, type, code, compareCatalog);
IndicatorsReportThree indReportData = tmp.get(calResult.getCompareObj());
if(indReportData == null) {
indReportData = new IndicatorsReportThree();
}
......
......@@ -70,4 +70,11 @@
#{id}
</foreach>
</delete>
<select id="selectByIds" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndDef">
select *
from drive_ind_def where ind_id in
<foreach collection="indIds" open="(" item="id" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -11,7 +11,22 @@
code = #{code} and
compare_catalog = #{compareCatalog}
</select>
<select id="selectByParamInCompareObj" resultType="com.keymobile.indicators.model.entity.report.IndicatorsReportThree">
select *
from indicators_report_three
where
compare_date = #{date} and
compare_type = #{type} and
code = #{code} and
compare_catalog = #{compareCatalog} and
compare_obj in
<foreach collection="compareObjs" separator="," open="(" close=")" item="compareObj" >
#{compareObj}
</foreach>
</select>
<delete id="deleteByParam" parameterType="map">
delete
from indicators_report_three
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment