提交 53b8d266 编写于 作者: minghao.wu's avatar minghao.wu

style: 格式调整

上级 76bc782f
流水线 #342 已通过 于阶段
in 22 second
......@@ -129,9 +129,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getActivityDetail", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -157,9 +157,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getPSAActivityDetail", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -182,9 +182,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getRoundDetail", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
......@@ -250,10 +250,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getReplyList", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -311,10 +310,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getReplyDetail", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -379,10 +377,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getReplyDetailByExamTitleId", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -511,10 +508,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("nextReplyList", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -574,10 +570,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("nextReplyDetail", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -615,7 +610,7 @@ public class AnalysisController {
/**
* 如果判断检测的数据中有垃圾 直接返回
*/
PicaResponse response = antiSpamService.processString(user != null ? user.getId() : 0, sysCode, content, false);
PicaResponse response = antiSpamService.processString(user.getId(), sysCode, content, false);
if (!response.getCode().equals(PicaResultCode.SUCCESS.code())) {
response.setData("");
return response;
......@@ -739,10 +734,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("getRoundDetailV2", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......@@ -813,10 +807,9 @@ public class AnalysisController {
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
logger.error("myStar", e);
t.setStatus(e);
Cat.logError(e);
e.printStackTrace();
}
t.complete();
return builder.build();
......
......@@ -58,7 +58,7 @@ public class AntiSpamController {
}
return antiSpamService.processString(
user != null ? user.getId() : 0,
user.getId(),
sysCode,
sbContent.toString(),
type != 0
......@@ -88,7 +88,7 @@ public class AntiSpamController {
return ReturnUtil.getPicaResponse(PicaResultCode.PARAM_IS_INVALID);
}
if (!antiSpamService.processImageContent(user != null ? user.getId() : 0, sysCode, sbContent.toString())) {
if (!antiSpamService.processImageContent(user.getId(), sysCode, sbContent.toString())) {
return ReturnUtil.getPicaResponse("400002", "图片包含违禁内容,请修改后重新输入", "");
}
......
......@@ -162,4 +162,9 @@ public class Reply {
return false;
return true;
}
@Override
public int hashCode() {
return 1;
}
}
\ No newline at end of file
......@@ -77,7 +77,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
String signature = SignatureUtils.genSignature(properties.getNeteaseAntispamSecretKey(), params);
params.put("signature", signature);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error("processString", e);
}
/**
......@@ -115,6 +115,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
if (action == 0) {
insertRecord(userId, sysCode, content, response, (byte)action, 0, "");
} else {
StringBuilder hint = new StringBuilder();
for (JsonElement labelElement : labelArray) {
JsonObject lObject = labelElement.getAsJsonObject();
int label = lObject.get("label").getAsInt();
......@@ -129,7 +130,6 @@ public class AntiSpamServiceImpl implements AntiSpamService {
else if (label == 600) msg = "输入内容包含谩骂词汇,请修改后重新输入";
else if (label == 700) msg = "输入内容包含灌水词汇,请修改后重新输入";
StringBuilder hint = new StringBuilder();
for (JsonElement eleHint : hintArray) {
hint.append(eleHint.getAsString()).append(",");
}
......@@ -138,15 +138,13 @@ public class AntiSpamServiceImpl implements AntiSpamService {
}
insertRecord(userId, sysCode, content, response, (byte)action, label, hint.toString());
return ReturnUtil.getPicaResponse("400002", msg, hint.toString());
break;
}
return ReturnUtil.getPicaResponse(PicaResultCode.DATA_IS_WRONG.code(), msg, hint.toString());
}
} else {
return ReturnUtil.getPicaResponse(jObject.get("code").getAsString(), msg, "");
}
return ReturnUtil.getPicaResponse(PicaResultCode.SUCCESS, "");
}
......@@ -212,7 +210,7 @@ public class AntiSpamServiceImpl implements AntiSpamService {
String signature = SignatureUtils.genSignature(properties.getNeteaseAntispamSecretKey(), params);
params.put("signature", signature);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error("processImage", e);
}
/**
......
package com.pica.cloud.online.exam.analysis.server.service.impl;
import com.pica.cloud.online.exam.analysis.common.CommonUtils;
import com.pica.cloud.online.exam.analysis.common.constants.CommonConstants;
import com.pica.cloud.online.exam.analysis.common.dto.*;
import com.pica.cloud.online.exam.analysis.server.configuration.PropertiesConfiguration;
import com.pica.cloud.online.exam.analysis.server.entity.*;
......@@ -9,6 +7,8 @@ import com.pica.cloud.online.exam.analysis.server.mapper.*;
import com.pica.cloud.online.exam.analysis.server.service.CHCAnalysisService;
import com.pica.cloud.online.exam.analysis.server.utils.DateUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -22,6 +22,7 @@ import java.util.*;
@Service
public class CHCAnalysisServiceImpl implements CHCAnalysisService {
static final String[] OPTIONS = {"A", "B", "C", "D", "E", "F", "G", "H"};
private static Logger logger = LoggerFactory.getLogger(CHCAnalysisServiceImpl.class);
@Autowired
CHCAnalysisMapper analysisMapper;
......@@ -261,7 +262,7 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
*/
replyDtoList.add(getReplyDtoByReply(reply, userId));
} catch (Exception e) {
e.printStackTrace();
logger.error("getReplyListDtoByExamTitleId", e);
}
}
......
......@@ -14,7 +14,7 @@ public class DateUtils {
private static final long ONE_DAY = 86400;
private static final long THREE_DAY = 259200;
public static Calendar calendar = Calendar.getInstance();
public static final Calendar calendar = Calendar.getInstance();
public static String fromNow(Date date) {
calendar.setTime(date);
......
......@@ -11,6 +11,8 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.Charset;
......@@ -24,6 +26,7 @@ import java.util.Map;
* @date 2018/8/23 15:44
*/
public class HttpClient4Utils {
private static Logger logger = LoggerFactory.getLogger(HttpClient4Utils.class);
/**
* 实例化HttpClient
* @param maxTotal
......@@ -71,15 +74,13 @@ public class HttpClient4Utils {
response = (CloseableHttpResponse) httpClient.execute(httpPost);
resp = EntityUtils.toString(response.getEntity(), encoding);
} catch (Exception e) {
// log
e.printStackTrace();
logger.error("sendPost", e);
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
// log
e.printStackTrace();
logger.error("sendPost", e);
}
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册