|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.ps.inquiry.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.ps.core.util.ContextUtils;
|
|
|
import com.uas.ps.entity.Product;
|
|
|
@@ -216,7 +217,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- }).run();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
@@ -250,15 +251,15 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
try {
|
|
|
long start = System.currentTimeMillis();
|
|
|
HttpUtil.Response res = HttpUtil.sendGetRequest(url, formData);
|
|
|
- log.info("/productuser/getProductUsersByEnUUAndCmpCode,耗时:" + (System.currentTimeMillis() - start));
|
|
|
+ log.info("/productuser/getProductUsersByEnUUAndCmpCode,耗时:{}", (System.currentTimeMillis() - start));
|
|
|
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<MessageModel> models = new ArrayList<MessageModel>();
|
|
|
- User buyerUser = userDao.findOne(null != item.getInquiry().getRecorderUU() ? item.getInquiry().getRecorderUU() : 0L);
|
|
|
- Enterprise buyerEnterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
for (ProductUsers user : users) {
|
|
|
+ User buyerUser = userDao.findOne(null != item.getInquiry().getRecorderUU() ? item.getInquiry().getRecorderUU() : 0L);
|
|
|
+ Enterprise buyerEnterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
|
|
|
String content = "发布关于“型号:" + cmp + "”的公共询价信息,邀请您参与报价。";
|
|
|
MessageModel model = new MessageModel();
|
|
|
@@ -274,8 +275,8 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
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 != buyerEnterprise ? buyerEnterprise.getAdminUU() : 0L);
|
|
|
+ Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
+ model.setSenderUu(null != enterprise ? enterprise.getAdminUU() : 0L);
|
|
|
}
|
|
|
model.setSenderEnuu(item.getInquiry().getEnUU());
|
|
|
model.setCmpCode(cmpCode);
|
|
|
@@ -298,22 +299,19 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
model.setMailTemplate(MAIL_TEMP_ID);
|
|
|
model.setSmTemplate(SMS_TEMP_ID);
|
|
|
models.add(model);
|
|
|
-// log.info("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人", "关联询价单明细【" + item.getId() + "】", "UserUU:" + user.getUseruu(), "Enuu:" + user.getEnuu(), "报价的应用来源:" + InquirySource.ERP.name());
|
|
|
+ log.info("公共询价产生消息", "根据物料型号【{}】查询接收人,关联询价单明细【{}】,UserUU:{},Enuu:{},报价的应用来源:{}", cmpCode, item.getId(), user.getUseruu(), user.getEnuu(), InquirySource.ERP.name());
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(models)) {
|
|
|
sendMessage(models);
|
|
|
sendWechatMessage(models);
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("发消息耗时:" + (System.currentTimeMillis() - start));
|
|
|
- start = System.currentTimeMillis();
|
|
|
// 生成推荐信息
|
|
|
remindInquiry(item, users);
|
|
|
- System.out.println("生成推荐耗时:" + (System.currentTimeMillis() - start));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
String reason = e.getMessage().length() > 10 ? e.getMessage().substring(0, 1000).concat("") : e.getMessage();
|
|
|
- log.info("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人失败,id" + item.getId(), "原因:" + reason,"Constant:" + Constant.UU, "报价的应用来源:" + InquirySource.ERP.name());
|
|
|
+ log.info("公共询价产生消息,根据物料型号【{}】查询接收人失败,id:{},原因:{}, Constant:{}, 报价的应用来源:{}", cmpCode, item.getId(), reason, Constant.UU, InquirySource.ERP.name());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
@@ -330,15 +328,15 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
public void run() {
|
|
|
try {
|
|
|
long start = System.currentTimeMillis();
|
|
|
-// log.info("发送微信消息实体" + JSON.toJSONString(models));
|
|
|
+ log.info("发送微信消息实体{}", JSON.toJSONString(models));
|
|
|
String res = HttpUtil.doPost(USOFTMALL_URL + "/wx/sendTemplateMessage", FlexJsonUtils.toJsonDeep(models));
|
|
|
-// log.info("微信消息请求发送日志" + res);
|
|
|
- log.info("微信消息请求发送,数量: " + models.size() + ",耗时:" + (System.currentTimeMillis() - start));
|
|
|
+ log.info("微信消息请求发送日志, {}", res);
|
|
|
+ log.info("微信消息请求发送,数量:{}, 耗时:{}", models.size(), (System.currentTimeMillis() - start));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- }).run();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -391,13 +389,12 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
public void run() {
|
|
|
try {
|
|
|
Map<Long, ProductUsers> productUsersMap = new HashMap<>();
|
|
|
- Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
if (!CollectionUtils.isEmpty(users)) {
|
|
|
- List<InquiryRemind> inquiryReminds = new ArrayList<>();
|
|
|
for (ProductUsers u : users) {
|
|
|
List<InquiryRemind> remindList = remindDao.findByVendUserUUAndVendUUAndItemId(u.getUseruu(), u.getEnuu(), item.getId());
|
|
|
if (remindList.size() == 0 && item.getInquiry().getEnUU() != null) {
|
|
|
productUsersMap.put(u.getEnuu(), u);
|
|
|
+ Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
InquiryRemind remind = new InquiryRemind();
|
|
|
remind.setEnName(enterprise.getEnName());
|
|
|
remind.setEnUU(item.getInquiry().getEnUU());
|
|
|
@@ -424,12 +421,9 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
remind.setVendUserUU(u.getUseruu());
|
|
|
remind.setDate(new Date(System.currentTimeMillis()));
|
|
|
remind.setStatus(Status.INPUTTING.value());
|
|
|
- inquiryReminds.add(remind);
|
|
|
+ remindDao.save(remind);
|
|
|
}
|
|
|
}
|
|
|
- if (!CollectionUtils.isEmpty(inquiryReminds)) {
|
|
|
- remindDao.save(inquiryReminds);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
// 查询已关注类目中是否有当前类目
|
|
|
@@ -444,7 +438,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
formData.put("pCmpCode", item.getCmpCode());
|
|
|
long start = System.currentTimeMillis();
|
|
|
HttpUtil.Response res = HttpUtil.sendGetRequest(url, formData);
|
|
|
- log.info("/product/businessOpportunity , 型号: " + item.getCmpCode() + ",耗时:" + (System.currentTimeMillis() - start));
|
|
|
+ log.info("/product/businessOpportunity , 型号:{}, 耗时:{}", item.getCmpCode(), (System.currentTimeMillis() - start));
|
|
|
if (res.getStatusCode() == HttpStatus.OK.value()) {
|
|
|
Map<String, Object> result = FlexJsonUtils.fromJson(res.getResponseText());
|
|
|
if (!StringUtils.isEmpty(result.get("enUUs"))) {
|
|
|
@@ -454,6 +448,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
if (!CollectionUtils.isEmpty(enuuSet)) {
|
|
|
List<InquiryEnRemind> inquiryEnReminds = new ArrayList<>();
|
|
|
for (Long enuu : enuuSet) {
|
|
|
+ Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
InquiryEnRemind remind = new InquiryEnRemind();
|
|
|
remind.setEnName(enterprise.getEnName());
|
|
|
remind.setEnUU(item.getInquiry().getEnUU());
|
|
|
@@ -495,7 +490,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- }).run();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -533,15 +528,15 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
public void run() {
|
|
|
try {
|
|
|
long start = System.currentTimeMillis();
|
|
|
-// log.info("发送消息实体" + JSON.toJSONString(models));
|
|
|
+ log.info("发送消息实体{}", JSON.toJSONString(models));
|
|
|
String res = HttpUtil.doPost(PS_MESSAGE_URL + "/messages", FlexJsonUtils.toJsonDeep(models));
|
|
|
log.info("消息请求发送");
|
|
|
- log.info("/messages , 条数: " + models.size() + ",耗时:" + (System.currentTimeMillis() - start));
|
|
|
+ log.info("/messages , 条数:{},耗时:{}", models.size(), (System.currentTimeMillis() - start));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- }).run();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -962,7 +957,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }, inquiries).run();
|
|
|
+ }, inquiries);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1156,7 +1151,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
info.expression(PredicateUtils.lte("date", new Date(filter.getEndDelivery()), false));
|
|
|
}
|
|
|
if (filter.getUserUU() != null) {
|
|
|
- info.expression(PredicateUtils.eq("vendUserUU", filter.getUserUU(), false));
|
|
|
+ info.expression(PredicateUtils.gte("vendUserUU", filter.getUserUU(), false));
|
|
|
}
|
|
|
if (StringUtils.hasText(filter.getKeyword())) {
|
|
|
SimpleExpression cmpCode = new SimpleExpression("cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
@@ -1229,7 +1224,6 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
*/
|
|
|
@Override
|
|
|
public IPage<PurcInquiryItemInfo> findTodoByPageInfo(final PageInfo info, final SearchFilter filter) {
|
|
|
- long start = System.currentTimeMillis();
|
|
|
Sort sort = new Sort(Sort.Direction.DESC, "id", "date");
|
|
|
if (info.getOffset() == 0) {
|
|
|
info.setOffset(info.getPageSize() * (info.getPageNumber() - 1));
|
|
|
@@ -1275,8 +1269,6 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
return null;
|
|
|
}
|
|
|
}, info);
|
|
|
- System.out.println("查询耗时:" + (System.currentTimeMillis() - start));
|
|
|
- start = System.currentTimeMillis();
|
|
|
// 将当前企业报价信息设置进去
|
|
|
if (null != filter && !StringUtils.isEmpty(enUU)) {
|
|
|
for (PurcInquiryItemInfo itemInfo : orders) {
|
|
|
@@ -1290,7 +1282,6 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
itemInfo.setQuotation(item);
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("设置报价信息:" + (System.currentTimeMillis() - start));
|
|
|
return covert(orders, enUU);
|
|
|
}
|
|
|
|
|
|
@@ -1301,7 +1292,6 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
* @return
|
|
|
*/
|
|
|
private IPage<PurcInquiryItemInfo> covert(Page<PurcInquiryItemInfo> orders, Long enuu) {
|
|
|
- long start = System.currentTimeMillis();
|
|
|
if (!CollectionUtils.isEmpty(orders.getContent()) && null != enuu) {
|
|
|
for (PurcInquiryItemInfo itemInfo : orders.getContent()) {
|
|
|
PublicInquiryItem item = publicInquiryItemDao.findByVendUUAndSourceId(enuu, itemInfo.getId());
|
|
|
@@ -1328,7 +1318,6 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("covert 耗时:" + (System.currentTimeMillis() - start));
|
|
|
return IPageUtils.covert(orders);
|
|
|
}
|
|
|
|