|
|
@@ -115,7 +115,10 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void importUser(List<StockGoodsExcel> data, Boolean isCovered) {
|
|
|
+ public R importUser(List<StockGoodsExcel> data, Boolean isCovered) {
|
|
|
+ StringBuffer good = new StringBuffer();//未找到商品信息的商品
|
|
|
+ StringBuffer corp = new StringBuffer();//未找到供应商的商品
|
|
|
+ StringBuffer storage = new StringBuffer();//未找到仓库的商品
|
|
|
for (StockGoodsExcel datum : data) {
|
|
|
StockGoods stockGoods = new StockGoods();
|
|
|
stockGoods.setLockingQuantity(datum.getLockingQuantity());
|
|
|
@@ -145,14 +148,25 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
|
|
|
stockGoods.setCname(goodsDesc.getData().getCname());
|
|
|
stockGoods.setCode(goodsDesc.getData().getCode());
|
|
|
}else {
|
|
|
+ good.append(datum.getCname());
|
|
|
continue;
|
|
|
}
|
|
|
//获取客户id
|
|
|
- R<CorpsDesc> corpsDesc = corpsDescClient.getCorpByName(datum.getCorpName(), SecureUtil.getTenantId());
|
|
|
- if (corpsDesc.isSuccess() && corpsDesc.getData() != null){
|
|
|
- stockGoods.setCorpId(corpsDesc.getData().getId());
|
|
|
- stockGoods.setCorpName(corpsDesc.getData().getCname());
|
|
|
+ if (StringUtils.isNotBlank(datum.getCorpName())){
|
|
|
+ R<CorpsDesc> corpsDesc = corpsDescClient.getCorpByName(datum.getCorpName(), SecureUtil.getTenantId());
|
|
|
+ if (corpsDesc.isSuccess() && corpsDesc.getData() != null){
|
|
|
+ stockGoods.setCorpId(corpsDesc.getData().getId());
|
|
|
+ stockGoods.setCorpName(corpsDesc.getData().getCname());
|
|
|
+ }
|
|
|
+ }else if (StringUtils.isBlank(datum.getCorpName()) && goodsDesc.getData().getCorpId() != null){
|
|
|
+ stockGoods.setCorpId(goodsDesc.getData().getCorpId());
|
|
|
+ stockGoods.setCorpName(goodsDesc.getData().getCorpName());
|
|
|
}else {
|
|
|
+ corp.append(datum.getCname());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (stockGoods.getCorpId() == null){
|
|
|
+ corp.append(datum.getCname());
|
|
|
continue;
|
|
|
}
|
|
|
//获取仓库id
|
|
|
@@ -160,6 +174,7 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
|
|
|
if (storageDesc != null){
|
|
|
stockGoods.setStorageId(storageDesc.getId());
|
|
|
}else {
|
|
|
+ storage.append(datum.getCname());
|
|
|
continue;
|
|
|
}
|
|
|
//查询库存账
|
|
|
@@ -177,6 +192,17 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
|
|
|
baseMapper.updateById(stockGoods);
|
|
|
}
|
|
|
}
|
|
|
+ String message = new String("导入成功");
|
|
|
+ if (StringUtils.isNotBlank(good)){
|
|
|
+ message = message + "在基础资料中未查到商品信息的商品有:" +good.toString();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(corp)){
|
|
|
+ message = message + "在基础资料中未查到供应商的商品有:" +corp.toString();
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(storage)){
|
|
|
+ message = message + "在基础资料中未查到仓库信息的商品有:" +storage.toString();
|
|
|
+ }
|
|
|
+ return R.data(message);
|
|
|
}
|
|
|
|
|
|
@Override
|