| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.privilege.BasePrivilegeDto; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.dto.smallWechatAttr.SmallWechatAttrDto; |
| | | import com.java110.dto.staffAppAuth.StaffAppAuthDto; |
| | | import com.java110.dto.wechat.SmallWeChatDto; |
| | | import com.java110.dto.wechat.SmallWechatAttrDto; |
| | | import com.java110.dto.user.StaffAppAuthDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.entity.order.Business; |
| | | import com.java110.entity.wechat.Content; |
| | | import com.java110.entity.wechat.Data; |
| | | import com.java110.entity.wechat.PropertyFeeTemplateMessage; |
| | | import com.java110.dto.system.Business; |
| | | import com.java110.dto.wechat.Content; |
| | | import com.java110.dto.wechat.Data; |
| | | import com.java110.dto.wechat.PropertyFeeTemplateMessage; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.order.IPrivilegeInnerServiceSMO; |
| | |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.intf.user.IStaffAppAuthInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.job.msgNotify.MsgNotifyFactory; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.util.Assert; |
| | |
| | | @Autowired |
| | | private RestTemplate outRestTemplate; |
| | | |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ReturnPayFeeAdapt.class); |
| | | |
| | | //模板信息推送地址 |
| | |
| | | ownerId = ownerRoomRelDtos.get(0).getOwnerId(); |
| | | } else if (!StringUtil.isEmpty(payerObjType) && payerObjType.equals("6666")) { |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setCarId(payerObjId); |
| | | ownerCarDto.setMemberId(payerObjId); |
| | | ownerCarDto.setCarTypeCd("1001"); //业主车辆 |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | Assert.listOnlyOne(ownerCarDtos, "查询业主车辆错误!"); |
| | |
| | | logger.info("未配置微信公众号信息,定时任务执行结束"); |
| | | return; |
| | | } |
| | | SmallWeChatDto weChatDto = smallWeChatDtos.get(0); |
| | | SmallWechatAttrDto smallWechatAttrDto = new SmallWechatAttrDto(); |
| | | smallWechatAttrDto.setCommunityId(communityDto.getCommunityId()); |
| | | smallWechatAttrDto.setWechatId(weChatDto.getWeChatId()); |
| | | smallWechatAttrDto.setSpecCd(SmallWechatAttrDto.SPEC_CD_WECHAT_PROCESS_TEMPLATE); |
| | | List<SmallWechatAttrDto> smallWechatAttrDtos = smallWechatAttrInnerServiceSMOImpl.querySmallWechatAttrs(smallWechatAttrDto); |
| | | if (smallWechatAttrDtos == null || smallWechatAttrDtos.size() <= 0) { |
| | | logger.info("未配置微信公众号消息模板"); |
| | | return; |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | | |
| | | // 根据特定权限查询 有该权限的 员工 |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/admin.html#/pages/property/returnPayFeeManage"); |
| | | List<UserDto> userDtos = privilegeInnerServiceSMO.queryPrivilegeUsers(basePrivilegeDto); |
| | | String url = sendMsgUrl + accessToken; |
| | | for (UserDto userDto : userDtos) { |
| | | //根据 userId 查询到openId |
| | | StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto(); |
| | | staffAppAuthDto.setStaffId(userDto.getUserId()); |
| | | staffAppAuthDto.setAppType("WECHAT"); |
| | | List<StaffAppAuthDto> staffAppAuthDtos = staffAppAuthInnerServiceSMO.queryStaffAppAuths(staffAppAuthDto); |
| | | if (staffAppAuthDtos != null && staffAppAuthDtos.size() > 0) { |
| | | String openId = staffAppAuthDtos.get(0).getOpenId(); |
| | | Data data = new Data(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.setFirst(new Content("您有新的退费申请,申请信息如下:")); |
| | | data.setKeyword1(new Content(paramIn.getString("detailId"))); |
| | | data.setKeyword2(new Content("退费申请")); |
| | | data.setKeyword3(new Content(paramIn.getString("name"))); |
| | | data.setKeyword4(new Content(paramIn.getString("name") + "提交的退费申请需审批")); |
| | | data.setKeyword5(new Content("申请退费")); |
| | | data.setRemark(new Content("请及时处理!")); |
| | | templateMessage.setData(data); |
| | | //获取员工公众号地址 |
| | | String wechatUrl = MappingCache.getValue(MappingConstant.URL_DOMAIN,"STAFF_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } |
| | | MsgNotifyFactory.sendApplyReturnFeeMsg(communityDto.getCommunityId(), userDto.getUserId(), paramIn); |
| | | } |
| | | } |
| | | |