|
@@ -342,17 +342,6 @@ public class ProductServiceImpl implements ProductService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 根据企业uu获取当前企业物料数量
|
|
|
|
|
- *
|
|
|
|
|
- * @param enUU 企业UU
|
|
|
|
|
- * @return 当前企业物料数量
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public Integer getCountByEnUU(Long enUU) {
|
|
|
|
|
- return productDao.findByEnUU(enUU).size();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据enUU和采购状态获取物料数目
|
|
* 根据enUU和采购状态获取物料数目
|
|
|
*
|
|
*
|
|
@@ -487,6 +476,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
for (Product product : products) {
|
|
for (Product product : products) {
|
|
|
if (null == product.getId()) {
|
|
if (null == product.getId()) {
|
|
|
if (null != product.getUserUU()) {
|
|
if (null != product.getUserUU()) {
|
|
|
|
|
+ Long userUU = product.getUserUU();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
|
|
|
if (null == product.getCode()) {
|
|
if (null == product.getCode()) {
|
|
|
String code = sdf.format(new Date()) + StringUtil.getRandomString(3);
|
|
String code = sdf.format(new Date()) + StringUtil.getRandomString(3);
|
|
@@ -503,9 +493,9 @@ public class ProductServiceImpl implements ProductService {
|
|
|
saveProducts.add(product);
|
|
saveProducts.add(product);
|
|
|
} else {
|
|
} else {
|
|
|
product = existedProds.get(0);
|
|
product = existedProds.get(0);
|
|
|
- List<ProductUsers> productUsers = productUsersDao.findByEnuuAndUseruuAndPrid(product.getEnUU(), product.getUserUU(), product.getId());
|
|
|
|
|
|
|
+ List<ProductUsers> productUsers = productUsersDao.findByEnuuAndUseruuAndPrid(product.getEnUU(), userUU, product.getId());
|
|
|
if (CollectionUtils.isEmpty(productUsers)) {
|
|
if (CollectionUtils.isEmpty(productUsers)) {
|
|
|
- ProductUsers productUser = new ProductUsers(product.getEnUU(), product.getUserUU(), product.getId());
|
|
|
|
|
|
|
+ ProductUsers productUser = new ProductUsers(product.getEnUU(), userUU, product.getId());
|
|
|
saveProductUsers.add(productUser);
|
|
saveProductUsers.add(productUser);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -592,6 +582,149 @@ public class ProductServiceImpl implements ProductService {
|
|
|
return map;
|
|
return map;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据enUU和code查找企业物料
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param code 物料编号
|
|
|
|
|
+ * @return 物料List -- 其实只有一个,为了配合之前B2B未建唯一索引时的查询方法,返回List
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndCode(Long enUU, String code) {
|
|
|
|
|
+ return productDao.findByEnUUAndCode(enUU, code);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据id查找企业物料
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 物料id
|
|
|
|
|
+ * @return 物料
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Product findById(Long id) {
|
|
|
|
|
+ return productDao.findOne(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据id字符串获取物料列表 (1,2,3,4...)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param ids
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByIds(String ids) {
|
|
|
|
|
+ String[] idArray = ids.split(",");
|
|
|
|
|
+ Set<Long> idSet = new HashSet<>();
|
|
|
|
|
+ for (String id : idArray) {
|
|
|
|
|
+ if (!StringUtils.isEmpty(id)) {
|
|
|
|
|
+ idSet.add(Long.valueOf(id));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return productDao.findAll(idSet);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据enUU 和物料编号list 批量获取物料信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param codes 物料编号List
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndCodes(Long enUU, List<String> codes) {
|
|
|
|
|
+ Set<String> codeSet = new HashSet<>(codes);
|
|
|
|
|
+ return productDao.findByEnUUAndCodeSet(enUU, codeSet);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过uu和名称判断物料是否存在(新增采购导入时需用到)
|
|
|
|
|
+ * 数量大时,速度会很慢 2018年7月11日 15:19:03 dongbw
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param title 物料名称
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndTitle(Long enUU, String title) {
|
|
|
|
|
+ return productDao.findByEnUUAndTitle(enUU, title);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过品牌和enuu查询所有信息
|
|
|
|
|
+ * 数量大时,速度会很慢 2018年7月11日 15:18:43 dongbw
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param brand 品牌
|
|
|
|
|
+ * @param isSale 是否可销售(1可 0 不可)
|
|
|
|
|
+ * @return 物料信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndBrandAndIsSale(Long enUU, String brand, Short isSale) {
|
|
|
|
|
+ return productDao.findByEnUUAndBrandAndIsSale(enUU, brand, isSale);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过品牌和enuu查询所有信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param brand 品牌
|
|
|
|
|
+ * @return 物料信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndBrand(Long enUU, String brand) {
|
|
|
|
|
+ return productDao.findByEnUUAndBrand(enUU, brand);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过品牌和enuu查询所有信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enuu 企业UU
|
|
|
|
|
+ * @param brand 品牌
|
|
|
|
|
+ * @param isPurc 是否待采购
|
|
|
|
|
+ * @return 物料信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndBrandAndIsPurchase(Long enuu, String brand, Short isPurc) {
|
|
|
|
|
+ return productDao.findByEnUUAndBrandAndIsPurchase(enuu, brand, isPurc);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过名称查询物料信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param title 物料名称
|
|
|
|
|
+ * @param isSale 是否待销售
|
|
|
|
|
+ * @return 物料信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndTitleAndIsSale(Long enUU, String title, Short isSale) {
|
|
|
|
|
+ return productDao.findByEnUUAndTitleAndIsSale(enUU, title, isSale);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过名称查询物料信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @param title 物料名称
|
|
|
|
|
+ * @param isPurc 是否待采购
|
|
|
|
|
+ * @return 物料信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> findByEnUUAndTitleAndIsPurchase(Long enUU, String title, Short isPurc) {
|
|
|
|
|
+ return productDao.findByEnUUAndTitleAndIsPurchase(enUU, title, isPurc);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过企业UU号查询物料上传数量
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enUU 企业UU
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long countByEnUU(Long enUU) {
|
|
|
|
|
+ return productDao.countByEnUU(enUU);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 更新物料信息
|
|
* 更新物料信息
|
|
|
* @param data 物料资料
|
|
* @param data 物料资料
|