This commit is contained in:
2024-01-05 15:57:25 +08:00
20 changed files with 181 additions and 83 deletions

View File

@@ -3,13 +3,12 @@ package org.nl;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import org.dromara.dynamictp.core.spring.EnableDynamicTp;
import org.mybatis.spring.annotation.MapperScan;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
@@ -25,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@EnableAsync
@RestController
@EnableDynamicTp
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})
@@ -47,14 +47,6 @@ public class AppRun {
public SpringContextHolder springContextHolder() {
return new SpringContextHolder();
}
@Bean
public ServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
return fa;
}
/**
* 访问首页提示
*

View File

@@ -25,7 +25,6 @@ public class AsyncLuceneAppender extends AspectLogbackAsyncAppender {
if (mdcPropertyMap.getClass().getName().contains("SynchronizedMap")) {
mdcPropertyMap.put("traceId", traceId);
}
MDC.clear();
}
super.append(event);
}

View File

@@ -16,7 +16,12 @@
package org.nl.config.thread;
import org.dromara.dynamictp.core.support.DynamicTp;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -28,16 +33,22 @@ import java.util.concurrent.TimeUnit;
* @author Zheng Jie
* @date 2019年10月31日18:16:47
*/
@Configuration
public class ThreadPoolExecutorUtil {
public static ThreadPoolExecutor getPoll() {
AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);
@Autowired
private AsyncTaskProperties asyncTaskProperties;
@Bean
@Primary
@DynamicTp("el-thread")
public ThreadPoolExecutor threadPoolExecutor() {
return new ThreadPoolExecutor(
properties.getCorePoolSize(),
properties.getMaxPoolSize(),
properties.getKeepAliveSeconds(),
asyncTaskProperties.getCorePoolSize(),
asyncTaskProperties.getMaxPoolSize(),
asyncTaskProperties.getKeepAliveSeconds(),
TimeUnit.SECONDS,
new ArrayBlockingQueue<>(properties.getQueueCapacity()),
new ArrayBlockingQueue<>(asyncTaskProperties.getQueueCapacity()),
new TheadFactoryName()
);
}

View File

@@ -139,8 +139,8 @@ public class LogAspect {
throw ex;
} finally {
log.info("[--response--][请求接口:{} 执行结束][耗时:{}s]", url, (System.currentTimeMillis() - comming) / 1000);
MDC.clear();
LuceneAppender.traceIdTL.remove();
MDC.clear();
}
return result;
}

View File

@@ -16,6 +16,8 @@ import org.nl.system.service.quartz.impl.SysQuartzJobServiceImpl;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async;
import java.util.concurrent.Future;
@@ -35,7 +37,9 @@ public class ExecutionJob extends TLogQuartzJobBean {
/**
* 该处仅供参考
*/
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
@Autowired
@Qualifier("threadPoolExecutor")
private ThreadPoolExecutor EXECUTOR;
@Override
public void executeTask(JobExecutionContext context) throws JobExecutionException {

View File

@@ -71,7 +71,7 @@
FROM
ST_IVT_IOStorInv ios
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinv_id = ios.iostorinv_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = dis.pcsn AND dis.box_no = sub.package_box_sn
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = dis.pcsn
WHERE
ios.is_delete = '0'
AND

View File

@@ -792,7 +792,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONArray resultJSONArray = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).process().getResultJSONArray(0);
List<JSONObject> ivtList = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "20").process().getResultJSONArray(0).toJavaList(JSONObject.class);
List<JSONObject> ivtList = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "21").process().getResultJSONArray(0).toJavaList(JSONObject.class);
List<Map<String, Object>> list = new ArrayList<>();
@@ -822,7 +822,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
String box_weight = ivtList.stream()
.filter(row -> row.getString("bill_code").equals(jsonObject.getString("bill_code")))
.filter(row -> row.getString("iostorinvdtl_id").equals(jsonObject.getString("iostorinvdtl_id")))
.map(row -> row.getDoubleValue("box_weight"))
.reduce(Double::sum).orElse(0.00).toString();

View File

@@ -199,7 +199,8 @@
MAX(ios.order_number) AS order_number,
MAX(ios.receiptaddress) AS receiptaddress,
MAX( sd.label ) AS bill_status,
count(DISTINCT(dis.box_no)) as box_count
count(DISTINCT(dis.box_no)) as box_count,
dtl.iostorinvdtl_id
FROM
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinvdtl dtl ON dis.iostorinvdtl_id = dtl.iostorinvdtl_id
@@ -1105,32 +1106,21 @@
ENDQUERY
ENDIF
IF 输入.flag = "20"
IF 输入.flag = "21"
QUERY
SELECT
SUM(sub.box_weight) AS box_weight,
MAX(ios.bill_code) AS bill_code
MAX(dtl.iostorinvdtl_id) AS iostorinvdtl_id
FROM
(
SELECT
a.box_no,
MAX(b.iostorinv_id) AS iostorinv_id,
MAX(a.pcsn) AS pcsn
FROM
st_ivt_iostorinvdis a
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
WHERE
b.io_type = '1'
and b.is_delete='0'
GROUP BY a.box_no
) dis
LEFT JOIN st_ivt_iostorinv ios ON dis.iostorinv_id = ios.iostorinv_id
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinvdtl dtl ON dis.iostorinvdtl_id = dtl.iostorinvdtl_id
LEFT JOIN st_ivt_iostorinv ios ON ios.iostorinv_id = dtl.iostorinv_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = dis.box_no AND dis.pcsn = sub.container_name
WHERE
ios.io_type = '1'
and ios.is_delete='0'
GROUP BY ios.bill_code
GROUP BY dtl.iostorinvdtl_id
ENDSELECT
ENDQUERY