|
@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.apache.commons.lang.SystemUtils;
|
|
import org.apache.commons.lang.SystemUtils;
|
|
|
|
+import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.utils.CommonUtil;
|
|
import org.springblade.common.utils.CommonUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
@@ -16,6 +17,7 @@ import org.springblade.manager.entity.WbsTreePrivate;
|
|
import org.springblade.repair.util.ExcelInfoUtils;
|
|
import org.springblade.repair.util.ExcelInfoUtils;
|
|
import org.springblade.repair.util.FileUtils;
|
|
import org.springblade.repair.util.FileUtils;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
|
+import org.springblade.system.cache.ParamCache;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -318,12 +320,19 @@ public class CheckAndRepairController {
|
|
public void checkPrivateHtmlIsCopy(){
|
|
public void checkPrivateHtmlIsCopy(){
|
|
String sql="select p_key_id,project_id,html_url from m_wbs_tree_private where is_deleted=0 and html_url NOT LIKE '%privateUrlCopy%' AND type=2";
|
|
String sql="select p_key_id,project_id,html_url from m_wbs_tree_private where is_deleted=0 and html_url NOT LIKE '%privateUrlCopy%' AND type=2";
|
|
List<WbsTreePrivate> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
List<WbsTreePrivate> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
+ String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
|
+ String projectUrl="";
|
|
|
|
+ if(sys_isonline.equals("20")){
|
|
|
|
+ projectUrl="/home/www/wwwroot/Users/hongchuangyanfa/Desktop/privateUrlCopy";
|
|
|
|
+ }else {
|
|
|
|
+ projectUrl="/mnt/sdc/Users/hongchuangyanfa/Desktop/privateUrlCopy/";
|
|
|
|
+ }
|
|
for (WbsTreePrivate wbsTreePrivate : list) {
|
|
for (WbsTreePrivate wbsTreePrivate : list) {
|
|
if(StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())){
|
|
if(StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())){
|
|
String url=wbsTreePrivate.getHtmlUrl();
|
|
String url=wbsTreePrivate.getHtmlUrl();
|
|
File html = new File(wbsTreePrivate.getHtmlUrl());
|
|
File html = new File(wbsTreePrivate.getHtmlUrl());
|
|
if(html.exists()){
|
|
if(html.exists()){
|
|
- String project = "/mnt/sdc/Users/hongchuangyanfa/Desktop/privateUrlCopy/"+wbsTreePrivate.getProjectId()+"/";
|
|
|
|
|
|
+ String project = projectUrl+wbsTreePrivate.getProjectId()+"/";
|
|
File projectFile = new File(project);
|
|
File projectFile = new File(project);
|
|
if(!projectFile.exists()){
|
|
if(!projectFile.exists()){
|
|
projectFile.mkdir();
|
|
projectFile.mkdir();
|
|
@@ -359,7 +368,7 @@ public class CheckAndRepairController {
|
|
* 检查private html文件是否存在
|
|
* 检查private html文件是否存在
|
|
*/
|
|
*/
|
|
@GetMapping("/checkPrivateHtmlIsExist")
|
|
@GetMapping("/checkPrivateHtmlIsExist")
|
|
- @Scheduled(cron = "0 30 1 * * ?")
|
|
|
|
|
|
+ @Scheduled(cron = "0 0 3 * * ?")
|
|
public void checkPrivateHtmlIsExist() throws Exception {
|
|
public void checkPrivateHtmlIsExist() throws Exception {
|
|
String sql="select p_key_id, excel_id,html_url from m_wbs_tree_private where html_url IS NOT NULL and is_deleted=0";
|
|
String sql="select p_key_id, excel_id,html_url from m_wbs_tree_private where html_url IS NOT NULL and is_deleted=0";
|
|
List<WbsTreePrivate> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
List<WbsTreePrivate> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
@@ -376,8 +385,9 @@ public class CheckAndRepairController {
|
|
boolean flag=true;
|
|
boolean flag=true;
|
|
//判断文件是否存在
|
|
//判断文件是否存在
|
|
if(!html.exists()){
|
|
if(!html.exists()){
|
|
|
|
+ System.out.println("文件不存在:"+htmlUrl+":"+wbsTreePrivate.getPKeyId());
|
|
List<WbsTreePrivate> list1;
|
|
List<WbsTreePrivate> list1;
|
|
- Path sourcePath = Paths.get(htmlUrl);
|
|
|
|
|
|
+ Path targetPath = Paths.get(htmlUrl);
|
|
String sql1="select html_url from m_wbs_tree_private where excel_id="+wbsTreePrivate.getExcelId()+" and is_deleted=0"+" and init_table_name= '"+wbsTreePrivate.getInitTableName()+"' and html_url like '%"+result+"' ";
|
|
String sql1="select html_url from m_wbs_tree_private where excel_id="+wbsTreePrivate.getExcelId()+" and is_deleted=0"+" and init_table_name= '"+wbsTreePrivate.getInitTableName()+"' and html_url like '%"+result+"' ";
|
|
list1= jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
list1= jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
if(list1.isEmpty()){
|
|
if(list1.isEmpty()){
|
|
@@ -389,7 +399,7 @@ public class CheckAndRepairController {
|
|
for (String htmlUrlSet : htmlSets) {
|
|
for (String htmlUrlSet : htmlSets) {
|
|
File htmlSet = new File(htmlUrlSet);
|
|
File htmlSet = new File(htmlUrlSet);
|
|
if(htmlSet.exists()){
|
|
if(htmlSet.exists()){
|
|
- Path targetPath = Paths.get(htmlUrlSet);
|
|
|
|
|
|
+ Path sourcePath = Paths.get(htmlUrlSet);
|
|
Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
|
|
Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
|
|
System.out.println("文件复制成功!"+wbsTreePrivate.getPKeyId());
|
|
System.out.println("文件复制成功!"+wbsTreePrivate.getPKeyId());
|
|
flag=false;
|
|
flag=false;
|
|
@@ -408,5 +418,4 @@ public class CheckAndRepairController {
|
|
}
|
|
}
|
|
System.out.println("检查完毕,更新了"+i+"条记录");
|
|
System.out.println("检查完毕,更新了"+i+"条记录");
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|