add:增加日志记录;

This commit is contained in:
2026-06-17 15:54:04 +08:00
parent 8a075f3023
commit bcbe782688
4 changed files with 52 additions and 38 deletions

View File

@@ -23,12 +23,15 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.nl.common.logging.domain.Log;
import org.nl.common.utils.IPUtil;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.RequestHolder;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.lucene.LuceneAppender;
import org.nl.common.utils.StringUtils;
import org.nl.wms.system_manage.service.logging.ISysLogService;
import org.nl.wms.system_manage.service.logging.dao.SysLog;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@@ -50,7 +53,8 @@ import java.util.Map;
@Slf4j
public class LogAspect {
@Autowired
private ISysLogService logService;
/**
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
@@ -59,7 +63,6 @@ public class LogAspect {
*/
@Around("@annotation(logInfo)")
public Object logAround(ProceedingJoinPoint joinPoint,org.nl.common.logging.annotation.Log logInfo) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
String params = getParameter(method, joinPoint.getArgs());
@@ -72,15 +75,12 @@ public class LogAspect {
Object result = null;
long comming = System.currentTimeMillis();
try {
log.info("[--request--][请求接口:{}][请求参数:{}]",url,params);
log.info("[--request--][请求接口:{}][请求参数:{}]", url, params);
result = joinPoint.proceed();
// //是否把日志存到日志表
// if (logInfo.isAddLogTable()) {
// Log log = new Log("INFO", System.currentTimeMillis() - comming);
// logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
// }
//是否把日志存到日志表
SysLog log = new SysLog("INFO", System.currentTimeMillis() - comming);
logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
}catch (Exception ex){
StringBuffer errorStack = new StringBuffer();
errorStack.append("<br/>【异常堆栈:");
String errorMsg = ex.getMessage();

View File

@@ -137,17 +137,15 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
.set(SchBasePoint::getVehicle_code, entity.getVehicle_code())
.set(SchBasePoint::getUpdate_name, nickName)
.set(SchBasePoint::getUpdate_time, now)
.set(SchBasePoint::getLock_up, entity.getLock_up())
.set(SchBasePoint::getRegion_name, baseRegion.getRegion_name());
if (ObjectUtil.isNotEmpty(entity.getCan_vehicle_types())) {
wrapper.set(SchBasePoint::getCan_vehicle_type, String.join(",", entity.getCan_vehicle_types()));
}
// 根据点位状态来判断更新内容
String pointStatus = entity.getPoint_status();
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals(PointStatusEnum.EMPTY_POINT.getCode())) {
wrapper.set(SchBasePoint::getVehicle_code, (String) null);
wrapper.set(SchBasePoint::getLock_up, false);
}else if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals(PointStatusEnum.FULL_POINT.getCode())) {
wrapper.set(SchBasePoint::getLock_up, true);
if (pointStatus.equals(PointStatusEnum.EMPTY_POINT.getCode())&&StringUtils.isBlank(entity.getVehicle_code()) ) {
wrapper.set(SchBasePoint::getVehicle_code, null);
}
pointMapper.update(null, wrapper);
}
@@ -226,7 +224,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(SchBasePoint::getPoint_code, pointCodes)
.set(SchBasePoint::getLock_up, false)
.set(SchBasePoint::getPoint_status, "1")
.set(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
.set(SchBasePoint::getIs_has_workder,"0")
.set(SchBasePoint::getVehicle_code, null)
.set(SchBasePoint::getUpdate_id, userId)

View File

@@ -12,6 +12,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
@@ -68,6 +70,7 @@ import java.util.stream.Collectors;
* 2025/5/29
*/
@Service
@Slf4j
public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> implements IOutBillService {
@Resource
@@ -1403,6 +1406,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
point_code2.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
point_code2.setLock_up(false);
iSchBasePointService.update(point_code2);
log.info("任务号:{}完成,解锁库位:{}", task.getTask_code(),point_code2);
//库存变动:根据冻结数更新物料库存
StructattrChangeDto changeDto = StructattrChangeDto.builder()
.inv(item.getIostorinv_id())
@@ -1450,17 +1454,17 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
jo.put("storagevehicle_code",task.getVehicle_code());
jo.put("struct_name",task.getPoint_code2());
jo.put("struct_code",task.getPoint_code2());
GroupPlate groupPlate=mdPbGroupplateMapper.selectOne(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getStoragevehicle_code,task.getVehicle_code()));
MdMeMaterialbase mdMeMaterialbase=mdMeMaterialbaseMapper.selectOne(new LambdaQueryWrapper<MdMeMaterialbase>().eq(MdMeMaterialbase::getMaterial_id,groupPlate.getMaterial_id()));
jo.put("material_name",mdMeMaterialbase.getMaterial_name());
jo.put("material_code",mdMeMaterialbase.getMaterial_code());
jo.put("qty",groupPlate.getQty());
List<JSONObject> tableData=new ArrayList<>();
tableData.add(jo);
towmsmsg.setTableData(tableData);
iWmsToWmsService.FinishOutTask(towmsmsg);
// GroupPlate groupPlate=mdPbGroupplateMapper.selectOne(new LambdaQueryWrapper<GroupPlate>()
// .eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
// .eq(GroupPlate::getStoragevehicle_code,task.getVehicle_code()));
// MdMeMaterialbase mdMeMaterialbase=mdMeMaterialbaseMapper.selectOne(new LambdaQueryWrapper<MdMeMaterialbase>().eq(MdMeMaterialbase::getMaterial_id,groupPlate.getMaterial_id()));
// jo.put("material_name",mdMeMaterialbase.getMaterial_name());
// jo.put("material_code",mdMeMaterialbase.getMaterial_code());
// jo.put("qty",groupPlate.getQty());
// List<JSONObject> tableData=new ArrayList<>();
// tableData.add(jo);
// towmsmsg.setTableData(tableData);
// iWmsToWmsService.FinishOutTask(towmsmsg);
}
@Override

View File

@@ -1,10 +1,12 @@
package org.nl.wms.wbwms.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -100,22 +102,32 @@ public class WmsToIWmsServiceImpl implements WmsToIWmsService {
SchBasePoint schBasePoint=new SchBasePoint();
GroupPlate groupPlate=new GroupPlate();
WmstoIWmsResponse result = new WmstoIWmsResponse();
try{
schBasePoint=iSchBasePointService.getByCode(turnout_destination_code);
try {
schBasePoint = iSchBasePointService.getByCode(turnout_destination_code);
if (schBasePoint == null) {
result.setCode("404");
result.setMsg("未找到出库货位");
return result;
}
//载具编码
String storagevehicle_code=schBasePoint.getVehicle_code();
String storagevehicle_code = schBasePoint.getVehicle_code();
// iSchBasePointService.unLockPoint(turnout_destination_code);
if(StringUtils.isNotEmpty(storagevehicle_code)) {
if (StringUtils.isNotEmpty(storagevehicle_code)) {
//将组盘状态改为出库
groupPlate = iMdPbGroupplateService.getByCode(storagevehicle_code);
mdPbGroupplateMapper.deleteById(groupPlate);
}
schBasePoint.setVehicle_code("");
schBasePoint.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
schBasePoint.setLock_up(false);
iSchBasePointService.update(schBasePoint);
MdPbStoragevehicleinfo mdPbStoragevehicleinfo=new MdPbStoragevehicleinfo();
if(StringUtils.isNotEmpty(storagevehicle_code)) {
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getUpdate_id,"2")
.set(SchBasePoint::getUpdate_name,"MES")
.set(SchBasePoint::getLock_up,false)
.set(SchBasePoint::getPoint_status,PointStatusEnum.EMPTY_POINT.getCode())
.set(SchBasePoint::getVehicle_code,null)
.set(SchBasePoint::getUpdate_time, DateUtil.now());
iSchBasePointService.update(wrapper);
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = new MdPbStoragevehicleinfo();
if (StringUtils.isNotEmpty(storagevehicle_code)) {
mdPbStoragevehicleinfo = iMdPbStoragevehicleinfoService.getByCode(storagevehicle_code);
//将载具信息清除
mdPbStoragevehicleinfoMapper.deleteById(mdPbStoragevehicleinfo);