Commit 2ecea2e4 by 吴迪

【新增】新增境内条码信息公告查询

parent 387cef02
......@@ -115,4 +115,69 @@ public class GTINController {
}
}
@Login
@PostMapping("/api/domesticCodeProductionNews")
public void domesticCodeProductionNews(@RequestBody GLNRequestBo glnRequestBo, HttpServletRequest request, HttpServletResponse response) {
PrintWriter printWriter = null;
try {
response.setCharacterEncoding("utf-8");
response.setHeader("contentType", "text/html; charset=utf-8");
printWriter = response.getWriter();
String typeKey = "";
boolean captcha = sysCaptchaService.validate(glnRequestBo.getUuid(), glnRequestBo.getCaptcha());
if (!captcha) {
R r = new R();
r.put("code", "500");
r.put("msg", "验证码不正确!");
printWriter.write(JSONUtil.toJsonStr(r));
return;
}
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
if(glnRequestBo.getCode().length()<13) {
R r = new R();
r.put("code", "500");
r.put("msg", "GTIN不能少于12位!");
printWriter.write(JSONUtil.toJsonStr(r));
return;
}
searchgtinlogEntity.setClassStr("境内商品条码信息查询");
typeKey = "境内商品条码信息查询";
//校验是否开启
String searchLimitStr = searchLimitUtil.checkSearchLimit(request, typeKey);
if (StringUtils.isNotBlank(searchLimitStr)) {
R r = new R();
r.put("code", "500");
r.put("msg", searchLimitStr);
printWriter.write(JSONUtil.toJsonStr(r));
return;
}
searchgtinlogEntity.setKeyword(glnRequestBo.getCode());
searchgtinlogEntity.setSearchsource(0);
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
R r = new R();
r.put("code", "0");
r.put("msg", "");
printWriter.write(JSONUtil.toJsonStr(r));
return;
} catch (IOException e) {
e.printStackTrace();
} finally {
printWriter.flush();;
printWriter.close();
}
}
}
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