diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java index 1c4d16d2f8..753dc70726 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java @@ -91,9 +91,10 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { private Boolean calulateCustomerIndexScore(CalculateCommonFormDTO formDTO) { try { String customerId = formDTO.getCustomerId(); - Boolean flag = false; + Boolean insertFlag = true; long start = System.currentTimeMillis(); try { + Boolean flag = false; //校验是否含有组织数据 int agencyCount = screenCustomerAgencyDao.selectCountByCustomerId(formDTO.getCustomerId()); if (agencyCount < 1) { @@ -148,27 +149,28 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { //计算全区 start = System.currentTimeMillis(); try { - indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); + flag = indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); } catch (Exception e) { log.error("indexCalculate calDistrictAll exception", e); } } catch (RenException e) { - flag = false; + insertFlag = false; } - //计算完毕后 将结果插入大屏相关数据表 - if (flag) { + //计算完毕后 将结果插入大屏相关数据表 计算当月的数据时 及时有错也插入 + String currentMonthId = DimIdGenerator.getMonthDimId(new Date()); + if (insertFlag || currentMonthId.equals(formDTO.getMonthId())) { start = System.currentTimeMillis(); try { factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); } catch (Exception e) { log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); - flag = false; + insertFlag = false; } } - return flag; + return insertFlag; } catch (Exception e) { log.error("calulateCustomerIndexScore exception", e); } finally {