搬家调试

20230922-ljl-fixBug
qiushengjie 1 year ago
parent 8ec90d7fc6
commit 7ee8e3979c

@ -5,6 +5,7 @@ import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.ItemDTO;
import com.ms.api.paas.StorageService;
@ -23,7 +24,14 @@ public class TestTosService extends SPIBaseService implements ExtensionServiceHa
public BaseResponse<String> handle(BaseRequest<ItemDTO> req) {
try{
initHandle(req);
return R.ok("");
Ret ret = storageService.uploadContent("test","这是测试数据");
String url = (String)ret.getData().get("url");
ret = storageService.getContent("test");
String content = (String)ret.getData().get("data");
String publicUrl = storageService.getPubOssUrlByOssPath("test");
return R.ok("地址:" + url + "内容:" + content + "公网地址: " + publicUrl);
}catch (Throwable e){
e.printStackTrace();
return R.ok(e.getMessage());

@ -1,5 +1,6 @@
package com.ms.api.common;
import com.jinritemai.cloud.base.core.util.LogUtils;
import com.ms.api.bo.RedisKeyBO;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@ -39,6 +40,7 @@ public abstract class TaskBaseService implements TaskHandler {
public void runTask() {
RedisKeyBO redisKeyBO = getRedisKey();
try{
setLogId();
if(isPoolFull()){ return;}
execute(redisKeyBO);
}catch (Throwable e){
@ -53,6 +55,7 @@ public abstract class TaskBaseService implements TaskHandler {
TransactionStatus status = transactionManager.getTransaction(def);
RedisKeyBO redisKeyBO = getRedisKey();
try{
setLogId();
if(isPoolFull()){ return;}
execute(redisKeyBO);
transactionManager.commit(status);
@ -64,6 +67,10 @@ public abstract class TaskBaseService implements TaskHandler {
}
}
private void setLogId(){
LogUtils.setLogId(getLogId() + System.currentTimeMillis());
}
private boolean isPoolFull(){
ThreadPoolTaskExecutor mTaskPool = (ThreadPoolTaskExecutor) getTaskPool();
if(mTaskPool.getActiveCount() == mTaskPool.getCorePoolSize()){
@ -95,6 +102,7 @@ public abstract class TaskBaseService implements TaskHandler {
log.info("执行任务结束");
}
protected String getLogId(){return getTaskExecutorName();}
protected RedisKeyBO getRedisKey(){
return null;
};

Loading…
Cancel
Save