rev:日志打印,add:空木箱入库mes回传
This commit is contained in:
@@ -6,9 +6,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.auto.Prun;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -173,5 +175,17 @@ public class PdmBiSubpackagerelationController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/schdule")
|
||||
@Log("定时调度")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> 定时调度(@RequestBody JSONObject whereJson) throws ClassNotFoundException {
|
||||
String aClass = whereJson.getString("class");
|
||||
Prun obj = (Prun) SpringContextHolder.getBean(aClass);
|
||||
obj.run();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
|
||||
import org.nl.common.enums.PackageInfoIvtEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -23,7 +24,7 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendToZxq {
|
||||
public class AutoSendToZxq extends Prun{
|
||||
|
||||
private final String THIS_CLASS = AutoSendToZxq.class.getName();
|
||||
@Resource
|
||||
@@ -38,6 +39,7 @@ public class AutoSendToZxq {
|
||||
private TaskQueue taskQueue;
|
||||
|
||||
//待检区->装箱区agv自动搬运任务
|
||||
@Autowired
|
||||
public void run() {
|
||||
this.sendDjqToZxq();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -48,7 +49,7 @@ import static org.nl.wms.util.TaskUtil.getMaxNum;
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoSendZxToDjw {
|
||||
public class AutoSendZxToDjw extends Prun{
|
||||
private final String THIS_CLASS = AutoSendZxToDjw.class.getName();
|
||||
|
||||
private static final String NUM_KEY = "AutoSendZxToDjw:NUM";
|
||||
@@ -83,6 +84,7 @@ public class AutoSendZxToDjw {
|
||||
private ISysParamService iSysParamService;
|
||||
|
||||
//装箱区->装箱对接位agv自动搬运任务
|
||||
@Autowired
|
||||
public void run() {
|
||||
this.sendZxToDjw();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
|
||||
|
||||
public abstract class Prun {
|
||||
public abstract void run();
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -146,7 +147,10 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
||||
|
||||
@Override
|
||||
public BstIvtBoxinfo getBoxInfo(JSONObject jsonObject) {
|
||||
lmsToMesService.momGetPackingInfo(jsonObject);
|
||||
String isConnect2 = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_MES2").getValue();
|
||||
if ("1".equals(isConnect2)) {
|
||||
lmsToMesService.momGetPackingInfo(jsonObject);
|
||||
}
|
||||
String boxNo = jsonObject.getString("box_no");
|
||||
BstIvtBoxinfo boxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, boxNo));
|
||||
if (boxinfo == null) {
|
||||
|
||||
@@ -209,7 +209,10 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("box_no", boxNO);
|
||||
//调用MES接口插入或更新木箱信息
|
||||
lmsToMesService.momGetPackingInfo(jo);
|
||||
String isConnect2 = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_MES2").getValue();
|
||||
if ("1".equals(isConnect2)) {
|
||||
lmsToMesService.momGetPackingInfo(jo);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
|
||||
@@ -53,7 +53,9 @@ public class DruidFilter extends FilterEventAdapter {
|
||||
}
|
||||
executeSql = SQLUtils.format(executeSql, JdbcUtils.MYSQL, params);
|
||||
}
|
||||
log.info("[----SQL----][update][ SQL: {} ]", executeSql);
|
||||
if (!sql.contains("sys_log")){
|
||||
log.info("[----SQL----][update][ SQL: {} ]", executeSql);
|
||||
}
|
||||
}
|
||||
super.statementExecuteAfter(statement, sql, result);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
|
||||
import net.dreamlu.mica.ip2region.core.IpInfo;
|
||||
import nl.basjes.parse.useragent.UserAgent;
|
||||
import nl.basjes.parse.useragent.UserAgentAnalyzer;
|
||||
import org.nl.modules.common.config.ElAdminProperties;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
@@ -50,13 +48,6 @@ public class StringUtils {
|
||||
private final static Ip2regionSearcher IP_SEARCHER = SpringContextHolder.getBean(Ip2regionSearcher.class);
|
||||
|
||||
|
||||
private static final UserAgentAnalyzer USER_AGENT_ANALYZER = UserAgentAnalyzer
|
||||
.newBuilder()
|
||||
.hideMatcherLoadStats()
|
||||
.withCache(10000)
|
||||
.withField(UserAgent.AGENT_NAME_VERSION)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 驼峰命名法工具
|
||||
*
|
||||
@@ -207,8 +198,7 @@ public class StringUtils {
|
||||
}
|
||||
|
||||
public static String getBrowser(HttpServletRequest request) {
|
||||
UserAgent.ImmutableUserAgent userAgent = USER_AGENT_ANALYZER.parse(request.getHeader("User-Agent"));
|
||||
return userAgent.get(UserAgent.AGENT_NAME_VERSION).getValue();
|
||||
return "PC";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ package org.nl.modules.logging.aspect;/*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,7 +24,10 @@ import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.utils.BaseCode;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.lucene.LuceneAppender;
|
||||
import org.nl.modules.common.utils.RequestHolder;
|
||||
import org.nl.modules.common.utils.StringUtils;
|
||||
import org.nl.modules.common.utils.ThrowableUtil;
|
||||
@@ -82,21 +86,51 @@ public class LogAspect {
|
||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
// 方法路径
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
String url = request.getRequestURI();
|
||||
MDC.put("requestMethod", url);
|
||||
MDC.put("requestIp", StringUtils.getIp(request));
|
||||
MDC.put("traceId", BaseCode.intToChars(IdUtil.getLongId()));
|
||||
MDC.put("requestTime", DateUtil.now());
|
||||
LuceneAppender.traceIdTL.set(BaseCode.intToChars(IdUtil.getLongId()));
|
||||
String params = getParameter(method, joinPoint.getArgs());
|
||||
long comming = System.currentTimeMillis();
|
||||
|
||||
Object result;
|
||||
currentTime.set(System.currentTimeMillis());
|
||||
result = joinPoint.proceed();
|
||||
SysLog log = new SysLog("INFO", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), joinPoint, log);
|
||||
try {
|
||||
log.info("[--request--][请求接口:{}][请求参数:{}]", url, params);
|
||||
currentTime.set(System.currentTimeMillis());
|
||||
result = joinPoint.proceed();
|
||||
SysLog log = new SysLog("INFO", System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), joinPoint, log);
|
||||
}catch (Exception ex) {
|
||||
StringBuffer errorStack = new StringBuffer();
|
||||
errorStack.append("<br/>【异常堆栈:");
|
||||
String errorMsg = ex.getMessage();
|
||||
int x = 0;
|
||||
StackTraceElement[] stackTrace = ex.getStackTrace();
|
||||
if (stackTrace != null && stackTrace.length > 0) {
|
||||
for (StackTraceElement stack : stackTrace) {
|
||||
x++;
|
||||
errorStack.append(stack.toString().replaceAll("<", ">")).append("<br/>");
|
||||
if (x > 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("[-requestError-][请求接口:{}]【异常信息:{}】[请求参数:{}] {}", url, errorMsg, params, errorStack.append("】").toString());
|
||||
throw ex;
|
||||
} finally {
|
||||
log.info("[--response--][请求接口:{} 执行结束][耗时:{}s]", url, (System.currentTimeMillis() - comming) / 1000);
|
||||
MDC.clear();
|
||||
LuceneAppender.traceIdTL.remove();
|
||||
MDC.clear();
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,8 +73,6 @@ public class StructattrController {
|
||||
}
|
||||
|
||||
@PostMapping("/getStructByCodes")
|
||||
@Log("获取仓位信息")
|
||||
|
||||
public ResponseEntity<Object> getStructByCodes(@RequestBody String json) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(json);
|
||||
return new ResponseEntity<>(structattrService.getStructByCodes(jsonArray), HttpStatus.OK);
|
||||
|
||||
@@ -160,3 +160,6 @@ sa-token:
|
||||
cookie:
|
||||
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
|
||||
domain:
|
||||
lucene:
|
||||
index:
|
||||
path: D:\log\lms\lucene\index
|
||||
|
||||
@@ -97,7 +97,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="debug">
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
|
||||
Reference in New Issue
Block a user