<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.0.6</version>
</dependency>
HUtoolAPI开发文档
Object result = joinPoint.proceed();
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
if (method.isAnnotationPresent(ApiOperation.class)) {
ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
hxWebLog.setDescription(apiOperation.value());
}
long endTime = System.currentTimeMillis();
String urlStr = request.getRequestURL().toString();
hxWebLog.setBasePath(StrUtil.removeSuffix(urlStr, URLUtil.url(urlStr).getPath()));
hxWebLog.setIp(request.getRemoteAddr());
hxWebLog.setMethod(request.getMethod());
hxWebLog.setParameter(getParameter(method, joinPoint.getArgs()).toString());
hxWebLog.setResult(result.toString());
hxWebLog.setSpendTime((int)(endTime - startTime));
hxWebLog.setStartTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime));
hxWebLog.setUri(request.getRequestURI());
hxWebLog.setUrl(request.getRequestURL().toString());
hxWebLog.setUsername(token);
if (StrUtil.isNotBlank(request.getParameter("fileName"))) {
hxWebLog.setCompanyName(request.getParameter("fileName"));
}
if (StrUtil.isNotBlank(request.getParameter("filePathId"))) {
hxWebLog.setCompanyId(Integer.parseInt(request.getParameter("filePathId")));
}
if (StrUtil.isNotBlank(request.getParameter("dept"))) {
hxWebLog.setDept(request.getParameter("dept"));
}
if (StrUtil.isNotBlank(request.getParameter("fillingName"))) {
hxWebLog.setFillingName(request.getParameter("fillingName"));
}
if (StrUtil.isNotBlank(request.getParameter("fillingTime"))) {
hxWebLog.setFillingTime(request.getParameter("fillingTime"));
}
LOGGER.info("{}", JSONUtil.parse(hxWebLog));
hxWebLogMapper.insert(hxWebLog);
CREATE TABLE [dbo].[hx_api_log] (
[uid] bigint IDENTITY(1,1) NOT NULL,
[time_stamp] bigint NULL,
[open_id] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[url] nvarchar(max) COLLATE Chinese_PRC_CI_AS NULL,
[result] nvarchar(max) COLLATE Chinese_PRC_CI_AS NULL,
[count] int NULL,
CONSTRAINT [PK_hx_api_log] PRIMARY KEY CLUSTERED ([uid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[hx_api_log] SET (LOCK_ESCALATION = TABLE)
GO
@ApiOperation(value = "查询经营异常")
@RequestMapping(value = "/api/v1/abnormal", method = RequestMethod.POST)
public BaseResult<Map<String, Integer>> saveAbnormal(@RequestParam Long id, @RequestParam String name, @RequestParam(required = false)Integer pageNum) {
return ResultUtil.success(abnormalOperationService.saveAbnormal(id, name, pageNum));
}
if(BeanUtil.isEmpty(pageNum)){
// pageNum 为null 查询全部
//记录页码
int count = 1;
while(true){
resultMap = getData(id, name, count, paramNum,timeStamp);
if(BeanUtil.isNotEmpty(resultMap)){
paramNum = resultMap.get("HxTycAbnormalOperation");
count +=1;
consumptionCount +=1;
}else{
break;
}
}
if(consumptionCount!=0){
hxApiLog.setCount(consumptionCount);
hxApiLogMapper.insert(hxApiLog);
}
}else{
//查询指定页码
resultMap = getData(id, name, pageNum, paramNum,timeStamp);
if(BeanUtil.isNotEmpty(resultMap)){
consumptionCount +=1;
}else{
return resultMap;
}
hxApiLog.setCount(consumptionCount);
hxApiLogMapper.insert(hxApiLog);
}
public static boolean isNotError(String paramStr) {
boolean isNotError = true;
JSONObject result = JSON.parseObject(paramStr);
Integer error_code = result.getInteger("error_code");
if (error_code == 0){
//throw new BaseException(CodeEnum.SUCCESS, result.toString());
if(result.getJSONObject("result").getJSONArray("items") != null){
if(BeanUtil.isEmpty(result.getJSONObject("result").getJSONArray("items"))){
isNotError = false;
}
}
} else {
isNotError = false;
}
System.out.println(isNotError);
return isNotError;
}
public void delDataBefore(long id,String name ){
Map<String,Object> delParam = new HashMap<>();
delParam.put("company_id",id);
delParam.put("company_name",name);
hxTycAbnormalOperationMapper.deleteByMap(delParam);
}