|
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.spire.xls.*;
|
|
@@ -32,7 +31,6 @@ import org.springblade.business.entity.ContractLog;
|
|
|
import org.springblade.business.entity.InformationQuery;
|
|
|
import org.springblade.business.feign.ContractLogClient;
|
|
|
import org.springblade.business.feign.InformationQueryClient;
|
|
|
-import org.springblade.business.feign.TaskClient;
|
|
|
import org.springblade.business.vo.SaveContractLogVO;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
@@ -44,7 +42,6 @@ import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
-import org.springblade.core.redis.cache.BladeRedis;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
@@ -66,18 +63,15 @@ import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.resource.vo.NewBladeFile;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import javax.imageio.ImageIO;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
@@ -93,10 +87,7 @@ import java.nio.file.StandardCopyOption;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
-import java.util.concurrent.ThreadPoolExecutor;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
@@ -132,12 +123,9 @@ public class ExcelTabController extends BladeController {
|
|
|
// 元素信息表-
|
|
|
private final IWbsFormElementService wbsFormElementService;
|
|
|
|
|
|
-
|
|
|
// 元素信息表-
|
|
|
private final IWbsTreeContractService wbsTreeContractService;
|
|
|
|
|
|
- private final INodeBaseInfoService nodeBaseInfoService;
|
|
|
-
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
@@ -164,17 +152,6 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
private final IContractInfoService contractInfoService;
|
|
|
|
|
|
- /*private final IWbsParamService wbsParamService;*/
|
|
|
-
|
|
|
- private final TaskClient taskClient;
|
|
|
-
|
|
|
- private final BladeRedis bladeRedis;
|
|
|
-
|
|
|
-
|
|
|
- // 线程池
|
|
|
- @Resource(name = "taskExecutor1")
|
|
|
- private ThreadPoolExecutor executor;
|
|
|
-
|
|
|
|
|
|
@Autowired
|
|
|
StringRedisTemplate RedisTemplate;
|
|
@@ -4422,95 +4399,6 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data(bussDataInfoTrial);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // @Scheduled(cron = "0/20 * * * * ?")
|
|
|
- public void HtmlCope() {
|
|
|
- //执行代码
|
|
|
- String sql = "SELECT * from m_wbs_tree_private_0425 where project_id=1750070685257990145 and wbs_id=1745384228667129857 and type =2 and is_deleted=0 LIMIT 200";
|
|
|
- List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
- if (maps != null && maps.size() >= 1) {
|
|
|
- for (Map<String, Object> dataInfo : maps) {
|
|
|
- if (executor.getQueue().size() <= 40) {
|
|
|
- String idkey = dataInfo.get("p_key_id") + "";
|
|
|
- Boolean aBoolean = RedisTemplate.hasKey("sign-" + idkey);
|
|
|
- if (!aBoolean) {
|
|
|
- RedisTemplate.opsForValue().set("sign-" + idkey, "1", 30, TimeUnit.SECONDS);
|
|
|
- CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
|
|
|
- try {
|
|
|
- this.checkHtmlCope(dataInfo);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }, executor);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("队列数量" + executor.getQueue().size());
|
|
|
- System.out.println("活跃数量" + executor.getActiveCount());
|
|
|
- System.out.println("总共数量" + executor.getTaskCount());
|
|
|
- System.out.println("完成数量" + executor.getCompletedTaskCount());
|
|
|
- }
|
|
|
-
|
|
|
- public void checkHtmlCope(Map<String, Object> dataInfo) throws Exception {
|
|
|
-
|
|
|
- String pkey_id = dataInfo.get("p_key_id") + "";
|
|
|
- String sql = "update m_wbs_tree_private_0425 set is_deleted=1 where p_key_id='" + pkey_id + "'";
|
|
|
- jdbcTemplate.execute(sql);
|
|
|
- String Html1 = dataInfo.get("html_url") + "";
|
|
|
- String fileName = Html1.substring(Html1.lastIndexOf("/") + 1, Html1.length());
|
|
|
- String Html2 = Html1.replaceAll("privateUrl", "/privateUrlCopy/1795277868551389185/").replaceAll("//", "/");
|
|
|
- String Html3 = Html1.replaceAll("privateUrl", "/privateUrlCopy/1792760669353865218/").replaceAll("//", "/");
|
|
|
- String url183 = "http://183.247.216.148:22776/";
|
|
|
- String local183 = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";
|
|
|
- if (Html1.indexOf("/home/") >= 0) {
|
|
|
- local183 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/";
|
|
|
- }
|
|
|
- String url210 = "http://fileinfo.hczcxx.cn/";
|
|
|
- String local210 = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";
|
|
|
- String saveUrl = "/Users/hongchuangyanfa/Desktop/privateUrl/" + fileName;
|
|
|
-
|
|
|
- // 先判断 基础路径是否存在
|
|
|
- String file1 = Html1.replaceAll(local183, url183);
|
|
|
- String file2 = Html2.replaceAll(local183, url183);
|
|
|
- String file3 = Html3.replaceAll(local183, url183);
|
|
|
- String file4 = Html1.replaceAll(local210, url210).replace("/home", "");
|
|
|
- String file5 = Html2.replaceAll(local210, url210).replace("/home", "");
|
|
|
- String file6 = Html3.replaceAll(local210, url210).replace("/home", "");
|
|
|
-
|
|
|
- List<String> dataUrl = new ArrayList<>();
|
|
|
- dataUrl.add(file2);
|
|
|
- dataUrl.add(file3);
|
|
|
- // dataUrl.add(file4);
|
|
|
- // dataUrl.add(file5);
|
|
|
- // dataUrl.add(file6);
|
|
|
- InputStream stream1 = getOSSInputStream2(file1);
|
|
|
- System.out.println(fileName);
|
|
|
- if (stream1 == null) {
|
|
|
- String sql2 = "update m_wbs_tree_private_0425 set is_deleted=5 where p_key_id='" + pkey_id + "'";
|
|
|
- jdbcTemplate.execute(sql2);
|
|
|
-
|
|
|
- for (String fileUrl : dataUrl) {
|
|
|
- InputStream str = getOSSInputStream2(fileUrl);
|
|
|
- if (str != null) {
|
|
|
- OutputStream outputStream = new FileOutputStream(saveUrl);
|
|
|
- byte[] bytes = CommonUtil.InputStreamToBytes(str);
|
|
|
- outputStream.write(bytes);
|
|
|
-
|
|
|
- if (outputStream != null) {
|
|
|
- outputStream.close();
|
|
|
- }
|
|
|
- String sql3 = "update m_wbs_tree_private_0425 set is_deleted=2 where p_key_id='" + pkey_id + "'";
|
|
|
- jdbcTemplate.execute(sql3);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
public static synchronized InputStream getOSSInputStream2(String urlStr) throws Exception {
|
|
|
//获取OSS文件流
|
|
|
URL url = new URL(urlStr);
|
|
@@ -4523,63 +4411,6 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // @Scheduled(cron = "0/20 * * * * ?")
|
|
|
- public void SignInfo() {
|
|
|
- //执行代码
|
|
|
- String sql = "SELECT * from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract where contract_id=1750757576810766337 and is_cope_tab=2 ) and type =1 and contract_id=1750757576810766337 and is_deleted<>4 ";
|
|
|
- List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
- if (maps != null && maps.size() >= 1) {
|
|
|
- for (Map<String, Object> dataInfo : maps) {
|
|
|
- if (executor.getQueue().size() <= 40) {
|
|
|
- String idkey = dataInfo.get("p_key_id") + "";
|
|
|
- Boolean aBoolean = RedisTemplate.hasKey("sign-" + idkey);
|
|
|
- if (!aBoolean) {
|
|
|
- RedisTemplate.opsForValue().set("sign-" + idkey, "1", 30, TimeUnit.SECONDS);
|
|
|
- CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
|
|
|
- try {
|
|
|
- this.checkIsExsitTaskBatch(dataInfo);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }, executor);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("队列数量" + executor.getQueue().size());
|
|
|
- System.out.println("活跃数量" + executor.getActiveCount());
|
|
|
- System.out.println("总共数量" + executor.getTaskCount());
|
|
|
- System.out.println("完成数量" + executor.getCompletedTaskCount());
|
|
|
- }
|
|
|
-
|
|
|
- public void checkIsExsitTaskBatch(Map<String, Object> dataInfo) {
|
|
|
- String sql = "SELECT * from m_wbs_tree_contract where parent_id =(select id from m_wbs_tree_contract where p_key_id='" + dataInfo.get("p_key_id") + "' and is_deleted=0 ) and type =2 and is_cope_tab=2 and contract_id=1750757576810766337 ORDER BY sort,create_time,node_name ASC";
|
|
|
- List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
- String node_name = "";
|
|
|
- System.out.println(sql);
|
|
|
- int index = 0;
|
|
|
- if (maps != null && maps.size() >= 1) {
|
|
|
- for (int i = 0; i < maps.size(); i++) {
|
|
|
- Map<String, Object> dataIn = maps.get(i);
|
|
|
- String nodeName = dataIn.get("node_name") + "";
|
|
|
- if (node_name.equals(nodeName)) {
|
|
|
- index = index + 1;
|
|
|
- } else {
|
|
|
- index = 1;
|
|
|
- }
|
|
|
- node_name = nodeName;
|
|
|
- if (nodeName.indexOf("__") >= 0) {
|
|
|
- nodeName = nodeName.split("__")[0];
|
|
|
- }
|
|
|
- String newNmae = nodeName + "__" + index;
|
|
|
- System.out.println(newNmae);
|
|
|
- // jdbcTemplate.update("update m_wbs_tree_contract set node_name='"+node_name+"' set is_deleted=4 where p_key_id='"+dataIn.get("p_key_id")+"' ");
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//@Scheduled(fixedDelay = 1000*60*60*24)
|
|
|
//检查excel路径有错的
|
|
|
public void cheackExcel() throws IOException {
|