|
@@ -1,105 +0,0 @@
|
|
-//package com.dragoninfo.dcuc.app.event;
|
|
|
|
-//
|
|
|
|
-//import com.dragoninfo.dcuc.app.config.DcucAppKafkaConfig;
|
|
|
|
-//import com.dragoninfo.dcuc.app.dto.AppEventDTO;
|
|
|
|
-//import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
|
-//import com.dragoninfo.dcuc.app.enumresources.AppMsgTypeEnum;
|
|
|
|
-//import com.dragoninfo.duceap.commons.util.kafka.KafkaServer;
|
|
|
|
-//import com.dragoninfo.mq.client.model.entity.MessageInfoVo;
|
|
|
|
-//import com.dragoninfo.mq.client.model.entity.RequestVo;
|
|
|
|
-//import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
|
|
|
|
-//import com.dragonsoft.duceap.commons.util.date.DateUtils;
|
|
|
|
-//import com.dragonsoft.duceap.commons.util.json.JsonUtils;
|
|
|
|
-//import com.dragonsoft.duceap.core.entity.response.ResponseResult;
|
|
|
|
-//import lombok.extern.slf4j.Slf4j;
|
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-//import org.springframework.context.ApplicationListener;
|
|
|
|
-//import org.springframework.stereotype.Component;
|
|
|
|
-//
|
|
|
|
-//import java.util.Collections;
|
|
|
|
-//import java.util.HashMap;
|
|
|
|
-//import java.util.List;
|
|
|
|
-//import java.util.Map;
|
|
|
|
-//
|
|
|
|
-///**
|
|
|
|
-// * @author huangzqa
|
|
|
|
-// * @date 2020/11/9
|
|
|
|
-// */
|
|
|
|
-//@Slf4j
|
|
|
|
-//@Component
|
|
|
|
-//public class AppEventListener implements ApplicationListener<AppEvent> {
|
|
|
|
-//
|
|
|
|
-// @Autowired
|
|
|
|
-// private DcucAppKafkaConfig dcucAppKafkaConfig;
|
|
|
|
-//
|
|
|
|
-// @Autowired
|
|
|
|
-// private KafkaServer kafkaServer;
|
|
|
|
-//
|
|
|
|
-// @Override
|
|
|
|
-// public void onApplicationEvent(AppEvent appEvent) {
|
|
|
|
-// //应用变更消息主题
|
|
|
|
-// String topic = dcucAppKafkaConfig.getAppChangeTopic();
|
|
|
|
-//
|
|
|
|
-// AppEventDTO appEventDTO = appEvent.getAppEventDTO();
|
|
|
|
-// BaseSecurityUser baseSecurityUser = appEventDTO.getBaseSecurityUser();
|
|
|
|
-// ApplyInfo applyInfo = appEventDTO.getApplyInfo();
|
|
|
|
-// AppMsgTypeEnum appMsgTypeEnum = appEventDTO.getAppMsgTypeEnum();
|
|
|
|
-// String content = appEventDTO.getContent();
|
|
|
|
-//
|
|
|
|
-// log.info("消息发送参数:topic:{},content:{},applyInfo:{}", topic, content, applyInfo);
|
|
|
|
-//
|
|
|
|
-// // 转换为 map
|
|
|
|
-// Map<String, String> stringStringMap = appToMap(applyInfo, appMsgTypeEnum);
|
|
|
|
-// List<Map<String, String>> infoSet = Collections.singletonList(stringStringMap);
|
|
|
|
-//
|
|
|
|
-// MessageInfoVo messageInfoVo = new MessageInfoVo(baseSecurityUser, "应用信息变更", content, topic);
|
|
|
|
-// messageInfoVo.setInfoSet(infoSet);
|
|
|
|
-//
|
|
|
|
-// List<MessageInfoVo> messages = Collections.singletonList(messageInfoVo);
|
|
|
|
-//
|
|
|
|
-// RequestVo requestVo = new RequestVo();
|
|
|
|
-// requestVo.setTopic(topic);
|
|
|
|
-// requestVo.setAppKey(dcucAppKafkaConfig.getAppKey());
|
|
|
|
-// requestVo.setAppSecret(dcucAppKafkaConfig.getAppSecret());
|
|
|
|
-// requestVo.setMessages(messages);
|
|
|
|
-//
|
|
|
|
-// ResponseResult result = kafkaServer.send(requestVo, dcucAppKafkaConfig.getServer());
|
|
|
|
-// log.info("Send result: {}", JsonUtils.toJSONString(result));
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// /**
|
|
|
|
-// * 将应用转换为map
|
|
|
|
-// *
|
|
|
|
-// * @param applyInfo 应用信息
|
|
|
|
-// * @param appMsgTypeEnum 操作类型
|
|
|
|
-// * @return map
|
|
|
|
-// */
|
|
|
|
-// private Map<String, String> appToMap(ApplyInfo applyInfo, AppMsgTypeEnum appMsgTypeEnum) {
|
|
|
|
-//
|
|
|
|
-// Map<String, String> map = new HashMap<>();
|
|
|
|
-// map.put("OPERATE_TYPE", appMsgTypeEnum.getValue());
|
|
|
|
-// map.put("ID", applyInfo.getId());
|
|
|
|
-// map.put("APPLY_NAME", applyInfo.getApplyName());
|
|
|
|
-// map.put("APPLY_CODE", applyInfo.getApplyCode());
|
|
|
|
-// map.put("APPLY_STATUS", applyInfo.getApplyStatus());
|
|
|
|
-// map.put("APPLY_CATEGORY", applyInfo.getApplyCategory());
|
|
|
|
-// map.put("POLICE_SPECIES", applyInfo.getPoliceSpecies());
|
|
|
|
-// map.put("ORG_CODE", applyInfo.getOrgCode());
|
|
|
|
-// map.put("ORG_NAME", applyInfo.getOrgName());
|
|
|
|
-// map.put("APPLY_URL", applyInfo.getApplyUrl());
|
|
|
|
-// map.put("MANUFACTURER_ID", applyInfo.getManufacturerId());
|
|
|
|
-// map.put("MANUFACTURER_NAME", applyInfo.getManufacturerName());
|
|
|
|
-// map.put("MANAGER_DESCRIBE", applyInfo.getManagerDescribe());
|
|
|
|
-// map.put("API_KEY", applyInfo.getApiKey());
|
|
|
|
-// map.put("SECRET_KEY", applyInfo.getSecretKey());
|
|
|
|
-// map.put("DELETED", applyInfo.getDeleted());
|
|
|
|
-// map.put("REGISTRATION_TIME", DateUtils.getDateFormat(applyInfo.getRegistrationTime()));
|
|
|
|
-// map.put("SORT", applyInfo.getSort());
|
|
|
|
-// map.put("MANAGER_NAME", applyInfo.getManagerName());
|
|
|
|
-// map.put("MANAGER_PHONE", applyInfo.getManagerPhone());
|
|
|
|
-// map.put("FZR", applyInfo.getFzr());
|
|
|
|
-// map.put("FZR_PHONE", applyInfo.getFzrPhone());
|
|
|
|
-// map.put("APPLY_ICON", applyInfo.getApplyIcon());
|
|
|
|
-// return map;
|
|
|
|
-// }
|
|
|
|
-//}
|
|
|