|
|
@ -9,6 +9,7 @@ import com.epmet.entity.evaluationindex.screen.IndexDictEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailTemplateEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.IndexGroupTemplateEntity; |
|
|
|
import com.epmet.service.evaluationindex.screen.IndexDictService; |
|
|
|
import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; |
|
|
|
import com.epmet.service.evaluationindex.screen.IndexGroupDetailTemplateService; |
|
|
|
import com.epmet.service.evaluationindex.screen.IndexGroupTemplateService; |
|
|
|
import com.epmet.support.normalizing.Correlation; |
|
|
@ -51,16 +52,25 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> { |
|
|
|
|
|
|
|
private IndexGroupDetailTemplateService indexGroupDetailTemplateService; |
|
|
|
|
|
|
|
private IndexGroupDetailService indexGroupDetailService; |
|
|
|
/** |
|
|
|
* 客户id不为空时,需要修改index_group_detail |
|
|
|
*/ |
|
|
|
private String customerId; |
|
|
|
|
|
|
|
/** |
|
|
|
* 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 |
|
|
|
* |
|
|
|
* @param indexDictService |
|
|
|
*/ |
|
|
|
public IndexExcelDataListener(IndexDictService indexDictService, IndexGroupTemplateService indexGroupTemplateService, IndexGroupDetailTemplateService indexGroupDetailTemplateService) { |
|
|
|
public IndexExcelDataListener(IndexDictService indexDictService, IndexGroupTemplateService indexGroupTemplateService, IndexGroupDetailTemplateService indexGroupDetailTemplateService, |
|
|
|
String customerId, |
|
|
|
IndexGroupDetailService indexGroupDetailService) { |
|
|
|
this.indexDictService = indexDictService; |
|
|
|
this.indexGroupTemplateService = indexGroupTemplateService; |
|
|
|
this.indexGroupDetailTemplateService = indexGroupDetailTemplateService; |
|
|
|
this.customerId=customerId; |
|
|
|
this.indexGroupDetailService=indexGroupDetailService; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -329,10 +339,16 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> { |
|
|
|
@Override |
|
|
|
public void doAfterAllAnalysed(AnalysisContext context) { |
|
|
|
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
|
|
|
|
if(StringUtils.isNotBlank(customerId)){ |
|
|
|
//修改客户权重信息
|
|
|
|
updateCustomerGroupDetail(); |
|
|
|
}else{ |
|
|
|
saveData(); |
|
|
|
} |
|
|
|
LOGGER.info("所有数据解析完成!total:{}", total.intValue()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 加上存储数据库 |
|
|
|
*/ |
|
|
@ -346,4 +362,11 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> { |
|
|
|
indexGroupDetailTemplateService.deleteAndInsertBatch(indexGroupDetailMap.values()); |
|
|
|
LOGGER.info("存储数据库成功!指标:{}个,分组:{}个,详情:{}个", indexDicMap.values().size(), indexGroupMap.values().size(), indexGroupDetailMap.values().size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 修改客户权重信息 |
|
|
|
*/ |
|
|
|
private void updateCustomerGroupDetail() { |
|
|
|
indexGroupDetailService.updateCustomerIndexGroupDetail(indexGroupDetailMap.values(),customerId); |
|
|
|
} |
|
|
|
} |
|
|
|