|
|
@@ -107,6 +107,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Autowired
|
|
|
private CartDao cartDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductPersonDao productPersonDao;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ProductModifyHistoryDao productModifyHistoryDao;
|
|
|
|
|
|
@@ -338,8 +341,16 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void deleteBatch(List<Long> ids) {
|
|
|
+ public void deleteBatch(List<Long> ids, Integer isPerson) {
|
|
|
for (Long id : ids) {
|
|
|
+ if (null != isPerson && isPerson.intValue() == IntegerConstant.YES_SHORT.intValue()) {
|
|
|
+ List<ProductPerson> productPersonList = productPersonDao.findByProductIdAndUserUU(id,SystemSession.getUser().getUserUU());
|
|
|
+ if (!CollectionUtils.isEmpty(productPersonList)) {
|
|
|
+ Long ppid = productPersonList.get(0).getId();
|
|
|
+ productPersonDao.delete(ppid);
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Product product = productDao.findOne(id);
|
|
|
if (product == null)
|
|
|
throw new IllegalOperatorException("选择的产品不存在,请重新选择");
|
|
|
@@ -366,6 +377,11 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
|
}
|
|
|
if (!isExistOrder) {
|
|
|
+ //是否被个人物料库收录
|
|
|
+ int count = productPersonDao.countByProductId(id);
|
|
|
+ if ( count > 0 ){
|
|
|
+ throw new IllegalOperatorException("该产品已被个人物料库收录,不能删除");
|
|
|
+ }
|
|
|
//删除外键关联的匹配结果列表,不然删除product失败
|
|
|
Set<ProductMatchResult> productMatchResultSet = product.getMatchresults();
|
|
|
productMatchResultDao.delete(productMatchResultSet);
|