|
@@ -11,6 +11,7 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.meter.dto.MeterTreeContractSaveBatchDTO;
|
|
@@ -971,7 +972,7 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean contractTreeNodeImport2(String id, MultipartFile file) {
|
|
|
+ public R<String> contractTreeNodeImport2(String id, MultipartFile file) {
|
|
|
MeterTreeContract meterTreeContract = baseMapper.selectById(id);
|
|
|
if (meterTreeContract.getAncestor().split(",").length > 5) {
|
|
|
throw new ServiceException("只能从前五层节点开始导入,操作失败");
|
|
@@ -989,7 +990,20 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
}
|
|
|
|
|
|
/*解析excel*/
|
|
|
- List<Map<String, String>> parseExcelFileToList = this.parseExcelFile(file);
|
|
|
+ List<Map<String, String>> parseExcelFileToList;
|
|
|
+ try {
|
|
|
+ parseExcelFileToList = this.parseExcelFile(file);
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new ServiceException("excel解析失败,请检查格式:"+e.getMessage());
|
|
|
+ }
|
|
|
+ if (parseExcelFileToList.size() == 0){
|
|
|
+ throw new ServiceException("excel中未发现数据,请检查后再导入");
|
|
|
+ }
|
|
|
+ parseExcelFileToList.stream().forEach(l->{
|
|
|
+ if (StringUtils.isNotBlank(l.get("清单编号")) && StringUtils.isBlank(l.get("施工图数量"))){
|
|
|
+ throw new ServiceException("清单:"+l.get("清单编号")+"没有施工图数量,请填写后重新导入");
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
/*节点新增*/
|
|
|
List<MeterTreeContract> resultNodeListAdd = new LinkedList<>();
|
|
@@ -999,6 +1013,8 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
List<InventoryFormMeter> resultFormListAdd = new LinkedList<>();
|
|
|
/*清单中间数量修改*/
|
|
|
List<InventoryFormMeter> resultFormListUpdate = new LinkedList<>();
|
|
|
+ /*合同清单变更后数量修改*/
|
|
|
+ List<ContractInventoryForm> InventoryFormListUpdate = new LinkedList<>();
|
|
|
|
|
|
/*导入节点的子级信息*/
|
|
|
//查询当前节点,有节点编号的所有子节点
|
|
@@ -1406,8 +1422,9 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- boolean var = false;
|
|
|
-
|
|
|
+ int addNode = 0;
|
|
|
+ int addForm = 0;
|
|
|
+ int updateForm = 0;
|
|
|
/*节点*/
|
|
|
if (resultNodeListAdd.size() > 0) {
|
|
|
//判断要新增的数据中,清单编号是否已经存在
|
|
@@ -1419,13 +1436,13 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
}
|
|
|
}
|
|
|
this.saveBatch(resultNodeListAdd, 1000);
|
|
|
- var = true;
|
|
|
+ addNode = resultNodeListAdd.size();
|
|
|
}
|
|
|
|
|
|
/*清单中间新增*/
|
|
|
if (resultFormListAdd.size() > 0) {
|
|
|
inventoryFormMeterMapper.batchInsert(resultFormListAdd);
|
|
|
- var = true;
|
|
|
+ addForm = resultFormListAdd.size();
|
|
|
}
|
|
|
|
|
|
/*清单中间数量修改*/
|
|
@@ -1443,7 +1460,7 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
inventoryFormMeter.getChangeBuildPictureMoney(),
|
|
|
inventoryFormMeter.getId());
|
|
|
}
|
|
|
- var = true;
|
|
|
+ updateForm = resultFormListUpdate.size();
|
|
|
}
|
|
|
|
|
|
/*节点金额修改*/
|
|
@@ -1475,10 +1492,20 @@ public class MeterTreeContractServiceImpl extends BaseServiceImpl<MeterTreeContr
|
|
|
moneyChangeAll,
|
|
|
treeContractId);
|
|
|
}
|
|
|
- var = true;
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ return R.success("成功导入:节点("+addNode+")个,"+"新增清单("+addForm+")条,"+"修改清单("+updateForm+")条.");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 只导入一层
|
|
|
+ * @param id
|
|
|
+ * @param file
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public R<String> contractTreeNodeImport1(String id, MultipartFile file) {
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|