java开源商城 java搭建直播商城 微服务商城 百万千万级商城 分布式商城 VR全景商城 saas商城 b2b2c商城 o2o商城 积分商城 秒杀商城 拼团商城 分销商城 短视频商城 商家入驻商城

 @源码地址来源: https://minglisoft.cn/honghu/business.html
package com.honghu.cloud.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.Maps;
import com.honghu.cloud.bean.Video;
import com.honghu.cloud.bean.VideoClass;
import com.honghu.cloud.bean.VideoComment;
import com.honghu.cloud.bean.VideoCommentLike;
import com.honghu.cloud.bean.VideoLike;
import com.honghu.cloud.bean.VideoTopic;
import com.honghu.cloud.code.ResponseCode;
import com.honghu.cloud.code.ResponseVO;
import com.honghu.cloud.common.page.Page;
import com.honghu.cloud.dto.AccessoryDto;
import com.honghu.cloud.dto.GoodsDto;
import com.honghu.cloud.dto.SnapshotDto;
import com.honghu.cloud.dto.StoreDto;
import com.honghu.cloud.dto.UserDto;
import com.honghu.cloud.dto.UserVideoDto;
import com.honghu.cloud.feign.AccessoryFeignClient;
import com.honghu.cloud.feign.GoodsFeignClient;
import com.honghu.cloud.feign.ModularClassFeignClient;
import com.honghu.cloud.feign.OrderFormFeignClient;
import com.honghu.cloud.feign.StoreFeignClient;
import com.honghu.cloud.feign.TXTemplateFeignClient;
import com.honghu.cloud.feign.UserFeignClient;
import com.honghu.cloud.service.IVideoClassService;
import com.honghu.cloud.service.IVideoCommentService;
import com.honghu.cloud.service.IVideoService;
import com.honghu.cloud.service.IVideoTopicService;
import com.honghu.cloud.tools.AliSmsUtil;
import com.honghu.cloud.tools.QueryTools;
import com.honghu.cloud.tools.SecurityUserHolder;
import com.honghu.cloud.util.CommUtil;

import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;

/**
 * 短视频带货
 * @author Administrator
 *
 */
@Slf4j
@RestController
@RequestMapping(value="/video")
public class VideoController {
	
	@Autowired
	private IVideoService videoService;
	@Autowired
	private IVideoClassService videoClassService;
	@Autowired
	private AccessoryFeignClient accessoryFeignClient;
	@Autowired
	private IVideoTopicService videoTopicService;
	@Autowired
	private QueryTools queryTools;
    @Autowired
    private UserFeignClient userFeignClient;
    @Autowired
    private IVideoCommentService videoCommentService;
    @Autowired
    private GoodsFeignClient goodsFeignClient;
    @Autowired
    private StoreFeignClient storeFeignClient;
    @Autowired
    private OrderFormFeignClient orderFormFeignClient;
    @Autowired
    private ModularClassFeignClient modularClassFeignClient;
    @Autowired
	private TXTemplateFeignClient tXTemplateFeignClient;
    
    
    @RequestMapping(value = "/apiForFeign/selectByPrimaryKey", method = RequestMethod.GET)
	public Video selectByPrimaryKey(@RequestParam("id")Long id) {
		return videoService.selectByPrimaryKey(id);
	}
    @RequestMapping(value = "/apiForFeign/selectCount", method = RequestMethod.GET)
    public int selectCount(@RequestBody Map params) {
    	return videoService.selectCount(params);
    }
    
    
	/**
	 * 视频首页
	 * @param order
	 * @param localPath
	 * @param buyer
	 */
	@RequestMapping(value = "/videoIndex", method = RequestMethod.POST)
	public Map videoIndex(HttpServletRequest request,@RequestBody JSONObject json) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if(user_id != null){
			UserDto user = userFeignClient.selectByPrimaryKey(user_id);
			if(user == null){
				// 用户不存在
				return ResponseCode.buildReturnMap(ResponseCode.USER_NOT_EXISTS_ERROR, null);
			}
		}
		
		HashMap result = new HashMap<>();
		HashMap params = new HashMap<>();
		String currentPage =null;
		if (json.containsKey("currentPage")) {
			currentPage = json.optString("currentPage");
		}	
		/*String type = json.optString("type");
		if ("same_city".equals(type)) {    // 附近的人 ,按位置排序
			String lat = json.optString("lat");
			String lng = json.optString("lng");
			if (StringUtils.isNotBlank(lat) && StringUtils.isNotBlank(lng)) {
				Map params2 = queryTools.getParams(currentPage, "distance", "asc");
				params2.put("lat", lat);
				params2.put("lng", lng);
				params2.put("distance_no_exceed", 5000000);      // 筛选不超过50,000米的 (50千米)
				params2.put("video_distance", "video_distance"); // 经纬度
				if (json.containsKey("time_stamp")) {
					params2.put("a_add_Time_less_than_equal", json.optString("time_stamp")); // 时间戳
				}
				Page

你可能感兴趣的:(honghu,b2b2c,java,微服务,分布式,电子商务,spring,cloud,alibaba)