|
@@ -12,6 +12,7 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.springblade.business.entity.ConstructionLedger;
|
|
|
import org.springblade.business.feign.ConstructionLedgerFeignClient;
|
|
|
+import org.springblade.business.feign.InformationQueryClient;
|
|
|
import org.springblade.common.utils.FileUtils;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
@@ -51,6 +52,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
+ private final InformationQueryClient informationQueryClient;
|
|
|
|
|
|
@Override
|
|
|
public List<WbsTreeContract> selectQueryCurrentNodeByAncestors(List<String> ids, String contractId) {
|
|
@@ -86,7 +88,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
//获取当前合同段所有节点、表单(不包括客户端新增或者复制节点)
|
|
|
List<WbsTreeContract> list = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
- .select(WbsTreeContract::getId, WbsTreeContract::getType)
|
|
|
+ .select(WbsTreeContract::getId, WbsTreeContract::getType, WbsTreeContract::getParentId)
|
|
|
.eq(WbsTreeContract::getContractId, pawDTO.getContractId())
|
|
|
.eq(WbsTreeContract::getWbsId, pawDTO.getWbsId())
|
|
|
.eq(WbsTreeContract::getStatus, 1)
|
|
@@ -179,6 +181,14 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
throw new ServiceException(StringUtil.format("节点下的 {} 中存在填报数据,删除失败!", names));
|
|
|
}
|
|
|
baseMapper.deleteBatch(ids1, pawDTO.getWbsId(), pawDTO.getProjectId(), pawDTO.getContractId());
|
|
|
+
|
|
|
+ //更新redis缓存
|
|
|
+ List<WbsTreeContract> delObjList = list.stream().filter(f -> ids1.contains(f.getId())).collect(Collectors.toList());
|
|
|
+ Map<Long, List<WbsTreeContract>> collect = delObjList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getParentId())).collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
+ for (Map.Entry<Long, List<WbsTreeContract>> longListEntry : collect.entrySet()) {
|
|
|
+ informationQueryClient.AsyncWbsTree(longListEntry.getKey().toString() + "", longListEntry.getKey() + "", pawDTO.getContractId(), "", "1");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//TODO ---------新增---------
|
|
@@ -233,6 +243,12 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
this.insertBatch(wbsTreeContractList, 1000);
|
|
|
constructionLedgerFeign.initConstructionLedger(constructionLedgerList);
|
|
|
+
|
|
|
+ //更新redis缓存
|
|
|
+ Map<Long, List<WbsTreeContract>> collect = wbsTreeContractList.stream().filter(f -> new Integer(1).equals(f.getType()) && ObjectUtil.isNotEmpty(f.getParentId())).collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
+ for (Map.Entry<Long, List<WbsTreeContract>> longListEntry : collect.entrySet()) {
|
|
|
+ informationQueryClient.AsyncWbsTree("", longListEntry.getKey().toString(), pawDTO.getContractId(), "", "1");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
@@ -359,7 +375,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
// 频率添加表单
|
|
|
@Override
|
|
|
- public boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,String[] excLenght){
|
|
|
+ public boolean addTabInfoByRan(RangeInfo info, List<Object> moreData, String[] excLenght) {
|
|
|
WbsTreeContract wbsInfo = this.baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, info.getPkId()));
|
|
|
|
|
@@ -369,7 +385,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
.eq(WbsTreeContract::getId, wbsInfo.getId())
|
|
|
.eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
|
|
|
.eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
|
|
|
- List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().filter(wbsTreeContract -> wbsTreeContract.getIsCopeTab() ==null || wbsTreeContract.getIsCopeTab()==3).sorted(Comparator.comparing(WbsTreeContract::getCreateTime)).collect(Collectors.toList());
|
|
|
+ List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().filter(wbsTreeContract -> wbsTreeContract.getIsCopeTab() == null || wbsTreeContract.getIsCopeTab() == 3).sorted(Comparator.comparing(WbsTreeContract::getCreateTime)).collect(Collectors.toList());
|
|
|
|
|
|
int indexId = wbsTreeContractList2.indexOf(wbsInfo);
|
|
|
|
|
@@ -378,73 +394,73 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
List<WbsTreeContract> addList = new ArrayList<>();
|
|
|
StringBuilder addSql = new StringBuilder();
|
|
|
//修改或新增数据
|
|
|
- for(int i=indexId+1 ; i<wbsTreeContractList2.size();i++){
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractList2.get(i);
|
|
|
- List<Map<String, Object>> DataMap = jdbcTemplate.queryForList("select * from " + wbsInfo.getInitTableName() + " where p_key_id=" + wbsTreeContract.getPKeyId());
|
|
|
-
|
|
|
- int dataSize = 0;
|
|
|
- if(moreData.size()>= excLenght.length){
|
|
|
- dataSize =excLenght.length;
|
|
|
- }else{
|
|
|
- dataSize =moreData.size();
|
|
|
- if(dataSize<=0){
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(DataMap!=null && DataMap.size()>=1){
|
|
|
+ for (int i = indexId + 1; i < wbsTreeContractList2.size(); i++) {
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractList2.get(i);
|
|
|
+ List<Map<String, Object>> DataMap = jdbcTemplate.queryForList("select * from " + wbsInfo.getInitTableName() + " where p_key_id=" + wbsTreeContract.getPKeyId());
|
|
|
+
|
|
|
+ int dataSize = 0;
|
|
|
+ if (moreData.size() >= excLenght.length) {
|
|
|
+ dataSize = excLenght.length;
|
|
|
+ } else {
|
|
|
+ dataSize = moreData.size();
|
|
|
+ if (dataSize <= 0) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (DataMap != null && DataMap.size() >= 1) {
|
|
|
String dataCol = "";
|
|
|
- String updateSql = "update "+wbsInfo.getInitTableName()+" set "+info.getKey() +"=";
|
|
|
- for(int j=0; j<dataSize;j++){
|
|
|
- if(j==dataSize-1){
|
|
|
- dataCol = dataCol + moreData.get(j) +"_^_"+excLenght[j];
|
|
|
- }else{
|
|
|
- dataCol = dataCol + moreData.get(j) +"_^_"+excLenght[j]+"☆";
|
|
|
+ String updateSql = "update " + wbsInfo.getInitTableName() + " set " + info.getKey() + "=";
|
|
|
+ for (int j = 0; j < dataSize; j++) {
|
|
|
+ if (j == dataSize - 1) {
|
|
|
+ dataCol = dataCol + moreData.get(j) + "_^_" + excLenght[j];
|
|
|
+ } else {
|
|
|
+ dataCol = dataCol + moreData.get(j) + "_^_" + excLenght[j] + "☆";
|
|
|
}
|
|
|
}
|
|
|
- updateSql = updateSql + "'"+dataCol +"' where p_key_id=" + wbsTreeContract.getPKeyId() +" ;";
|
|
|
+ updateSql = updateSql + "'" + dataCol + "' where p_key_id=" + wbsTreeContract.getPKeyId() + " ;";
|
|
|
moreData = moreData.stream().skip(excLenght.length).map(com.mixsmart.utils.StringUtils::handleNull).collect(Collectors.toList());
|
|
|
addSql.append(updateSql);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
long dataId = SnowFlakeUtil.getId();
|
|
|
- String insertSql = "insert into "+wbsInfo.getInitTableName() +"(id,p_key_id,"+info.getKey()+") VALUES ("+dataId+","+ wbsTreeContract.getPKeyId()+",'";
|
|
|
+ String insertSql = "insert into " + wbsInfo.getInitTableName() + "(id,p_key_id," + info.getKey() + ") VALUES (" + dataId + "," + wbsTreeContract.getPKeyId() + ",'";
|
|
|
String dataCol = "";
|
|
|
- for(int j=0; j<dataSize;j++){
|
|
|
- if(j==dataSize-1){
|
|
|
- dataCol = dataCol + moreData.get(j) +"_^_"+excLenght[j];
|
|
|
- }else{
|
|
|
- dataCol = dataCol + moreData.get(j) +"_^_"+excLenght[j]+"☆";
|
|
|
+ for (int j = 0; j < dataSize; j++) {
|
|
|
+ if (j == dataSize - 1) {
|
|
|
+ dataCol = dataCol + moreData.get(j) + "_^_" + excLenght[j];
|
|
|
+ } else {
|
|
|
+ dataCol = dataCol + moreData.get(j) + "_^_" + excLenght[j] + "☆";
|
|
|
}
|
|
|
}
|
|
|
- insertSql =insertSql+dataCol+"');";
|
|
|
+ insertSql = insertSql + dataCol + "');";
|
|
|
moreData = moreData.stream().skip(excLenght.length).map(com.mixsmart.utils.StringUtils::handleNull).collect(Collectors.toList());
|
|
|
addSql.append(insertSql);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//计算张数
|
|
|
- double tabCount = moreData.size() / Double.parseDouble(excLenght.length+"") ;
|
|
|
- double tabsCount = Math.ceil(tabCount);//- wbsTreeContractList2.size()+indexId+1;
|
|
|
- int maxIndex=0;
|
|
|
- if(tabsCount>=1){
|
|
|
- for(int i =0 ;i<tabsCount;i++){
|
|
|
+ double tabCount = moreData.size() / Double.parseDouble(excLenght.length + "");
|
|
|
+ double tabsCount = Math.ceil(tabCount);//- wbsTreeContractList2.size()+indexId+1;
|
|
|
+ int maxIndex = 0;
|
|
|
+ if (tabsCount >= 1) {
|
|
|
+ for (int i = 0; i < tabsCount; i++) {
|
|
|
long newPkId = SnowFlakeUtil.getId();
|
|
|
WbsTreeContract wbsTreeContract = new WbsTreeContract();
|
|
|
- BeanUtil.copy(wbsInfo,wbsTreeContract);
|
|
|
+ BeanUtil.copy(wbsInfo, wbsTreeContract);
|
|
|
wbsTreeContract.setPKeyId(newPkId);
|
|
|
wbsTreeContract.setCreateTime(new Date());
|
|
|
wbsTreeContract.setTabGroupId(tabGroupId);
|
|
|
- String nodeName = wbsTreeContractList2.get(wbsTreeContractList2.size()-1).getNodeName();
|
|
|
+ String nodeName = wbsTreeContractList2.get(wbsTreeContractList2.size() - 1).getNodeName();
|
|
|
|
|
|
if (nodeName.indexOf("_PL_") >= 0) {
|
|
|
String[] oldName = nodeName.split("_PL_");
|
|
|
- if(i==0){
|
|
|
+ if (i == 0) {
|
|
|
maxIndex = Integer.parseInt(oldName[1]);
|
|
|
}
|
|
|
- maxIndex =maxIndex+1 ;
|
|
|
+ maxIndex = maxIndex + 1;
|
|
|
nodeName = oldName[0] + "_PL_" + maxIndex;
|
|
|
} else {
|
|
|
- maxIndex =maxIndex+1 ;
|
|
|
+ maxIndex = maxIndex + 1;
|
|
|
nodeName = nodeName + "_PL_" + maxIndex;
|
|
|
}
|
|
|
|
|
@@ -458,22 +474,22 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
addList.add(wbsTreeContract);
|
|
|
|
|
|
int dataSize = 0;
|
|
|
- if(moreData.size()>= excLenght.length){
|
|
|
- dataSize =excLenght.length;
|
|
|
- }else{
|
|
|
- dataSize =moreData.size();
|
|
|
+ if (moreData.size() >= excLenght.length) {
|
|
|
+ dataSize = excLenght.length;
|
|
|
+ } else {
|
|
|
+ dataSize = moreData.size();
|
|
|
}
|
|
|
long dataId = SnowFlakeUtil.getId();
|
|
|
- String insertSql = "insert into "+wbsInfo.getInitTableName() +"(id,p_key_id,"+info.getKey()+") VALUES ("+dataId+","+ wbsTreeContract.getPKeyId()+",'";
|
|
|
+ String insertSql = "insert into " + wbsInfo.getInitTableName() + "(id,p_key_id," + info.getKey() + ") VALUES (" + dataId + "," + wbsTreeContract.getPKeyId() + ",'";
|
|
|
String dataCol = "";
|
|
|
- for(int j=0; j<dataSize;j++){
|
|
|
- if(j==dataSize-1){
|
|
|
- dataCol = dataCol + moreData.get(j) +"_^_"+excLenght[j];
|
|
|
- }else{
|
|
|
- dataCol = dataCol + moreData.get(j) +"_^_"+excLenght[j]+"☆";
|
|
|
+ for (int j = 0; j < dataSize; j++) {
|
|
|
+ if (j == dataSize - 1) {
|
|
|
+ dataCol = dataCol + moreData.get(j) + "_^_" + excLenght[j];
|
|
|
+ } else {
|
|
|
+ dataCol = dataCol + moreData.get(j) + "_^_" + excLenght[j] + "☆";
|
|
|
}
|
|
|
}
|
|
|
- insertSql =insertSql+dataCol+"');";
|
|
|
+ insertSql = insertSql + dataCol + "');";
|
|
|
moreData = moreData.stream().skip(excLenght.length).map(com.mixsmart.utils.StringUtils::handleNull).collect(Collectors.toList());
|
|
|
addSql.append(insertSql);
|
|
|
}
|
|
@@ -482,12 +498,12 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
|
|
|
this.jdbcTemplate.execute(addSql.toString());
|
|
|
- for(WbsTreeContract wbsTreeCont:wbsTreeContractList2){
|
|
|
+ for (WbsTreeContract wbsTreeCont : wbsTreeContractList2) {
|
|
|
UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
|
|
|
updateWrapper.set("tab_group_id", tabGroupId);
|
|
|
wbsTreeCont.setTabGroupId(tabGroupId);
|
|
|
- this.getBaseMapper().update(wbsTreeCont,updateWrapper);
|
|
|
+ this.getBaseMapper().update(wbsTreeCont, updateWrapper);
|
|
|
}
|
|
|
return false;
|
|
|
}
|