|
@@ -21,6 +21,7 @@ import com.inkasso.adapter.web.LoginUserHolder;
|
|
|
import com.inkasso.auth.exception.ValidatorException;
|
|
|
import com.inkasso.factoring.acceptanceManagement.dao.CAcceptanceBasicInfoMapper;
|
|
|
import com.inkasso.factoring.acceptanceManagement.entity.*;
|
|
|
+import com.inkasso.factoring.acceptanceManagement.entity.request.AcceptanceImportGoodsRequest;
|
|
|
import com.inkasso.factoring.acceptanceManagement.entity.vo.AcceptanceListVo;
|
|
|
import com.inkasso.factoring.acceptanceManagement.entity.vo.CAcceptanceGoodsExcelInfo;
|
|
|
import com.inkasso.factoring.acceptanceManagement.service.ICAcceptanceBasicInfoService;
|
|
@@ -585,7 +586,8 @@ public class CAcceptanceBasicInfoServiceImpl extends ServiceImpl<CAcceptanceBasi
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file) {
|
|
|
+ public List<CAcceptanceGoodsExcelInfo> importGoodsInfo(MultipartFile file,
|
|
|
+ AcceptanceImportGoodsRequest acceptanceImportGoodsRequest) {
|
|
|
if (file.isEmpty()) {
|
|
|
throw new BusinessException(CodeUtil.FAIL, "导入Excel文件不能为空");
|
|
|
}
|
|
@@ -606,6 +608,27 @@ public class CAcceptanceBasicInfoServiceImpl extends ServiceImpl<CAcceptanceBasi
|
|
|
goodsInfo.setFloatingPrice(goodsInfo.getFloatingPrice().setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
+ if(acceptanceImportGoodsRequest.getFlag()!=null && acceptanceImportGoodsRequest.getFlag() ==1){
|
|
|
+ List<String> goodsIdList = Lists.newArrayList();
|
|
|
+ //过滤出货物id不是空的
|
|
|
+ acceptanceGoodsInfo = acceptanceGoodsInfo.stream().filter(x->x.getGoodsId()!=null).collect(Collectors.toList());
|
|
|
+ //判断 这个验收单货物 是否存在防止用户 添加新的验收单货物
|
|
|
+ Iterator<CAcceptanceGoodsExcelInfo> it = acceptanceGoodsInfo.iterator();
|
|
|
+ while (it.hasNext()) {
|
|
|
+ CAcceptanceGoodsExcelInfo excel = it.next();
|
|
|
+ String goodsId = excel.getGoodsId();
|
|
|
+ if(goodsIdList.indexOf(goodsId)>=0){
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ CAcceptanceGoodsInfo one = acceptanceGoodsInfoService.lambdaQuery()
|
|
|
+ .eq(CAcceptanceGoodsInfo::getcAcceptanceBasicInfoId,
|
|
|
+ acceptanceImportGoodsRequest.getAcceptanceBasicId())
|
|
|
+ .eq(CAcceptanceGoodsInfo::getId, goodsId).one();
|
|
|
+ if(one==null){
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return (List<CAcceptanceGoodsExcelInfo>) acceptanceGoodsInfo;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|