放货有货 重新分配货位
This commit is contained in:
@@ -5,15 +5,15 @@ import com.ruoyi.log.domain.RequestLog;
|
||||
|
||||
/**
|
||||
* 接口记录Service接口
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
public interface IRequestLogService
|
||||
public interface IRequestLogService
|
||||
{
|
||||
/**
|
||||
* 查询接口记录
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 接口记录
|
||||
*/
|
||||
@@ -21,7 +21,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 查询接口记录列表
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 接口记录集合
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 修改接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 批量删除接口记录
|
||||
*
|
||||
*
|
||||
* @param requestIds 需要删除的接口记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -53,9 +53,26 @@ public interface IRequestLogService
|
||||
|
||||
/**
|
||||
* 删除接口记录信息
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRequestLogByRequestId(Long requestId);
|
||||
|
||||
/**
|
||||
* 请求接口记录
|
||||
* @param url
|
||||
* @param param
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String url, String param, String remark);
|
||||
/**
|
||||
* 接收接口记录
|
||||
*
|
||||
* @param param
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String param, String remark);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
package com.ruoyi.log.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.log.mapper.RequestLogMapper;
|
||||
@@ -9,19 +18,19 @@ import com.ruoyi.log.service.IRequestLogService;
|
||||
|
||||
/**
|
||||
* 接口记录Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
@Service
|
||||
public class RequestLogServiceImpl implements IRequestLogService
|
||||
public class RequestLogServiceImpl implements IRequestLogService
|
||||
{
|
||||
@Autowired
|
||||
private RequestLogMapper requestLogMapper;
|
||||
|
||||
/**
|
||||
* 查询接口记录
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 接口记录
|
||||
*/
|
||||
@@ -33,7 +42,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
|
||||
/**
|
||||
* 查询接口记录列表
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 接口记录
|
||||
*/
|
||||
@@ -45,7 +54,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -57,7 +66,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
|
||||
/**
|
||||
* 修改接口记录
|
||||
*
|
||||
*
|
||||
* @param requestLog 接口记录
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -69,7 +78,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
|
||||
/**
|
||||
* 批量删除接口记录
|
||||
*
|
||||
*
|
||||
* @param requestIds 需要删除的接口记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -81,7 +90,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
|
||||
/**
|
||||
* 删除接口记录信息
|
||||
*
|
||||
*
|
||||
* @param requestId 接口记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -90,4 +99,67 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
{
|
||||
return requestLogMapper.deleteRequestLogByRequestId(requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入请求日志
|
||||
*
|
||||
* @param url 请求url
|
||||
* @param param 参数
|
||||
* @return requestLog
|
||||
*/
|
||||
@Override
|
||||
public RequestLog getRequestLog(String url, String param, String remark) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
requestLog.setRequestTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setSourceSystem("wcs");
|
||||
requestLog.setTargetSystem("wms");
|
||||
requestLog.setEndpoint(remark);
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setRequestHeaders(null);
|
||||
requestLog.setRequestBody(param);
|
||||
requestLog.setRequestUrl(url);
|
||||
try {
|
||||
String resStr = HttpUtil.post(url, param);
|
||||
requestLog.setResponseBody(resStr);
|
||||
AjaxResult bean = JSONUtil.toBean(resStr, AjaxResult.class);
|
||||
if (Convert.toInt(bean.get("code")) == 0) {
|
||||
requestLog.setResponseTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setResponseStatus("1");
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(Convert.toDate(requestLog.getRequestTime()), Convert.toDate(requestLog.getResponseTime()), DateUnit.MS)));
|
||||
requestLog.setIsSuccessful("1");
|
||||
}else {
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setErrorDetails(Convert.toStr(bean.get("msg")));
|
||||
requestLog.setIsSuccessful("0");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
requestLog.setErrorDetails(e.getMessage());
|
||||
requestLog.setIsSuccessful("0");
|
||||
requestLog.setResponseStatus("0");
|
||||
} finally {
|
||||
requestLogMapper.insertRequestLog(requestLog);
|
||||
}
|
||||
return requestLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入请求日志
|
||||
*
|
||||
* @return requestLog
|
||||
*/
|
||||
@Override
|
||||
public RequestLog getRequestLog(String param, String remark) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
requestLog.setRequestTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setRequestBody(param);
|
||||
requestLog.setSourceSystem("wms");
|
||||
requestLog.setTargetSystem("wcs");
|
||||
requestLog.setEndpoint(remark);
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setResponseTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setDuration(Convert.toStr(DateUtil.between(Convert.toDate(requestLog.getRequestTime()), Convert.toDate(requestLog.getResponseTime()), DateUnit.MS)));
|
||||
requestLog.setIsSuccessful("1");
|
||||
return requestLog;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user