add: 添加操作日志,添加PDF加载系统
This commit is contained in:
33
get_picture/.gitignore
vendored
Normal file
33
get_picture/.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
19
get_picture/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
19
get_picture/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
wrapperVersion=3.3.2
|
||||||
|
distributionType=only-script
|
||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
|
||||||
66
get_picture/pom.xml
Normal file
66
get_picture/pom.xml
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.2.10.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
<groupId>com.nuoli</groupId>
|
||||||
|
<artifactId>PDF</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>PDF</name>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<hutool.version>5.7.14</hutool.version>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--工具包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>fontbox</artifactId>
|
||||||
|
<version>2.0.9</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>pdfbox</artifactId>
|
||||||
|
<version>2.0.9</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.nuoli.PDF;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author admin
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
public class GetPictureApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(GetPictureApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
package com.yan.yan_first.config.handler;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 全局异常类
|
||||||
|
*
|
||||||
|
* @author LENOVO
|
||||||
|
*//*
|
||||||
|
|
||||||
|
@RestControllerAdvice
|
||||||
|
public class HandlerException {
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public void handleException(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package com.nuoli.PDF.system.controller.secutiry;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import sun.misc.BASE64Encoder;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录
|
||||||
|
*
|
||||||
|
* @author LENOVO
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/file")
|
||||||
|
public class AuthorizationController {
|
||||||
|
|
||||||
|
@Value("${material.path}")
|
||||||
|
public String materialPath;
|
||||||
|
|
||||||
|
@Value("${vehicle.path}")
|
||||||
|
public String vehiclePath;
|
||||||
|
|
||||||
|
@Value("${vehicle.post}")
|
||||||
|
public String vehicleFilePost;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("selectPath")
|
||||||
|
public List<Map<String, String>> selectPath(@RequestBody JSONArray json) throws IOException {
|
||||||
|
File file = new File(materialPath);
|
||||||
|
if (file.exists()) {
|
||||||
|
return selectMaterialPath(file, json);
|
||||||
|
} else {
|
||||||
|
System.out.println("文件不存在");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("selectFile")
|
||||||
|
public String selectFile(@RequestBody JSONObject json) {
|
||||||
|
byte[] bytes = pdf2png(json.getStr("path"), "png");
|
||||||
|
if (ObjectUtil.isNotEmpty(bytes)) {
|
||||||
|
BASE64Encoder encoder = new BASE64Encoder();
|
||||||
|
return "data:image/png;base64," + encoder.encode(bytes).replace("\r\n", "");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, String>> selectMaterialPath(File directory, JSONArray materials) throws UnknownHostException {
|
||||||
|
if (directory == null || !directory.exists() || !directory.isDirectory()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Queue<File> queue = new LinkedList<>();
|
||||||
|
queue.add(directory);
|
||||||
|
|
||||||
|
List<Map<String, String>> maps = new ArrayList<>();
|
||||||
|
Set<String> materialSet = new HashSet<>(materials.toList(String.class));
|
||||||
|
|
||||||
|
// 如果 materialSet 为空,直接返回空的 maps 列表
|
||||||
|
if (materialSet.isEmpty()) {
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
while (!queue.isEmpty()) {
|
||||||
|
File currentDir = queue.poll();
|
||||||
|
File[] files = currentDir.listFiles();
|
||||||
|
if (files == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (File file : files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
queue.add(file);
|
||||||
|
} else if (file.isFile() && file.getName().endsWith(".pdf")) {
|
||||||
|
String material = file.getName().substring(0, file.getName().lastIndexOf('.'));
|
||||||
|
if (materialSet.contains(material)) {
|
||||||
|
pdf2png(file.getPath(), vehiclePath, material);
|
||||||
|
InetAddress localhost = InetAddress.getLocalHost();
|
||||||
|
String url = "http://" + localhost.getHostAddress() + ":" + vehicleFilePost + "/" + material + ".jpg";
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("name", material);
|
||||||
|
map.put("value", url);
|
||||||
|
maps.add(map);
|
||||||
|
materialSet.remove(material);
|
||||||
|
if (materialSet.isEmpty()) {
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用pdfbox将整个pdf转换成图片
|
||||||
|
*
|
||||||
|
* @param fileAddress 文件地址 如:C:\\Users\\user\\Desktop\\test
|
||||||
|
* @param type 图片类型 png 和jpg
|
||||||
|
*/
|
||||||
|
public byte[] pdf2png(String fileAddress, String type) {
|
||||||
|
File file = new File(fileAddress);
|
||||||
|
try (PDDocument doc = PDDocument.load(file)) {
|
||||||
|
PDFRenderer renderer = new PDFRenderer(doc);
|
||||||
|
int pageCount = doc.getNumberOfPages();
|
||||||
|
for (int i = 0; i < pageCount; i++) {
|
||||||
|
// dpi为144,越高越清晰,转换越慢
|
||||||
|
BufferedImage image = renderer.renderImageWithDPI(i, 144);
|
||||||
|
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||||
|
ImageIO.write(image, type, bos);
|
||||||
|
return bos.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pdf2png(String fileAddress, String lastAddress, String materialName) {
|
||||||
|
File file = new File(fileAddress);
|
||||||
|
try (PDDocument doc = PDDocument.load(file)) {
|
||||||
|
PDFRenderer renderer = new PDFRenderer(doc);
|
||||||
|
int pageCount = doc.getNumberOfPages();
|
||||||
|
for (int i = 0; i < pageCount; i++) {
|
||||||
|
BufferedImage image = renderer.renderImageWithDPI(i, 144);
|
||||||
|
String lastPath = lastAddress + "\\" + materialName + ".jpg";
|
||||||
|
File lastFile = new File(lastPath);
|
||||||
|
if(!lastFile.exists()){
|
||||||
|
lastFile.createNewFile();
|
||||||
|
}
|
||||||
|
ImageIO.write(image, "jpg", lastFile);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void imageToByteAndWriteToFile() throws IOException {
|
||||||
|
String imageUrl = "http://10.192.37.10:3000/uploads/sortedpallets/N329650_P26.png";
|
||||||
|
String outputFilePath = "D:\\software\\nginx-1.24.0\\N329650_P26.png";
|
||||||
|
|
||||||
|
URL url = new URL(imageUrl);
|
||||||
|
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
|
||||||
|
httpURLConnection.setRequestMethod("GET");
|
||||||
|
|
||||||
|
try (InputStream inputStream = httpURLConnection.getInputStream();
|
||||||
|
FileOutputStream fileOutputStream = new FileOutputStream(outputFilePath)) {
|
||||||
|
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
fileOutputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
httpURLConnection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.nuoli.PDF.system.service.secutiry;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录实现类
|
||||||
|
* @author LENOVO
|
||||||
|
*/
|
||||||
|
public interface AuthorizationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录
|
||||||
|
* @param json
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONObject login(JSONObject json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.nuoli.PDF.system.service.secutiry.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.nuoli.PDF.system.service.secutiry.AuthorizationService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录实现类
|
||||||
|
*
|
||||||
|
* @author LENOVO
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AuthorizationServiceImpl implements AuthorizationService {
|
||||||
|
|
||||||
|
private static final String errString = "登录失败";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject login(JSONObject json) {
|
||||||
|
boolean allNotEmpty = ObjectUtil.isAllNotEmpty(json.getStr("username"), json.getStr("password"));
|
||||||
|
if (allNotEmpty) throw new RuntimeException(errString);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
get_picture/src/main/resources/application.yml
Normal file
9
get_picture/src/main/resources/application.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
server:
|
||||||
|
port: 8083
|
||||||
|
|
||||||
|
material:
|
||||||
|
path: \\cnsha08447\SSLSDATA\07_Technology\Formal_Drawing\PDF
|
||||||
|
|
||||||
|
vehicle:
|
||||||
|
path: D:\software\images
|
||||||
|
post: 8088
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.nuoli.PDF;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class YanFirstApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,4 +28,28 @@ import java.lang.annotation.Target;
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Log {
|
public @interface Log {
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否打印到日志文件
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isPrintToLogFile() default false;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否插入操作日志表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isAddLogTable() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否接口日志
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isInterfaceLog() default false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,14 @@
|
|||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*//*
|
*/
|
||||||
|
|
||||||
package org.nl.common.logging.aspect;
|
package org.nl.common.logging.aspect;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
@@ -31,6 +33,10 @@ import org.nl.common.utils.SecurityUtils;
|
|||||||
import org.nl.common.utils.StringUtils;
|
import org.nl.common.utils.StringUtils;
|
||||||
import org.nl.common.utils.ThrowableUtil;
|
import org.nl.common.utils.ThrowableUtil;
|
||||||
import org.nl.common.logging.domain.Log;
|
import org.nl.common.logging.domain.Log;
|
||||||
|
import org.nl.config.IdUtil;
|
||||||
|
import org.nl.system.service.logging.ISysLogService;
|
||||||
|
import org.nl.system.service.logging.dao.SysLog;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -41,79 +47,67 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Parameter;
|
import java.lang.reflect.Parameter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @author Zheng Jie
|
|
||||||
* @date 2018-11-24
|
|
||||||
*//*
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Aspect
|
@Aspect
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LogAspect {
|
public class LogOperate {
|
||||||
|
|
||||||
private final LogService logService;
|
@Autowired
|
||||||
|
private ISysLogService logService;
|
||||||
|
|
||||||
ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
||||||
|
|
||||||
public LogAspect(LogService logService) {
|
public LogOperate(ISysLogService logService) {
|
||||||
this.logService = logService;
|
this.logService = logService;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 配置切入点
|
|
||||||
*//*
|
|
||||||
|
|
||||||
@Pointcut("@annotation(org.nl.common.logging.annotation.Log)")
|
@Pointcut("@annotation(org.nl.common.logging.annotation.Log)")
|
||||||
public void logPointcut() {
|
public void logPointcut() {
|
||||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
|
||||||
*
|
|
||||||
* @param joinPoint join point for advice
|
|
||||||
*//*
|
|
||||||
|
|
||||||
@Around("logPointcut()")
|
@Around("logPointcut()")
|
||||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
String trackId = UUID.randomUUID().toString();
|
||||||
HttpServletRequest request = attributes.getRequest();
|
|
||||||
HttpServletResponse response = attributes.getResponse();
|
|
||||||
// HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
|
||||||
|
|
||||||
|
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
// 方法路径
|
// 方法路径
|
||||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||||
String params = getParameter(method, joinPoint.getArgs());
|
String params = getParameter(method, joinPoint.getArgs());
|
||||||
|
|
||||||
log.info("请求uri:{}", request.getRequestURI());
|
org.nl.common.logging.annotation.Log logInfo = method.getAnnotation(org.nl.common.logging.annotation.Log.class);
|
||||||
log.info("请求方法:{}",methodName);
|
|
||||||
log.info("请求方法参数:{}",params);
|
|
||||||
|
|
||||||
|
//是否输出到日志文件
|
||||||
|
if (logInfo.isPrintToLogFile()) {
|
||||||
|
log.info("track_id:{},请求方法:{},请求方法参数:{}", trackId, methodName, params);
|
||||||
|
}
|
||||||
|
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||||
|
String requestIp = StringUtils.getIp(request);
|
||||||
Object result;
|
Object result;
|
||||||
currentTime.set(System.currentTimeMillis());
|
long startTime = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
result = joinPoint.proceed();
|
result = joinPoint.proceed();
|
||||||
Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
|
//是否把日志存到日志表
|
||||||
currentTime.remove();
|
if (logInfo.isAddLogTable()) {
|
||||||
|
SysLog log = new SysLog("INFO", System.currentTimeMillis() - startTime);
|
||||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log);
|
logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("track_id:{},error:{}", trackId, ex.getMessage());
|
||||||
|
SysLog log = new SysLog("ERROR", System.currentTimeMillis() - startTime);
|
||||||
|
log.setException_detail(ThrowableUtil.getStackTrace(ex).getBytes());
|
||||||
|
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 根据方法和传入的参数获取请求参数
|
|
||||||
*//*
|
|
||||||
|
|
||||||
private String getParameter(Method method, Object[] args) {
|
private String getParameter(Method method, Object[] args) {
|
||||||
List<Object> argList = new ArrayList<>();
|
List<Object> argList = new ArrayList<>();
|
||||||
@@ -142,29 +136,13 @@ public class LogAspect {
|
|||||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 配置异常通知
|
|
||||||
*
|
|
||||||
* @param joinPoint join point for advice
|
|
||||||
* @param e exception
|
|
||||||
*//*
|
|
||||||
|
|
||||||
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
|
||||||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
|
||||||
Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
|
|
||||||
currentTime.remove();
|
|
||||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
|
||||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
|
||||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
try {
|
try {
|
||||||
return SecurityUtils.getCurrentUsername();
|
return SecurityUtils.getCurrentNickName();
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
@@ -2,8 +2,10 @@ package org.nl.system.service.logging;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.system.service.logging.dao.SysLog;
|
import org.nl.system.service.logging.dao.SysLog;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -25,6 +27,9 @@ public interface ISysLogService extends IService<SysLog> {
|
|||||||
*/
|
*/
|
||||||
IPage<SysLog> queryAll(Map criteria, PageQuery pageable);
|
IPage<SysLog> queryAll(Map criteria, PageQuery pageable);
|
||||||
|
|
||||||
|
@Async
|
||||||
|
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog log);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询异常详情
|
* 查询异常详情
|
||||||
* @param id 日志ID
|
* @param id 日志ID
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -18,6 +21,8 @@ import lombok.EqualsAndHashCode;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@TableName("sys_log")
|
@TableName("sys_log")
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class SysLog implements Serializable {
|
public class SysLog implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -52,4 +57,8 @@ public class SysLog implements Serializable {
|
|||||||
private String create_time;
|
private String create_time;
|
||||||
|
|
||||||
|
|
||||||
|
public SysLog(String logType, Long time) {
|
||||||
|
this.log_type = logType;
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,35 @@
|
|||||||
package org.nl.system.service.logging.impl;
|
package org.nl.system.service.logging.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.Dict;
|
import cn.hutool.core.lang.Dict;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
import org.nl.common.logging.annotation.Log;
|
||||||
|
import org.nl.common.utils.StringUtils;
|
||||||
import org.nl.common.utils.ValidationUtil;
|
import org.nl.common.utils.ValidationUtil;
|
||||||
import org.nl.system.service.logging.ISysLogService;
|
import org.nl.system.service.logging.ISysLogService;
|
||||||
import org.nl.system.service.logging.dao.SysLog;
|
import org.nl.system.service.logging.dao.SysLog;
|
||||||
import org.nl.system.service.logging.dao.mapper.SysLogMapper;
|
import org.nl.system.service.logging.dao.mapper.SysLogMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Parameter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,12 +51,10 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
|||||||
public IPage<SysLog> queryAll(Map whereJson, PageQuery pageable) {
|
public IPage<SysLog> queryAll(Map whereJson, PageQuery pageable) {
|
||||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry"))?whereJson.get("blurry").toString():null;
|
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry"))?whereJson.get("blurry").toString():null;
|
||||||
String log_type = ObjectUtil.isNotEmpty(whereJson.get("log_type"))?whereJson.get("log_type").toString():null;
|
String log_type = ObjectUtil.isNotEmpty(whereJson.get("log_type"))?whereJson.get("log_type").toString():null;
|
||||||
String username = ObjectUtil.isNotEmpty(whereJson.get("username"))?whereJson.get("username").toString():null;
|
|
||||||
String begin_time = ObjectUtil.isNotEmpty(whereJson.get("begin_time"))?whereJson.get("begin_time").toString():null;
|
String begin_time = ObjectUtil.isNotEmpty(whereJson.get("begin_time"))?whereJson.get("begin_time").toString():null;
|
||||||
String end_time = ObjectUtil.isNotEmpty(whereJson.get("end_time"))?whereJson.get("end_time").toString():null;
|
String end_time = ObjectUtil.isNotEmpty(whereJson.get("end_time"))?whereJson.get("end_time").toString():null;
|
||||||
LambdaQueryWrapper<SysLog> lam = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysLog> lam = new LambdaQueryWrapper<>();
|
||||||
lam.eq(ObjectUtil.isNotEmpty(log_type), SysLog::getLog_type, log_type)
|
lam.eq(ObjectUtil.isNotEmpty(log_type), SysLog::getLog_type, log_type)
|
||||||
.eq(ObjectUtil.isNotEmpty(username), SysLog::getUsername, username)
|
|
||||||
.like(ObjectUtil.isNotEmpty(blurry), SysLog::getDescription, blurry)
|
.like(ObjectUtil.isNotEmpty(blurry), SysLog::getDescription, blurry)
|
||||||
.le(ObjectUtil.isNotEmpty(end_time), SysLog::getCreate_time, end_time)
|
.le(ObjectUtil.isNotEmpty(end_time), SysLog::getCreate_time, end_time)
|
||||||
.ge(ObjectUtil.isNotEmpty(begin_time), SysLog::getCreate_time, begin_time)
|
.ge(ObjectUtil.isNotEmpty(begin_time), SysLog::getCreate_time, begin_time)
|
||||||
@@ -51,6 +64,60 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog logDto) {
|
||||||
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
|
Method method = signature.getMethod();
|
||||||
|
Log aopLog = method.getAnnotation(Log.class);
|
||||||
|
|
||||||
|
// 方法路径
|
||||||
|
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||||
|
|
||||||
|
// 描述
|
||||||
|
if (logDto != null) {
|
||||||
|
logDto.setDescription(aopLog.value());
|
||||||
|
}
|
||||||
|
assert logDto != null;
|
||||||
|
logDto.setRequest_ip(ip);
|
||||||
|
logDto.setLog_id(RandomUtil.randomString(5));
|
||||||
|
logDto.setAddress(StringUtils.getCityInfo(logDto.getRequest_ip()));
|
||||||
|
logDto.setMethod(methodName);
|
||||||
|
logDto.setUsername(username);
|
||||||
|
logDto.setParams(getParameter(method, joinPoint.getArgs()));
|
||||||
|
logDto.setBrowser(browser);
|
||||||
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
|
String dateString = DateUtil.date(currentTimeMillis).toString();
|
||||||
|
logDto.setCreate_time(dateString);
|
||||||
|
logMapper.insert(logDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getParameter(Method method, Object[] args) {
|
||||||
|
List<Object> argList = new ArrayList<>();
|
||||||
|
Parameter[] parameters = method.getParameters();
|
||||||
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
|
//将RequestBody注解修饰的参数作为请求参数
|
||||||
|
RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class);
|
||||||
|
if (requestBody != null) {
|
||||||
|
argList.add(args[i]);
|
||||||
|
}
|
||||||
|
//将RequestParam注解修饰的参数作为请求参数
|
||||||
|
RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class);
|
||||||
|
if (requestParam != null) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
String key = parameters[i].getName();
|
||||||
|
if (!StrUtil.isEmpty(requestParam.value())) {
|
||||||
|
key = requestParam.value();
|
||||||
|
}
|
||||||
|
map.put(key, args[i]);
|
||||||
|
argList.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (argList.size() == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object findByErrDetail(String id) {
|
public Object findByErrDetail(String id) {
|
||||||
SysLog sysLog = logMapper.selectById(id);
|
SysLog sysLog = logMapper.selectById(id);
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ public class FabServiceImpl {
|
|||||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_code")}, "参数不能为空!");
|
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_code")}, "参数不能为空!");
|
||||||
CallMaterVo callMaterVo = form.toJavaObject(CallMaterVo.class);
|
CallMaterVo callMaterVo = form.toJavaObject(CallMaterVo.class);
|
||||||
SchBasePoint schBasePoint2 = iSchBasePointService.selectByPointCode(callMaterVo.getDevice_code());
|
SchBasePoint schBasePoint2 = iSchBasePointService.selectByPointCode(callMaterVo.getDevice_code());
|
||||||
if (schBasePoint2.getPoint_status().equals(GoodsEnum.IN_STOCK.getValue())) {
|
/*if (schBasePoint2.getPoint_status().equals(GoodsEnum.IN_STOCK.getValue()) || StrUtil.isNotEmpty(schBasePoint2.getVehicle_code())) {
|
||||||
throw new BadRequestException("该点位已存在物料!");
|
throw new BadRequestException("该点位已存在物料!");
|
||||||
}
|
}*/
|
||||||
param.put("device_code", callMaterVo.getDevice_code());
|
param.put("device_code", callMaterVo.getDevice_code());
|
||||||
param.put("config_code", "PcOperationCMTask");
|
param.put("config_code", "PcOperationCMTask");
|
||||||
param.put("region_code", callMaterVo.getRegion_code());
|
param.put("region_code", callMaterVo.getRegion_code());
|
||||||
@@ -155,7 +155,6 @@ public class FabServiceImpl {
|
|||||||
pcOperationSNTTask.apply(param);
|
pcOperationSNTTask.apply(param);
|
||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, sendVehicleVo.getDevice_code())
|
.eq(SchBasePoint::getPoint_code, sendVehicleVo.getDevice_code())
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
|
||||||
.set(SchBasePoint::getIs_lock, true));
|
.set(SchBasePoint::getIs_lock, true));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
.eq(SchBasePoint::getVehicle_code, param.getString("vehicle_code"))
|
.eq(SchBasePoint::getVehicle_code, param.getString("vehicle_code"))
|
||||||
.ne(SchBasePoint::getPoint_code, param.getString("device_code")));
|
.ne(SchBasePoint::getPoint_code, param.getString("device_code")));
|
||||||
Assert.isNull(one, "载具号已存在别的点位,请确认再下发");
|
Assert.isNull(one, "载具号已存在别的点位,请确认再下发");
|
||||||
String region_code = param.getString("region_code");
|
String region_code = param.getString("regionCode");
|
||||||
String device_code = param.getString("device_code");
|
String device_code = param.getString("device_code");
|
||||||
String vehicle_code = param.getString("vehicle_code");
|
String vehicle_code = param.getString("vehicle_code");
|
||||||
String type = param.getString("type");
|
String type = param.getString("type");
|
||||||
@@ -303,6 +303,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
*/
|
*/
|
||||||
private void goShelves(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) {
|
private void goShelves(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) {
|
||||||
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
|
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
|
||||||
|
Assert.notNull(region_code,"下道区域不能为空!");
|
||||||
JSONArray materials = param.getJSONArray("material");
|
JSONArray materials = param.getJSONArray("material");
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
//冲床人工入库使用
|
//冲床人工入库使用
|
||||||
@@ -315,7 +316,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
connectorTask.apply(jo);
|
connectorTask.apply(jo);
|
||||||
} else {
|
} else {
|
||||||
if (StrUtil.isBlank(region_code)) {
|
if (StrUtil.isBlank(region_code)) {
|
||||||
JSONObject json = new JSONObject();
|
/*JSONObject json = new JSONObject();
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
materials.forEach(material2 -> {
|
materials.forEach(material2 -> {
|
||||||
boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code"));
|
boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code"));
|
||||||
@@ -329,7 +330,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
jsonArray.add(map);
|
jsonArray.add(map);
|
||||||
});
|
});
|
||||||
json.put("vehicle_code", vehicle_code);
|
json.put("vehicle_code", vehicle_code);
|
||||||
json.put("region_code", schBasePoint.getRegion_code());
|
json.put("region_code", StrUtil.isNotEmpty(param.getString("regionCode")) ? param.getString("regionCode") : schBasePoint.getRegion_code());
|
||||||
json.put("materials", jsonArray);
|
json.put("materials", jsonArray);
|
||||||
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json);
|
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json);
|
||||||
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == HttpStatus.OK.value()) {
|
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == HttpStatus.OK.value()) {
|
||||||
@@ -353,7 +354,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
jo.put("region_code", region_code);
|
jo.put("region_code", region_code);
|
||||||
} else if (ObjectUtil.isNotEmpty(json1)) {
|
} else if (ObjectUtil.isNotEmpty(json1)) {
|
||||||
throw new BadRequestException(json1.getString("msg"));
|
throw new BadRequestException(json1.getString("msg"));
|
||||||
}
|
}*/
|
||||||
} else {
|
} else {
|
||||||
jo.put("region_code", region_code);
|
jo.put("region_code", region_code);
|
||||||
}
|
}
|
||||||
@@ -388,9 +389,9 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||||
jo.put("vehicle_code", vehicle_code);
|
jo.put("vehicle_code", vehicle_code);
|
||||||
jo.put("region_code", region_code);
|
jo.put("region_code", region_code);
|
||||||
jo.put("ext_data", param);
|
|
||||||
param.put("region_code", region_code);
|
param.put("region_code", region_code);
|
||||||
param.put("target_region_code", region_code);
|
param.put("target_region_code", region_code);
|
||||||
|
jo.put("ext_data", param);
|
||||||
connectorTask.apply(jo);
|
connectorTask.apply(jo);
|
||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, device_code)
|
.eq(SchBasePoint::getPoint_code, device_code)
|
||||||
@@ -413,8 +414,9 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
if (param.getJSONArray("pointCodes").size() > 0) {
|
if (param.getJSONArray("pointCodes").size() > 0) {
|
||||||
param.getJSONArray("pointCodes").forEach(pointCode -> {
|
param.getJSONArray("pointCodes").forEach(pointCode -> {
|
||||||
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(pointCode);
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(pointCode);
|
||||||
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(jsonObject.getStr("point_code"));
|
||||||
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, jsonObject.get("vehicle_code")));
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, schBasePoint.getVehicle_code()));
|
||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, jsonObject.get("point_code"))
|
.eq(SchBasePoint::getPoint_code, jsonObject.get("point_code"))
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
ROW_NUMBER() OVER (PARTITION BY vg.vehicle_code ORDER BY vg.due_date) AS rn
|
ROW_NUMBER() OVER (PARTITION BY vg.vehicle_code ORDER BY vg.due_date) AS rn
|
||||||
FROM
|
FROM
|
||||||
sch_base_vehiclematerialgroup vg
|
sch_base_vehiclematerialgroup vg
|
||||||
where vg.is_delete = 0
|
where 0 = 0
|
||||||
<if test="query.vehicle_code != null">
|
<if test="query.vehicle_code != null">
|
||||||
AND vg.vehicle_code like CONCAT('%', #{query.vehicle_code}, '%')
|
AND vg.vehicle_code like CONCAT('%', #{query.vehicle_code}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<if test="query.material_id != null">
|
<if test="query.material_id != null">
|
||||||
AND vg.material_id like CONCAT('%', #{query.material_id}, '%')
|
AND vg.material_id like CONCAT('%', #{query.material_id}, '%')
|
||||||
</if>
|
</if>
|
||||||
order by vg.region_code desc
|
order by vg.create_time desc
|
||||||
)
|
)
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM RankedVehicles
|
FROM RankedVehicles
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
|||||||
item.setBetween(daysBetween + "");
|
item.setBetween(daysBetween + "");
|
||||||
item.setHas_work(true);
|
item.setHas_work(true);
|
||||||
});
|
});
|
||||||
schBaseVehiclematerialgroupIPage.getRecords().sort(Comparator.comparingLong(group -> Long.parseLong(group.getBetween())));
|
|
||||||
return schBaseVehiclematerialgroupIPage;
|
return schBaseVehiclematerialgroupIPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package org.nl.wms.sch.task.controller;
|
package org.nl.wms.sch.task.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -18,10 +16,8 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import sun.security.krb5.internal.PAData;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
/**
|
/**
|
||||||
@@ -99,4 +95,11 @@ public class SchBaseTaskController {
|
|||||||
schBaseTaskService.downTask(schBaseTaskService.queryAll(whereJson),response);
|
schBaseTaskService.downTask(schBaseTaskService.queryAll(whereJson),response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/selectCacheTask")
|
||||||
|
@Log("查询缓存任务")
|
||||||
|
@ApiOperation("查询缓存任务")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<JSONObject> selectCacheTask(@RequestBody JSONObject jsonObject) {
|
||||||
|
return new ResponseEntity<>(schBaseTaskService.selectCacheTask(jsonObject),HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,4 +141,11 @@ public interface ISchBaseTaskService extends IService<SchBaseTask> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SchBaseTask> selectNoFinishTaskByPointCode(String taskCode,String pointCode);
|
List<SchBaseTask> selectNoFinishTaskByPointCode(String taskCode,String pointCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据点位查询缓存的任务
|
||||||
|
* @param jsonObject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONObject selectCacheTask(JSONObject jsonObject);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
|
|||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||||
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||||
import org.nl.wms.sch.task.service.dao.mapper.SchBaseTaskMapper;
|
import org.nl.wms.sch.task.service.dao.mapper.SchBaseTaskMapper;
|
||||||
@@ -59,6 +61,8 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
private SchBaseTaskMapper schBaseTaskMapper;
|
private SchBaseTaskMapper schBaseTaskMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SchBaseTaskconfigMapper schBaseTaskconfigMapper;
|
private SchBaseTaskconfigMapper schBaseTaskconfigMapper;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupServiceImpl;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskFactory taskFactory;
|
private TaskFactory taskFactory;
|
||||||
@@ -402,6 +406,31 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
.eq(SchBaseTask::getPoint_code2, pointCode));
|
.eq(SchBaseTask::getPoint_code2, pointCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject selectCacheTask(JSONObject jsonObject) {
|
||||||
|
Assert.notNull(jsonObject.getString("deviceCode"), "点位参数不能为空!");
|
||||||
|
List<SchBaseTask> schBaseTasks = schBaseTaskMapper.selectList(Wrappers.lambdaQuery(SchBaseTask.class)
|
||||||
|
.eq(SchBaseTask::getPoint_code2, jsonObject.getString("deviceCode"))
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatus.CREATED.getCode()));
|
||||||
|
if(CollUtil.isNotEmpty(schBaseTasks)){
|
||||||
|
String vehicle_code = schBaseTasks.get(0).getVehicle_code();
|
||||||
|
List<SchBaseVehiclematerialgroup> list = schBaseVehiclematerialgroupServiceImpl.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||||
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
||||||
|
JSONObject jsonObject2 = new JSONObject();
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
for (SchBaseVehiclematerialgroup schBaseVehiclematerialgroup : list) {
|
||||||
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
|
jsonObject1.put("order_code", schBaseVehiclematerialgroup.getOrder_code());
|
||||||
|
jsonObject1.put("material_id", schBaseVehiclematerialgroup.getMaterial_id());
|
||||||
|
jsonArray.add(jsonObject1);
|
||||||
|
}
|
||||||
|
jsonObject2.put("vehicleCode", vehicle_code);
|
||||||
|
jsonObject2.put("materialList", jsonArray);
|
||||||
|
return jsonObject2;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static byte[] writeExcelAfterToBytes(String[] headers, ArrayList<List> cellList) {
|
public static byte[] writeExcelAfterToBytes(String[] headers, ArrayList<List> cellList) {
|
||||||
ExcelWriter writer = null;
|
ExcelWriter writer = null;
|
||||||
ByteArrayOutputStream outputStream = null;
|
ByteArrayOutputStream outputStream = null;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.nl.wms.sch.task_manage.enums.TaskDirectionEnum;
|
|||||||
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
|
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
|
||||||
import org.nl.wms.sch.task_manage.task.AcsUtil;
|
import org.nl.wms.sch.task_manage.task.AcsUtil;
|
||||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
|
import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationCMTask;
|
||||||
import org.nl.wms.util.TaskUtils;
|
import org.nl.wms.util.TaskUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -92,6 +93,9 @@ public abstract class AbstractTask {
|
|||||||
//2、根据任务配置补全任务
|
//2、根据任务配置补全任务
|
||||||
//3、下发
|
//3、下发
|
||||||
for (SchBaseTask task : taskList) {
|
for (SchBaseTask task : taskList) {
|
||||||
|
if("PcOperationCMTask".equals(task.getConfig_code())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
List<AcsTaskDto> list = new ArrayList<>();
|
List<AcsTaskDto> list = new ArrayList<>();
|
||||||
AcsTaskDto taskDto = new AcsTaskDto();
|
AcsTaskDto taskDto = new AcsTaskDto();
|
||||||
taskDto.setTask_id(task.getTask_id());
|
taskDto.setTask_id(task.getTask_id());
|
||||||
@@ -120,7 +124,7 @@ public abstract class AbstractTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AcsTaskDto setTask(String config_code, AcsTaskDto taskDto, SchBaseTask task) {
|
protected AcsTaskDto setTask(String config_code, AcsTaskDto taskDto, SchBaseTask task) {
|
||||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||||
.eq(SchBaseTaskconfig::getConfig_code, config_code));
|
.eq(SchBaseTaskconfig::getConfig_code, config_code));
|
||||||
taskDto.setPriority(StrUtil.isNotEmpty(task.getAcs_trace_id()) ? task.getAcs_trace_id() : taskConfig.getPriority());
|
taskDto.setPriority(StrUtil.isNotEmpty(task.getAcs_trace_id()) ? task.getAcs_trace_id() : taskConfig.getPriority());
|
||||||
@@ -233,7 +237,7 @@ public abstract class AbstractTask {
|
|||||||
// 校验同个点位,同种任务是否多次请求创建任务(固定只能1个任务)
|
// 校验同个点位,同种任务是否多次请求创建任务(固定只能1个任务)
|
||||||
List<SchBaseTask> applyPointTask = taskService.findUnFinishTasksByTaskConfig(
|
List<SchBaseTask> applyPointTask = taskService.findUnFinishTasksByTaskConfig(
|
||||||
taskConfig.getConfig_code(), apply_point_code, taskConfig.getTask_direction());
|
taskConfig.getConfig_code(), apply_point_code, taskConfig.getTask_direction());
|
||||||
if (applyPointTask.size() == 1) {
|
if (!"PcOperationCMTask".equals(config_code) && applyPointTask.size() == 1) {
|
||||||
throw new BadRequestException("已创建相同点位任务,不可重复创建!");
|
throw new BadRequestException("已创建相同点位任务,不可重复创建!");
|
||||||
}
|
}
|
||||||
// 获取对接位点位对象
|
// 获取对接位点位对象
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class BlankingTask extends AbstractTask {
|
|||||||
schBaseVehiclematerialgroup.setDue_date(jsonObject.getStr("due_date"));
|
schBaseVehiclematerialgroup.setDue_date(jsonObject.getStr("due_date"));
|
||||||
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
schBaseVehiclematerialgroup.setPriority(jsonObject.getStr("priority"));
|
schBaseVehiclematerialgroup.setPriority(jsonObject.getStr("priority"));
|
||||||
schBaseVehiclematerialgroup.setRegion_code(StrUtil.isBlank(finalRegion_code) ? jsonObject.getStr("region_code") : finalRegion_code);
|
schBaseVehiclematerialgroup.setRegion_code(StrUtil.isBlank(finalRegion_code) ? taskObj.getRegion_code() : finalRegion_code);
|
||||||
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||||
});
|
});
|
||||||
// 任务完成
|
// 任务完成
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -21,16 +22,21 @@ import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
|||||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||||
|
import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.task.AcsUtil;
|
||||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
import org.nl.wms.util.PointUtils;
|
import org.nl.wms.util.PointUtils;
|
||||||
import org.nl.wms.util.TaskUtils;
|
import org.nl.wms.util.TaskUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sorting呼叫满料
|
* sorting呼叫满料
|
||||||
@@ -86,6 +92,58 @@ public class PcOperationCMTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renotifyAcs(List<SchBaseTask> taskList) {
|
||||||
|
taskList = taskList.stream().filter(task -> task.getConfig_code().equals(TASK_CONFIG_CODE)).collect(Collectors.toList());
|
||||||
|
for (SchBaseTask schBaseTask : taskList) {
|
||||||
|
List<SchBaseTask> schBaseTasks = taskService.list(Wrappers.lambdaQuery(SchBaseTask.class)
|
||||||
|
.eq(SchBaseTask::getConfig_code, TASK_CONFIG_CODE)
|
||||||
|
.gt(SchBaseTask::getTask_status, TaskStatus.CREATED.getCode())
|
||||||
|
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
|
||||||
|
.ne(SchBaseTask::getPoint_code1,schBaseTask.getPoint_code1())
|
||||||
|
.eq(SchBaseTask::getPoint_code2,schBaseTask.getPoint_code2())
|
||||||
|
);
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(schBaseTask.getPoint_code2());
|
||||||
|
if(ObjectUtil.isEmpty(schBasePoint)){
|
||||||
|
log.info("{}点位不存在!!!",schBasePoint.getPoint_code());
|
||||||
|
throw new BadRequestException("点位不存在!");
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(schBaseTasks) || schBasePoint.getPoint_status().equals(GoodsEnum.IN_STOCK.getValue())){
|
||||||
|
log.info("{}点位被占用!!!",schBasePoint.getPoint_code());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
issuedAcsTask(schBaseTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void issuedAcsTask(SchBaseTask schBaseTask) {
|
||||||
|
List<AcsTaskDto> list = new ArrayList<>();
|
||||||
|
AcsTaskDto taskDto = new AcsTaskDto();
|
||||||
|
taskDto.setTask_id(schBaseTask.getTask_id());
|
||||||
|
taskDto.setTask_code(schBaseTask.getTask_code());
|
||||||
|
|
||||||
|
taskDto.setRoute_plan_code("normal");
|
||||||
|
taskDto.setStart_device_code(schBaseTask.getPoint_code1());
|
||||||
|
//如果存在等待点,任务下发目标点给等待点
|
||||||
|
if (ObjectUtil.isEmpty(schBaseTask.getPoint_code2())) {
|
||||||
|
taskDto.setNext_device_code(schBaseTask.getNext_wait_point());
|
||||||
|
} else {
|
||||||
|
taskDto.setNext_device_code(schBaseTask.getPoint_code2());
|
||||||
|
}
|
||||||
|
taskDto.setVehicle_code(schBaseTask.getVehicle_code());
|
||||||
|
setTask(schBaseTask.getConfig_code(), taskDto, schBaseTask);
|
||||||
|
list.add(taskDto);
|
||||||
|
JSONObject result = AcsUtil.notifyAcs("api/wms/task", list);
|
||||||
|
if (HttpStatus.OK.value() == result.getInteger("status")) {
|
||||||
|
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode());
|
||||||
|
schBaseTask.setRemark(" ");
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
} else if (HttpStatus.BAD_REQUEST.value() == result.getInteger("status")) {
|
||||||
|
schBaseTask.setRemark(result.getString("message"));
|
||||||
|
taskService.update(schBaseTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateStatus(String task_code, TaskStatus status) {
|
protected void updateStatus(String task_code, TaskStatus status) {
|
||||||
//TODO:完成任务的时候将int_task_code的清除
|
//TODO:完成任务的时候将int_task_code的清除
|
||||||
@@ -170,4 +228,7 @@ public class PcOperationCMTask extends AbstractTask {
|
|||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,8 +91,9 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
|
|
||||||
for (SchBaseTask task : tasks) {
|
for (SchBaseTask task : tasks) {
|
||||||
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(task.getRequest_param());
|
||||||
//判断是否指定到外协区
|
//判断是否指定到外协区
|
||||||
String targetRegionCode = sendMaterVo.getRegion_code();
|
String targetRegionCode = jsonObject.getString("region_code");
|
||||||
if (StringUtils.isBlank(targetRegionCode)) {
|
if (StringUtils.isBlank(targetRegionCode)) {
|
||||||
task.setRemark("未指定区域!");
|
task.setRemark("未指定区域!");
|
||||||
taskService.updateById(task);
|
taskService.updateById(task);
|
||||||
@@ -253,6 +254,9 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
* @param sendVehicleVos
|
* @param sendVehicleVos
|
||||||
*/
|
*/
|
||||||
private void interiorTemplate(SchBaseTask taskObj, List<SendVehicleVo> sendVehicleVos) {
|
private void interiorTemplate(SchBaseTask taskObj, List<SendVehicleVo> sendVehicleVos) {
|
||||||
|
Param isPrint = sysParamService.findByCode(GeneralDefinition.IS_PRINT);
|
||||||
|
if (ObjectUtil.isNotEmpty(isPrint) && "1".equals(isPrint.getValue())) {
|
||||||
|
} else {
|
||||||
JSONObject jsonObject3 = new JSONObject();
|
JSONObject jsonObject3 = new JSONObject();
|
||||||
jsonObject3.put("vehicle_code", taskObj.getVehicle_code());
|
jsonObject3.put("vehicle_code", taskObj.getVehicle_code());
|
||||||
jsonObject3.put("id", taskObj.getTask_code());
|
jsonObject3.put("id", taskObj.getTask_code());
|
||||||
@@ -268,6 +272,7 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
jsonObject3.put("materials", jsonArray);
|
jsonObject3.put("materials", jsonArray);
|
||||||
lmsToWmsService.feedbackMaterialStatus(jsonObject3);
|
lmsToWmsService.feedbackMaterialStatus(jsonObject3);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改终点点位状态
|
* 修改终点点位状态
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
<el-table v-loading="loading" :data="data" style="width: 100%;">
|
||||||
<el-table-column prop="description" label="行为" min-width="130" show-overflow-tooltip />
|
<el-table-column prop="description" label="行为" min-width="130" show-overflow-tooltip />
|
||||||
<el-table-column prop="request_ip" label="IP" />
|
<el-table-column prop="request_ip" label="IP" />
|
||||||
|
<el-table-column prop="username" label="用户名" />
|
||||||
<el-table-column show-overflow-tooltip prop="address" label="IP来源" />
|
<el-table-column show-overflow-tooltip prop="address" label="IP来源" />
|
||||||
<el-table-column prop="browser" label="浏览器" min-width="120" show-overflow-tooltip />
|
<el-table-column prop="browser" label="浏览器" min-width="120" show-overflow-tooltip />
|
||||||
<el-table-column prop="time" label="请求耗时" align="center">
|
<el-table-column prop="time" label="请求耗时" align="center">
|
||||||
|
|||||||
Reference in New Issue
Block a user