Commit 6600973a by shenjunjie

2022/09/15 17:44

parent 3551ee37
package com.zhiwei.brandkbs2.enmus; package com.zhiwei.brandkbs2.enmus;
import java.util.Arrays;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -33,6 +35,8 @@ public enum EmotionEnum { ...@@ -33,6 +35,8 @@ public enum EmotionEnum {
private final int state; private final int state;
private final String name; private final String name;
public static final List<String> EMOTION_LIST = Arrays.asList(POSITIVE.getName(), NEUTRAL.getName(), NEGATIVE.getName());
public static final String EMOTION_LABEL_KEY = "情感倾向"; public static final String EMOTION_LABEL_KEY = "情感倾向";
public static final String POSITIVE_LABEL = "正面"; public static final String POSITIVE_LABEL = "正面";
public static final String NEUTRAL_LABEL = "中性"; public static final String NEUTRAL_LABEL = "中性";
......
package com.zhiwei.brandkbs2.model; package com.zhiwei.brandkbs2.enmus.response;
import com.zhiwei.brandkbs2.model.ResultCode;
/** /**
* @author lxj * @author lxj
......
package com.zhiwei.brandkbs2.enmus.response;
import com.zhiwei.brandkbs2.model.ResultCode;
/**
* @ClassName: ReportCodeEnum
* @Description ReportCodeEnum
* @author: sjj
* @date: 2022-09-15 14:13
*/
public enum ReportCodeEnum implements ResultCode {
/**
* 该类型报告已存在
*/
REPORT_TYPE_EXIST_ERROR(false, 1101, "该类型报告已存在", 200);
/**
* 操作是否成功
*/
final boolean success;
/**
* 操作代码
*/
final int code;
/**
* 提示信息
*/
final String message;
/**
* 聚合状态码
*/
final int aggCode;
ReportCodeEnum(boolean success, int code, String message, int aggCode) {
this.success = success;
this.code = code;
this.message = message;
this.aggCode = aggCode;
}
@Override
public boolean success() {
return success;
}
@Override
public int code() {
return code;
}
@Override
public String message() {
return message;
}
@Override
public int aggCode() {
return aggCode;
}
}
...@@ -124,7 +124,7 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -124,7 +124,7 @@ public class ChannelServiceImpl implements ChannelService {
result.put("source", channel.getSource()); result.put("source", channel.getSource());
result.put("articleCount", channel.getArticleCount()); result.put("articleCount", channel.getArticleCount());
result.put("eventCount", channel.getEventCount()); result.put("eventCount", channel.getEventCount());
result.put("emotion", channel.getEmotion()); result.put("emotion", EmotionEnum.state2Name(channel.getEmotion()));
result.put("emotionIndex", channel.getEmotionIndex()); result.put("emotionIndex", channel.getEmotionIndex());
result.put("experienceLevel", ExperienceEnum.getValueFromDataBaseName(channel.getExperienceLevel())); result.put("experienceLevel", ExperienceEnum.getValueFromDataBaseName(channel.getExperienceLevel()));
result.put("lastTime", channel.getLastTime()); result.put("lastTime", channel.getLastTime());
......
...@@ -24,7 +24,7 @@ import com.zhiwei.brandkbs2.enmus.ImportantChannelEnum; ...@@ -24,7 +24,7 @@ import com.zhiwei.brandkbs2.enmus.ImportantChannelEnum;
import com.zhiwei.brandkbs2.exception.ExceptionCast; import com.zhiwei.brandkbs2.exception.ExceptionCast;
import com.zhiwei.brandkbs2.listener.ApplicationProjectListener; import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
import com.zhiwei.brandkbs2.model.CommonCodeEnum; import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import com.zhiwei.brandkbs2.model.EventCodeEnum; import com.zhiwei.brandkbs2.enmus.response.EventCodeEnum;
import com.zhiwei.brandkbs2.pojo.*; import com.zhiwei.brandkbs2.pojo.*;
import com.zhiwei.brandkbs2.pojo.dto.EventDataDTO; import com.zhiwei.brandkbs2.pojo.dto.EventDataDTO;
import com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO; import com.zhiwei.brandkbs2.pojo.dto.EventSearchDTO;
......
...@@ -12,6 +12,7 @@ import com.zhiwei.brandkbs2.dao.ReportDao; ...@@ -12,6 +12,7 @@ import com.zhiwei.brandkbs2.dao.ReportDao;
import com.zhiwei.brandkbs2.dao.ReportSettingsDao; import com.zhiwei.brandkbs2.dao.ReportSettingsDao;
import com.zhiwei.brandkbs2.enmus.EmotionEnum; import com.zhiwei.brandkbs2.enmus.EmotionEnum;
import com.zhiwei.brandkbs2.enmus.ReportTypeEnum; import com.zhiwei.brandkbs2.enmus.ReportTypeEnum;
import com.zhiwei.brandkbs2.enmus.response.ReportCodeEnum;
import com.zhiwei.brandkbs2.exception.ExceptionCast; import com.zhiwei.brandkbs2.exception.ExceptionCast;
import com.zhiwei.brandkbs2.listener.ApplicationProjectListener; import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
import com.zhiwei.brandkbs2.model.CommonCodeEnum; import com.zhiwei.brandkbs2.model.CommonCodeEnum;
...@@ -95,7 +96,7 @@ public class ReportServiceImpl implements ReportService { ...@@ -95,7 +96,7 @@ public class ReportServiceImpl implements ReportService {
} }
ReportSettingsDTO reportSettingsDTO = ReportSettingsDTO.createFromReportSettings(settings); ReportSettingsDTO reportSettingsDTO = ReportSettingsDTO.createFromReportSettings(settings);
if (!CollectionUtils.isEmpty(reportSettingsDTO.getContendIds())) { if (!CollectionUtils.isEmpty(reportSettingsDTO.getContendIds())) {
reportSettingsDTO.setContendBrandNames(reportSettingsDTO.getContendIds().stream().map(contendId -> projectService.getProjectByLinkedGroupId(contendId).getBrandName()).collect(Collectors.toList())); reportSettingsDTO.setContendBrandNames(reportSettingsDTO.getContendIds().stream().map(contendId -> projectService.getProjectByContendId(UserThreadLocal.getProjectId(), contendId).getBrandName()).collect(Collectors.toList()));
} }
res.put(key, reportSettingsDTO); res.put(key, reportSettingsDTO);
} }
...@@ -116,7 +117,7 @@ public class ReportServiceImpl implements ReportService { ...@@ -116,7 +117,7 @@ public class ReportServiceImpl implements ReportService {
// 已存在类型 // 已存在类型
if (originSettings.containsKey(type)) { if (originSettings.containsKey(type)) {
if (null == reportSettings.getId() || !originSettings.get(type).getId().equals(reportSettings.getId())) { if (null == reportSettings.getId() || !originSettings.get(type).getId().equals(reportSettings.getId())) {
ExceptionCast.cast(CommonCodeEnum.INVALID_PARAM); ExceptionCast.cast(ReportCodeEnum.REPORT_TYPE_EXIST_ERROR);
} }
reportSettingsDao.updateOne(reportSettings); reportSettingsDao.updateOne(reportSettings);
return; return;
......
...@@ -13,6 +13,7 @@ import com.zhiwei.brandkbs2.common.GenericAttribute; ...@@ -13,6 +13,7 @@ import com.zhiwei.brandkbs2.common.GenericAttribute;
import com.zhiwei.brandkbs2.common.GlobalPojo; import com.zhiwei.brandkbs2.common.GlobalPojo;
import com.zhiwei.brandkbs2.config.Constant; import com.zhiwei.brandkbs2.config.Constant;
import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO; import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO;
import com.zhiwei.brandkbs2.enmus.EmotionEnum;
import com.zhiwei.brandkbs2.model.ResponseResult; import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.BaseMap; import com.zhiwei.brandkbs2.pojo.BaseMap;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform; import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
...@@ -389,7 +390,10 @@ public class Tools { ...@@ -389,7 +390,10 @@ public class Tools {
} }
for (Map<String, Object> cacheMap : cacheMaps) { for (Map<String, Object> cacheMap : cacheMaps) {
if ("情感倾向".equals(String.valueOf(cacheMap.get("group_name")))) { if ("情感倾向".equals(String.valueOf(cacheMap.get("group_name")))) {
return String.valueOf(cacheMap.get("name")); String emotionName = String.valueOf(cacheMap.get("name"));
if (EmotionEnum.EMOTION_LIST.contains(emotionName)) {
return emotionName;
}
} }
} }
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment