|
@@ -12,8 +12,10 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.tool.utils.*;
|
|
|
+import org.springblade.manager.bean.TableInfo;
|
|
|
import org.springblade.manager.dto.*;
|
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.entity.Formula;
|
|
@@ -174,7 +176,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
String tableName = nodeList.get(0).getInitTableName();
|
|
|
try {
|
|
|
if(!this.tec.getCoordinateMap().containsKey(tableName)){
|
|
|
- this.tec.getCoordinateMap().put(tableName, getTableCols(nodeList.get(0), null));
|
|
|
+ this.tec.getCoordinateMap().put(tableName, getTableCols(nodeList.get(0)));
|
|
|
}
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
@@ -244,7 +246,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public Map<String, String> getTableCols(AppWbsTreeContractVO wbsTreeContract, String colkey) throws FileNotFoundException {
|
|
|
+ public Map<String, String> getTableCols(AppWbsTreeContractVO wbsTreeContract) throws FileNotFoundException {
|
|
|
Map<String, String> dataMap = new HashMap<>();
|
|
|
if (Func.isEmpty(wbsTreeContract.getHtmlUrl())) {
|
|
|
return dataMap;
|
|
@@ -527,6 +529,52 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void copy(FormData fd){
|
|
|
+ WbsTreeContract origin = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId,fd.getTableIds().get(fd.getTableIds().size()-1)));
|
|
|
+ if(origin!=null){
|
|
|
+ /*复制表*/
|
|
|
+ WbsTreeContract target = new WbsTreeContract();
|
|
|
+ BeanUtil.copy(origin,target);
|
|
|
+ target.setPKeyId(SnowFlakeUtil.getId());
|
|
|
+ this.wbsTreeContractService.saveOrUpdate(target);
|
|
|
+ tec.getKeyMappers().stream().filter(e->e.getPkId().equals(origin.getPKeyId())).findFirst().ifPresent(d->{
|
|
|
+ /*添加KeyMapper映射关系*/
|
|
|
+ KeyMapper km = new KeyMapper();
|
|
|
+ BeanUtil.copy(d,km);
|
|
|
+ km.setPkId(target.getPKeyId());
|
|
|
+ tec.getKeyMappers().add(km);
|
|
|
+ tec.getTableInfoList().stream().filter(o->StringUtils.isEquals(o.getPkeyId(),origin.getPKeyId())).findFirst().ifPresent(tb->{
|
|
|
+ /*表单数据复制*/
|
|
|
+ TableInfo tableInfo = new TableInfo();
|
|
|
+ BeanUtil.copy(tb,tableInfo);
|
|
|
+ tableInfo.setDataMap(new LinkedHashMap<>());
|
|
|
+ tec.getTableInfoList().add(tableInfo);
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void enlarge(FormData fd,int size){
|
|
|
+ int pageSize = fd.getCoordsList().size();
|
|
|
+ int pageAdd=(int)Math.ceil((double)size/(double) pageSize);
|
|
|
+ Map<String,List<KeyMapper>> kmMap = this.tec.getKeyMappers().stream().collect(Collectors.groupingBy(KeyMapper::getTableName));
|
|
|
+ List<KeyMapper> kms = kmMap.get(fd.getTableName());
|
|
|
+ kms.forEach(k->{
|
|
|
+ FormData tmp = tec.getFormDataMap().get(k.getCode());
|
|
|
+ if(tmp!=null){
|
|
|
+ List<Coords> list = tmp.getCoordsList();
|
|
|
+ ElementData last = tmp.getValues().get(tmp.getValues().size()-1);
|
|
|
+ int index =last.getIndex();
|
|
|
+ int groupId=last.getGroupId();
|
|
|
+ for(int i=0;i<pageAdd;i++){
|
|
|
+ int finalIndex = index;
|
|
|
+ tmp.getValues().addAll(list.stream().map(c-> new ElementData(finalIndex,groupId,null,c.getX(),c.getY())).collect(Collectors.toList()));
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|