|
@@ -31,6 +31,7 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.IWbsTreeContractService;
|
|
|
import org.springblade.manager.utils.DiffListUtil;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -50,6 +51,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
private final WbsTreePrivateMapper wbsTreePrivateMapper;
|
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
public List<WbsTreeContract> selectQueryCurrentNodeByAncestors(List<String> ids, String contractId) {
|
|
|
return this.baseMapper.selectQueryCurrentNodeByAncestors(ids, contractId);
|
|
@@ -358,19 +361,68 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,String[] excLenght) throws FileNotFoundException {
|
|
|
+ public boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,String[] excLenght){
|
|
|
WbsTreeContract wbsInfo = this.baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, info.getPkId()));
|
|
|
|
|
|
+ String cols = Arrays.stream(excLenght).collect(Collectors.joining(StringPool.COMMA));
|
|
|
|
|
|
List<WbsTreeContract> wbsTreeContractList = this.baseMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.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).reversed()).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);
|
|
|
+
|
|
|
|
|
|
long tabGroupId = SnowFlakeUtil.getId();
|
|
|
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){
|
|
|
+ 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]+"☆";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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{
|
|
|
+ long dataId = SnowFlakeUtil.getId();
|
|
|
+ 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]+"☆";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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+"") ;
|
|
@@ -384,7 +436,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
wbsTreeContract.setPKeyId(newPkId);
|
|
|
wbsTreeContract.setCreateTime(new Date());
|
|
|
wbsTreeContract.setTabGroupId(tabGroupId);
|
|
|
- String nodeName = wbsTreeContractList2.get(0).getNodeName();
|
|
|
+ String nodeName = wbsTreeContractList2.get(wbsTreeContractList2.size()-1).getNodeName();
|
|
|
|
|
|
if (nodeName.indexOf("_PL_") >= 0) {
|
|
|
String[] oldName = nodeName.split("_PL_");
|
|
@@ -406,10 +458,32 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
wbsTreeContract.setPdfUrl("");
|
|
|
wbsTreeContract.setIsCopeTab(3);
|
|
|
addList.add(wbsTreeContract);
|
|
|
+
|
|
|
+ int dataSize = 0;
|
|
|
+ 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 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]+"☆";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ insertSql =insertSql+dataCol+"');";
|
|
|
+ moreData = moreData.stream().skip(excLenght.length).map(com.mixsmart.utils.StringUtils::handleNull).collect(Collectors.toList());
|
|
|
+ addSql.append(insertSql);
|
|
|
}
|
|
|
|
|
|
this.baseMapper.insertBatchSomeColumn(addList);
|
|
|
}
|
|
|
+
|
|
|
+ this.jdbcTemplate.execute(addSql.toString());
|
|
|
for(WbsTreeContract wbsTreeCont:wbsTreeContractList2){
|
|
|
UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
|