Merge remote-tracking branch 'origin/huacheng_test' into huacheng_test
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | String ryo7M3n8loC5Abcd = MyAESUtil.Encrypt("{\"order_status\":\"9\",\"wash_name\":null,\"wash_mobile\":null,\"phone\":\"15828259512\"}", "Ryo7M3n8loC5Abcd"); |
| | | // String ryo7M3n8loC5Abcd = MyAESUtil.Decrypt("Ixp8WMuJ9bnKhiBKmKWq\/rQXQ7SaWc3fHLB1e\/PzAvIEN0CH1nXtMCBzMegT49on31S+3Itop388Yc0EGVx30GGVlG81p7ssiqHlLRna2i903Rid9hqbjZdrBomiy2jp", "Ryo7M3n8loC5Abcd"); |
| | | String ryo7M3n8loC5Abcd = MyAESUtil.Encrypt("{\"order_status\":\"3\",\"wash_name\":null,\"wash_mobile\":null,\"phone\":\"13980596944\"}", "Ryo7M3n8loC5Abcd"); |
| | | // String ryo7M3n8loC5Abcd = MyAESUtil.Decrypt("Ixp8WMuJ9bnKhiBKmKWq\\/rQXQ7SaWc3fHLB1e\\/PzAvIEN0CH1nXtMCBzMegT49on31S+3Itop388Yc0EGVx30GGVlG81p7ssiqHlLRna2i903Rid9hqbjZdrBomiy2jp", "Ryo7M3n8loC5Abcd"); |
| | | // String ryo7M3n8loC5Abcd = MyAESUtil.Decrypt("0H4upa36EW9AFSNcoF9rVX6D5enB9T/9P1hWxLf/NgiGCueg159vz7Ex6+tPAR83aQLPyGeuF74Y5C9VpzQjL7brj8aWdMmnWJp/W1i5lpM=", "Ryo7M3n8loC5Abcd"); |
| | | // 订单完成13980596944 {"aesString":"0H4upa36EW9AFSNcoF9rVX6D5enB9T\/9P1hWxLf\/NgiGCueg159vz7Ex6+tPAR83aQLPyGeuF74Y5C9VpzQjL2IYlgC9A6hhT82p\/kQTjTk="} |
| | | // 取消订单13980596944 {"aesString":"0H4upa36EW9AFSNcoF9rVfYjNQ0z81u6AWDcCU9O9DqGCueg159vz7Ex6+tPAR83aQLPyGeuF74Y5C9VpzQjL2IYlgC9A6hhT82p\/kQTjTk="} |
| | | System.out.println(ryo7M3n8loC5Abcd); |
| | | } |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.constants.WxSubscribeConstants; |
| | |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing9", washerName)); |
| | | paras.add(new TemplateParam("phone_number10",washerMobile)); |
| | | paras.add(new TemplateParam("thing9", StrUtil.isBlank(washerName) ? "":washerName)); |
| | | paras.add(new TemplateParam("phone_number10",StrUtil.isBlank(washerMobile) ? "0":washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | subscribeDTO.setTemplate_id(templateId); |
| | | subscribeDTO.setPage("pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing9", washerName)); |
| | | paras.add(new TemplateParam("phone_number10",washerMobile)); |
| | | paras.add(new TemplateParam("thing9", StrUtil.isBlank(washerName) ? "无":washerName)); |
| | | paras.add(new TemplateParam("phone_number10",StrUtil.isBlank(washerMobile) ? "0" :washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing4", status)); |
| | | paras.add(new TemplateParam("thing3", washerName)); |
| | | paras.add(new TemplateParam("thing6",washerMobile)); |
| | | paras.add(new TemplateParam("thing3", StrUtil.isBlank(washerName) ? "":washerName)); |
| | | paras.add(new TemplateParam("thing6",StrUtil.isBlank(washerMobile) ? "":washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | subscribeDTO.setPage("pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("thing4", status)); |
| | | paras.add(new TemplateParam("thing3", washerName)); |
| | | paras.add(new TemplateParam("thing6",washerMobile)); |
| | | paras.add(new TemplateParam("thing3", StrUtil.isBlank(washerName) ? "":washerName)); |
| | | paras.add(new TemplateParam("thing6",StrUtil.isBlank(washerMobile) ? "":washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | subscribeDTO.setPage("packageD/pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("phrase14", status)); |
| | | paras.add(new TemplateParam("name3", washerName)); |
| | | paras.add(new TemplateParam("thing5",washerMobile)); |
| | | paras.add(new TemplateParam("name3", StrUtil.isBlank(washerName) ? "":washerName)); |
| | | paras.add(new TemplateParam("thing5",StrUtil.isBlank(washerMobile) ? "":washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | subscribeDTO.setPage("pages/washer/order/index"); |
| | | List<TemplateParam> paras=new ArrayList<TemplateParam>(); |
| | | paras.add(new TemplateParam("phrase14", status)); |
| | | paras.add(new TemplateParam("name3", washerName)); |
| | | paras.add(new TemplateParam("thing5",washerMobile)); |
| | | paras.add(new TemplateParam("name3", StrUtil.isBlank(washerName) ? "":washerName)); |
| | | paras.add(new TemplateParam("thing5",StrUtil.isBlank(washerMobile) ? "":washerMobile)); |
| | | subscribeDTO.setTemplateParamList(paras); |
| | | try { |
| | | sendSubscribe(accessToken,subscribeDTO); |
| | |
| | | public String getAccessToken(String appId) throws Exception { |
| | | String accessToken = ""; |
| | | accessToken = wxXCXTempSend.stringRedisTemplate.boundValueOps("access_token:access_token:" + appId).get(); |
| | | if (appId.equals(APP_ID)) { |
| | | accessToken = validAccessToken(accessToken, appId, APP_SECRET); |
| | | } |
| | | return accessToken; |
| | | } |
| | | |
| | |
| | | String accessTokenUrl = ACCESS_TOKEN_URL + "&appid=" + appId + "&secret=" + appSecret; |
| | | String result = HttpClientUtil.httpGet(accessTokenUrl, null, null); |
| | | Map<String, Object> resultMap = JSON.parseObject(result, Map.class); |
| | | StringRedisTemplate redisTemplate = wxXCXTempSend.stringRedisTemplate; |
| | | if (resultMap.containsKey("access_token")) { |
| | | accessToken = resultMap.get("access_token").toString(); |
| | | wxXCXTempSend.stringRedisTemplate.opsForValue().set("access_token:access_token:" + appId, accessToken); |
| | | redisTemplate.opsForValue().set("access_token:access_token:" + appId, accessToken); |
| | | } |
| | | HttpServletRequest request = ServletUtils.getRequest(); |
| | | String requestURI = request.getRequestURI(); |
| | | //加上时间戳 |
| | | String datetime = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | //这里是 Redis key的前缀,如: sys:tabieId:表名 如果不需要去掉表名也可以 |
| | | String key = MessageFormat.format("{0}:{1}:{2}", "request_incr",datetime,requestURI); |
| | | String key = MessageFormat.format("{0}:{1}:{2}", "access_token_request_incr",datetime,requestURI); |
| | | //查询 key 是否存在, 不存在返回 1 ,存在的话则自增加1 |
| | | wxXCXTempSend.stringRedisTemplate.opsForValue().increment(key, 1); |
| | | redisTemplate.opsForValue().increment(key, 1); |
| | | |
| | | } catch (IOException ioe) { |
| | | log.error("小程序http请求异常"); |
| | | ioe.printStackTrace(); |
| | | } |
| | | return accessToken; |
| | | } |
| | | |
| | | /** |
| | | * 发布消息时重新设置access_token 防止过期 |
| | | * |
| | | * @param appId |
| | | * @param appSecret |
| | | * @throws Exception |
| | | */ |
| | | public void setAppAccessTokenToCache(String appId, String appSecret) throws Exception { |
| | | String accessToken = "0"; |
| | | try { |
| | | log.info("获取微信token参数:appid=" + appId + ",appSecret=" + appSecret); |
| | | String accessTokenUrl = ACCESS_TOKEN_URL + "&appid=" + appId + "&secret=" + appSecret; |
| | | String result = HttpClientUtil.httpGet(accessTokenUrl, null, null); |
| | | Map<String, Object> resultMap = JSON.parseObject(result, Map.class); |
| | | if (resultMap.containsKey("access_token")) { |
| | | accessToken = resultMap.get("access_token").toString(); |
| | | wxXCXTempSend.stringRedisTemplate.opsForValue().set("access_token:access_token:" + appId, accessToken, EXPIRE_TIME, TimeUnit.HOURS); |
| | | } |
| | | } catch (IOException ioe) { |
| | | log.error("小程序http请求异常"); |
| | | ioe.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public String getAccessTokenValid(String appId, Integer index) throws Exception { |
| | | if (index % 1000 == 0) { |
| | | return getAccessToken(appId); |
| | | } else { |
| | | return wxXCXTempSend.stringRedisTemplate.boundValueOps("access_token:access_token:" + appId).get(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public String getWsAccessToken() throws Exception { |
| | |
| | | package com.panzhihua.service_community.message; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.SysUserDao; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidDangerMemberVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidMemberVO; |
| | | 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 com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.SysUserDao; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.service.ComActAcidMemberService; |
| | | import com.panzhihua.service_community.util.WxMaConfiguration; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | /** |
| | | * @author zzj |
| | | */ |
| | | @Component |
| | | public class AcidMessage { |
| | | public static final String DELAYED_QUEUE="huacheng.acid.queue"; |
| | | public static final String DELAYED_QUEUE = "huacheng.acid.queue"; |
| | | public static final String ACID_DANGER_QUEUE = "huacheng.acid.danger.queue"; |
| | | public static final String DIRECT_QUEUE="huacheng.acid.direct.queue"; |
| | | public static final String ACID_MESSAGE_QUEUE="huacheng.acid.message.queue"; |
| | | public static final String DIRECT_QUEUE = "huacheng.acid.direct.queue"; |
| | | public static final String ACID_MESSAGE_QUEUE = "huacheng.acid.message.queue"; |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | |
| | | private ComActDAO comActDAO; |
| | | @Resource |
| | | private SysUserDao sysUserDao; |
| | | @Resource |
| | | private WxMaConfiguration wxMaConfiguration; |
| | | |
| | | @RabbitListener(queues=DELAYED_QUEUE) |
| | | @RabbitListener(queues = DELAYED_QUEUE) |
| | | public void doTemplate(ComActAcidRecordVO comActAcidRecordVO) { |
| | | R<LoginUserInfoVO> loginUserInfoVOR= userService.getUserInfoByUserId(comActAcidRecordVO.getUserId().toString()); |
| | | LoginUserInfoVO loginUserInfoVO=loginUserInfoVOR.getData(); |
| | | if(loginUserInfoVO!=null&& StringUtils.isNotEmpty(loginUserInfoVO.getOpenid())){ |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | String accessToken = null; |
| | | try { |
| | | accessToken = util.getAccessToken(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | WxUtil.sendSubscribeTXTZ(loginUserInfoVO.getOpenid(),accessToken,"pov2BTQ_uILduT5OoVKubeS2dibbZ_p79cy5AMb_BGE"); |
| | | } |
| | | R<LoginUserInfoVO> loginUserInfoVOR = userService.getUserInfoByUserId(comActAcidRecordVO.getUserId().toString()); |
| | | LoginUserInfoVO loginUserInfoVO = loginUserInfoVOR.getData(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | if (loginUserInfoVO != null && StringUtils.isNotEmpty(loginUserInfoVO.getOpenid())) { |
| | | try { |
| | | WxUtil.sendSubscribeTXTZ(loginUserInfoVO.getOpenid(), maService.getAccessToken(), "pov2BTQ_uILduT5OoVKubeS2dibbZ_p79cy5AMb_BGE"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues=ACID_DANGER_QUEUE) |
| | | @RabbitListener(queues = ACID_DANGER_QUEUE) |
| | | public void pushMessage(ComActAcidDangerMemberVO dangerMember) { |
| | | R r = comActAcidMemberService.selectPushList(dangerMember.getRelationName()); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | 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.getAccessToken(); |
| | | WxUtil.sendSubscribeDanger(member.getOpenid(), maService.getAccessToken(), dangerMember, "Yr5idSziLRiRo0t07mcz284sMm41Kr2KsA5UmSc0jWU"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | WxUtil.sendSubscribeDanger(member.getOpenid(), accessToken, dangerMember, "Yr5idSziLRiRo0t07mcz284sMm41Kr2KsA5UmSc0jWU"); |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues = DIRECT_QUEUE) |
| | | public void updateUserInfo(ComActAcidRecordVO comActAcidRecordVO){ |
| | | public void updateUserInfo(ComActAcidRecordVO comActAcidRecordVO) { |
| | | //防疫登记提交默认绑定用户信息 |
| | | R<LoginUserInfoVO> loginUserInfoVOR= userService.getUserInfoByUserId(comActAcidRecordVO.getUserId().toString()); |
| | | if(R.isOk(loginUserInfoVOR)&&loginUserInfoVOR.getData()!=null){ |
| | | LoginUserInfoVO loginUserInfoVO=loginUserInfoVOR.getData(); |
| | | if(StringUtils.isEmpty(loginUserInfoVO.getPhone())||StringUtils.isEmpty(loginUserInfoVO.getIdCard())){ |
| | | R<LoginUserInfoVO> loginUserInfoVOR = userService.getUserInfoByUserId(comActAcidRecordVO.getUserId().toString()); |
| | | if (R.isOk(loginUserInfoVOR) && loginUserInfoVOR.getData() != null) { |
| | | LoginUserInfoVO loginUserInfoVO = loginUserInfoVOR.getData(); |
| | | if (StringUtils.isEmpty(loginUserInfoVO.getPhone()) || StringUtils.isEmpty(loginUserInfoVO.getIdCard())) { |
| | | loginUserInfoVO.setPhone(comActAcidRecordVO.getPhone()); |
| | | loginUserInfoVO.setIdCard(comActAcidRecordVO.getIdCard()); |
| | | loginUserInfoVO.setName(comActAcidRecordVO.getName()); |
| | | if(StringUtils.isNotEmpty(comActAcidRecordVO.getLocalCity())){ |
| | | String town=comActAcidRecordVO.getLocalCity().split(",")[2]; |
| | | String area=comActAcidRecordVO.getLocalCity().split(",")[1]; |
| | | String country=comActAcidRecordVO.getLocalCity().split(",")[0]; |
| | | List<ComActDO> comActDOS=comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName,town).eq(ComActDO::getAppId,"wx118de8a734d269f0")); |
| | | if(CollectionUtils.isNotEmpty(comActDOS)){ |
| | | if(comActDOS.size()==1){ |
| | | if (StringUtils.isNotEmpty(comActAcidRecordVO.getLocalCity())) { |
| | | String town = comActAcidRecordVO.getLocalCity().split(",")[2]; |
| | | String area = comActAcidRecordVO.getLocalCity().split(",")[1]; |
| | | String country = comActAcidRecordVO.getLocalCity().split(",")[0]; |
| | | List<ComActDO> comActDOS = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, town).eq(ComActDO::getAppId, "wx118de8a734d269f0")); |
| | | if (CollectionUtils.isNotEmpty(comActDOS)) { |
| | | if (comActDOS.size() == 1) { |
| | | loginUserInfoVO.setCommunityId(comActDOS.get(0).getCommunityId()); |
| | | } |
| | | else { |
| | | ComActDO comActDO=comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getAppId,"wx118de8a734d269f0").eq(ComActDO::getName,town).and(comActDOLambdaQueryWrapper -> comActDOLambdaQueryWrapper.like(ComActDO::getAddress,town).or().like(ComActDO::getAddress,area).or().like(ComActDO::getAddress,country))); |
| | | if(comActDO!=null){ |
| | | } else { |
| | | ComActDO comActDO = comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getAppId, "wx118de8a734d269f0").eq(ComActDO::getName, town).and(comActDOLambdaQueryWrapper -> comActDOLambdaQueryWrapper.like(ComActDO::getAddress, town).or().like(ComActDO::getAddress, area).or().like(ComActDO::getAddress, country))); |
| | | if (comActDO != null) { |
| | | loginUserInfoVO.setCommunityId(comActDO.getCommunityId()); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RabbitListener(queues = ACID_MESSAGE_QUEUE) |
| | | public void sendMessage(ComActDynVO comActDynVO){ |
| | | try{ |
| | | List<String> openIds=sysUserDao.selectOpenId(); |
| | | public void sendMessage(ComActDynVO comActDynVO) { |
| | | try { |
| | | List<String> openIds = sysUserDao.selectOpenId(); |
| | | String appId = "wx118de8a734d269f0"; |
| | | WxXCXTempSend wxXCXTempSend=new WxXCXTempSend(); |
| | | WxXCXTempSend wxXCXTempSend = new WxXCXTempSend(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | for (int i = 0; i < openIds.size(); i++) { |
| | | try { |
| | | WxUtil.sendLongTimeTemplate(openIds.get(i),wxXCXTempSend.getAccessTokenValid(appId,i),"疫情快讯",comActDynVO.getTitle().length()>10?comActDynVO.getTitle().substring(0,10)+"..":comActDynVO.getTitle(),"/pages/community_child/community/detail?id="+comActDynVO.getId()+"&title=疫情快讯详情"); |
| | | WxUtil.sendLongTimeTemplate(openIds.get(i), maService.getAccessToken(), "疫情快讯", comActDynVO.getTitle().length() > 10 ? comActDynVO.getTitle().substring(0, 10) + ".." : comActDynVO.getTitle(), "/pages/community_child/community/detail?id=" + comActDynVO.getId() + "&title=疫情快讯详情"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.model.dtos.community.ActivityInviteDTO; |
| | |
| | | import com.panzhihua.service_community.entity.ComActActivityInvite; |
| | | import com.panzhihua.service_community.model.dos.ComActNeighborCircleTopicWestDO; |
| | | import com.panzhihua.service_community.service.ComActActivityInviteService; |
| | | import com.panzhihua.service_community.util.WxMaConfiguration; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | |
| | | private ComActActivityInviteService comActActivityInviteService; |
| | | @Resource |
| | | private ComActNeighborCircleDAO comActNeighborCircleDAO; |
| | | @Resource |
| | | private WxMaConfiguration wxMaConfiguration; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySigns(activitySignVO); |
| | | if (!activitySignVOS.isEmpty()) { |
| | | try { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | String accessToken = util.getAccessToken(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | String accessToken = maService.getAccessToken(); |
| | | ComActDO comActDO=comActDAO.selectById(comActActivityDO.getCommunityId()); |
| | | R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),1); |
| | | activitySignVOS.forEach(activitySignVO1 -> { |
| | |
| | | // log.info("定时任务--修改社区活动报名状态活动数量【{}】", num1); |
| | | // 查询已经结束的活动,需要计算积分 |
| | | List<Long> activityEndIds = comActActivityDAO.selectBeginIds(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | if(!CollectionUtils.isEmpty(activityEndIds)){ |
| | | activityEndIds.forEach(activityId->{ |
| | | List<String> openIds=comActActivityDAO.selectOpenIdByActivityId(activityId); |
| | |
| | | openIds.forEach(op->{ |
| | | WxXCXTempSend wxXCXTempSend=new WxXCXTempSend(); |
| | | try { |
| | | WxUtil.sendLongTimeTemplate(op,wxXCXTempSend.getAccessToken("wx118de8a734d269f0"),"活动开始提醒","您参加的活动已开始","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+activityId); |
| | | WxUtil.sendLongTimeTemplate(op,maService.getAccessToken(),"活动开始提醒","您参加的活动已开始","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+activityId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | openIds.forEach(op->{ |
| | | WxXCXTempSend wxXCXTempSend=new WxXCXTempSend(); |
| | | try { |
| | | WxUtil.sendLongTimeTemplate(op,wxXCXTempSend.getAccessToken("wx118de8a734d269f0"),"活动结束提醒","您参加的活动已结束","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+id); |
| | | WxUtil.sendLongTimeTemplate(op,maService.getAccessToken(),"活动结束提醒","您参加的活动已结束","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+id); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | .lambda().le(ComActActivityDO::getBeginAt, DateUtils.addDays(new Date(), 1)) |
| | | .ge(ComActActivityDO::getBeginAt, new Date()).notIn(ComActActivityDO::getStatus,5,6)); |
| | | if (!actActivityList.isEmpty()) { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | try { |
| | | String accessToken = util.getAccessToken(); |
| | | String accessToken = maService.getAccessToken(); |
| | | actActivityList.forEach(actActivity -> { |
| | | ComActDO comActDO=comActDAO.selectById(actActivity.getCommunityId()); |
| | | R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),9); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R acceptRequest(Long id, Long specterId) { |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.user.SysAppConfigVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps; |
| | | import me.chanjar.weixin.common.redis.WxRedisOps; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | |
| | | |
| | | @Resource |
| | | private WxMaProperties properties; |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | |
| | | public WxMaService getMaService() { |
| | | WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
| | |
| | | wxMaService.setWxMaConfig(config); |
| | | return wxMaService; |
| | | } |
| | | |
| | | public WxMaService getMaService(String appid) { |
| | | WxRedisOps redisOps = new RedisTemplateWxRedisOps(stringRedisTemplate); |
| | | WxMaRedisBetterConfigImpl config = new WxMaRedisBetterConfigImpl(redisOps, "access_token"); |
| | | if(StringUtils.isNotEmpty(appid)){ |
| | | R<SysAppConfigVO> r=userService.selectByAppid(appid); |
| | | if(R.isOk(r)){ |
| | | SysAppConfigVO sysAppConfigVO= r.getData(); |
| | | config.setAppid(sysAppConfigVO.getAppId()); |
| | | config.setSecret(sysAppConfigVO.getSecret()); |
| | | config.setMsgDataFormat(properties.getMsgDataFormat()); |
| | | } |
| | | } |
| | | else{ |
| | | config.setAppid(properties.getAppid()); |
| | | config.setSecret(properties.getSecret()); |
| | | config.setMsgDataFormat(properties.getMsgDataFormat()); |
| | | } |
| | | WxMaService wxMaService = new WxMaServiceImpl(); |
| | | wxMaService.setWxMaConfig(config); |
| | | return wxMaService; |
| | | } |
| | | } |
| | |
| | | dealNewData(message); |
| | | } |
| | | |
| | | @Async |
| | | void dealNewData(String message) { |
| | | comPropertyAlarmDao = SpringUtil.getBean(ComPropertyAlarmDao.class); |
| | | JSONObject deviceMess = JSONObject.parseObject(message); |
| | | boolean checkFlag = |
| | | ("trace_call".equals(deviceMess.getString("cmd")) && (StringUtils.isNotEmpty(deviceMess.getString("userid")))); |
| | | if (checkFlag) { |
| | | logger.info("收到设备报警信息:{}", message); |
| | | for (int i = 1; i < 10; i++) { |
| | | if (org.apache.commons.lang.StringUtils.isNotEmpty(deviceMess.getString("num" + i))) { |
| | | ComPropertyAlarm comPropertyAlarm = new ComPropertyAlarm(); |
| | | comPropertyAlarm.setSerialNo(deviceMess.getString("userid")); |
| | | comPropertyAlarm.setReceiveNo(deviceMess.getString("num" + i)); |
| | | comPropertyAlarm.setStatus(0); |
| | | // 10位的秒级别的时间戳 |
| | | Date createDate = new Date(deviceMess.getLong("ts" + i) * 1000); |
| | | //对应的就是时间戳对应的Date |
| | | comPropertyAlarm.setCreateTime(createDate); |
| | | comPropertyAlarm.setType(1); |
| | | comPropertyAlarmDao.insert(comPropertyAlarm); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Deprecated |
| | | @Async |
| | | void dealNewData(String message) { |
| | |
| | | int isExpertAccount(String account); |
| | | |
| | | /** |
| | | * 是否为党员 |
| | | * */ |
| | | int isDpcMember(@Param("phone") String phone,@Param("name")String name); |
| | | |
| | | /** |
| | | * 查询两个appid的用户做更新 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<SysUserDO> selectByUserId(@Param("userId") Long userId); |
| | | |
| | | /** |
| | | * 是否为党员 |
| | | * */ |
| | | int isDpcMember(@Param("phone") String phone,@Param("name")String name); |
| | | } |
| | |
| | | * @create: 2020-12-25 10:34 |
| | | **/ |
| | | @Data |
| | | @TableName("sys_oper_log") |
| | | @TableName("sys_oper_log_1") |
| | | public class SysOperLogDO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import lombok.Data; |
| | | |
| | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | Boolean isIndustryOrExpertAccount=(userDao.isIndustryCenterAccount(name)>0 || userDao.isExpertAccount(name)>0); |
| | | if (1 == type) { |
| | | sysUserDO = userDao.selectOne( |
| | | new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, type).eq(SysUserDO::getOpenid, name)); |
| | | new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getType, type).eq(SysUserDO::getOpenid, name).eq(SysUserDO::getAppId, appId)); |
| | | }else if(isIndustryOrExpertAccount) { |
| | | //三说会堂行业分中心或专家后台账号登陆 |
| | | sysUserDO = userDao.selectOne( |
| | |
| | | || operlog.getTitle().equals(UPDATEACIDRECORD)); |
| | | if (flag) { |
| | | //保存数据 |
| | | try { |
| | | operlog.setBeforeUpdateData(saveBeforeUpdateData(operlog)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // try { |
| | | //// operlog.setBeforeUpdateData(saveBeforeUpdateData(operlog)); |
| | | // } catch (JsonProcessingException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | } |
| | | SysOperLogDO sysOperLogDO = new SysOperLogDO(); |
| | | BeanUtils.copyProperties(operlog, sysOperLogDO); |
| | |
| | | WxUtil.sendUuWash3(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "sU18zbyzxFldHAdOREaQCR5uq_uMvCKTmGtklO1xw-w"); |
| | | break; |
| | | case 4: |
| | | status = "车美已开始服务"; |
| | | status = "开始服务"; |
| | | WxUtil.sendUuWash4(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "Eft5ksvsnOQANy2uNOGY43CC3pb33eDGA_lgCEoxuiw"); |
| | | break; |
| | | case 6: |
| | | status = "订单确认完成"; |
| | | status = "订单完成"; |
| | | WxUtil.sendUuWash6(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "k1aV97H3pDNNcNcDTeZBD9jQemNDADnRE801HhTXweI"); |
| | | break; |
| | | case 9: |
| | | status = "订单已取消"; |
| | | status = "订单取消"; |
| | | WxUtil.sendUuWash(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "9_2FhQPDxZoUqmAuIZ1L1zjjYXokdNvu7A0gzKfvruI"); |
| | | break; |
| | | } |
| | |
| | | WxUtil.sendWsWash3(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "sNj6m-JBvW6rOokKGDX9X3-XH1AD0GY5_X0jA9JSLwc"); |
| | | break; |
| | | case 4: |
| | | status = "车美已开始服务"; |
| | | status = "开始服务"; |
| | | WxUtil.sendWsWash4(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "Eft5ksvsnOQANy2uNOGY43CC3pb33eDGA_lgCEoxuiw"); |
| | | break; |
| | | case 6: |
| | | status = "订单确认完成"; |
| | | status = "订单完成"; |
| | | WxUtil.sendWsWash6(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "iPS8yrsGDqy76hiP8bIbxkosveoX1xTFhdusSiGp-XM"); |
| | | break; |
| | | case 9: |
| | | status = "订单已取消"; |
| | | status = "订单取消"; |
| | | WxUtil.sendWsWash(sysUserDO.getOpenid(), accessToken, status, washName, washPhone, phone, "z_ysGXz9JWBc2rXuYZzVCXKJTyLf0w0WerrohuNoEng"); |
| | | break; |
| | | } |