| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.aliyuncs.CommonRequest; |
| | | import com.aliyuncs.CommonResponse; |
| | | import com.aliyuncs.DefaultAcsClient; |
| | |
| | | import com.java110.intf.order.IPrivilegeInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWeChatInnerServiceSMO; |
| | | import com.java110.intf.store.ISmallWechatAttrInnerServiceSMO; |
| | | import com.java110.intf.user.*; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; |
| | | import com.java110.intf.user.IStaffAppAuthInnerServiceSMO; |
| | | import com.java110.job.adapt.DatabusAdaptImpl; |
| | | import com.java110.po.fee.PayFeeDetailPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | feeDetailDto.setbId(business.getbId()); |
| | | List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto); |
| | | Assert.listOnlyOne(feeDetailDtos, "未查询到缴费记录"); |
| | | businessPayFeeDetails = JSONArray.parseArray(JSONArray.toJSONString(feeDetailDtos)); |
| | | businessPayFeeDetails = JSONArray.parseArray(JSONArray.toJSONString(feeDetailDtos, SerializerFeature.WriteDateUseDateFormat)); |
| | | } else if (data.containsKey(PayFeeDetailPo.class.getSimpleName())) { |
| | | Object bObj = data.get(PayFeeDetailPo.class.getSimpleName()); |
| | | if (bObj instanceof JSONObject) { |
| | |
| | | //获取缴费用户楼栋单元房间号 |
| | | String payerObjName = computeFeeSMOImpl.getFeeObjName(feeDtos.get(0)); |
| | | //获得用户缴费开始时间 |
| | | String startTime = payFeeDetailPo.getStartTime(); |
| | | String startTime = DateUtil.dateTimeToDate(payFeeDetailPo.getStartTime()); |
| | | //获取用户缴费到期时间 |
| | | String endTime = payFeeDetailPo.getEndTime(); |
| | | String endTime = DateUtil.dateTimeToDate(payFeeDetailPo.getEndTime()); |
| | | //获取用户缴费金额 |
| | | String receivedAmount = payFeeDetailPo.getReceivedAmount(); |
| | | //获取社区名称 |
| | |
| | | } |
| | | String templateId = smallWechatAttrDtos.get(0).getValue(); |
| | | String accessToken = WechatFactory.getAccessToken(weChatDto.getAppId(), weChatDto.getAppSecret()); |
| | | if (accessToken == null || accessToken == "") { |
| | | if (StringUtil.isEmpty(accessToken)) { |
| | | logger.info("推送微信模板,获取accessToken失败:{}", accessToken); |
| | | return; |
| | | } |
| | |
| | | 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); |
| | | 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("payFeeRoom"))); |
| | | data.setKeyword2(new Content(paramIn.getString("feeTypeCdName"))); |
| | | data.setKeyword3(new Content(paramIn.getString("payFeeTime"))); |
| | | data.setKeyword4(new Content(paramIn.getString("receivedAmount") + "元")); |
| | | data.setRemark(new Content("感谢您的使用,如有疑问请联系相关物业人员")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | try { |
| | | StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto(); |
| | | staffAppAuthDto.setStaffId(userDto.getUserId()); |
| | | staffAppAuthDto.setAppType("WECHAT"); |
| | | List<StaffAppAuthDto> staffAppAuthDtos = staffAppAuthInnerServiceSMO.queryStaffAppAuths(staffAppAuthDto); |
| | | 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("payFeeRoom"))); |
| | | data.setKeyword2(new Content(paramIn.getString("feeTypeCdName"))); |
| | | data.setKeyword3(new Content(paramIn.getString("payFeeTime"))); |
| | | data.setKeyword4(new Content(paramIn.getString("receivedAmount") + "元")); |
| | | data.setRemark(new Content("感谢您的使用,如有疑问请联系相关物业人员")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | | logger.info("微信模板返回内容:{}", responseEntity); |
| | | } catch (Exception e) { |
| | | logger.error("发送缴费信息失败", e); |
| | | } |
| | | } |
| | | } |
| | | |