|
|
@@ -248,8 +248,6 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
|
|
|
throw new SecurityException("导入数据不能为空");
|
|
|
}
|
|
|
List<PjProductLaunch> pjProductLaunchList = new ArrayList<>();
|
|
|
- List<PjProductLaunch> launchList = new ArrayList<>();
|
|
|
- List<PjProductLaunch> pjProductLaunchList1 = new ArrayList<>();
|
|
|
List<String> goodsNames = data.stream().map(ProductLaunchImportExcel::getCname).collect(Collectors.toList());
|
|
|
LambdaQueryWrapper<PjGoodsDesc> goodsDescLambdaQueryWrapper = new LambdaQueryWrapper<PjGoodsDesc>()
|
|
|
.eq(PjGoodsDesc::getIsDeleted, 0)
|
|
|
@@ -331,8 +329,8 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
|
|
|
throw new RuntimeException("商品" + e.getCname() + "名称错误或商品不存在");
|
|
|
}
|
|
|
//获得所属公司
|
|
|
- if (StringUtil.isNotBlank(e.getSalesCompanyName())) {
|
|
|
- Dept dept = deptList.stream().filter(item -> item.getFullName().equals(productLaunch.getSalesCompanyName()))
|
|
|
+ if (StringUtil.isNotBlank(AuthUtil.getDeptId())) {
|
|
|
+ Dept dept = deptList.stream().filter(item -> item.getId().equals(Long.parseLong(AuthUtil.getDeptId())))
|
|
|
.findFirst().orElse(null);
|
|
|
if (dept != null) {
|
|
|
productLaunch.setSalesCompanyId(dept.getId());
|
|
|
@@ -356,90 +354,15 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
|
|
|
productLaunch.setCreateUser(AuthUtil.getUserId());
|
|
|
productLaunch.setTenantId(AuthUtil.getTenantId());
|
|
|
productLaunch.setUpAndDownShelves(1);
|
|
|
-// baseMapper.insert(productLaunch);
|
|
|
} else {
|
|
|
productLaunch.setId(one.getId());
|
|
|
productLaunch.setUpdateUser(AuthUtil.getUserId());
|
|
|
productLaunch.setUpdateTime(new Date());
|
|
|
productLaunch.setSharedCompany(one.getSharedCompany());
|
|
|
productLaunch.setVersion(one.getVersion());
|
|
|
-// baseMapper.updateById(productLaunch);
|
|
|
- }
|
|
|
- //获得共享公司
|
|
|
- if (!"1".equals(whetherIntegral)) {
|
|
|
- if (StringUtil.isNotBlank(e.getSharedCompany())) {
|
|
|
- List<Dept> dept = deptList.stream().filter(item -> productLaunch.getSharedCompany().contains(item.getId() + "")).collect(Collectors.toList());
|
|
|
- productLaunch.setSharedCompany("");
|
|
|
- for (Dept item : dept) {
|
|
|
- productLaunch.setSharedCompany(productLaunch.getSharedCompany() + "," + item.getId());
|
|
|
- PjProductLaunch launch = new PjProductLaunch();
|
|
|
- BeanUtils.copyProperties(productLaunch, launch);
|
|
|
- PjProductLaunch selOne = productLaunchList.stream().filter(i -> i.getBillType().equals(1) &&
|
|
|
- i.getGoodsId().equals(productLaunch.getGoodsId()) && i.getSalesCompanyId().equals(item.getId()) &&
|
|
|
- i.getSourceCompanyId().equals(productLaunch.getSalesCompanyId())).findFirst().orElse(null);
|
|
|
- if (ObjectUtil.isEmpty(selOne)) {
|
|
|
- launch.setId(null);
|
|
|
- launch.setBillType(1);
|
|
|
- launch.setWhetherShare(0);
|
|
|
- launch.setUpAndDownShelves(0);
|
|
|
- launch.setCreateUser(AuthUtil.getUserId());
|
|
|
- launch.setCreateTime(new Date());
|
|
|
- launch.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
- launch.setSourceId(productLaunch.getId());
|
|
|
- launch.setSourceCompanyId(productLaunch.getSalesCompanyId());
|
|
|
- launch.setSourceCompanyName(productLaunch.getSalesCompanyName());
|
|
|
- launch.setTenantId(AuthUtil.getTenantId());
|
|
|
- launch.setSharedCompany(null);
|
|
|
- launch.setSalesCompanyId(item.getId());
|
|
|
- launch.setSalesCompanyName(item.getFullName());
|
|
|
- launch.setVersion(0);
|
|
|
-// baseMapper.insert(launch);
|
|
|
- launchList.add(launch);
|
|
|
- } else {
|
|
|
- selOne.setInventory(productLaunch.getInventory());
|
|
|
- selOne.setPriceOne(productLaunch.getPriceOne());
|
|
|
- selOne.setPriceTwo(productLaunch.getPriceTwo());
|
|
|
- selOne.setPriceThree(productLaunch.getPriceThree());
|
|
|
- selOne.setPriceFour(productLaunch.getPriceFour());
|
|
|
- selOne.setBrandItem(productLaunch.getBrandItem());
|
|
|
- selOne.setPlaceProduction(productLaunch.getPlaceProduction());
|
|
|
- selOne.setExplosionProof(productLaunch.getExplosionProof());
|
|
|
- selOne.setOriginalFactory(productLaunch.getOriginalFactory());
|
|
|
- selOne.setSelfRecovery(productLaunch.getSelfRecovery());
|
|
|
- selOne.setUpdateTime(new Date());
|
|
|
- selOne.setUpdateUser(AuthUtil.getUserId());
|
|
|
- selOne.setWhetherShare(0);
|
|
|
- selOne.setUpAndDownShelves(0);
|
|
|
- selOne.setSharedCompany(null);
|
|
|
- selOne.setVersion(selOne.getVersion());
|
|
|
-// baseMapper.updateById(selOne);
|
|
|
- launchList.add(selOne);
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotNull(productLaunch.getSharedCompany()) && productLaunch.getSharedCompany().length() > 1) {
|
|
|
- productLaunch.setSharedCompany(productLaunch.getSharedCompany().substring(1));
|
|
|
- }
|
|
|
- List<PjProductLaunch> list = productLaunchList.stream().filter(item -> item.getBillType().equals(1) &&
|
|
|
- item.getGoodsId().equals(productLaunch.getGoodsId()) && item.getSourceCompanyId().equals(productLaunch.getSalesCompanyId()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (ObjectUtil.isNotEmpty(list)) {
|
|
|
- list.forEach(i -> {
|
|
|
- i.setWhetherShare(1);
|
|
|
- i.setPriceOne(productLaunch.getPriceOne());
|
|
|
- i.setPriceTwo(productLaunch.getPriceTwo());
|
|
|
- i.setPriceThree(productLaunch.getPriceThree());
|
|
|
- i.setPriceFour(productLaunch.getPriceFour());
|
|
|
- i.setVersion(i.getVersion());
|
|
|
- pjProductLaunchList1.add(i);
|
|
|
-// baseMapper.updateById(i);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
pjProductLaunchList.add(productLaunch);
|
|
|
}
|
|
|
- this.saveOrUpdateBatch(launchList);
|
|
|
- this.updateBatchById(pjProductLaunchList1);
|
|
|
this.saveOrUpdateBatch(pjProductLaunchList);
|
|
|
List<PjProductLaunchFiles> filesList = new ArrayList<>();
|
|
|
for (PjProductLaunch item : pjProductLaunchList) {
|
|
|
@@ -981,8 +904,6 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
|
|
|
throw new SecurityException("导入数据不能为空");
|
|
|
}
|
|
|
List<PjProductLaunch> pjProductLaunchList = new ArrayList<>();
|
|
|
- List<PjProductLaunch> launchList = new ArrayList<>();
|
|
|
- List<PjProductLaunch> pjProductLaunchList1 = new ArrayList<>();
|
|
|
List<String> goodsNames = data.stream().map(ProductLaunchImportCodeExcel::getCode).collect(Collectors.toList());
|
|
|
LambdaQueryWrapper<PjGoodsDesc> goodsDescLambdaQueryWrapper = new LambdaQueryWrapper<PjGoodsDesc>()
|
|
|
.eq(PjGoodsDesc::getIsDeleted, 0)
|
|
|
@@ -1066,8 +987,8 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
|
|
|
}
|
|
|
|
|
|
//获得所属公司
|
|
|
- if (StringUtil.isNotBlank(e.getSalesCompanyName())) {
|
|
|
- Dept dept = deptList.stream().filter(item -> item.getFullName().equals(productLaunch.getSalesCompanyName()))
|
|
|
+ if (StringUtil.isNotBlank(AuthUtil.getDeptId())) {
|
|
|
+ Dept dept = deptList.stream().filter(item -> item.getId().equals(Long.parseLong(AuthUtil.getDeptId())))
|
|
|
.findFirst().orElse(null);
|
|
|
if (dept != null) {
|
|
|
productLaunch.setSalesCompanyId(dept.getId());
|
|
|
@@ -1091,90 +1012,15 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
|
|
|
productLaunch.setCreateUser(AuthUtil.getUserId());
|
|
|
productLaunch.setTenantId(AuthUtil.getTenantId());
|
|
|
productLaunch.setUpAndDownShelves(1);
|
|
|
-// baseMapper.insert(productLaunch);
|
|
|
} else {
|
|
|
productLaunch.setId(one.getId());
|
|
|
productLaunch.setUpdateUser(AuthUtil.getUserId());
|
|
|
productLaunch.setUpdateTime(new Date());
|
|
|
productLaunch.setSharedCompany(one.getSharedCompany());
|
|
|
productLaunch.setVersion(one.getVersion());
|
|
|
-// baseMapper.updateById(productLaunch);
|
|
|
- }
|
|
|
- //获得共享公司
|
|
|
- if (!"1".equals(whetherIntegral)) {
|
|
|
- if (StringUtil.isNotBlank(e.getSharedCompany())) {
|
|
|
- List<Dept> dept = deptList.stream().filter(item -> productLaunch.getSharedCompany().contains(item.getId() + "")).collect(Collectors.toList());
|
|
|
- productLaunch.setSharedCompany("");
|
|
|
- for (Dept item : dept) {
|
|
|
- productLaunch.setSharedCompany(productLaunch.getSharedCompany() + "," + item.getId());
|
|
|
- PjProductLaunch launch = new PjProductLaunch();
|
|
|
- BeanUtils.copyProperties(productLaunch, launch);
|
|
|
- PjProductLaunch selOne = productLaunchList.stream().filter(i -> i.getBillType().equals(1) &&
|
|
|
- i.getGoodsId().equals(productLaunch.getGoodsId()) && i.getSalesCompanyId().equals(item.getId()) &&
|
|
|
- i.getSourceCompanyId().equals(productLaunch.getSalesCompanyId())).findFirst().orElse(null);
|
|
|
- if (ObjectUtil.isEmpty(selOne)) {
|
|
|
- launch.setId(null);
|
|
|
- launch.setBillType(1);
|
|
|
- launch.setWhetherShare(0);
|
|
|
- launch.setUpAndDownShelves(0);
|
|
|
- launch.setCreateUser(AuthUtil.getUserId());
|
|
|
- launch.setCreateTime(new Date());
|
|
|
- launch.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
- launch.setSourceId(productLaunch.getId());
|
|
|
- launch.setSourceCompanyId(productLaunch.getSalesCompanyId());
|
|
|
- launch.setSourceCompanyName(productLaunch.getSalesCompanyName());
|
|
|
- launch.setTenantId(AuthUtil.getTenantId());
|
|
|
- launch.setSharedCompany(null);
|
|
|
- launch.setSalesCompanyId(item.getId());
|
|
|
- launch.setSalesCompanyName(item.getFullName());
|
|
|
- launch.setVersion(0);
|
|
|
-// baseMapper.insert(launch);
|
|
|
- launchList.add(launch);
|
|
|
- } else {
|
|
|
- selOne.setInventory(productLaunch.getInventory());
|
|
|
- selOne.setPriceOne(productLaunch.getPriceOne());
|
|
|
- selOne.setPriceTwo(productLaunch.getPriceTwo());
|
|
|
- selOne.setPriceThree(productLaunch.getPriceThree());
|
|
|
- selOne.setPriceFour(productLaunch.getPriceFour());
|
|
|
- selOne.setBrandItem(productLaunch.getBrandItem());
|
|
|
- selOne.setPlaceProduction(productLaunch.getPlaceProduction());
|
|
|
- selOne.setExplosionProof(productLaunch.getExplosionProof());
|
|
|
- selOne.setOriginalFactory(productLaunch.getOriginalFactory());
|
|
|
- selOne.setSelfRecovery(productLaunch.getSelfRecovery());
|
|
|
- selOne.setUpdateTime(new Date());
|
|
|
- selOne.setUpdateUser(AuthUtil.getUserId());
|
|
|
- selOne.setWhetherShare(0);
|
|
|
- selOne.setUpAndDownShelves(0);
|
|
|
- selOne.setSharedCompany(null);
|
|
|
- selOne.setVersion(selOne.getVersion());
|
|
|
-// baseMapper.updateById(selOne);
|
|
|
- launchList.add(selOne);
|
|
|
- }
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotNull(productLaunch.getSharedCompany()) && productLaunch.getSharedCompany().length() > 1) {
|
|
|
- productLaunch.setSharedCompany(productLaunch.getSharedCompany().substring(1, productLaunch.getSharedCompany().length()));
|
|
|
- }
|
|
|
- List<PjProductLaunch> list = productLaunchList.stream().filter(item -> item.getBillType().equals(1) &&
|
|
|
- item.getGoodsId().equals(productLaunch.getGoodsId()) && item.getSourceCompanyId().equals(productLaunch.getSalesCompanyId()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (ObjectUtil.isNotEmpty(list)) {
|
|
|
- list.forEach(i -> {
|
|
|
- i.setWhetherShare(1);
|
|
|
- i.setPriceOne(productLaunch.getPriceOne());
|
|
|
- i.setPriceTwo(productLaunch.getPriceTwo());
|
|
|
- i.setPriceThree(productLaunch.getPriceThree());
|
|
|
- i.setPriceFour(productLaunch.getPriceFour());
|
|
|
- i.setVersion(i.getVersion());
|
|
|
- pjProductLaunchList1.add(i);
|
|
|
-// baseMapper.updateById(i);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
pjProductLaunchList.add(productLaunch);
|
|
|
}
|
|
|
- this.saveOrUpdateBatch(launchList);
|
|
|
- this.updateBatchById(pjProductLaunchList1);
|
|
|
this.saveOrUpdateBatch(pjProductLaunchList);
|
|
|
List<PjProductLaunchFiles> filesList = new ArrayList<>();
|
|
|
for (PjProductLaunch item : pjProductLaunchList) {
|