|
@@ -4,6 +4,7 @@ package com.dgtly.wxportal.utils.qywxutils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dgtly.common.utils.StringUtils;
|
|
|
import com.dgtly.common.utils.http.HttpUtils;
|
|
|
+import com.dgtly.system.domain.CustomerModelVO;
|
|
|
import com.dgtly.system.service.ISysUserService;
|
|
|
import com.dgtly.system.service.impl.SysConfigServiceImpl;
|
|
|
import com.dgtly.wxportal.domain.SendOrderNoticeTaskModel;
|
|
@@ -170,26 +171,27 @@ public class QyWxSendMessageUtil {
|
|
|
if(credit.getCustomerMap()!=null&&credit.getCustomerMap().size()>0){
|
|
|
try{
|
|
|
//需要发送的组织codeset列表
|
|
|
- Set<String> orgCodeSet = credit.getCustomerMap().keySet();
|
|
|
+ Collection<CustomerModelVO> orgCodeSet = credit.getCustomerMap().values();
|
|
|
+ Set<String> customerId=new HashSet<>();
|
|
|
//需要发送的组织凑的
|
|
|
-
|
|
|
- Map<String,Map<String,Object>> orgCodeTouser = sysUserService.selectLoginNamesByCostumerCode(orgCodeSet);
|
|
|
+ for (CustomerModelVO customerModelVO:orgCodeSet
|
|
|
+ ) {
|
|
|
+ customerId.add(customerModelVO.getCustomerId());
|
|
|
+ }
|
|
|
+ Map<String,Map<String,Object>> orgCodeTouser = sysUserService.selectLoginNamesByCostumerVoCode(orgCodeSet);
|
|
|
String conKey = "";
|
|
|
String form="";
|
|
|
if(type==0){
|
|
|
- log.info("发送经销商过信用");
|
|
|
conKey ="wx.notification.credit.customer";
|
|
|
form="3";
|
|
|
}else {
|
|
|
- log.info("发送经销商未过信用");
|
|
|
conKey ="wx.notification.nocredit.customer";
|
|
|
form="7";
|
|
|
}
|
|
|
String temple =configService.selectConfigByKey(conKey);
|
|
|
BatchSendGetToUser<String> getToUser = new CreditGetToUser<>(orgCodeTouser);
|
|
|
BatchSendGetSendMessage getText = new CreditGetSendMessageCus(temple,credit.getCustomerMap());
|
|
|
-
|
|
|
- BatchSendQyWxMessage batchSendQyWxMessage = new BatchSendCustomerCreditMessage<String,Map<String,Object>>(orgCodeSet,getToUser,getText);
|
|
|
+ BatchSendQyWxMessage batchSendQyWxMessage = new BatchSendCustomerCreditMessage<String,Map<String,Object>>(customerId,getToUser,getText);
|
|
|
List<QyWxBaseMessage> messageList = batchSendQyWxMessage.getMessageList();
|
|
|
int success = batchSendMessage(messageList,form);
|
|
|
log.info("批量发送信息,成功:"+success+"条,总共:"+messageList.size());
|
|
@@ -360,7 +362,6 @@ public class QyWxSendMessageUtil {
|
|
|
String url = QyWxServiceUrl.SEND_MESSAGE_URL.getformatUrl(qyWxAccessTokenUtil.getAccessToken());
|
|
|
String result = HttpUtils.sendJsonPost(url,message);
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
-
|
|
|
Integer errcode = json.getInteger("errcode");
|
|
|
if(errcode!=0){
|
|
|
throw new QyWeixinException(errcode,url);
|