|
|
@@ -104,7 +104,7 @@ public class MessageListener implements ApplicationListener<SaveReleaseEvent<?,
|
|
|
List<UserAndEnterprise> inquiryEnUUs = commonDao.query(inquirySql, UserAndEnterprise.class);
|
|
|
List<UserAndEnterprise> orderEnUUs = commonDao.query(orderSql, UserAndEnterprise.class);
|
|
|
List<UserAndEnterprise> quotationEnUUs = commonDao.query(quotationSql, UserAndEnterprise.class);
|
|
|
- List<UserAndEnterprise> enuus = new ArrayList<>();
|
|
|
+ Set<UserAndEnterprise> enuus = new HashSet<UserAndEnterprise>();
|
|
|
Set<Long> enUUs = new HashSet<Long>();
|
|
|
enuus.addAll(prodEnUUs);
|
|
|
enuus.addAll(inquiryEnUUs);
|
|
|
@@ -118,12 +118,15 @@ public class MessageListener implements ApplicationListener<SaveReleaseEvent<?,
|
|
|
// 先查询客户分配
|
|
|
String sql = "select distinct(purc$distribute.pd_useruu) useruu from purc$distribute left join purc$vendors " +
|
|
|
"on purc$distribute.pd_vdid = purc$vendors.ve_id where purc$vendors.ve_myenuu = " + item.getInquiry().getEnUU() +
|
|
|
- "and purc$vendors.ve_vendenuu = " + enter.getEnuu();
|
|
|
+ "and purc$vendors.ve_vendenuu = " + enter.getEnuu() + "and purc$distribute.pd_useruu in " +
|
|
|
+ "(select user_uu from sec$userenterprise where sec$userenterprise.en_uu = " + enter.getEnuu() + ")";
|
|
|
List<UserAndEnterprise> uus = commonDao.query(sql, UserAndEnterprise.class);
|
|
|
if(!CollectionUtils.isEmpty(uus)) {
|
|
|
for(UserAndEnterprise uu : uus) {// 再查询单个物料的分配情况
|
|
|
- Integer count = commonDao.queryForObject("select count(1) from product$users left join products on product$users.pu_prid = products.pr_id" +
|
|
|
- " where products.pr_code = '" + item.getProduct().getCode() + "' or products.pr_title = '" + item.getProduct().getTitle() + "'", Integer.class);
|
|
|
+ String countS = "select count(1) from product$users left join products on product$users.pu_prid = products.pr_id" +
|
|
|
+ " where product$users.pu_useruu = " + uu.getUseruu() + " and product$users.pu_enuu = " + enter.getEnuu() +
|
|
|
+ " and (products.pr_code = '" + item.getProduct().getCode() + "' or products.pr_title = '" + item.getProduct().getTitle() + "')";
|
|
|
+ Integer count = commonDao.queryForObject(countS, Integer.class);
|
|
|
if(count > 0)
|
|
|
useruus.add(uu);
|
|
|
}
|