| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.fanli.dao.dynamic.DynamicInfoDao; |
| | | import com.yeshi.fanli.dao.mybatis.help.HelpCenterMapper; |
| | | import com.yeshi.fanli.dto.push.PushContentDTO; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityShareResult; |
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.config.push.PushMsgFactory; |
| | | import com.yeshi.fanli.entity.dynamic.InviteMaterial; |
| | | import com.yeshi.fanli.exception.ActivityException; |
| | | import com.yeshi.fanli.exception.push.PushException; |
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; |
| | | import com.yeshi.fanli.exception.user.UserInfoException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.log.LogManager; |
| | | import com.yeshi.fanli.log.LogType; |
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.InviteMaterialService; |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.service.inter.order.msg.MsgOrderDetailService; |
| | | import com.yeshi.fanli.service.inter.push.PushService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.db.MongoDBManager; |
| | | import com.yeshi.fanli.util.email.MailSenderUtil; |
| | | import com.yeshi.fanli.util.push.OPPOPushUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoCouponCache; |
| | |
| | | import com.yeshi.goods.facade.service.TaoBaoCouponCacheService; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.select.Elements; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.Scheduler; |
| | | import org.quartz.SchedulerException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.amqp.core.Message; |
| | | import org.springframework.amqp.core.MessageProperties; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.cache.ehcache.EhCacheCacheManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | |
| | | @Controller |
| | |
| | | |
| | | @Resource |
| | | private TaoBaoCouponCacheService taoBaoCouponCacheService; |
| | | |
| | | @Resource |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | @RequestMapping(value = "kefu") |
| | | public void kefu(HttpServletRequest request, PrintWriter out) { |
| | |
| | | out.println(array.toString()); |
| | | } |
| | | |
| | | @Resource |
| | | private MsgOrderDetailService msgOrderDetailService; |
| | | |
| | | @Resource |
| | | private PushService pushService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @RequestMapping(value = "pushOrderMsg") |
| | | public void pushOrderMsg(String id, PrintWriter out) throws UserInfoException, PushException { |
| | | MsgOrderDetail msgOrderDetail = msgOrderDetailService.selectByPrimaryKey(Long.parseLong(id)); |
| | | if (msgOrderDetail == null) { |
| | | out.print("ID不存在"); |
| | | return; |
| | | } |
| | | UserInfo userInfo = userInfoService.getUserInfo(msgOrderDetail.getUser().getId()); |
| | | PushContentDTO dto = PushMsgFactory.createFanLiOrderStatisticed(msgOrderDetail.getOrderType(), msgOrderDetail.getOrderId(), msgOrderDetail.getHongBaoMoney()); |
| | | pushService.pushZNX(userInfo.getId(), dto.getTitle(), dto.getContent(), null, null, userInfo.getSystem()); |
| | | } |
| | | |
| | | @RequestMapping(value = "pushOppo") |
| | | public void pushOppo(String registerId, PrintWriter out) { |
| | | List<String> registerIds = new ArrayList<>(); |
| | | registerIds.add(registerId); |
| | | String androidBaseActivity = ""; |
| | | try { |
| | | OPPOPushUtil.pushUrl(registerIds, "测试网页推送", "测试网页推送内容", "http://www.baidu.com"); |
| | | OPPOPushUtil.pushUrl(registerIds, "测试网页推送", "测试网页推送内容", "http://www.baidu.com", androidBaseActivity); |
| | | } catch (PushException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | OPPOPushUtil.pushGoods(registerIds, "测试商品网页推送", "测试商品推送内容", 1, 577628549116L); |
| | | OPPOPushUtil.pushGoods(registerIds, "测试商品网页推送", "测试商品推送内容", 1, 577628549116L+"", androidBaseActivity); |
| | | } catch (PushException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | OPPOPushUtil.pushUserSignInNotification(registerIds, "测试签到推送", "测试签到推送"); |
| | | OPPOPushUtil.pushUserSignInNotification(registerIds, "测试签到推送", "测试签到推送", androidBaseActivity); |
| | | } catch (PushException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | OPPOPushUtil.pushWelfareCenter(registerIds, "测试福利中心推送", "测试福利中心推送"); |
| | | OPPOPushUtil.pushWelfareCenter(registerIds, "测试福利中心推送", "测试福利中心推送", androidBaseActivity); |
| | | } catch (PushException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | @RequestMapping("getTBGoodsCate") |
| | | public void getTaoBaoGoodsCat(Long id, PrintWriter out) { |
| | | public void getTaoBaoGoodsCat(String id, PrintWriter out) { |
| | | TaoBaoGoodsBrief goods = null; |
| | | try { |
| | | goods = TaoKeApiUtil.getSimpleGoodsInfo(id); |
| | |
| | | out.print(data.toString()); |
| | | } |
| | | |
| | | @RequestMapping("log") |
| | | public void log(PrintWriter out) { |
| | | Logger testLogger= LoggerFactory.getLogger("testLog"); |
| | | |
| | | @RequestMapping("wx") |
| | | public void log(HttpServletRequest request, PrintWriter out) { |
| | | LogManager.getLogger(LogType.taobaoAuth).info("123123123"); |
| | | String content = WXUtil.getContent(request); |
| | | testLogger.info("wx: "+content); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | TaoBaoCouponCache cache = new TaoBaoCouponCache(); |
| | | cache.setActivityId("123123123"); |
| | | cache.setPid("mm_12_12_12"); |
| | | cache.setAuctionId(123123L); |
| | | cache.setAuctionId(123123L+""); |
| | | taoBaoCouponCacheService.save(cache); |
| | | } |
| | | |
| | | @RequestMapping("email") |
| | | public void testEmail(PrintWriter out) { |
| | | MailSenderUtil.sendEmail("1101184511@qq.com", "kuaisheng110@163.com", "CMZASWUPTJSFXCNP", "测试", "测试内容:" + System.currentTimeMillis()); |
| | | out.print("success"); |
| | | } |
| | | |
| | | @RequestMapping("testRabbit") |
| | | public void testRabbit(){ |
| | | String msg = "你好:"+TimeUtil.getGernalTime(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss"); |
| | | // 向队列发送消息 |
| | | // rabbitTemplate.convertAndSend("order-all-fanli",msg); |
| | | // 向exchange发送消息 |
| | | // rabbitTemplate.convertAndSend("topic_place_order", "*", msg); |
| | | |
| | | // Message message = MessageBuilder.withBody(msg.getBytes()).setDeliveryMode(MessageDeliveryMode.PERSISTENT).setExpiration("10000").build(); |
| | | rabbitTemplate.convertAndSend("test_queue",msg); |
| | | } |
| | | @RequestMapping("testRabbitDelay") |
| | | public void testRabbitDelay(){ |
| | | String msg = "这是测试的一条延时消息"; |
| | | int time = 5; |
| | | MessageProperties messageProperties = new MessageProperties(); |
| | | messageProperties.setHeader("x-delay", 1000 * time);//延迟5秒被删除 |
| | | Message message = new Message(msg.getBytes(StandardCharsets.UTF_8), messageProperties); |
| | | rabbitTemplate.convertAndSend("delay_exchange", "delay", message);//交换机和路由键必须和配置文件类中保持一致 |
| | | System.out.println(TimeUtil.getGernalTime(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss") + " 发送一条消息"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |