|
@@ -25,6 +25,7 @@ import org.springblade.manager.entity.WbsTreeContract;
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
|
|
+import org.springblade.manager.entity.*;
|
|
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;
|
|
@@ -732,4 +733,47 @@ public class CheckAndRepairController {
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 检查元素库的元素 根据key和html上的元素是否对应
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/checkAndRepairElementAndHtml")
|
|
|
|
+ @Scheduled(cron = "0 00 4 * * ?")
|
|
|
|
+ public void checkAndRepairElementAndHtml() throws Exception {
|
|
|
|
+ String sql=" select id,tab_en_name from m_table_info where is_deleted=0";
|
|
|
|
+ List<TableInfo> TableInfoList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TableInfo.class));
|
|
|
|
+ int i=TableInfoList.size();
|
|
|
|
+ for (TableInfo tableInfo : TableInfoList) {
|
|
|
|
+ String sql1="select e_key,e_name from m_wbs_form_element where f_id="+tableInfo.getId()+" and is_deleted=0";
|
|
|
|
+ List<WbsFormElement> wbsFormElementList = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(WbsFormElement.class));
|
|
|
|
+ String sql2="select DISTINCT html_url from m_wbs_tree_private where init_table_name='"+tableInfo.getTabEnName()+"' and is_deleted=0 and html_url is not null";
|
|
|
|
+ List<String> htmlUrlList = jdbcTemplate.query(sql2,new SingleColumnRowMapper<>(String.class));
|
|
|
|
+ if(!htmlUrlList.isEmpty()&&!wbsFormElementList.isEmpty()){
|
|
|
|
+ for (String htmlurl : htmlUrlList) {
|
|
|
|
+ InputStream inputStream = FileUtils.getInputStreamByUrl(htmlurl);
|
|
|
|
+ if(inputStream==null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String htmlString = IoUtil.readToString(inputStream);
|
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
|
+ for (WbsFormElement wbsFormElement : wbsFormElementList) {
|
|
|
|
+ Elements elements = doc.select("[keyname^=" + wbsFormElement.getEKey() + "__]");;
|
|
|
|
+ for (Element element : elements) {
|
|
|
|
+ element.attr("placeholder", wbsFormElement.getEName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ File writefile = new File(htmlurl);
|
|
|
|
+ FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
|
+ System.out.println("修改成功:"+ htmlurl);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ System.out.println("修改html文件异常:"+ htmlurl);
|
|
|
|
+ }finally {
|
|
|
|
+ inputStream.close();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ System.out.println("已处理"+i+"条数据,还剩下条"+(TableInfoList.size()-i)+"数据:"+tableInfo.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|