Commit 54abfc3a by zhangkb

启动类添加EnableAsy标识启动异步调用操作

parent 8d882460
...@@ -4,9 +4,11 @@ import org.springframework.boot.SpringApplication; ...@@ -4,9 +4,11 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableAsync
@EnableSwagger2 @EnableSwagger2
@SpringBootApplication @SpringBootApplication
@EnableFeignClients @EnableFeignClients
......
...@@ -93,6 +93,12 @@ public class ObjScoreRuleCtrl { ...@@ -93,6 +93,12 @@ public class ObjScoreRuleCtrl {
return scoreRuleService.getById(id); return scoreRuleService.getById(id);
} }
@ApiOperation(value = "根据idList获取单位评分规则", notes = "根据idList获取单位评分规则")
@PostMapping(value = "/findByIdList")
public List<ScoreRule> findByIdList(@RequestParam List<Integer> ids) {
return scoreRuleService.getByIdList(ids);
}
@ApiOperation(value = "根据code获取所有单位评分规则", notes = "根据code获取所有单位评分规则") @ApiOperation(value = "根据code获取所有单位评分规则", notes = "根据code获取所有单位评分规则")
@PostMapping(value = "/findAll") @PostMapping(value = "/findAll")
public List<ScoreRule> findByCode(@RequestParam String code) { public List<ScoreRule> findByCode(@RequestParam String code) {
......
...@@ -29,6 +29,7 @@ public class IndicatorReportCtrl { ...@@ -29,6 +29,7 @@ public class IndicatorReportCtrl {
@ApiOperation(value = "整合基础项本期同期报表数据", notes = "整合基础项本期同期报表数据") @ApiOperation(value = "整合基础项本期同期报表数据", notes = "整合基础项本期同期报表数据")
@PostMapping(value = "/dealBaseReportOne") @PostMapping(value = "/dealBaseReportOne")
public String dealBaseReportOne(@RequestParam Integer date,@RequestParam List<String> compareObjs) { public String dealBaseReportOne(@RequestParam Integer date,@RequestParam List<String> compareObjs) {
return indicatorsReportService.dealBaseIndReportOneData(date, compareObjs); indicatorsReportService.dealBaseIndReportOneData(date, compareObjs);
return "基础项本期同期报表数据开始整合...";
} }
} }
...@@ -19,10 +19,16 @@ public class IndicatorsReportTwo { ...@@ -19,10 +19,16 @@ public class IndicatorsReportTwo {
private String indId;//指标编号 private String indId;//指标编号
private String indName;//指标名称 private String indName;//指标名称
private String compareUnitId;//对标单元id
private String compareUnitName;//对标单元名称
private String compareDate;//对标时间 private String compareDate;//对标时间
private String compareType;//对标类型 private String compareType;//对标类型
private String unit;//单位 private String unit;//单位
private String average;//平均值 private String currentAverage;//本期全省平均值
private String sameAverage;//同期全省平均值
private String averageRate;//全省平均分同比
private String trend;//全省平均分变化趋势 0:趋好 1:趋坏
private String currentActualAverage;//本期实际平均值
private String bestUnit;//标杆单位 private String bestUnit;//标杆单位
private String bestUnitValue;//标杆值 private String bestUnitValue;//标杆值
private String bestAverageUnits;//优于平均单位数 private String bestAverageUnits;//优于平均单位数
......
...@@ -18,4 +18,6 @@ public interface ScoreRuleMapper extends BaseMapper<ScoreRule>{ ...@@ -18,4 +18,6 @@ public interface ScoreRuleMapper extends BaseMapper<ScoreRule>{
@Param("keyword")String keyword,@Param("start") int start,@Param("end") int end); @Param("keyword")String keyword,@Param("start") int start,@Param("end") int end);
public int countByCatalogId(@Param("catalogId")Integer catalogId,@Param("keyword")String keyword); public int countByCatalogId(@Param("catalogId")Integer catalogId,@Param("keyword")String keyword);
public List<ScoreRule> findByIdList(@Param("ids")List<Integer> ids);
} }
...@@ -100,6 +100,10 @@ public class ScoreRuleService { ...@@ -100,6 +100,10 @@ public class ScoreRuleService {
return null; return null;
} }
public List<ScoreRule> getByIdList(List<Integer> ids){
return scoreRuleMapper.findByIdList(ids);
}
//计算组内考核指标平均值 //计算组内考核指标平均值
private ObjScoreCalResult calGroupIndAverage(ObjScoreCalResult objResult,ScoreRule scoreRule,List<String> indIds, private ObjScoreCalResult calGroupIndAverage(ObjScoreCalResult objResult,ScoreRule scoreRule,List<String> indIds,
String compareObj,int date){ String compareObj,int date){
......
...@@ -2,7 +2,10 @@ package com.keymobile.indicators.service.report; ...@@ -2,7 +2,10 @@ package com.keymobile.indicators.service.report;
import java.util.List; import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.keymobile.indicators.model.entity.indicators.BaseIndDef; import com.keymobile.indicators.model.entity.indicators.BaseIndDef;
...@@ -19,6 +22,8 @@ import com.keymobile.indicators.utils.CalculateUtils; ...@@ -19,6 +22,8 @@ import com.keymobile.indicators.utils.CalculateUtils;
@Service @Service
public class IndicatorsReportService { public class IndicatorsReportService {
private Logger logger = LoggerFactory.getLogger(IndicatorsReportService.class);
@Autowired @Autowired
private ReportOneMapper reportOneMapper; private ReportOneMapper reportOneMapper;
@Autowired @Autowired
...@@ -39,7 +44,9 @@ public class IndicatorsReportService { ...@@ -39,7 +44,9 @@ public class IndicatorsReportService {
return reportData.getId(); return reportData.getId();
} }
public String dealBaseIndReportOneData(Integer date,List<String> compareObjs) { //异步执行基础项数据整合
@Async
public void dealBaseIndReportOneData(Integer date,List<String> compareObjs) {
//根据条件获取基础项数据 //根据条件获取基础项数据
List<IndicatorsData> indiDatas = baseIndDataService.getIndDataByParam(date, compareObjs); List<IndicatorsData> indiDatas = baseIndDataService.getIndDataByParam(date, compareObjs);
for(IndicatorsData indiData : indiDatas) { for(IndicatorsData indiData : indiDatas) {
...@@ -55,7 +62,7 @@ public class IndicatorsReportService { ...@@ -55,7 +62,7 @@ public class IndicatorsReportService {
indReportData = fillBaseIndiReportOneData(indiData,indReportData); indReportData = fillBaseIndiReportOneData(indiData,indReportData);
this.saveOrUpdate(indReportData); this.saveOrUpdate(indReportData);
} }
return "整合基础项报表数据完成"; logger.info("完成基础项本期同期整合");
} }
//处理单挑指标结果报表数据 //处理单挑指标结果报表数据
......
...@@ -34,4 +34,13 @@ ...@@ -34,4 +34,13 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="findByIdList" resultType="com.keymobile.indicators.model.entity.objscorerule.ScoreRule" >
select *
from obj_score_rule
where id in
<foreach item="id" collection="ids" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
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