|  | @@ -6,6 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
	
		
			
				|  |  |  import lombok.AllArgsConstructor;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  | +import org.jsoup.Jsoup;
 | 
	
		
			
				|  |  | +import org.jsoup.nodes.Document;
 | 
	
		
			
				|  |  | +import org.jsoup.nodes.Element;
 | 
	
		
			
				|  |  | +import org.jsoup.select.Elements;
 | 
	
		
			
				|  |  |  import org.springblade.common.constant.CommonConstant;
 | 
	
		
			
				|  |  |  import org.springblade.common.utils.SnowFlakeUtil;
 | 
	
		
			
				|  |  |  import org.springblade.core.log.exception.ServiceException;
 | 
	
	
		
			
				|  | @@ -26,16 +30,21 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
 | 
	
		
			
				|  |  |  import org.springblade.manager.service.IExcelTabService;
 | 
	
		
			
				|  |  |  import org.springblade.manager.service.ITableInfoService;
 | 
	
		
			
				|  |  |  import org.springblade.manager.service.IWbsFormElementService;
 | 
	
		
			
				|  |  | +import org.springblade.manager.utils.FileUtils;
 | 
	
		
			
				|  |  |  import org.springblade.manager.utils.WbsElementUtil;
 | 
	
		
			
				|  |  |  import org.springblade.manager.vo.WbsFormElementVO;
 | 
	
		
			
				|  |  |  import org.springblade.manager.vo.WbsFormElementVO2;
 | 
	
		
			
				|  |  |  import org.springblade.manager.vo.WbsNodeTableVO;
 | 
	
		
			
				|  |  |  import org.springblade.system.cache.ParamCache;
 | 
	
		
			
				|  |  |  import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | +import org.springframework.jdbc.core.ResultSetExtractor;
 | 
	
		
			
				|  |  | +import org.springframework.jdbc.core.SingleColumnRowMapper;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.io.File;
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.io.InputStream;
 | 
	
		
			
				|  |  |  import java.math.BigInteger;
 | 
	
		
			
				|  |  |  import java.text.ParseException;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
	
		
			
				|  | @@ -296,7 +305,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public R updateAndSyn(List<WbsFormElement> wbsFormElementList, String initTableName) {
 | 
	
		
			
				|  |  | +    public R updateAndSyn(List<WbsFormElement> wbsFormElementList, String initTableName) throws Exception {
 | 
	
		
			
				|  |  |          if (StringUtils.isEmpty(initTableName)) {
 | 
	
		
			
				|  |  |              return R.fail("未获取到initTableName对应实体表名称,操作失败");
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -388,6 +397,26 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //元素库修改元素的同时要去修改html上面的元素
 | 
	
		
			
				|  |  | +            String sql="select DISTINCT html_url from m_wbs_tree_private where init_table_name='"+initTableName+"' and is_deleted=0 and html_url is not null";
 | 
	
		
			
				|  |  | +            List<String> htmlurls = jdbcTemplate.query(sql, new SingleColumnRowMapper<>(String.class));
 | 
	
		
			
				|  |  | +            if(!htmlurls.isEmpty()){
 | 
	
		
			
				|  |  | +                for (String htmlurl : htmlurls) {
 | 
	
		
			
				|  |  | +                    InputStream inputStream = FileUtils.getInputStreamByUrl(htmlurl);
 | 
	
		
			
				|  |  | +                    String htmlString = IoUtil.readToString(inputStream);
 | 
	
		
			
				|  |  | +                    Document doc = Jsoup.parse(htmlString);
 | 
	
		
			
				|  |  | +                    for (WbsFormElement wbsFormElement : wbsFormElements) {
 | 
	
		
			
				|  |  | +                        Elements elements = doc.select("[keyname^=" + wbsFormElement.getEKey() + "__]");;
 | 
	
		
			
				|  |  | +                        for (Element element : elements) {
 | 
	
		
			
				|  |  | +                            element.attr("placeholder", wbsFormElement.getEName());
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    File writefile = new File(htmlurl);
 | 
	
		
			
				|  |  | +                    FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
 | 
	
		
			
				|  |  | +                    inputStream.close();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return R.success("操作成功");
 | 
	
		
			
				|  |  |      }
 |