Commit 29382506 by hzc

Merge remote-tracking branch 'origin/hy-tobacco' into hy-tobacco

# Conflicts:
#	src/main/resources/application-test.yml
parents 2ff9fa57 0c07ddc3
......@@ -4,6 +4,7 @@ import java.util.*;
import com.keymobile.indicators.constant.Constants;
import com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog;
import com.keymobile.indicators.service.SystemAuthService;
import com.keymobile.indicators.service.hytobacco.CompareUnitCalLogService;
import com.keymobile.indicators.utils.LogManager;
import org.apache.commons.lang.StringUtils;
......@@ -25,6 +26,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
private IndicatorsReportService indicatorsReportService = SpringUtil.getBean(IndicatorsReportService.class);
private SystemAuthService systemAuthService = SpringUtil.getBean(SystemAuthService.class);
private CompareUnitCalLogService compareUnitCalLogService = SpringUtil.getBean(CompareUnitCalLogService.class);
private int numberOfConfirm = 0;//定义返回确认消息的子actor
......@@ -47,6 +50,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
private String path = null;//对标单元目录id
private Boolean isClearAllPools;
@Override
public Receive createReceive() {
try {
......@@ -60,6 +65,9 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
compCalLogId = beforeCompareUnitCalMsg.getCompCalLogId();
path = beforeCompareUnitCalMsg.getPath();
currentDate = beforeCompareUnitCalMsg.getDateMark();//dateMark记录本期对标时间
isClearAllPools=beforeCompareUnitCalMsg.getClearAllPools();//是否清理smartBi缓存
if("0".equals(isTest)) {
logger.info("进行date:"+sameDate+" 的对标单元试运行计算.....日志id:"+compCalLogId);
}else {
......@@ -183,6 +191,11 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
compareUnitCalLogService.saveOrUndate(compCalLog);
}
LogManager.logInfo(Constants.LOG_INDICATOR_UNIT_CAL_API,"完成对标单元id:{},日期:{} 的正式运行计算",compCalLogId,currentDate );
//清缓存
if(isClearAllPools){
logger.info("开始清除smartBi缓存");
systemAuthService.clearAllPools();
}
logger.info("本期同期对标单元计算完成");
}
}
......
......@@ -26,6 +26,7 @@ public class StartCompareUnitCalMsg implements Serializable{
private Integer dateMark;//本期对标时间
private Boolean clearAllPools;
public StartCompareUnitCalMsg(List<CompareUnitDef> compareInitDefs,String code,
String isTest,Integer dateMark) {
......@@ -35,6 +36,14 @@ public class StartCompareUnitCalMsg implements Serializable{
this.dateMark = dateMark;
}
public Boolean getClearAllPools() {
return clearAllPools;
}
public void setClearAllPools(Boolean clearAllPools) {
this.clearAllPools = clearAllPools;
}
public Integer getCompCalLogId() {
return compCalLogId;
}
......
......@@ -67,4 +67,11 @@ public interface SystemAuthService {
*/
@GetMapping("/standardObj/listByIds")
List<JSONObject> getStandardObjByIds(@RequestParam("ids") List<String> ids);
/**
* 清理smartBi缓存
* * @return
*/
@GetMapping("/smartBi/clearAllPools")
void clearAllPools();
}
......@@ -13,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.keymobile.indicators.akka.actor.indicators.BeforeCompareUnitCalActor;
......@@ -48,7 +49,10 @@ public class DriveIndCalResultService {
@Autowired
private TestObjScoreCalResultMapper testObjScoreCalResultMapper;
@Value("${isClearAllPools}")
private Boolean isClearAllPools;
public int saveOrUpdate(DriveIndCalResultDef driveIndCalResult) {
if(driveIndCalResult.getId()==null) {
driveIndCalResultDefMapper.insert(driveIndCalResult);
......@@ -150,7 +154,7 @@ public class DriveIndCalResultService {
startCompareUnitCalMsg.setCompCalLogId(compCalLogId);
//author:zhangkb time:2020-12-12 desc:将path参数传入对标计算中
startCompareUnitCalMsg.setPath(path);
startCompareUnitCalMsg.setClearAllPools(isClearAllPools);
ActorRef beforeCompareUnitCalActor = system.actorOf(Props.create(
BeforeCompareUnitCalActor.class,()-> new BeforeCompareUnitCalActor()));
beforeCompareUnitCalActor.tell(startCompareUnitCalMsg, ActorRef.noSender());
......
......@@ -155,7 +155,7 @@ public class ScoreRuleService {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
// && !"0.0000".equals(calResult.getValue())
&& !"0".equals(calResult.getValue())) {
scoreValues.add(calResult.getValue());
scoreValues.add(calResult.getScore());
}
indCount += 1;
......@@ -285,7 +285,7 @@ public class ScoreRuleService {
if(!"NaN".equals(calresultOp.getValue()) && !"Infinite".equals(calresultOp.getValue())
// && !"0.0000".equals(calResult.getValue())
&& !"0".equals(calresultOp.getValue())) {
scoreTmpSumValue+=Double.parseDouble(calresultOp.getValue());
scoreTmpSumValue+=Double.parseDouble(calresultOp.getScore());
}
//得分类型:0 指标值直接参与计算
......@@ -441,7 +441,7 @@ public class ScoreRuleService {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
// && !"0.0000".equals(calResult.getValue())
&& !"0".equals(calResult.getValue())) {
scoreValues.add(calResult.getValue());
scoreValues.add(calResult.getScore());
}
if("0".equals(scoreRule.getScoreType())) {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
......
......@@ -119,7 +119,7 @@ public class TestScoreRuleService {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
// && !"0.0000".equals(calResult.getValue())
&& !"0".equals(calResult.getValue())) {
scoreValues.add(calResult.getValue());
scoreValues.add(calResult.getScore());
}
indCount += 1;
//得分类型:0 指标值直接参与计算
......@@ -239,7 +239,7 @@ public class TestScoreRuleService {
if(!"NaN".equals(calresultOp.getValue()) && !"Infinite".equals(calresultOp.getValue())
// && !"0.0000".equals(calResult.getValue())
&& !"0".equals(calresultOp.getValue())) {
scoreTmpSumValue+=Double.parseDouble(calresultOp.getValue());
scoreTmpSumValue+=Double.parseDouble(calresultOp.getScore());
}
//得分类型:0 指标值直接参与计算
if("0".equals(scoreRule.getScoreType())) {
......@@ -374,7 +374,7 @@ public class TestScoreRuleService {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
// && !"0.0000".equals(calResult.getValue())
&& !"0".equals(calResult.getValue())) {
scoreValues.add(calResult.getValue());
scoreValues.add(calResult.getScore());
}
if("0".equals(scoreRule.getScoreType())) {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
......
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