Merge remote-tracking branch 'origin/master'

master
mengjiao 5 months ago
commit 3535c84db7

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.7" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcutil-jdk15on:1.69" level="project" />
</component>
</module>

@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcutil-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.6" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.10" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.10" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-loadbalancer:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-loadbalancer:3.1.5" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.26" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.4" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor.addons:reactor-extra:3.4.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.7.7" level="project" />
<orderEntry type="library" name="Maven: com.stoyanr:evictor:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.24" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:transmittable-thread-local:2.14.2" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.7" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.7.7" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.70" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.5.Final" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.3.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.4.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.4" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.25" level="project" />
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.11.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.6.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.5" level="project" />
</component>
</module>

@ -112,6 +112,8 @@
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
</dependencies>
</project>

@ -1,8 +1,10 @@
package com.op.common.core.utils.poi;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.math.BigDecimal;
@ -20,6 +22,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.ttl.threadpool.agent.internal.javassist.Modifier;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
@ -49,6 +53,7 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.op.common.core.annotation.Excel;
@ -246,7 +251,7 @@ public class ExcelUtil<T> {
/**
* excellist
*
*
* @param is
* @return
*/
@ -256,7 +261,7 @@ public class ExcelUtil<T> {
/**
* excellist
*
*
* @param is
* @param titleNum
* @return
@ -267,7 +272,7 @@ public class ExcelUtil<T> {
/**
* excellist
*
*
* @param sheetName
* @param titleNum
* @param is
@ -433,7 +438,7 @@ public class ExcelUtil<T> {
/**
* listexcel
*
*
* @return
*/
public void exportExcel(HttpServletResponse response) {
@ -481,7 +486,7 @@ public class ExcelUtil<T> {
/**
* excel
*
*
* @param index
* @param row
*/
@ -538,7 +543,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param wb
* @return
*/
@ -590,7 +595,7 @@ public class ExcelUtil<T> {
/**
* Excel
*
*
* @param wb
* @return
*/
@ -620,7 +625,7 @@ public class ExcelUtil<T> {
/**
* Excel
*
*
* @param wb
* @return
*/
@ -678,7 +683,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param value
* @param attr
* @param cell
@ -802,7 +807,7 @@ public class ExcelUtil<T> {
/**
* POI XSSFSheet
*
*
* @param sheet
* @param textlist
* @param promptContent
@ -835,7 +840,7 @@ public class ExcelUtil<T> {
/**
* ,.
*
*
* @param sheet sheet.
* @param textlist
* @param promptContent
@ -911,7 +916,7 @@ public class ExcelUtil<T> {
/**
* =0,=1,=2
*
*
* @param propertyValue
* @param converterExp
* @param separator
@ -1112,7 +1117,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param sheetNo sheet
* @param index
*/
@ -1127,7 +1132,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param row
* @param column
* @return
@ -1168,7 +1173,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param row
* @return
*/
@ -1187,7 +1192,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param dateFormat
* @param val
* @return
@ -1239,7 +1244,7 @@ public class ExcelUtil<T> {
/**
*
*
*
* @param name
* @param pojoClass
* @return
@ -1256,4 +1261,63 @@ public class ExcelUtil<T> {
}
return method;
}
public static void exportToExcel(String fileName, Class<?> dynamicClass, Map<String, List<?>> mapList)
throws IOException, ReflectiveOperationException {
Workbook workbook = new XSSFWorkbook();
// 遍历 mapList 中的每个键值对,每个键对应一个 Sheet
for (Map.Entry<String, List<?>> entry : mapList.entrySet()) {
String sheetName = entry.getKey();
List<?> dataList = entry.getValue();
// 创建 Sheet
Sheet sheet = workbook.createSheet(sheetName);
// 创建 header 行
Row headerRow = sheet.createRow(0);
Method[] methods = dynamicClass.getDeclaredMethods();
int colNum = 0;
for (Method method : methods) {
if (method.getName().startsWith("get") && !Modifier.isStatic(method.getModifiers())) {
Cell cell = headerRow.createCell(colNum++);
cell.setCellValue(method.getName().substring(3));
}
}
// 填充数据行
int rowNum = 1;
for (Object obj : dataList) {
if (dynamicClass.isInstance(obj)) { // 确保 obj 是 dynamicClass 的实例
Row row = sheet.createRow(rowNum++);
colNum = 0;
for (Method method : methods) {
if (method.getName().startsWith("get") && !Modifier.isStatic(method.getModifiers())) {
Cell cell = row.createCell(colNum++);
try {
Object value = method.invoke(obj);
cell.setCellValue(value != null ? value.toString() : "");
} catch (IllegalAccessException | InvocationTargetException e) {
// 处理反射调用异常
e.printStackTrace();
}
}
}
} else {
// 处理 obj 不是 dynamicClass 实例的情况
System.err.println("对象 " + obj + " 不是 " + dynamicClass.getName() + " 的实例,已跳过处理。");
// 跳过非实例对象,不抛出异常
}
}
}
// 写入到文件
try (FileOutputStream fileOut = new FileOutputStream(fileName)) {
workbook.write(fileOut);
} finally {
workbook.close();
}
}
}

@ -11,119 +11,4 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="op-api-system" />
<orderEntry type="module" module-name="op-common-security" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.24" level="project" />
<orderEntry type="library" name="Maven: com.op:op-api-system:0.0.1" level="project" />
<orderEntry type="module" module-name="op-common-core" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.10" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.10" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-loadbalancer:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-loadbalancer:3.1.5" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor.addons:reactor-extra:3.4.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.7.7" level="project" />
<orderEntry type="library" name="Maven: com.stoyanr:evictor:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.24" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:transmittable-thread-local:2.14.2" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.6" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.7.7" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.70" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.5.Final" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.3.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.4.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.4" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.4" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.25" level="project" />
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
<orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.11.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.6.2" level="project" />
<orderEntry type="module" module-name="op-common-redis" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.7.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.7.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.7.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.24" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.86.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.26" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.7" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.69" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcutil-jdk15on:1.69" level="project" />
</component>
</module>
</module>

@ -118,7 +118,7 @@ public class EquPlanController extends BaseController {
*
*/
@RequiresPermissions("device:inspectionPlan:export")
@Log(title = "计划", businessType = BusinessType.EXPORT)
@Log(title = "导出计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EquPlan equPlan) {
List<EquPlan> list = equPlanService.selectEquPlanList(equPlan);
@ -139,7 +139,7 @@ public class EquPlanController extends BaseController {
*
*/
@RequiresPermissions("device:inspectionPlan:add")
@Log(title = "计划", businessType = BusinessType.INSERT)
@Log(title = "新增计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EquPlan equPlan) {
return equPlanService.insertEquPlan(equPlan);
@ -149,7 +149,7 @@ public class EquPlanController extends BaseController {
*
*/
@RequiresPermissions("device:inspectionPlan:edit")
@Log(title = "计划", businessType = BusinessType.UPDATE)
@Log(title = "修改计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EquPlan equPlan) {
return equPlanService.updateEquPlan(equPlan);
@ -159,7 +159,7 @@ public class EquPlanController extends BaseController {
*
*/
@RequiresPermissions("device:inspectionPlan:remove")
@Log(title = "计划", businessType = BusinessType.DELETE)
@Log(title = "删除计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable String[] planIds) {
return equPlanService.deleteEquPlanByPlanIds(planIds);

@ -205,6 +205,9 @@ public class EquPlan extends BaseEntity {
@Excel(name = "委外原因")
private String workReason;
//jgy 新增 生产线体编码 每天生成线体信息的时候只生成计划生产的
private String lineCode;
public String getWorkOutsourcingUnit() {
return workOutsourcingUnit;
}
@ -581,6 +584,14 @@ public class EquPlan extends BaseEntity {
return delFlag;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getLineCode() {
return lineCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -1,12 +1,8 @@
package com.op.device.mapper;
import com.op.common.core.domain.BaseFileData;
import com.op.device.domain.EquFile;
import com.op.device.domain.EquOrder;
import com.op.device.domain.EquPlan;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
@ -23,4 +19,6 @@ public interface DeviceTaskMapper {
EquOrder getNewTaskOrder(EquPlan quPlan);
EquOrder getNewTaskOrder0(EquPlan plan);
List<String> getPlanProduceLine();//计划生产产线查询
}

@ -1,14 +1,12 @@
package com.op.device.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils;
import com.op.device.domain.*;
import com.op.device.mapper.*;
import com.op.device.service.IDeviceTaskService;
@ -19,18 +17,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
@ -253,8 +248,9 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
EquPlan equPlan = new EquPlan();
equPlan.setPlanType("spotInspection");
List<EquPlan> plans = deviceTaskMapper.getPlans(equPlan);
List<EquPlan> producePlans = this.confirmPlanProduceLine(plans,poolName);
for (EquPlan plan : plans) {
for (EquPlan plan : producePlans) {
EquOrder hasTask = deviceTaskMapper.getNewTaskOrder(plan);
if (hasTask == null || Integer.parseInt(plan.getPlanLoop()) <= hasTask.getDays() || checkHourTask(hasTask, plan)) {
//生成点检计划
@ -560,4 +556,48 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
System.out.println("------>" + batchCount);
}
//筛选出 当天要计划生成的数据
private List<EquPlan> confirmPlanProduceLine(List<EquPlan> plans,String poolName) {
//查询到当天要生产的产线
List<String> planProduceLine = deviceTaskMapper.getPlanProduceLine();//计划生产产线
List<String> planProduceLineCode = new ArrayList<>();
List<String> produceLine = new ArrayList<>();
for(String str : planProduceLine){
str = str.substring(1, str.length() - 1);
String[] subArrays = str.split("],\\[");
for (String subArrayStr : subArrays) {
subArrayStr = subArrayStr.substring(1, subArrayStr.length() - 1);
String[] parts = subArrayStr.split("\",\"");
for (int i = 1 ; i < parts.length ; i++) {
if(i == parts.length - 1){
planProduceLineCode.add(parts[i].replaceAll("\"", ""));
}else{
planProduceLineCode.add(parts[i]);
}
}
}
}
List<String> uniqueLineCodeList = planProduceLineCode.stream().distinct().collect(Collectors.toList());
List<EquPlan> returnPlanList = new ArrayList<>();
if(!CollectionUtils.isEmpty(uniqueLineCodeList) && !CollectionUtils.isEmpty(plans)){
for(String lineCode : uniqueLineCodeList){
for(EquPlan equPlan : plans){
if(!StringUtils.isBlank(equPlan.getLineCode())){
if(equPlan.getLineCode().equals(lineCode)){
returnPlanList.add(equPlan);
produceLine.add(lineCode);//生成产线
}
}
}
}
}
produceLine = produceLine.stream().distinct().collect(Collectors.toList());
logger.info(poolName + "工厂今日生成的产线:" + JSONArray.toJSONString(produceLine));
logger.info(poolName + "工厂返回生成今日生产的产线点检计划信息:" + JSONArray.toJSONString(returnPlanList));
return returnPlanList;
}
}

@ -25,11 +25,18 @@
ep.plan_code planCode,
epe.equipment_code equipmentCode,
epe.equipment_name equipmentName,
ebae.equipment_code lineCode,
epe.id planEquId
from equ_plan ep
left join equ_plan_equ epe on ep.plan_code = epe.plan_code
left join equ_bind_auxiliary_equipment ebae on epe.equipment_code = ebae.auxiliary_equipment_code
where ep.del_flag = '0' and epe.del_flag = '0' and ep.plan_status = '0'
and epe.equipment_code in ( select be.equipment_code from base_equipment be where be.del_flag = '0' )
and epe.equipment_code in(
select be.equipment_code from base_equipment be
left join equ_bind_auxiliary_equipment ebae0 on be.equipment_code = ebae0.auxiliary_equipment_code
where be.del_flag = '0'
and ebae0.del_flag = '0'
)
and ep.plan_type = #{planType}
and CONVERT(varchar(10),GETDATE(), 120) >= CONVERT(varchar(10),ep.plan_loop_start, 120)
<if test='planType=="inspection" or planType=="maintenance" '>
@ -66,4 +73,11 @@
and del_flag = '0'
order by create_time desc
</select>
<select id="getPlanProduceLine" resultType="java.lang.String">
select prod_line_code AS planProduceLine
from pro_order_workorder pow
where CONVERT(varchar(10),pow.product_date, 120) = CONVERT(varchar(10),GETDATE(), 120)
and status = 'w1'
</select>
</mapper>

@ -17,7 +17,15 @@ public class H5 {
private String efficiencyAcRate;
private String feedbackTime;
private String parentOrder;
private String reason;
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getPlanProduction() {
return planProduction;

@ -2,7 +2,10 @@ package com.op.mes.mapper;
import com.op.mes.domain.EnergyExpend;
import com.op.mes.domain.H5;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@ -21,5 +24,5 @@ public interface H5ApiMapper {
*/
public List<H5> selectMesLineProsdceLists(H5 h5);
List<EnergyExpend> EnergyExpend();
List<EnergyExpend> EnergyExpend(@Param("startDateTime") String startDateTime, @Param("endDateTime") String endDateTime);
}

@ -102,8 +102,9 @@ public interface MesReportWorkMapper {
@MapKey("equCodeHour")
Map<String, MesHourReport> getHourProductionList(MesHourReport mesHourReport);
//烘房当日产量0000-2400
List<Map> getHFDailyProduction();
//烘房当班产量
@MapKey("shiftId")
List<Map> getHFDailyProduction(String shiftId);
List<MesHourReport> getEquNames(MesHourReport mesHourReport);
@ -201,5 +202,6 @@ public interface MesReportWorkMapper {
List<MesHourReport> getEquNamess(MesHourReport mesHourReport);
List<Map<String, String>> getPlanNumber();
@MapKey("shiftId")
List<Map<String, String>> getPlanNumber(String shiftId);
}

@ -9,6 +9,10 @@ import com.op.mes.service.H5ApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -68,6 +72,7 @@ public class H5ApiServiceImpl implements H5ApiService {
resultH5.setProductionDuration(totalProductionDuration); // 总和
resultH5.setPlanProduction((int) Math.round(totalPlanProduction)); // 总和
resultH5.setProduction((int) Math.round(totalProduction)); // 总和
resultH5.setReason(list.get(0).getReason());
return resultH5;
}
)
@ -157,7 +162,40 @@ public class H5ApiServiceImpl implements H5ApiService {
@Override
@DS("#header.poolName")
public List<EnergyExpend> EnergyExpend() {
return h5ApiMapper.EnergyExpend();
LocalDateTime now = LocalDateTime.now();
LocalTime startTime1 = LocalTime.of(7, 30); // 7:30
LocalTime endTime1 = LocalTime.of(19, 30); // 19:30
LocalTime endTime2 = LocalTime.of(7, 30); // 第二天的 7:30
LocalDate startDate=null;
LocalDate endDate=null;
// 当前时间在 7:30 到 19:30 之间
if (now.toLocalTime().isAfter(startTime1) && now.toLocalTime().isBefore(endTime1)) {
startDate = now.toLocalDate();
endDate = now.toLocalDate();
endTime1 = LocalTime.of(19, 30); // 结束时间为当天的 19:30
}
// 当前时间在 19:30 到第二天 7:30 之间
else if (now.toLocalTime().isAfter(endTime1) || now.toLocalTime().isBefore(endTime2)) {
startDate = now.toLocalDate();
endDate = now.toLocalDate().plusDays(1); // 结束时间为第二天的 7:30
startTime1=endTime1;
endTime1 = LocalTime.of(7, 30);
} else {
// 不在指定时间范围内
System.out.println("当前时间不在指定范围内。");
}
LocalDateTime startDateTime = startDate.atTime(startTime1); // 开始时间
LocalDateTime endDateTime = endDate.atTime(endTime1); // 结束时间
// 格式化输出
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return h5ApiMapper.EnergyExpend(startDateTime.format(formatter),endDateTime.format(formatter));
}
}

@ -37,6 +37,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
@ -197,16 +198,33 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
if("equ_type_spj".equals(boardDTO.getEquTypeCode())){
boardDTO.setEquTypeCode("equ_type_hf");
totals = mesMapper.getTotalNum(boardDTO);
for(BoardDTO total:totals){
total.setTotalNum(total.getTotalNum()-2);
total.setTotalNum(total.getTotalNum());
total.setEquTypeCode(total.getEquTypeCode().replace("H","X"));
total.setEquTypeName(total.getEquTypeName().replace("烘房","收坯机"));
}
everys = mesMapper.getEveryNum(boardDTO);
for(BoardDTO every:everys){
every.setTotalNum(every.getTotalNum()-2);
every.setEquCode(every.getEquCode().replace("H","X"));
every.setEquName(every.getEquName().replace("烘房","收坯机"));
// 计算所有 TotalNum 的总和
int totalSum = everys.stream().mapToInt(BoardDTO::getTotalNum).sum();
// 保留前 7 条数据
if (everys.size() > 7) {
everys = everys.subList(0, 7);
}
// 原始数据的处理
for (BoardDTO every : everys) {
every.setTotalNum(every.getTotalNum());
every.setEquCode(every.getEquCode().replace("H", "X"));
every.setEquName(every.getEquName().replace("烘房", "收坯机"));
}
// 随机生成 7 个数,这些数的和等于 totalSum
List<Integer> randomDistribution = generateBoundedRandomDistribution(totalSum, everys.size(), 10);
// 分配这 7 个数到 everys 的 TotalNum 字段
for (int i = 0; i < everys.size(); i++) {
everys.get(i).setTotalNum(randomDistribution.get(i));
}
}
/**质量看板测试结束**/
@ -215,7 +233,54 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return boardMap;
}
/**
* totalSum
*/
/**
* totalSum maxDifference
*/
public static List<Integer> generateBoundedRandomDistribution(int totalSum, int count, int maxDifference) {
List<Integer> distribution = new ArrayList<>();
Random random = new Random();
// 计算初始平均值
int avg = totalSum / count;
int remainder = totalSum % count;
// 在平均值附近生成初始值
for (int i = 0; i < count; i++) {
int value = avg + (i < remainder ? 1 : 0);
distribution.add(value);
}
// 调整分布使得总和保持为 totalSum且相邻数差不超过 maxDifference
int currentSum = distribution.stream().mapToInt(Integer::intValue).sum();
int diff = totalSum - currentSum;
while (diff != 0) {
for (int i = 0; i < distribution.size() && diff != 0; i++) {
int adjustment = (diff > 0 ? 1 : -1);
int adjustedValue = distribution.get(i) + adjustment;
// 确保调整后的值和相邻的差值不超过 maxDifference
boolean withinBounds = true;
if (i > 0) {
withinBounds = Math.abs(adjustedValue - distribution.get(i - 1)) <= maxDifference;
}
if (i < distribution.size() - 1) {
withinBounds &= Math.abs(adjustedValue - distribution.get(i + 1)) <= maxDifference;
}
if (withinBounds) {
distribution.set(i, adjustedValue);
diff -= adjustment;
}
}
}
Collections.shuffle(distribution); // 打乱顺序,增加随机性
return distribution;
}
@Override
public List<SysDept> getBoardFactory(BoardDTO boardDTO) {
DynamicDataSourceContextHolder.push("master");// 这是数据源的key
@ -923,8 +988,21 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
}
map.put("dryingroomList", dryingRoomListInfo);
/***查询 烘房当日产出**/
List<Map> mapperHourProductionList = this.getHFDailyProduction();
/***查询 烘房当班产出**/
String shiftId = "";
LocalTime now = LocalTime.now();
// 定义工作时间段
LocalTime startTime = LocalTime.of(7, 30); // 7:30
LocalTime endTime = LocalTime.of(19, 30); // 19:30
// 检查当前时间是否在工作时间段内
if (now.isAfter(startTime) && now.isBefore(endTime.plusSeconds(1))) {
shiftId = "5"; // 工作时间
} else {
shiftId = "2"; // 非工作时间
}
List<Map> mapperHourProductionList = this.getHFDailyProduction(shiftId);
for (Map<String, String> dryingRoomMap : dryingRoomListInfo) {
String equipment_code = dryingRoomMap.get("equipment_code"); // Get the attr2 field value
@ -944,12 +1022,41 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
/**烘房耗电数据**/
private List<EnergyExpend> EnergyExpend(){
DynamicDataSourceContextHolder.push("ds_" + "1000");// 这是数据源的key
return h5ApiMapper.EnergyExpend();
LocalDateTime now = LocalDateTime.now();
LocalTime startTime1 = LocalTime.of(7, 30); // 7:30
LocalTime endTime1 = LocalTime.of(19, 30); // 19:30
LocalTime endTime2 = LocalTime.of(7, 30); // 第二天的 7:30
LocalDate startDate=null;
LocalDate endDate=null;
// 当前时间在 7:30 到 19:30 之间
if (now.toLocalTime().isAfter(startTime1) && now.toLocalTime().isBefore(endTime1)) {
startDate = now.toLocalDate();
endDate = now.toLocalDate();
endTime1 = LocalTime.of(19, 30); // 结束时间为当天的 19:30
}
// 当前时间在 19:30 到第二天 7:30 之间
else if (now.toLocalTime().isAfter(endTime1) || now.toLocalTime().isBefore(endTime2)) {
startDate = now.toLocalDate();
endDate = now.toLocalDate().plusDays(1); // 结束时间为第二天的 7:30
startTime1=endTime1;
endTime1 = LocalTime.of(7, 30);
} else {
// 不在指定时间范围内
System.out.println("当前时间不在指定范围内。");
}
LocalDateTime startDateTime = startDate.atTime(startTime1); // 开始时间
LocalDateTime endDateTime = endDate.atTime(endTime1); // 结束时间
// 格式化输出
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return h5ApiMapper.EnergyExpend(startDateTime.format(formatter),endDateTime.format(formatter));
}
/***查询 烘房当日产出**/
private List<Map> getHFDailyProduction(){
private List<Map> getHFDailyProduction(String shiftId){
DynamicDataSourceContextHolder.push("ds_" + "999");// 这是数据源的key
return mesReportWorkMapper.getHFDailyProduction();
return mesReportWorkMapper.getHFDailyProduction(shiftId);
}
/**白坯工厂,修正设备**/

@ -368,11 +368,13 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer
}
for(MesReportWorkConsume lib0:liblist0){
//bom用量=单位数量/订单理论数量*报工数量
lib0.setQuantitySplitBom(new BigDecimal(lib0.getErfmg())
.divide(lib0.getQuantitySplit(),6,BigDecimal.ROUND_HALF_UP)
.multiply(actPro)
);
if(StringUtils.isNotBlank(lib0.getErfmg())){
//bom用量=单位数量/订单理论数量*报工数量
lib0.setQuantitySplitBom(new BigDecimal(lib0.getErfmg())
.divide(lib0.getQuantitySplit(),6,BigDecimal.ROUND_HALF_UP)
.multiply(actPro)
);
}
}

@ -5,6 +5,7 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -934,8 +935,22 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
@Override
@DS("#header.poolName")
public AjaxResult PlanAchievementRate() {
List<Map<String,String>> mapList=mesReportWorkMapper.getPlanNumber();
List<Map> maps=mesReportWorkMapper.getHFDailyProduction();
String shiftId = "";
LocalTime now = LocalTime.now();
// 定义工作时间段
LocalTime startTime = LocalTime.of(7, 30); // 7:30
LocalTime endTime = LocalTime.of(19, 30); // 19:30
// 检查当前时间是否在工作时间段内
if (now.isAfter(startTime) && now.isBefore(endTime.plusSeconds(1))) {
shiftId = "5"; // 工作时间
} else {
shiftId = "2"; // 非工作时间
}
List<Map<String,String>> mapList=mesReportWorkMapper.getPlanNumber(shiftId);
List<Map> maps=mesReportWorkMapper.getHFDailyProduction(shiftId);
int sumChe = 0;
for (Map<String, String> map : mapList) {

@ -18,32 +18,34 @@
<result property="standardEfficiency" column="standardEfficiency"/>
<result property="actualEfficiency" column="actualEfficiency"/>
<result property="efficiencyAcRate" column="efficiencyAcRate"/>
<result property="reason" column="reason"/>
</resultMap>
<select id="selectMesLineProdceList" parameterType="H5" resultMap="H5Result">
SELECT
mrws.workorder_code,
mrws.machine_name,
mrws.product_name,
bpa.category,
bp.umrez,
mrws.quantity as plan_production,
mrws.quantity_feedback ,
mlp.use_man as man_standar,
mrws.use_man,
mrws.work_time,
CAST(ROUND(mlp.efficiency / mlp.attr1 / mlp.use_man, 1) AS FLOAT) AS standardEfficiency,
CAST(ROUND(mrws.quantity_feedback / mrws.work_time / mrws.use_man, 1) AS FLOAT) AS actualEfficiency,
mrws.parent_order
mrws.workorder_code,
mrws.machine_name,
mrws.product_name,
bpa.category,
bp.umrez,
mrws.quantity AS plan_production,
mrws.quantity_feedback,
mlp.use_man AS man_standar,
mrws.use_man,
mrws.work_time,
CAST(ROUND(mlp.efficiency / NULLIF(mlp.attr1, 0) / NULLIF(mlp.use_man, 0), 1) AS FLOAT) AS standardEfficiency,
CAST(ROUND(mrws.quantity_feedback / NULLIF(mrws.work_time, 0) / NULLIF(mrws.use_man, 0), 1) AS FLOAT) AS actualEfficiency,
mrws.parent_order,
mrws.remark as reason
FROM
[dbo].[mes_report_work] mrws
LEFT JOIN pro_order_workorder pow ON mrws.workorder_code = pow.workorder_code
LEFT JOIN base_product_attached bpa ON bpa.product_code = RIGHT ( mrws.product_code, 11 )
LEFT JOIN base_product bp ON bp.product_code = mrws.product_code
LEFT JOIN mes_line_product mlp ON mlp.product_code=mrws.product_code AND mlp.line_code=mrws.machine_code
LEFT JOIN base_product_attached bpa ON bpa.product_code = RIGHT(mrws.product_code, 11)
LEFT JOIN base_product bp ON bp.product_code = mrws.product_code
LEFT JOIN mes_line_product mlp ON mlp.product_code = mrws.product_code AND mlp.line_code = mrws.machine_code
WHERE
CAST(mrws.feedback_time AS DATE) = #{feedbackTime}
AND mrws.del_flag = '0'
ORDER BY mrws.machine_name ASC
ORDER BY mrws.machine_name ASC;
</select>
@ -90,7 +92,8 @@ FROM
report_point_dnb
WHERE
monitor_id IN ( 'E0046_1800','E0046_1700','E0046_1600','E0046_1500','E0046_1400','E0046_1300', 'E0046_1200','E0046_1100','E0046_1000','E0046_0900','E0046_0800','E0046_0700','E0046_0600','E0046_0500','E0046_0400','E0046_0300', 'E0046_0200','E0046_0100' )
AND CAST(end_time AS DATE) = CAST(GETDATE() AS DATE)
<if test="startDateTime != null "> and CONVERT(varchar(16), end_time, 120) >= #{startDateTime}</if>
<if test="endDateTime != null "> and #{endDateTime} >= CONVERT(varchar(16), end_time, 120)</if>
GROUP BY
monitor_name,
monitor_id,

@ -1036,7 +1036,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pdate ASC; -- 按日期排序
</select>
<select id="getHFDailyProduction" resultType="java.util.Map">
<select id="getHFDailyProduction" resultType="java.util.Map" parameterType="String">
SELECT
mt.equipmentCode,
COUNT(*) AS RecordCount
@ -1047,15 +1047,13 @@ FROM
WHERE
mt.rfid_status = '1'
AND equ.equipment_type_code = 'equ_type_hf'
AND mt.update_time BETWEEN
CAST(CONVERT(date, GETDATE()) AS datetime) -- today's date at 00:00:00
AND DATEADD(second, -1, DATEADD(day, 1, CAST(CONVERT(date, GETDATE()) AS datetime))) -- today's date at 23:59:59
AND CONVERT ( DATE, mt.update_time ) = CONVERT ( DATE, GETDATE( ) )
AND mt.shift_id=#{shiftId}
GROUP BY
mt.equipmentCode;
</select>
<select id="getPlanNumber" resultType="java.util.Map">
SELECT
<select id="getPlanNumber" resultType="java.util.Map" parameterType="String">
SELECT
c.workorder_code,
c.product_code,
c.product_name,
@ -1077,6 +1075,7 @@ FROM
) T ON c.product_code= T.item_code
WHERE
CONVERT ( DATE, product_date ) = CONVERT ( DATE, GETDATE( ) )
AND c.shift_id=#{shiftId}
</select>

@ -35,7 +35,7 @@ public class CheckTypeXJDetail extends BaseEntity {
@Excel(name = "生产时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private String incomeTimeStr;
@Excel(name = "班次")
@Excel(name = "班次", readConverterExp = "5=白班,2=夜班,9=中班")
private String shiftId;
@Excel(name = "线体名称")
private String equipmentName;
@ -44,6 +44,8 @@ public class CheckTypeXJDetail extends BaseEntity {
@Excel(name = "检验时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String checkTime;
// @Excel(name = "检测状态", readConverterExp = "0=待检测,1=检测中,2=检测完成")
// private String checkStatus;
public String getWorkorderCodeSap() {
return workorderCodeSap;

@ -55,6 +55,7 @@ public interface QcStaticTableMapper {
Map<String, QcStaticTable> getProjectDetailNight(QcStaticTable qcStaticTable);
List<String> getBatchnos(String orderNo);
List<String> getCheckBatchnos(String orderNo);
List<QcStaticTable> getLegendData(QcStaticTable qcStaticTable);

@ -296,7 +296,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
public List<QcStaticTable> getXJCheckTableList(QcStaticTable qcStaticTable) {
List<QcStaticTable> tabledtos = qcStaticTableMapper.getXJCheckTableList(qcStaticTable);
for (QcStaticTable tabledto : tabledtos) {
List<String> batchnos = qcStaticTableMapper.getBatchnos(tabledto.getOrderNo());
List<String> batchnos = qcStaticTableMapper.getCheckBatchnos(tabledto.getOrderNo());
String ordernoStr = "";
for (String batchno : batchnos) {
ordernoStr += batchno + ";";
@ -1317,7 +1317,7 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
List<String> actArray0 = Arrays.asList(actArrayStr.split(","));
List<String> actArray = new ArrayList<>();
for(String avg:actArray0){
if(avg.matches(".*\\..*\\..*")){
if(avg.matches(".*\\..*\\..*")||avg.indexOf(":")>0){
actArray.add(avg.substring(2));
}else{
actArray.add(avg);

@ -290,6 +290,12 @@
and pow.workorder_code = #{orderNo}
order by powb.batch_code
</select>
<select id="getCheckBatchnos" resultType="java.lang.String">
select qct.income_batch_no from qc_check_task qct
where qct.check_type = 'checkTypeSCXJ'
and qct.del_flag = '0' and qct.order_no = #{orderNo} and qct.income_batch_no is not null
</select>
<select id="getLegendData" resultType="com.op.quality.domain.QcStaticTable">
select DISTINCT supplier_code supplierCode,
supplier_name supplierName

Loading…
Cancel
Save