Sfoglia il codice sorgente

优化积余订餐推送的代码

longmeizhen@avic-s.com 2 anni fa
parent
commit
e4d9368fe2

+ 3 - 1
sql/huanjingpeizhi/formal environment/tomcat_super_service/WEB-INF/classes/wechat.properties

@@ -185,4 +185,6 @@ wxMessageUrl=http://172.18.223.212:8127/front/message/customMessageByUserIdsJson
 
 newSmsMessageUrl=http://172.18.223.212:8115/wechat/smsAuthcode/sendSmsMessage
 
-wxMessageConfigUrl=http://172.18.223.212:8115/wechat/smsAuthcode/getWxMessageConfig
+wxMessageConfigUrl=http://172.18.223.212:8115/wechat/smsAuthcode/getWxMessageConfig
+
+wxTempUrl=http://wx.palmnest.com/super_cloud/api/wechat/front/message

+ 3 - 1
sql/huanjingpeizhi/test environment/WEB-INF/classes/wechat.properties

@@ -195,4 +195,6 @@ wxMessageUrl=http://172.18.223.211:8127/front/message/customMessageByUserIdsJson
 
 newSmsMessageUrl=http://172.18.223.211:8115/wechat/smsAuthcode/sendSmsMessage
 
-wxMessageConfigUrl=http://172.18.223.211:8115/wechat/smsAuthcode/getWxMessageConfig
+wxMessageConfigUrl=http://172.18.223.211:8115/wechat/smsAuthcode/getWxMessageConfig
+
+wxTempUrl=http://wx.palmnest.com/super_cloud/api/wechat/front/message

+ 1 - 1
src/main/java/com/palmnest/dao/dinner/impl/OrderDinnerSetDaoImpl.java

@@ -54,7 +54,7 @@ public class OrderDinnerSetDaoImpl extends GenericDaoHibernate<OrderDinnerSet, I
         sql.append("  FROM tb_user u LEFT JOIN tb_order_dinner_set s ON u.id = s.userId ");
         sql.append(" WHERE u.organizationId IN ( "+orgIds+" ) AND u.openId <> '' AND u.isEnabled = '1'  ");
         if(StringUtils.isNotEmpty(openId)){
-            sql.append(" AND u.openId in ("+openId+")  ");
+            sql.append(" AND (u.openid in ("+openId+") or u.bind_openid in ("+openId+") )  ");
         }
         sql.append("   ) t WHERE t.state = 1 ");
         sql.append("  ORDER BY t.orgId, t.id ");

+ 19 - 9
src/main/java/com/palmnest/service/dinner/service/impl/PlaceAnOrderServiceImpl.java

@@ -15,7 +15,9 @@ import java.util.Map;
 import cn.superdesk.libs.common.json.JsonUtils;
 import com.palmnest.application.dto.*;
 import com.palmnest.model.dinner.*;
+import com.palmnest.model.estateserve.WxPublicno;
 import com.palmnest.service.dinner.manager.*;
+import com.palmnest.service.notice.WxPubManager;
 import net.sf.json.JsonConfig;
 import net.sf.json.util.JSONUtils;
 
@@ -115,7 +117,7 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 	private SmsAuthCodeManager smsAuthCodeManager;
 	
 	@Autowired
-	private MobileConfigManager mobileConfigManager;
+	private WxPubManager wxPubManager;
 	
 	@Autowired
 	private ScWxuserManager scWxuserManager;
@@ -141,7 +143,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 	public static final String wxMessageUrl  = PropertiesKit.readPropertiesValue("wxMessageUrl", "wechat.properties");
 
 	public static final String wxTempUrl  = PropertiesKit.readPropertiesValue("wxTempUrl", "wechat.properties");
-	private String wxMessageConfigUrl     = PropertiesKit.readPropertiesValue("wxMessageConfigUrl", "wechat.properties");
 	/**
 	 * 获取能够订餐的用户
 	 * @return
@@ -1687,21 +1688,29 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 		Map<Integer,String> resMap = orderDinnerSetManager.findUserByOrgIds(orgIds,openId);
 		for (Integer org : resMap.keySet()){
 			String userIds = resMap.get(org);
-			tempMsg(org,userIds,content,url);
+			tempMsg(org,userIds,content,url,tomorrow);
 		}
 	}
 
-	private void tempMsg(Integer org,String userIds,String content,String url){
-		WxMessageConfigVo vo = smsAuthCodeManager.getWxMessageConfig(org,CodeConstants.BOOK_DINNER_TASK);
-		if(null == vo){
+	private void tempMsg(Integer org,String userIds,String content,String url,String date){
+		WxPublicno no = wxPubManager.getPublicByOrgId(org.toString());
+		if(null == no){
 			tempMsg1(org,userIds,content,url);//基础推送,平台推送,积余不需要这个模板,换
 		}else{
-			tempMsg2(org,userIds,url,vo);//模板库发送
+			//根据公众号id获取模板信息
+			WxMessageConfigVo vo = smsAuthCodeManager.getWxMessageConfig(no.getId(),CodeConstants.BOOK_DINNER_TASK);
+			LOG.info("tempMsg-vo:"+JsonUtils.toJson(vo));
+			if(null == vo){
+				tempMsg1(org,userIds,content,url);//基础推送,平台推送,积余不需要这个模板,换
+			}else{
+				tempMsg2(org,userIds,url,vo,date);//模板库发送
+			}
 		}
 	}
 
 	public String sendMessageTemp(WechatMessageDto dto) {
-		if(null == dto || null == dto.getOrgId() || null == dto.getType() || StringUtils.isEmpty(dto.getBusinessCode()) || StringUtils.isEmpty(dto.getType())){
+		LOG.info("sendMessageTemp-dto:"+JsonUtils.toJson(dto));
+		if(null == dto || null == dto.getOrgId() || null == dto.getType() || StringUtils.isEmpty(dto.getBusinessCode())){
 			return "参数为空";
 		}
 		if(StringUtils.isEmpty(wxTempUrl)){
@@ -1715,9 +1724,10 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
 		return result;
 	}
 
-	private void tempMsg2(Integer org,String userIds,String url,WxMessageConfigVo vo){
+	private void tempMsg2(Integer org,String userIds,String url,WxMessageConfigVo vo,String date){
 		Map<String,String> paramMap=new HashMap<String, String>();
 		paramMap.put("[PARAM_URL]", url);
+		paramMap.put("[PARAM_DATE]", date);
 		WechatMessageDto msgDto=new WechatMessageDto();
 		msgDto.setOrgId(org);
 		msgDto.setBusinessCode(vo.getBusinessCode());