|
|
@@ -63,6 +63,7 @@ import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
import org.apache.commons.beanutils.ConvertUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -2225,12 +2226,51 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Override
|
|
|
public List<Product> findProductsByProdNums(List<String> prodNums) {
|
|
|
if (CollectionUtils.isNotEmpty(prodNums)) {
|
|
|
- return productDao.findByProdNums(prodNums);
|
|
|
+ List<Product> productDaoByProdNums = productDao.findByProdNums(prodNums);
|
|
|
+ return productDaoByProdNums;
|
|
|
} else {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根物料标号,获取物料编号和物料id(单独写这个方法是为了解决,从主数据库保存之后,马上获取信息,获取不到的问题,主从同步需要时间)
|
|
|
+ *
|
|
|
+ * @param prodNums 物料编号list
|
|
|
+ * @return 返回物料信息。
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Product> findProductIdAndProdnumsByProdNums(List<String> prodNums) {
|
|
|
+ if (CollectionUtils.isEmpty(prodNums)) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ if (sysConf.getProfile().equals("prod")) {
|
|
|
+ String sql = "/*#mycat:db_type=master*/ select p.pr_id, p.pr_code from products p left join product$private pp on pp.pr_id = p.pr_id and pp.pr_b2cenabled = 1 where p.pr_code in (:prodNums)";
|
|
|
+ Map<String, Object> map = new HashedMap();
|
|
|
+ map.put("prodNums", prodNums);
|
|
|
+ List<Map<String, Object>> maps = namedParameterJdbcTemplate.queryForList(sql, map);
|
|
|
+ List<Product> list = new ArrayList<>();
|
|
|
+ Product product = null;
|
|
|
+ for (Map<String, Object> stringObjectMap : maps) {
|
|
|
+ product = new Product();
|
|
|
+ Object pr_id = stringObjectMap.get("pr_id");
|
|
|
+ if (pr_id != null) {
|
|
|
+ product.setId((Long) pr_id);
|
|
|
+ }
|
|
|
+ Object pr_code = stringObjectMap.get("pr_code");
|
|
|
+ if (pr_code != null) {
|
|
|
+ product.setProdNum((String) pr_code);
|
|
|
+ }
|
|
|
+ if ((pr_code != null) && (pr_id != null)) {
|
|
|
+ list.add(product);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ } else {
|
|
|
+ return findProductsByProdNums(prodNums);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 批量保存,通过jdbctemplate
|
|
|
*
|