| | |
| | | package com.panzhihua.service_community.message; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO; |
| | |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | | import com.panzhihua.common.utlis.WxXCXTempSend; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.stereotype.Component; |
| | | import com.panzhihua.service_community.entity.ComActAcidMember; |
| | | import com.panzhihua.service_community.service.ComActAcidMemberService; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zzj |
| | |
| | | @Component |
| | | public class AcidMessage { |
| | | public static final String DELAYED_QUEUE="huacheng.acid.queue"; |
| | | public static final String ACID_DANGER_QUEUE = "huacheng.acid.danger.queue"; |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private ComActAcidMemberService comActAcidMemberService; |
| | | |
| | | @RabbitListener(queues=DELAYED_QUEUE) |
| | | public void doTemplate(ComActAcidRecordVO comActAcidRecordVO) { |
| | | R<LoginUserInfoVO> loginUserInfoVOR= userService.getUserInfoByUserId(comActAcidRecordVO.getUserId().toString()); |
| | |
| | | WxUtil.sendSubscribeTXTZ(loginUserInfoVO.getOpenid(),accessToken,"pov2BTQ_uILduT5OoVKubeS2dibbZ_p79cy5AMb_BGE"); |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues=ACID_DANGER_QUEUE) |
| | | public void pushMessage(ComActAcidRecordVO comActAcidRecordVO) { |
| | | R r = comActAcidMemberService.selectPushList(""); |
| | | if (R.isOk(r) && nonNull(r.getData())) { |
| | | List<ComActAcidMemberVO> members = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComActAcidMemberVO.class); |
| | | if (nonNull(members) && !members.isEmpty()) { |
| | | members.forEach(member -> { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | String accessToken = null; |
| | | try { |
| | | accessToken = util.getXQAppAccessToken(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | WxUtil.sendSubscribeTXTZ(member.getOpenid(), accessToken,"Yr5idSziLRiRo0t07mcz284sMm41Kr2KsA5UmS"); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |