|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
|
import com.epmet.dto.indexcal.CalculateCommonFormDTO; |
|
|
@ -71,6 +72,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { |
|
|
|
Boolean flag = false; |
|
|
|
for (String customerId : customerIds) { |
|
|
|
CalculateCommonFormDTO calculateCommonFormDTO = new CalculateCommonFormDTO(customerId, formDTO.getMonthId()); |
|
|
|
long start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
//计算党员相关的
|
|
|
|
try { |
|
|
@ -81,8 +83,11 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { |
|
|
|
log.error("indexCalculate cpcIndexCalculate exception", e); |
|
|
|
throw new RenException("indexCalculate cpcIndexCalculate exception", e); |
|
|
|
} |
|
|
|
//测试用
|
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【党员相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
|
|
|
|
//计算网格
|
|
|
|
start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
flag = gridCorreLationService.calculateGridCorreLation(calculateCommonFormDTO); |
|
|
|
log.info("indexCalculate calculateGridCorreLation return result:{}", flag); |
|
|
@ -90,37 +95,46 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { |
|
|
|
log.error("indexCalculate calculateGridCorreLation exception", e); |
|
|
|
throw new RenException("indexCalculate calculateGridCorreLation exception", e); |
|
|
|
} |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【网格相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
//计算社区
|
|
|
|
start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
flag = indexCalculateCommunityService.calCommunityAll(customerId, formDTO.getMonthId()); |
|
|
|
log.info("indexCalculate calCommunityAll return result:{}", flag); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【社区相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("indexCalculate calCommunityAll exception", e); |
|
|
|
throw new RenException("indexCalculate calAll exception", e); |
|
|
|
} |
|
|
|
|
|
|
|
//计算街道
|
|
|
|
start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId()); |
|
|
|
log.info("indexCalculate calStreetAll return result:{}", flag); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【街道相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("indexCalculate calStreetAll exception", e); |
|
|
|
throw new RenException("indexCalculate calStreetAll exception", e); |
|
|
|
} |
|
|
|
|
|
|
|
//计算区直属
|
|
|
|
start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
flag = deptScoreService.calculateDeptCorreLation(calculateCommonFormDTO); |
|
|
|
log.info("indexCalculate calculateDeptCorreLation return result:{}", flag); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【区直部门】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("indexCalculate calculateDeptCorreLation exception", e); |
|
|
|
throw new RenException("indexCalculate calculateDeptCorreLation exception", e); |
|
|
|
} |
|
|
|
|
|
|
|
//计算全区
|
|
|
|
start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); |
|
|
|
log.info("indexCalculate calDistrictAll return result:{}", flag); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【全区相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("indexCalculate calDistrictAll exception", e); |
|
|
|
throw new RenException("indexCalculate calDistrictAll exception", e); |
|
|
@ -131,8 +145,10 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { |
|
|
|
|
|
|
|
//计算完毕后 将结果插入大屏相关数据表
|
|
|
|
if (flag) { |
|
|
|
start = System.currentTimeMillis(); |
|
|
|
try { |
|
|
|
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 分数插入到大屏显示库完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); |
|
|
|
flag = false; |
|
|
|