Commit d9ff29d1 authored by 李驰骋's avatar 李驰骋

请求参数日志添加

参数默认调整
parent afa83024
package com.topsunit.scanservice.ximai.common;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@Aspect
@Component
public class ControllerLoggingAspect {
private static final Logger logger = LoggerFactory.getLogger("com.topsunit.scanservice.ximai.controller");
// 定义切点,拦截控制器中的所有方法
@Pointcut("execution(* com.topsunit.scanservice.ximai.controller..*(..))")
public void controllerPointcut() {
}
// 在控制器方法执行前添加日志记录
@Before("controllerPointcut()")
public void logBefore(JoinPoint joinPoint) {
if(logger.isDebugEnabled()) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
StringBuilder logMessage = new StringBuilder();
logMessage.append("Request to ").append(request.getRequestURI()).append(" | Method: ").append(request.getMethod()).append("\n");
logMessage.append("Parameters: ");
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
Parameter[] parameters = method.getParameters();
Map<String, Object> parameterMap = new HashMap<>();
for (int i = 0; i < parameters.length; i++) {
Parameter parameter = parameters[i];
String parameterName = parameter.getName();
Object value = joinPoint.getArgs()[i];
parameterMap.put(parameterName, value);
}
logMessage.append(parameterMap);
logger.debug(logMessage.toString());
}
}
}
......@@ -34,19 +34,21 @@ public class PurccCreateParams {
@ApiModelProperty("供货商号")
private String cc005;
@ApiModelProperty("")
private String cc006;
private String cc006="";
@ApiModelProperty("打印方式")
private String cc008="1";
@ApiModelProperty("审核状态")
private String cc009="N";
@ApiModelProperty("单据日期")
private String cc010;
@ApiModelProperty("")
private String cc011="";
@ApiModelProperty("供货商名称")
private String cc012;
@ApiModelProperty("表身到货总数量")
private BigDecimal cc013;
@ApiModelProperty("")
private String cc026;
private String cc026="";
@ApiModelProperty("库房标识")
private String udf01;
@ApiModelProperty("到货明细")
......
......@@ -87,6 +87,9 @@ public class CmsmvService {
throw new TopsunitException(loginResult2.getMsg());
}
LoginResult loginResult = tokenService.getUserByToken(loginResult2.getToken());
if(StringUtil.isNullOrEmpty(exAccountInfo.getAccountCode())){
throw new TopsunitException(MessageUtils.getMessage("请维护账套数据库编码"));
}
//生成扫码自生token
String newToken = tokenManger.generate(loginParams.getUsername(), loginResult.getLocal(),exAccountInfo.getAccountCode());
loginResult.setToken(newToken);
......
package com.topsunit.scanservice.ximai.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.topsunit.scanservice.ximai.common.DateUtil;
import com.topsunit.scanservice.ximai.common.TopsunitException;
import com.topsunit.scanservice.ximai.dao.CoptgDao;
......@@ -52,6 +53,8 @@ public class CopthService {
coptg.setTg044(coptn.getTn030());
int i = 1;
for(StockSaleOutParams.StockSaleOutDetail s : params.getData()){
s.setWarehouse(StrUtil.trim(s.getWarehouse()));
s.setLocation(StrUtil.trim(s.getLocation()));
//查询出货通知单明细
Copto copto = coptoDao.findFirstByTo001AndTo002AndTo007("251", params.getApplyNo(), s.getMaterialNo())
.orElseThrow(()->new TopsunitException(MessageUtils.getMessage("未找到出货通知单明细:{0},{1}", params.getApplyNo(), s.getMaterialNo())));
......
......@@ -2,6 +2,7 @@ package com.topsunit.scanservice.ximai.service;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.topsunit.scanservice.ximai.common.TopsunitException;
import com.topsunit.scanservice.ximai.dao.CoptgDao;
import com.topsunit.scanservice.ximai.dao.CopthDao;
import com.topsunit.scanservice.ximai.dao.CoptoDao;
......@@ -9,6 +10,7 @@ import com.topsunit.scanservice.ximai.dto.StockSaleOutDto;
import com.topsunit.scanservice.ximai.dto.StockSaleOutQueryParams;
import com.topsunit.scanservice.ximai.entity.Copth;
import com.topsunit.scanservice.ximai.entity.Copto;
import com.topsunit.scanservice.ximai.utils.MessageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -27,10 +29,18 @@ public class CoptoService {
@Autowired
private CopthDao copthDao;
/**
* 查询出货通知单
* @param params
* @return
*/
public StockSaleOutDto getStockSaleOutDto(StockSaleOutQueryParams params){
StockSaleOutDto rst = new StockSaleOutDto();
List<StockSaleOutDto.StockSaleOutDetail> data = new ArrayList<>();
List<Copto> list = coptoDao.findByTo001AndTo002("251", params.getSaleOutNo());
if(list.isEmpty()){
throw new TopsunitException(MessageUtils.getMessage("未找到出货通知单:")+params.getSaleOutNo());
}
//查询已出库通知单数据,扣减相应数量
Map<String, List<Copth>> copthMap = copthDao.findByTh045AndTh046("251", params.getSaleOutNo()).stream()
.collect(Collectors.groupingBy(s->StrUtil.trim(s.getTh004())));
......@@ -49,12 +59,18 @@ public class CoptoService {
}else{
saleOutDetail.setDeliverQuantity(s.getTo024());
}
if(saleOutDetail.getDeliverQuantity().compareTo(BigDecimal.ZERO)<=0){
return;
}
saleOutDetail.setPlanOutDate(s.getUdf01());
saleOutDetail.setMaterialName(StrUtil.trim(s.getTo008()));
saleOutDetail.setMaterialNo(StrUtil.trim(s.getTo007()));
saleOutDetail.setUnit(StrUtil.trim(s.getTo010()));
data.add(saleOutDetail);
});
if(data.isEmpty()){
throw new TopsunitException(MessageUtils.getMessage("通知单{0}已全部出库", params.getSaleOutNo()));
}
rst.setData(data);
rst.setApplyNo(params.getSaleOutNo());
return rst;
......
......@@ -270,6 +270,7 @@ public class PurccService {
purcd.setCd013(detail.getArrivalQuantity());
purcd.setCd015(purtd.getTd009());
purcd.setCd016(purtd.getTd007());
purcd.setCd021(invmb.getMb004());
purcdDao.save(purcd);
sumQuantity = sumQuantity.add(detail.getArrivalQuantity());
i++;
......
......@@ -14,9 +14,7 @@ server:
logging:
level:
root: info
org:
springframework:
web: info
org.springframework.web: TRACE
com.topsunit: info
spring:
messages:
......
......@@ -14,10 +14,12 @@ server:
logging:
level:
root: warn
org:
springframework:
web: debug
com.topsunit: debug
com:
topsunit:
scanservice:
ximai:
controller: debug
com.topsunit: info
druid:
sql:
Statement: debug
......
......@@ -14,12 +14,12 @@ server:
logging:
level:
root: info
org:
springframework:
web: info
com:
topsunit:
scanservice:
ximai:
controller: debug
com.topsunit: info
org.springframework.web.servlet.DispatcherServlet: DEBUG
org.springframework.web.filter.CommonsRequestLoggingFilter: DEBUG
file:
name: logs/erp-service.log
spring:
......
spring:
profiles:
active:
- dev
\ No newline at end of file
- test-sh
\ No newline at end of file
......@@ -36,4 +36,6 @@
品号{0}批号{1}库存不足。=品号{0}批号{1}库存不足。
未找到采购订单{0},{1}=未找到采购订单{0},{1}
未找到采购订单{0},{1},{2}=未找到采购订单{0},{1},{2}
未找到工单:{0},{1}=未找到工单:{0},{1}
\ No newline at end of file
未找到工单:{0},{1}=未找到工单:{0},{1}
请维护账套数据库编码=请维护账套数据库编码
通知单{0}已全部出库=通知单{0}已全部出库
\ No newline at end of file
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