|
|
@@ -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,7 @@ 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);
|
|
|
+ model.setSenderUu(null != buyerEnterprise ? buyerEnterprise.getAdminUU() : 0L);
|
|
|
}
|
|
|
model.setSenderEnuu(item.getInquiry().getEnUU());
|
|
|
model.setCmpCode(cmpCode);
|
|
|
@@ -299,7 +297,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
model.setMailTemplate(MAIL_TEMP_ID);
|
|
|
model.setSmTemplate(SMS_TEMP_ID);
|
|
|
models.add(model);
|
|
|
- log.info("公共询价产生消息", "根据物料型号【{}】查询接收人,关联询价单明细【{}】,UserUU:{},Enuu:{},报价的应用来源:{}", cmpCode, item.getId(), user.getUseruu(), 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);
|
|
|
@@ -328,7 +326,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
public void run() {
|
|
|
try {
|
|
|
long start = System.currentTimeMillis();
|
|
|
- log.info("发送微信消息实体{}", JSON.toJSONString(models));
|
|
|
+ log.info("发送微信消息");
|
|
|
String res = HttpUtil.doPost(USOFTMALL_URL + "/wx/sendTemplateMessage", FlexJsonUtils.toJsonDeep(models));
|
|
|
log.info("微信消息请求发送日志, {}", res);
|
|
|
log.info("微信消息请求发送,数量:{}, 耗时:{}", models.size(), (System.currentTimeMillis() - start));
|
|
|
@@ -389,12 +387,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 +420,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 +450,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 +529,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
public void run() {
|
|
|
try {
|
|
|
long start = System.currentTimeMillis();
|
|
|
- log.info("发送消息实体{}", JSON.toJSONString(models));
|
|
|
+ log.info("发送消息");
|
|
|
String res = HttpUtil.doPost(PS_MESSAGE_URL + "/messages", FlexJsonUtils.toJsonDeep(models));
|
|
|
log.info("消息请求发送");
|
|
|
log.info("/messages , 条数:{},耗时:{}", models.size(), (System.currentTimeMillis() - start));
|