|
|
@@ -16,7 +16,6 @@ import com.uas.ps.inquiry.model.*;
|
|
|
import com.uas.ps.inquiry.page.PageInfo;
|
|
|
import com.uas.ps.inquiry.page.SearchFilter;
|
|
|
import com.uas.ps.inquiry.page.criteria.*;
|
|
|
-import com.uas.ps.inquiry.page.exception.IllegalOperatorException;
|
|
|
import com.uas.ps.inquiry.service.PublicInquiryService;
|
|
|
import com.uas.ps.inquiry.support.InquiryBufferedLogger;
|
|
|
import com.uas.ps.inquiry.util.*;
|
|
|
@@ -66,7 +65,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
private PurcInquiryItemInfoDao inquiryItemInfoDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private PublicInquiryItemInfoDao itemInfoDao;
|
|
|
+ private PublicInquiryItemInfoDao itemInfoDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PublicInquiryItemDao publicInquiryItemDao;
|
|
|
@@ -90,32 +89,16 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
*/
|
|
|
private final String SOURCERAPP = "B2B";
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 消息类型 (在B2B消息中拼接跳转单据详情url请求时需要)
|
|
|
*/
|
|
|
private final String INQUIRY_TYPE = "公共询价";
|
|
|
|
|
|
- /**
|
|
|
- * 消息类型 (在B2B消息中拼接跳转单据详情url请求时需要)
|
|
|
- */
|
|
|
- private final String INQUIRY_TYPE_MALL = "MALL公共询价";
|
|
|
-
|
|
|
- /**
|
|
|
- * 消息类型 (在MALL消息中拼接求购询价待报价)
|
|
|
- */
|
|
|
- private final String INQUIRY_TYPE_SELLER_MALL = "MALL跳转卖家待报价页面";
|
|
|
-
|
|
|
/**
|
|
|
* 消息类型,公共询价的采纳结果
|
|
|
*/
|
|
|
private final String INQUIRY_DECIDE_TYPE = "公共询价采纳结果";
|
|
|
|
|
|
- /**
|
|
|
- * 消息类型,公共询价的采纳结果
|
|
|
- */
|
|
|
- private final String INQUIRY_DECIDE_TYPE_MALL = "商城公共询价采纳结果";
|
|
|
-
|
|
|
/**
|
|
|
* 询价种类
|
|
|
*/
|
|
|
@@ -149,7 +132,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
/**
|
|
|
* 接收应用
|
|
|
*/
|
|
|
- private final String CONSUMERAPP = "B2B";
|
|
|
+ private final String CONSUMERAPP = "B2B,MALL";
|
|
|
|
|
|
/**
|
|
|
* 公共物料访问地址
|
|
|
@@ -218,9 +201,9 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void notifyMessage(List<PurcInquiryItem> inquiryItems, String sourceApp) throws Exception {
|
|
|
- final String CONSUMERAPP ="MALL,B2B";
|
|
|
for (PurcInquiryItem item : inquiryItems) {
|
|
|
String cmpCode = null;
|
|
|
+ //如果型号为空
|
|
|
if (item.getCmpCode() != null) {
|
|
|
cmpCode = item.getCmpCode();
|
|
|
} else if (null != item.getProductId()) {
|
|
|
@@ -236,22 +219,22 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
HttpUtil.Response res = HttpUtil.sendGetRequest(url, formData);
|
|
|
if (res.getStatusCode() == 200) {
|
|
|
List<ProductUsers> users = FlexJsonUtils.fromJsonArray(res.getResponseText(), ProductUsers.class);
|
|
|
- users = getProductReplaceByEnUUAndCmpCode(item.getInquiry().getRecorderUU(), cmpCode, users);
|
|
|
- if (!CollectionUtils.isEmpty(users)) {
|
|
|
+ List<ProductReplace> productReplaces = getProductReplaceByEnUUAndCmpCode(item.getInquiry().getEnUU(), cmpCode, users);
|
|
|
+ if (!CollectionUtils.isEmpty(productReplaces)) {
|
|
|
List<MessageModel> models = new ArrayList<MessageModel>();
|
|
|
- for (ProductUsers user : users) {
|
|
|
+ for (ProductReplace user : productReplaces) {
|
|
|
User u = userDao.findOne(null != item.getInquiry().getRecorderUU() ? item.getInquiry().getRecorderUU() : 0L);
|
|
|
Enterprise e = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
|
|
|
- String content = "发布关于“型号:" + cmp + "”的公共询价信息,邀请您参与报价。";
|
|
|
+ String content = "发布关于“" + cmp + "”的公共询价信息,邀请您参与报价";
|
|
|
if (null != e) {
|
|
|
content = e.getEnName() + content;
|
|
|
} else if (null != u) {
|
|
|
content = u.getUserName() + content;
|
|
|
}
|
|
|
+ //发送短信信息
|
|
|
MessageModel model = new MessageModel();
|
|
|
model.setType(INQUIRY_TYPE);
|
|
|
- model.setType(INQUIRY_TYPE_SELLER_MALL);
|
|
|
model.setProducerApp(sourceApp);
|
|
|
model.setConsumerType(CUST_TYPE);
|
|
|
model.setConsumerApp(CONSUMERAPP);
|
|
|
@@ -259,7 +242,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
model.setRemark(String.valueOf(item.getInquiry().getId()));
|
|
|
model.setSourceId(item.getId());
|
|
|
model.setReceiverEnuu(user.getEnuu());
|
|
|
- model.setReceiverUu(user.getUseruu());
|
|
|
+ model.setReceiverUu(user.getUserUU());
|
|
|
model.setSenderEnuu(item.getInquiry().getEnUU());
|
|
|
if (null != item.getUserUU() || null != item.getInquiry().getRecorderUU()) {
|
|
|
model.setSenderUu(item.getUserUU() != null ? item.getUserUU() : item.getInquiry().getRecorderUU());
|
|
|
@@ -271,19 +254,20 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
model.setMailTemplate(MAIL_TEMP_ID);
|
|
|
model.setSmTemplate(SMS_TEMP_ID);
|
|
|
models.add(model);
|
|
|
- logger.log("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人", "关联询价单明细【" + item.getId() + "】", user.getUseruu(), user.getEnuu(), InquirySource.ERP.name());
|
|
|
+ logger.log("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人", "关联询价单明细【" + item.getId() + "】", user.getUserUU(), user.getEnuu(), InquirySource.ERP.name());
|
|
|
}
|
|
|
+
|
|
|
if (!CollectionUtils.isEmpty(models)) {
|
|
|
sendMessage(models);
|
|
|
}
|
|
|
|
|
|
// 生成推荐信息
|
|
|
- remindInquiry(item, users);
|
|
|
+ remindInquiry(inquiryItems, users);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- String reason = e.getMessage().length() > 10 ? e.getMessage().substring(0, 1000).concat("") : e.getMessage();
|
|
|
- logger.log("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人失败,id" + item.getId(), reason, Constant.UU, Constant.UU, InquirySource.ERP.name());
|
|
|
+ String reson = e.getMessage().length() > 10 ? e.getMessage().substring(0, 1000).concat("") : e.getMessage();
|
|
|
+ logger.log("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人失败,id" + item.getId(), reson, Constant.UU, Constant.UU, InquirySource.ERP.name());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
@@ -293,35 +277,36 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
/**
|
|
|
* 根据企业UU和物料原厂型号cmpCode获取替代物料信息
|
|
|
*
|
|
|
+ * @param enUU 企业UU
|
|
|
* @param cmpCode 物料原厂型号
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ProductUsers> getProductReplaceByEnUUAndCmpCode(final Long userUU, final String cmpCode, List<ProductUsers> productUsers) {
|
|
|
+ public List<ProductReplace> getProductReplaceByEnUUAndCmpCode(final Long enUU, final String cmpCode, List<ProductUsers> productUsers) {
|
|
|
List<ProductReplace> productReplacesList = productReplaceDao.findAll(new Specification<ProductReplace>() {
|
|
|
@Override
|
|
|
public Predicate toPredicate(Root<ProductReplace> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
final PredicateFactory<ProductReplace> factory = new PredicateFactory<>();
|
|
|
- factory.add(PredicateUtils.ne("userUU", userUU, false));
|
|
|
+ factory.add(PredicateUtils.ne("enuu", enUU, false));
|
|
|
factory.add(PredicateUtils.and (PredicateUtils.isNotNull("ptrCmpcode"), PredicateUtils.eq("ptrCmpcode", cmpCode, false)));
|
|
|
query.where(factory.toPredicate(root, query, cb));
|
|
|
return null;
|
|
|
}
|
|
|
});
|
|
|
- if (!CollectionUtils.isEmpty(productReplacesList)) {
|
|
|
- for (ProductReplace productReplace:productReplacesList) {
|
|
|
- ProductUsers user = new ProductUsers();
|
|
|
- user.setEnuu(productReplace.getEnuu());
|
|
|
- user.setUseruu(productReplace.getUserUU());
|
|
|
- productUsers.add(user);
|
|
|
+ if (!CollectionUtils.isEmpty(productUsers)) {
|
|
|
+ for (ProductUsers user:productUsers) {
|
|
|
+ ProductReplace productReplace = new ProductReplace();
|
|
|
+ productReplace.setEnuu(user.getEnuu());
|
|
|
+ productReplace.setUserUU(user.getUseruu());
|
|
|
+ productReplacesList.add(productReplace);
|
|
|
}
|
|
|
}
|
|
|
// 去掉同一企业下同一个人相同原厂型号的不同物料的记录,保证一个原厂型号只发一条
|
|
|
- List<ProductUsers> returnList = new ArrayList<>();
|
|
|
+ List<ProductReplace> returnList = new ArrayList<>();
|
|
|
Set<String> enUUAndUserUUs = new HashSet<>();
|
|
|
- for (ProductUsers user : productUsers) {
|
|
|
- String receiverInfo = user.getEnuu().toString() + user.getUseruu().toString();
|
|
|
+ for (ProductReplace productReplace : productReplacesList) {
|
|
|
+ String receiverInfo = productReplace.getEnuu().toString() + productReplace.getUserUU().toString();
|
|
|
if (!enUUAndUserUUs.contains(receiverInfo)) {
|
|
|
- returnList.add(user);
|
|
|
+ returnList.add(productReplace);
|
|
|
enUUAndUserUUs.add(receiverInfo);
|
|
|
}
|
|
|
}
|
|
|
@@ -331,47 +316,54 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
/**
|
|
|
* 通过查询的个人物料相关联的信息,自动生成推荐的报价的数据
|
|
|
*
|
|
|
- * @param item 报价明细
|
|
|
+ * @param inquiryItems 报价明细
|
|
|
* @param users 用户信息
|
|
|
*/
|
|
|
- private void remindInquiry(final PurcInquiryItem item, final List<ProductUsers> users) {
|
|
|
+ private void remindInquiry(final List<PurcInquiryItem> inquiryItems, final List<ProductUsers> users) {
|
|
|
ThreadUtils.task(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try {
|
|
|
+ List<InquiryRemind> reminds = new ArrayList<InquiryRemind>();
|
|
|
for (ProductUsers u : users) {
|
|
|
- List<InquiryRemind> remindList = remindDao.findByVendUserUUAndVendUUAndItemId(u.getUseruu(), u.getEnuu(), item.getId());
|
|
|
- if (remindList.size() == 0 && item.getInquiry().getEnUU() != null) {
|
|
|
- Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
- InquiryRemind remind = new InquiryRemind();
|
|
|
- remind.setEnName(enterprise.getEnName());
|
|
|
- remind.setEnUU(item.getInquiry().getEnUU());
|
|
|
- remind.setUserName(item.getUserName());
|
|
|
- remind.setUserTel(item.getUserTel());
|
|
|
- remind.setCode(item.getInquiry().getCode());
|
|
|
- remind.setBrand(item.getInbrand());
|
|
|
- remind.setInbrand(item.getInbrand());
|
|
|
- remind.setCmpCode(item.getCmpCode());
|
|
|
- remind.setSpec(item.getSpec());
|
|
|
- remind.setProdTitle(item.getProdTitle());
|
|
|
- remind.setInid(item.getInquiry().getId());
|
|
|
- if (item.getProduct() != null) {
|
|
|
- remind.setBrand(item.getProduct().getBrand());
|
|
|
- remind.setCmpCode(item.getProduct().getCmpCode());
|
|
|
- remind.setSpec(item.getProduct().getSpec());
|
|
|
- remind.setProdTitle(item.getProduct().getTitle());
|
|
|
+ for (PurcInquiryItem item : inquiryItems) {
|
|
|
+ List<InquiryRemind> remindList = remindDao.findByVendUserUUAndVendUUAndItemId(u.getUseruu(), u.getEnuu(), item.getId());
|
|
|
+ if (remindList.size() == 0 && item.getInquiry().getEnUU() != null &&
|
|
|
+ ((item.getProduct() != null && item.getProduct().getCmpCode().equals(u.getProduct().getCmpCode())) ||
|
|
|
+ item.getCmpCode().equals(u.getProduct().getCmpCode()))) {
|
|
|
+ Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
+ InquiryRemind remind = new InquiryRemind();
|
|
|
+ remind.setEnName(enterprise.getEnName());
|
|
|
+ remind.setEnUU(item.getInquiry().getEnUU());
|
|
|
+ remind.setUserName(item.getUserName());
|
|
|
+ remind.setUserTel(item.getUserTel());
|
|
|
+ remind.setCode(item.getInquiry().getCode());
|
|
|
+ remind.setBrand(item.getBrand());
|
|
|
+ remind.setCmpCode(item.getCmpCode());
|
|
|
+ remind.setSpec(item.getSpec());
|
|
|
+ remind.setTitle(item.getProdTitle());
|
|
|
+ if (item.getProduct() != null) {
|
|
|
+ remind.setBrand(item.getProduct().getBrand());
|
|
|
+ remind.setCmpCode(item.getProduct().getCmpCode());
|
|
|
+ remind.setSpec(item.getProduct().getSpec());
|
|
|
+ remind.setTitle(item.getProduct().getTitle());
|
|
|
+ }
|
|
|
+ remind.setItemId(item.getId());
|
|
|
+ remind.setNeedQty(item.getNeedquantity());
|
|
|
+ remind.setReDate(item.getInquiry().getDate());
|
|
|
+ remind.setEndDate(item.getInquiry().getEndDate());
|
|
|
+ remind.setVendUU(u.getEnuu());
|
|
|
+ remind.setVendUserUU(u.getUseruu());
|
|
|
+ remind.setDate(new Date(System.currentTimeMillis()));
|
|
|
+ remind.setStatus(Status.INPUTTING.value());
|
|
|
+ reminds.add(remind);
|
|
|
}
|
|
|
- remind.setItemId(item.getId());
|
|
|
- remind.setNeedQty(item.getNeedquantity());
|
|
|
- remind.setReDate(item.getInquiry().getDate());
|
|
|
- remind.setEndDate(item.getInquiry().getEndDate());
|
|
|
- remind.setVendUU(u.getEnuu());
|
|
|
- remind.setVendUserUU(u.getUseruu());
|
|
|
- remind.setDate(new Date(System.currentTimeMillis()));
|
|
|
- remind.setStatus(Status.INPUTTING.value());
|
|
|
- remindDao.save(remind);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+ if (!CollectionUtils.isEmpty(reminds)) {
|
|
|
+ remindDao.save(reminds);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -450,23 +442,21 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
if (!CollectionUtils.isEmpty(inquiry.getInProducts())) {
|
|
|
for (BatchInProduct batch : inquiry.getInProducts()) {
|
|
|
PurcInquiryItem item = new PurcInquiryItem();
|
|
|
+ item.setIsOpen(Constant.YES);
|
|
|
List<Product> products = productDao.findByEnUUAndCode(enuu, batch.getBip_prodcode());
|
|
|
- if (!CollectionUtils.isEmpty(products)) {
|
|
|
- item.setProductId(products.get(0).getId());
|
|
|
- item.setCmpCode(products.get(0).getCmpCode());
|
|
|
- item.setInbrand(products.get(0).getBrand());
|
|
|
- item.setProdTitle(products.get(0).getTitle());
|
|
|
- item.setSpec(products.get(0).getSpec());
|
|
|
- } else {
|
|
|
- item.setCmpCode(batch.getPr_orispeccode());
|
|
|
- item.setInbrand(batch.getPr_brand());
|
|
|
- item.setProdTitle(batch.getPr_detail());
|
|
|
- item.setSpec(batch.getPr_spec());
|
|
|
+ if (CollectionUtils.isEmpty(products)) {
|
|
|
+ throw new NotFoundException("enUU:[" + enuu + "],编号:[" + batch.getBip_prodcode() + "]");
|
|
|
}
|
|
|
- item.setProdCode(batch.getBip_prodcode());
|
|
|
+ item.setProductId(products.get(0).getId());
|
|
|
+ item.setCmpCode(products.get(0).getCmpCode());
|
|
|
+ item.setInbrand(products.get(0).getBrand());
|
|
|
+ item.setProdTitle(products.get(0).getTitle());
|
|
|
+ item.setSpec(products.get(0).getSpec());
|
|
|
item.setRemark(batch.getBip_remark());
|
|
|
+ item.setProdCode(products.get(0).getCode());
|
|
|
+ item.setProdTitle(products.get(0).getTitle());
|
|
|
item.setNumber(batch.getBip_detno());
|
|
|
- item.setFromDate(new Date(System.currentTimeMillis()));
|
|
|
+ item.setFromDate(new Date());
|
|
|
item.setToDate(purcInquiry.getEndDate());
|
|
|
item.setStatus((short) Status.NOT_REPLY.value());
|
|
|
item.setIsOpen(Constant.YES);
|
|
|
@@ -478,7 +468,6 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
item.setUserCode(batch.getBip_buyercode());
|
|
|
item.setOfferAmount(0);
|
|
|
item.setEndDate(inquiry.getBi_enddate());
|
|
|
- item.setNeedquantity(batch.getYcgqty());
|
|
|
if (null == item.getCmpCode() || item.getCmpCode().equals("无")) {
|
|
|
item.setCmpCode(item.getSpec());
|
|
|
}
|
|
|
@@ -487,8 +476,8 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
} else {
|
|
|
item.setDate(new Date(System.currentTimeMillis()));
|
|
|
}
|
|
|
- if (item.getCustCurrency() == null) {
|
|
|
- item.setCustCurrency("RMB");
|
|
|
+ if (item.getCurrency() == null) {
|
|
|
+ item.setCurrency("RMB");
|
|
|
}
|
|
|
purcInquiryItems.add(item);
|
|
|
}
|
|
|
@@ -631,7 +620,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
product = productDao.findOne(item.getProductId());
|
|
|
}
|
|
|
String cmpCode = product.getCmpCode() != null ? product.getCmpCode() : item.getCmpCode();
|
|
|
- String content = item.getAgreed() == 1 ? "【已采纳】" : "【未采纳】";
|
|
|
+ String content = item.getAgreed() == 1 ? "【采纳】" : "【未采纳】";
|
|
|
content = content + "您关于“" + cmpCode + "”的报价";
|
|
|
if (null != e) {
|
|
|
content = e.getEnName() + content;
|
|
|
@@ -639,7 +628,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
content = u.getUserName() + content;
|
|
|
} else if (null == e && null == u) {
|
|
|
content = "您关于“" + cmpCode + "”的报价已被";
|
|
|
- String result = item.getAgreed() == 1 ? "【已采纳】" : "【拒绝】";
|
|
|
+ String result = item.getAgreed() == 1 ? "【采纳】" : "【拒绝】";
|
|
|
content = content + result;
|
|
|
}
|
|
|
MessageModel model = new MessageModel();
|
|
|
@@ -896,11 +885,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
if (StringUtils.hasText(filter.getKeyword())) {
|
|
|
SimpleExpression cmpCode = new SimpleExpression("cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression brand = new SimpleExpression("inbrand", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression prodCmpCode = new SimpleExpression("product.cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression prodBrand = new SimpleExpression("product.brand", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression code = new SimpleExpression("inquiry.code", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression title = new SimpleExpression("prodTitle", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- SimpleExpression spec = new SimpleExpression("spec", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression prodTitle = new SimpleExpression("product.title", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression inquiryEnName = new SimpleExpression("inquiry.enName", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- SimpleExpression[] simpleExpressions = new SimpleExpression[]{cmpCode, brand, code, title, inquiryEnName, spec};
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{cmpCode, brand, prodCmpCode, prodBrand, code, title, prodTitle, inquiryEnName};
|
|
|
LogicalExpression logical = new LogicalExpression(simpleExpressions, CriterionExpression.Operator.OR);
|
|
|
info.expression(logical);
|
|
|
}
|
|
|
@@ -979,15 +970,9 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
SimpleExpression cmpCode = new SimpleExpression("cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression brand = new SimpleExpression("inbrand", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression title = new SimpleExpression("prodTitle", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- SimpleExpression spec = new SimpleExpression("spec", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression code = new SimpleExpression("inquiry.code", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
SimpleExpression enName = new SimpleExpression("inquiry.enName", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- SimpleExpression[] simpleExpressions = null;
|
|
|
- if (!StringUtils.isEmpty(filter.getIsLogin()) && filter.getIsLogin() == 0) {
|
|
|
- simpleExpressions = new SimpleExpression[]{cmpCode, brand, code, title, spec};
|
|
|
- } else {
|
|
|
- simpleExpressions = new SimpleExpression[]{cmpCode, brand, code, title, enName, spec};
|
|
|
- }
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{cmpCode, brand, code, title, enName};
|
|
|
LogicalExpression logical = new LogicalExpression(simpleExpressions, CriterionExpression.Operator.OR);
|
|
|
info.expression(logical);
|
|
|
}
|
|
|
@@ -1008,6 +993,8 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
private IPage<PurcInquiryItemInfo> covert(Page<PurcInquiryItemInfo> orders, Long enuu) {
|
|
|
if (!CollectionUtils.isEmpty(orders.getContent()) && null != enuu) {
|
|
|
for (PurcInquiryItemInfo itemInfo : orders.getContent()) {
|
|
|
+ // 为了用户隐私,这个地方隐藏掉联系人电话
|
|
|
+ itemInfo.setUserTel(null);
|
|
|
PublicInquiryItem item = publicInquiryItemDao.findByVendUUAndSourceId(enuu, itemInfo.getId());
|
|
|
itemInfo.setQuoted(Constant.NO);
|
|
|
if (null != item) {
|
|
|
@@ -1043,15 +1030,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public PageInfo covert(PageInfo pageInfo, String state, Short overdue) {
|
|
|
+ public PageInfo covert(PageInfo pageInfo, String state) {
|
|
|
if (state.equals(OrderStatus.todo.name())) {
|
|
|
pageInfo.filter("status", Status.NOT_REPLY.value());
|
|
|
pageInfo.filter("overdue", Constant.NO);
|
|
|
pageInfo.filter("invalid", Constant.NO);
|
|
|
} else if (state.equals(OrderStatus.done.name())) {
|
|
|
- if (StringUtils.isEmpty(overdue) || !overdue.equals(Constant.YES)) {
|
|
|
- pageInfo.filter("overdue", Constant.NO);
|
|
|
- }
|
|
|
+ pageInfo.filter("overdue", Constant.NO);
|
|
|
pageInfo.filter("status", Status.REPLIED.value());
|
|
|
pageInfo.filter("invalid", Constant.NO);
|
|
|
pageInfo.filter("decideStatus", Status.UNAUDIT.value());
|
|
|
@@ -1059,11 +1044,8 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
pageInfo.filter("overdue", Constant.YES);
|
|
|
pageInfo.filter("invalid", Constant.NO);
|
|
|
} else if (state.equals(OrderStatus.invalid.name())) {
|
|
|
- SimpleExpression overdue1 = new SimpleExpression("overdue", Constant.NO, CriterionExpression.Operator.NE, true);
|
|
|
- SimpleExpression invalid = new SimpleExpression("invalid", Constant.NO, CriterionExpression.Operator.NE, true);
|
|
|
- SimpleExpression[] simpleExpressions = new SimpleExpression[]{invalid, overdue1};
|
|
|
- LogicalExpression logical = new LogicalExpression(simpleExpressions, CriterionExpression.Operator.OR);
|
|
|
- pageInfo.expression(logical);
|
|
|
+ pageInfo.filter("overdue", Constant.YES);
|
|
|
+ pageInfo.filter("invalid", Constant.YES);
|
|
|
} else if (state.equals(OrderStatus.agreed.name())) {
|
|
|
pageInfo.filter("agreed", Constant.YES);
|
|
|
pageInfo.filter("status", Status.REPLIED.value());
|
|
|
@@ -1173,177 +1155,8 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public PublicInquiryItemInfo findOneInfo(Long id, Long enuu, Long useruu) {
|
|
|
- PublicInquiryItemInfo itemInfo = itemInfoDao.findOne(id);
|
|
|
- if (!itemInfo.getVendUU().equals(enuu)) {
|
|
|
- throw new IllegalOperatorException("访问受限");
|
|
|
- }
|
|
|
- return itemInfo;
|
|
|
+ public PublicInquiryItemInfo findOneInfo(Long id) {
|
|
|
+ return itemInfoDao.findOne(id);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 将推荐信息转成UU互联需要的数据
|
|
|
- *
|
|
|
- * @param content 推荐信息
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<PurcInquiryItemInfo> covertRemindToInquiry(List<InquiryRemind> content) {
|
|
|
- List<PurcInquiryItemInfo> infoList = new ArrayList<>();
|
|
|
- if (!CollectionUtils.isEmpty(content)) {
|
|
|
- for (InquiryRemind remind : content) {
|
|
|
- PurcInquiryItemInfo itemInfo = inquiryItemInfoDao.findOne(remind.getItemId());
|
|
|
- if (null != itemInfo) {
|
|
|
- Product product = new Product();
|
|
|
- product.setTitle(itemInfo.getProdTitle());
|
|
|
- product.setCmpCode(itemInfo.getCmpCode());
|
|
|
- product.setCode(itemInfo.getCmpCode());
|
|
|
- product.setBrand(itemInfo.getInbrand());
|
|
|
- product.setSpec(itemInfo.getSpec());
|
|
|
- itemInfo.setProduct(product);
|
|
|
- if (remind.getStatus().equals(Status.NOTALLOW.value())) {
|
|
|
- itemInfo.setAgreed(Constant.NO);
|
|
|
- } else if (remind.getStatus().equals(Status.ALLOW.value())) {
|
|
|
- itemInfo.setAgreed(Constant.YES);
|
|
|
- }
|
|
|
- itemInfo.setQuoted(Constant.NO);
|
|
|
- if (remind.getStatus().equals(Status.SUBMITTED.value())) {
|
|
|
- itemInfo.setQuoted(Constant.YES);
|
|
|
- itemInfo.setQuteId(remind.getNewId());
|
|
|
- }
|
|
|
- if (itemInfo.getRemainingTime() <= 0) {
|
|
|
- itemInfo.setOverdue(Constant.YES);
|
|
|
- }
|
|
|
- infoList.add(itemInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return infoList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 针对供应商,客户将拒绝理由发送信息给供应商
|
|
|
- *
|
|
|
- * @param item 询价明细
|
|
|
- * @param sourceApp 应用来源
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Page<MessageModel> refuseMessage(PublicInquiryItem item, String sourceApp) {
|
|
|
- if (null != item.getVendUU() && null != item.getVendUserUU() ) {
|
|
|
- final String SMS_TYPE = "SM"; //发送信息
|
|
|
- final String CONSUMERAPP ="MALL";
|
|
|
- List<MessageModel> models = new ArrayList<MessageModel>();
|
|
|
- String Buyer=item.getInquiry().getEnName() == null ? item.getInquiry().getRecorder():item.getInquiry().getEnName();
|
|
|
- String cmpCode = item.getCmpCode();
|
|
|
- String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
|
|
|
- String content= "因"+item.getRefusereason() + "," + Buyer + "【未采纳】您关于“型号:" + cmp + "”的报价。期待与您的下次合作!" ;
|
|
|
- MessageModel model = new MessageModel();
|
|
|
- model.setType(INQUIRY_DECIDE_TYPE_MALL);
|
|
|
- model.setProducerApp(sourceApp);
|
|
|
- model.setConsumerType(CUST_TYPE);
|
|
|
- model.setConsumerApp(CONSUMERAPP);
|
|
|
- model.setContent(content);
|
|
|
- model.setRemark(String.valueOf(item.getInquiry().getId()));
|
|
|
- model.setSourceId(item.getId());
|
|
|
- model.setReceiverEnuu(item.getVendUU());
|
|
|
- model.setReceiverUu(item.getVendUserUU());
|
|
|
- model.setSenderEnuu(item.getInquiry().getEnUU());
|
|
|
- if (null != item.getUserUU() || null != item.getInquiry().getRecorderUU()) {
|
|
|
- model.setSenderUu(item.getUserUU() != null ? item.getUserUU() : item.getInquiry().getRecorderUU());
|
|
|
- } else {
|
|
|
- Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
- model.setSenderUu(null != enterprise ? enterprise.getAdminUU() : 0L);
|
|
|
- }
|
|
|
- model.setSmsType(SMS_TYPE);
|
|
|
- models.add(model);
|
|
|
- if (!CollectionUtils.isEmpty(models)) {
|
|
|
- sendMessage(models);
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
-
|
|
|
- }
|
|
|
- /**
|
|
|
- * 针对供应商,把客户采纳报价的消息发送给供应商
|
|
|
- *
|
|
|
- * @param item 询价明细
|
|
|
- * @param sourceApp 应用来源
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Page<MessageModel> adoptMessage(PublicInquiryItem item, String sourceApp) {
|
|
|
- if (null != item.getVendUU() && null != item.getVendUserUU() ) {
|
|
|
- final String SMS_TYPE = "SM"; //发送信息
|
|
|
- final String CONSUMERAPP ="MALL";
|
|
|
- List<MessageModel> models = new ArrayList<MessageModel>();
|
|
|
- String cmpCode = item.getCmpCode();
|
|
|
- String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
|
|
|
- String content= item.getInquiry().getEnName()+"【已采纳】您关于'型号:'" + cmp + "的报价,期待与您的合作!" ;
|
|
|
- MessageModel model = new MessageModel();
|
|
|
- model.setType(INQUIRY_DECIDE_TYPE_MALL);
|
|
|
- model.setProducerApp(sourceApp);
|
|
|
- model.setConsumerType(CUST_TYPE);
|
|
|
- model.setConsumerApp(CONSUMERAPP);
|
|
|
- model.setContent(content);
|
|
|
- model.setRemark(String.valueOf(item.getInquiry().getId()));
|
|
|
- model.setSourceId(item.getId());
|
|
|
- model.setReceiverEnuu(item.getVendUU());
|
|
|
- model.setReceiverUu(item.getVendUserUU());
|
|
|
- model.setSenderEnuu(item.getInquiry().getEnUU());
|
|
|
- if (null != item.getUserUU() || null != item.getInquiry().getRecorderUU()) {
|
|
|
- model.setSenderUu(item.getUserUU() != null ? item.getUserUU() : item.getInquiry().getRecorderUU());
|
|
|
- } else {
|
|
|
- Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
- model.setSenderUu(null != enterprise ? enterprise.getAdminUU() : 0L);
|
|
|
- }
|
|
|
- model.setSmsType(SMS_TYPE);
|
|
|
- models.add(model);
|
|
|
- if (!CollectionUtils.isEmpty(models)) {
|
|
|
- sendMessage(models);
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Page<MessageModel> ReceiveMessage(PublicInquiryItem item, String sourceApp) {
|
|
|
- if (null != item.getVendUU() && null != item.getVendUserUU() ) {
|
|
|
- final String SMS_TYPE = "SM"; //发送信息
|
|
|
- final String CONSUMERAPP ="MALL";
|
|
|
- List<MessageModel> models = new ArrayList<MessageModel>();
|
|
|
- String cmpCode = item.getCmpCode();
|
|
|
- String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
|
|
|
- String content= "您收到了"+item.getVendName()+"关于“型号:"+ cmp +"“的报价,马上去看一看吧!";
|
|
|
-
|
|
|
- MessageModel model = new MessageModel();
|
|
|
- model.setType(INQUIRY_TYPE_MALL);
|
|
|
- model.setProducerApp(sourceApp);
|
|
|
- model.setConsumerType(CUST_TYPE);
|
|
|
- model.setConsumerApp(CONSUMERAPP);
|
|
|
- model.setContent(content);
|
|
|
- model.setRemark(String.valueOf(item.getInquiry().getId()));
|
|
|
- model.setSourceId(item.getId());
|
|
|
- model.setReceiverEnuu(item.getInquiry().getEnUU());
|
|
|
- model.setReceiverUu(item.getInquiry().getRecorderUU());
|
|
|
- model.setSenderEnuu(item.getVendUU());
|
|
|
- if (null != item.getUserUU() || null != item.getInquiry().getRecorderUU()) {
|
|
|
- model.setSenderUu(item.getUserUU() != null ? item.getUserUU() : item.getInquiry().getRecorderUU());
|
|
|
- } else {
|
|
|
- Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
- model.setSenderUu(null != enterprise ? enterprise.getAdminUU() : 0L);
|
|
|
- }
|
|
|
- model.setSmsType(SMS_TYPE);
|
|
|
- models.add(model);
|
|
|
- if (!CollectionUtils.isEmpty(models)) {
|
|
|
- sendMessage(models);
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|