Commit 8de05bb1 authored by zhkwei's avatar zhkwei

Merge branch 'dev_mysql' of C:\Users\ZhiKai Z Wei\Project\atms with conflicts.

parent 64b25282
...@@ -167,7 +167,6 @@ public class AssetListServiceImpl extends BaseService { ...@@ -167,7 +167,6 @@ public class AssetListServiceImpl extends BaseService {
saveResult.setResult(false); saveResult.setResult(false);
return saveResult; return saveResult;
} }
;
//在循环取数据外定义资产类别map,防止map重新定义,不能过滤重复资产类别 //在循环取数据外定义资产类别map,防止map重新定义,不能过滤重复资产类别
Set assetNameSet = new HashSet(); Set assetNameSet = new HashSet();
...@@ -176,17 +175,16 @@ public class AssetListServiceImpl extends BaseService { ...@@ -176,17 +175,16 @@ public class AssetListServiceImpl extends BaseService {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(now.get(Calendar.YEAR)); sb.append(now.get(Calendar.YEAR));
if(now.get(Calendar.MONTH) + 1<=9){ if(now.get(Calendar.MONTH) + 1 < 10){
sb.append(0); sb.append(0);
} }
sb.append(now.get(Calendar.MONTH) + 1); sb.append(now.get(Calendar.MONTH) + 1);
//在循环存储新的资产之前先删除原有资产 List<CitAssetsList> citAssetsLists = new ArrayList<>();
deleteByExample(projectId); StringBuilder errorMsgSb = new StringBuilder("第");
//通过循环来完成sheet获取每一行每一列数据并进行相关逻辑处理 //通过循环来完成sheet获取每一行每一列数据并进行相关逻辑处理
for (int rowNum = sheet.getFirstRowNum() + 1; rowNum <= sheet.getLastRowNum(); rowNum++) { for (int rowNum = sheet.getFirstRowNum() + 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
CitAssetsList citAsset = new CitAssetsList(); CitAssetsList citAsset = new CitAssetsList();
citAsset.setId(idService.nextId()); citAsset.setId(idService.nextId());
//赋值projectId //赋值projectId
citAsset.setProjectId(projectId); citAsset.setProjectId(projectId);
...@@ -197,11 +195,24 @@ public class AssetListServiceImpl extends BaseService { ...@@ -197,11 +195,24 @@ public class AssetListServiceImpl extends BaseService {
Row rowData = sheet.getRow(rowNum); Row rowData = sheet.getRow(rowNum);
//因模板固定,则按照写死的做法处理数据单元格数据 //因模板固定,则按照写死的做法处理数据单元格数据
citAsset = cellToCitAsset(rowData, citAsset, assetNameSet, citAssetGroupResults); citAsset = cellToCitAsset(rowData, citAsset, assetNameSet, citAssetGroupResults);
if(citAsset == null){
saveResult.setResult(false);
errorMsgSb.append(rowNum+",");
}
if(!saveResult.getResult()){
saveResult.setResultMsg("行数据为空或格式错误!");
}
//目前没有进行税法分类,标注状态 //目前没有进行税法分类,标注状态
citAsset.setStatus(0); citAsset.setStatus(0);
assetListMapper.insertSelective(citAsset); citAssetsLists.add(citAsset);
} }
//在循环存储新的资产之前先删除原有资产
deleteByExample(projectId);
//循环存储新的资产
for (CitAssetsList citAsset : citAssetsLists){
assetListMapper.insertSelective(citAsset);
}
//处理资产类别 //处理资产类别
//1、根据projectId查询数据库中已有的资产类别,并和新导入的资产类别进行比较 //1、根据projectId查询数据库中已有的资产类别,并和新导入的资产类别进行比较
// for (CitAssetGroupResult groupResult : citAssetGroupResults) { // for (CitAssetGroupResult groupResult : citAssetGroupResults) {
...@@ -232,6 +243,9 @@ public class AssetListServiceImpl extends BaseService { ...@@ -232,6 +243,9 @@ public class AssetListServiceImpl extends BaseService {
//获取资产编号 //获取资产编号
Cell cell = rowData.getCell(1); Cell cell = rowData.getCell(1);
Object value = getValue(cell); Object value = getValue(cell);
if (value == null) {
return null;
}
citAsset.setAssetNumber(value.toString()); citAsset.setAssetNumber(value.toString());
//获取资产描述 //获取资产描述
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment