From 2b64a6519eaff3854c811300e8ee911a53832d7e Mon Sep 17 00:00:00 2001 From: jianjun Date: Sat, 10 Oct 2020 15:38:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcal/impl/IndexCalculateServiceImpl.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 {