|
|
@@ -1,6 +1,5 @@
|
|
|
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;
|
|
|
@@ -257,9 +256,9 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
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();
|
|
|
@@ -275,8 +274,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 != enterprise ? enterprise.getAdminUU() : 0L);
|
|
|
+// Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
|
|
|
+ model.setSenderUu(null != buyerEnterprise ? buyerEnterprise.getAdminUU() : 0L);
|
|
|
}
|
|
|
model.setSenderEnuu(item.getInquiry().getEnUU());
|
|
|
model.setCmpCode(cmpCode);
|
|
|
@@ -299,15 +298,18 @@ 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("公共询价产生消息", "根据物料型号【" + cmpCode + "】查询接收人", "关联询价单明细【" + item.getId() + "】", "UserUU:" + user.getUseruu(), "Enuu:" + 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();
|
|
|
@@ -328,9 +330,9 @@ 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("微信消息请求发送日志" + res);
|
|
|
log.info("微信消息请求发送,数量: " + models.size() + ",耗时:" + (System.currentTimeMillis() - start));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -389,12 +391,13 @@ 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());
|
|
|
@@ -421,9 +424,12 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
remind.setVendUserUU(u.getUseruu());
|
|
|
remind.setDate(new Date(System.currentTimeMillis()));
|
|
|
remind.setStatus(Status.INPUTTING.value());
|
|
|
- remindDao.save(remind);
|
|
|
+ inquiryReminds.add(remind);
|
|
|
}
|
|
|
}
|
|
|
+ if (!CollectionUtils.isEmpty(inquiryReminds)) {
|
|
|
+ remindDao.save(inquiryReminds);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 查询已关注类目中是否有当前类目
|
|
|
@@ -448,7 +454,6 @@ 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());
|
|
|
@@ -528,7 +533,7 @@ 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));
|
|
|
@@ -1224,6 +1229,7 @@ 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));
|
|
|
@@ -1269,6 +1275,8 @@ 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) {
|
|
|
@@ -1282,6 +1290,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
itemInfo.setQuotation(item);
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println("设置报价信息:" + (System.currentTimeMillis() - start));
|
|
|
return covert(orders, enUU);
|
|
|
}
|
|
|
|
|
|
@@ -1292,6 +1301,7 @@ 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());
|
|
|
@@ -1318,6 +1328,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println("covert 耗时:" + (System.currentTimeMillis() - start));
|
|
|
return IPageUtils.covert(orders);
|
|
|
}
|
|
|
|