七十七、java版商城之直播短视频带货Spring Cloud+SpringBoot+mybatis+uniapp b2b2c o2o 多商家入驻商城 直播带货商城 电子商务

一个好的SpringCloud+SpringBoot b2b2c 电子商务平台涉及哪些技术、运营方案?以下是我结合公司的产品做的总结,希望可以帮助到大家!

搜索体验小程序:海哇

1. 涉及平台
平台管理、商家端(PC端、手机端)、买家平台(H5/公众号、小程序、APP端(IOS/Android)、微服务平台(业务服务)

2. 核心架构
Spring Cloud、Spring Boot、Mybatis、Redis

3. 前端框架
VUE、Uniapp、Bootstrap/H5/CSS3、IOS、Android、小程序

4. 核心思想
分布式、微服务、云架构、模块化、原子化、持续集成、集群部署、前后端分离、支持阿里Docker

5. 开发模式
前后端分离、微服务开发

6. 社交模式
VR全景虚拟现实、直播带货、短视频带货、分销分润、代跑腿配送、内容营销、社交种草、社交电商、秒杀、积分商城、限时折扣、活动商品、拼团活动等

7. 营销模式
通用版本(标准多商户入驻+二级分销体系+满减、满送、优惠券、组合销售、平台礼包等营销活动)
直播、短视频带货版本(标准多商户入驻+直播、短视频带货+二级分销体系+满减、满送、优惠券、组合销售、平台礼包等营销活动)
特殊营销方案(一):一县一特(一个县城,一个特色,集本地特产、特色、名胜、小吃、文化为一体的营销方案)
特殊营销方案(二):短距离配送(外卖、生鲜水果配送,解决1.5公里配送问题,接入第三方代跑腿服务)
特殊营销方案(三):酒店行业(酒店商家入驻,根据定位,可针对附近酒店,不同城酒店进行线上预定、下线核销等,参考去哪儿网酒店业务)
特殊营销方案(四):VR全景(商家入驻后,可以进行VR全景拍摄,VR店铺体验,全新购物方式,通过虚拟现实技术,线上线下打通,实现全新O2O,深度场景体验,感受另一个大千世界,让用户足不出户完美购物。通过VR让您的店铺曝光率更高,让天下没有难销的商品)
特殊营销方案(五):线下套餐体验(针对于实体行业,用户线上消费后生成核销码,用户到实体店铺体验套餐,可凭借核销码进行体验项目)
特殊营销方案(六):旅游业(周边游、本地游、异地游等,旅游景区和VR全景结合,用户足不出户先感受一下旅游项目、旅游攻略等,可线上订票、预定等)
特殊营销方案(七):供应求购(简易供应链供应、求购模式)
特殊营销方案(八):社交资讯(用户发布文章,可进行带货)
特殊营销方案(九):社交动态(个人信息、动态、视频,如:文字+图片、文字+视频,可进行带货;粉丝、关注、分享等)
活动商品(平台发布活动商品,如:可以进行0元领取,领取需要进行用户拉新,拉新后可进行现金奖励等)
特殊营销方案(十):异业联盟(不同行业的联盟销售,如:在某餐饮店面消费后可送附近健身卡优惠券,凭借优惠券可进行线下体验)
特殊营销方案(十一):一键代发营销(商家选择平台商品后放入自己店面销售,用户购买后商家可获取特殊分润提成,商家不需要发货,由平台厂家直接发货,并支持本店面自提)
 

七十七、java版商城之直播短视频带货Spring Cloud+SpringBoot+mybatis+uniapp b2b2c o2o 多商家入驻商城 直播带货商城 电子商务_第1张图片

 七十七、java版商城之直播短视频带货Spring Cloud+SpringBoot+mybatis+uniapp b2b2c o2o 多商家入驻商城 直播带货商城 电子商务_第2张图片

七十七、java版商城之直播短视频带货Spring Cloud+SpringBoot+mybatis+uniapp b2b2c o2o 多商家入驻商城 直播带货商城 电子商务_第3张图片 

 七十七、java版商城之直播短视频带货Spring Cloud+SpringBoot+mybatis+uniapp b2b2c o2o 多商家入驻商城 直播带货商城 电子商务_第4张图片

 七十七、java版商城之直播短视频带货Spring Cloud+SpringBoot+mybatis+uniapp b2b2c o2o 多商家入驻商城 直播带货商城 电子商务_第5张图片

 

package com.honghu.cloud.controller;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
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.honghu.cloud.bean.Live;
import com.honghu.cloud.bean.LiveBaby;
import com.honghu.cloud.bean.LiveFollow;
import com.honghu.cloud.bean.UserSearchLog;
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.AddGoodsCarFormDto;
import com.honghu.cloud.dto.MessageDto;
import com.honghu.cloud.dto.SysConfigDto;
import com.honghu.cloud.dto.UserDto;
import com.honghu.cloud.feign.AccessoryFeignClient;
import com.honghu.cloud.feign.GoodsCartFeignClient;
import com.honghu.cloud.feign.GoodsShareFeignClient;
import com.honghu.cloud.feign.MessageFeignClient;
import com.honghu.cloud.feign.SysConfigFeignClient;
import com.honghu.cloud.feign.UserFeignClient;
import com.honghu.cloud.redis.RedisUtil;
import com.honghu.cloud.service.IUserSearchLogService;
import com.honghu.cloud.service.LiveBabyService;
import com.honghu.cloud.service.LiveFollowService;
import com.honghu.cloud.service.LiveService;
import com.honghu.cloud.tools.LiveUtils;
import com.honghu.cloud.tools.QueryTools;
import com.honghu.cloud.tools.SecurityUserHolder;
import com.honghu.cloud.util.CommUtil;
import com.honghu.cloud.utils.tools.Md5Encrypt;

import net.sf.json.JSONObject;

/**
 * 直播间管理控制器
 * 
 * @author Administrator
 *
 */
@RestController
@RequestMapping(value = "/live")
public class LiveController {
	private static final Logger logger = LoggerFactory.getLogger(LiveController.class);

	@Autowired
	private LiveService liveService;
	@Autowired
	private LiveFollowService liveFollowService;
	@Autowired
	private AccessoryFeignClient accessoryFeignClient;
	@Autowired
	private SysConfigFeignClient sysConfigFeignClient;
	@Autowired
	private LiveBabyService liveBabyService;
	@Autowired
	private UserFeignClient userFeignClient;
	@Autowired
	private MessageFeignClient messageFeignClient;
	@Autowired
	private GoodsShareFeignClient shareFeignClient;
	@Autowired
	private IUserSearchLogService userSearchLogService;
	@Autowired
	private GoodsCartFeignClient goodsCartFeignClient;

	@Autowired
	private RedisUtil redisUtil;

	/**
	 * 根据id查询直播
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "/apiForFeign/selectByPrimaryKey", method = RequestMethod.GET)
	public Live selectByPrimaryKey(@RequestParam("id") Long id) {
		return liveService.selectByPrimaryKey(id);
	}

	@RequestMapping(value = "/apiForFeign/selectByPrimaryKey1", method = RequestMethod.GET)
	public Live selectByPrimaryKey1(@RequestParam("id") Long id) {
		return liveService.selectByPrimaryKey1(id);
	}

	/**
	 * 我的直播间数据列表查询
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/getLiveList")
	public ResponseVO getLiveList(HttpServletRequest request, @RequestBody JSONObject json) {
		Map params = new HashMap();
		String currentPage = json.optString("currentPage"); // 当前页数
		String pageSize = json.optString("pageSize"); // 数据长度
		String userName = json.getString("userName"); // 主播用户
		String orderBy = json.optString("orderBy"); // 排序字段
		String orderType = json.optString("orderType"); // 排序方式
		if (StringUtils.isNotBlank(userName)) {
			if (StringUtils.isNotBlank(currentPage)) {
				params.put("currentPage", CommUtil.null2Int(currentPage));
			}
			if (StringUtils.isNotBlank(pageSize)) {
				params.put("pageSize", CommUtil.null2Int(pageSize));
			}
			if (StringUtils.isNotBlank(orderBy)) {
				params.put("orderBy", orderBy);
			}
			if (StringUtils.isNotBlank(orderType)) {
				params.put("orderType", orderType);
			}
			params.put("creater_id", userName); // 当前用户编号
		}
		List results = liveService.queryPages(params);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, results);
	}

	/**
	 * 我的直播间数据列表查询
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/getLiveList_new")
	public ResponseVO getLiveList_new(HttpServletRequest request, @RequestBody JSONObject json) {
		Map params = new HashMap();
		String currentPage = json.optString("currentPage"); // 当前页数
		String pageSize = json.optString("pageSize"); // 数据长度
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}

		params = QueryTools.getParams(currentPage, 12, "live_status DESC ,addTime", "DESC");
		params.put("user_id", user.getId()); // 当前用户编号
		params.put("goods_num", "goods_num"); // 查询宝贝件数

		Page results = liveService.list(params);
		params.clear();
		params.put("results", results);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, params);
	}

	/**
	 * 全部直播间数据列表查询
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/getLiveListAll")
	public ResponseVO getLiveListAll(HttpServletRequest request, @RequestBody JSONObject json) {
		Map params = new HashMap();
		String currentPage = json.optString("currentPage"); // 当前页数
		String pageSize = json.optString("pageSize"); // 数据长度
		String orderBy = json.optString("orderBy"); // 排序字段
		String orderType = json.optString("orderType"); // 排序方式
		String type = json.optString("type"); // 排序方式

		params = QueryTools.getParams(currentPage, CommUtil.null2Int(pageSize), orderBy, orderType);
		if (StringUtils.isNotBlank(type) && "follow".equals(type)) {
			// 查询用户关注的主播
			params.put("orderType", type);
		}

		List list = liveService.queryPages(params);
		HashMap results = new HashMap<>();
		results.put("list", list);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, results);
	}

	@RequestMapping(value = "/getLiveListAll1")
	public ResponseVO getLiveListAll1(HttpServletRequest request, @RequestBody JSONObject json) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}

		Map params = new HashMap();
		String currentPage = json.optString("currentPage"); // 当前页数
		String pageSize = json.optString("pageSize"); // 数据长度
		String type = json.optString("type"); // 排序方式
		String store_id = json.optString("store_id"); // 店铺id
		HashMap results = new HashMap<>();
		params = QueryTools.getParams(currentPage, CommUtil.null2Int(pageSize), "a.addTime", null);
		if (StringUtils.isNotBlank(type) && "follow".equals(type)) {
			// 查询用户关注的主播
			params.put("follow", user.getId());
		}
		if (StringUtils.isNotBlank(store_id)) {
			UserDto UserDto = userFeignClient.getUserByStoreId(CommUtil.null2Long(store_id));
			if (UserDto == null) {
				Page list = new Page<>();
				results.put("list", list);
				return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, results);
			}
			params.put("a_user_id", UserDto.getId());
		}

		Page list = liveService.list1(params);

		results.put("list", list);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, results);
	}

	/**
	 * 查询直播间数据
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping("/getLiveById")
	public ResponseVO getLiveById(@RequestBody JSONObject json, HttpServletRequest request) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		String live_id = json.optString("live_id");
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		if (StringUtils.isEmpty(live_id)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_ID_ISNULL, null);
		}

		Live live = liveService.selectByPrimaryKey(CommUtil.null2Long(live_id));
		if (live == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.GOODSCLASS_CODE_NULL, null);
		}
		UserDto anchor = userFeignClient.selectByPrimaryKey(live.getUser_id());
		if (anchor == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_CONCERN_ISNULL, null);
		}
		HashMap hashMap = new HashMap<>();
		AccessoryDto accessoryDto = accessoryFeignClient.selectByPrimaryKey(anchor.getPhoto_id());

		if (live.getLive_status() == 1) { // 若在直播中 添加热度
			int n = (int) (Math.random() * 20 + 15);
			live.setPopularity_num(live.getPopularity_num() == null ? 0 : live.getPopularity_num() + n);
			liveService.updateById(live);

			Object currentNumber = redisUtil.get("NUMBER_" + live.getId());
			redisUtil.set("NUMBER_" + live.getId(), null == currentNumber ? 1 : (int) currentNumber + 1);

		}

		if (user_id != null) {
			hashMap.put("concern", user_id);
			hashMap.put("to_concern", anchor.getId());
			hashMap.put("deleteStatus", 0);
			LiveFollow liveFollow = liveFollowService.getLiveFollow(hashMap);
			if (liveFollow != null) {
				live.setFollow(1); // 已关注
			}
		}
		hashMap.clear();
		hashMap.put("anchorname", anchor.getNickName());
		hashMap.put("anchorphoto", accessoryDto);
		hashMap.put("live", live);
		hashMap.put("user", user);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, hashMap);
	}

	/**
	 * 创建直播间 添加直播间数据
	 * 
	 * @param live
	 */
	@RequestMapping("/add_live_baby")
	public ResponseVO add_live(HttpServletRequest request, @RequestBody JSONObject json) {
		String mulitId = null; // 商品id
		if (json.containsKey("goods_id")) {
			mulitId = json.optString("goods_id");
		}
		String live_id = json.optString("live_id"); // 直播id
		String userName = json.optString("userName"); // 用户userName
		String live_title = json.optString("live_title"); // 直播间标题
		String live_cover = json.optString("live_cover"); // 直播间封面路径完整路径
		String live_status = json.optString("live_status"); // 直播状态
		String play_time = json.optString("play_time"); // 直播间预播时间

		// 直播间id
		if (StringUtils.isEmpty(live_id)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_ID_ISNULL, null); // 直播间ID不能为空
		}
		if (StringUtils.isEmpty(live_title)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TITLE_ISNULL, null); // 直播间标题不能为空
		}
		if (StringUtils.isEmpty(live_cover)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_COVER_ISNULL, null); // 直播间封面不能为空
		}
		if (StringUtils.isEmpty(userName)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_USERNAME_ISNULL, null); // 用户userName不能为空
		}
		if (StringUtils.isEmpty(live_status)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_STATUS, null); // 直播状态不能为空
		}

		Live live = new Live();
		live.setAddTime(new Date()); // 直播间创建时间
		live.setLive_title(live_title); // 直播间标题
		live.setLive_cover(live_cover); // 直播间封面完整路径
		live.setLive_num(CommUtil.null2Long(live_id)); // 直播间房间号
		live.setCreater_id(userName); // 创建用户
		live.setLive_status(Integer.valueOf(live_status)); // 直播状态
		// 日期转化格式
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = null;
		try {
			date = simpleDateFormat.parse(play_time);
			live.setPlay_time(date); // 预播时间
		} catch (ParseException e) {
			logger.error("LiveController >> add_live >> " + e.getMessage());
		}
		liveService.addLive(live); // 保存直播间数据信息
		if (null != mulitId) {
			String[] ids = mulitId.split(",");
			for (String id : ids) {
				LiveBaby liveBaby = new LiveBaby();
				liveBaby.setAddTime(new Date());
				liveBaby.setCreater_id(userName);
				liveBaby.setGoods_id(CommUtil.null2Long(id));
				liveBaby.setLive_id(CommUtil.null2Long(live_id)); // 直播间id
				liveBaby.setDeleteStatus(0); // 删除标识
				liveBabyService.addLiveBaby(liveBaby); // 添加直播间宝贝信息
			}
		}

		try {
			UserDto liveUser = userFeignClient.selectByUserName(userName);
			Map maps = new HashMap();
			maps.put("to_concern", liveUser.getId());
			List list = liveFollowService.queryPages(maps);
			List msgs = new ArrayList();
			for (LiveFollow lf : list) {
				// 发送站内消息
				MessageDto msg = new MessageDto();
				msg.setAddTime(new Date());
				msg.setDeleteStatus(0);
				msg.setMsg_cat(0);
				msg.setReply_status(0);
				msg.setStatus(0);
				String nickName = liveUser.getNickName();
				if (StringUtils.isBlank(nickName)) {
					StringBuilder sb = new StringBuilder(liveUser.getMobile());
					if (sb.length() >= 11) {
						sb.replace(3, 7, "****");
					}
					nickName = sb.toString();
				}
				if (StringUtils.equals("1", live_status)) {
					msg.setTitle("直播通知");
					msg.setContent("你关注的" + nickName + "正在直播,请及时观看。");
					// TODO 添加公众号推送
				} else {
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
					String format = sdf.format(date); // 将Date类型转换成String类型
					msg.setTitle("预播通知");
					msg.setContent("你关注的" + nickName + "将于" + format + "开始直播,请及时观看哦!");
				}
				msg.setType(2);
				msg.setFromUser_id(1L);
				msg.setToUser_id(lf.getConcern());
				msgs.add(msg);
			}
			messageFeignClient.saveList(msgs);
		} catch (Exception e) {
			logger.error("LiveController >> add_live >> sendMsg error " + e.getMessage());
		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 创建直播间 添加直播间数据
	 * 
	 * @param live
	 */
	@RequestMapping(value = "/add_live_baby_new", method = RequestMethod.POST)
	public ResponseVO add_live_new(HttpServletRequest request, @RequestBody JSONObject json) {
		String mulitId = null; // 商品id
		if (json.containsKey("goods_id")) {
			mulitId = json.optString("goods_id");
		}
		// String live_id = json.optString("live_id"); //直播id
		String live_title = json.optString("live_title"); // 直播间标题
		String live_cover = json.optString("live_cover"); // 直播间封面路径完整路径
		String live_status = json.optString("live_status"); // 直播状态
		String play_time = json.optString("play_time"); // 直播间预播时间
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		/*
		 * if(StringUtils.isEmpty(live_id)){ return
		 * ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_ID_ISNULL, null);
		 * //直播间ID不能为空 }
		 */
		if (StringUtils.isEmpty(live_title)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TITLE_ISNULL, null); // 直播间标题不能为空
		}
		if (StringUtils.isEmpty(live_cover)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_COVER_ISNULL, null); // 直播间封面不能为空
		}
		if (StringUtils.isEmpty(live_status)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_STATUS, null); // 直播状态不能为空
		}
		Map maps = new HashMap();
		Live live = new Live();
		Date date = null;

		if (live_status.equals("3")) {
			// 日期转化格式
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			try {
				date = simpleDateFormat.parse(play_time);
				// 查询预播时间点是否存在
				maps.put("a_user_id", user.getId());
				maps.put("a_play_time", play_time);
				List queryPages = liveService.queryPages(maps);
				if (queryPages != null && queryPages.size() > 0) { // 该时间存在预播
																	// 不保存
					return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_PREVIEW_IS, null); // 预播已存在
				}
				live.setPlay_time(date); // 预播时间
			} catch (ParseException e) {
				logger.error("LiveController >> add_live >> " + e.getMessage());
			}
		}
		live.setAddTime(new Date()); // 直播间创建时间
		live.setLive_title(live_title); // 直播间标题
		live.setLive_cover(live_cover); // 直播间封面完整路径
		Long selectMaxLiveCode = liveService.selectMaxLiveCode();
		live.setLive_num(selectMaxLiveCode == null ? 100000 : selectMaxLiveCode + 1); // 直播间房间号
		live.setUser_id(user.getId());
		live.setCreater_id(user.getUserName()); // 创建用户
		live.setLive_status(Integer.valueOf(live_status)); // 直播状态

		if (live_status.equals("1")) {
			live.setDeleteStatus(1); // 若为直播,先置位删除状态 , 推流时修改
		}
		liveService.addLive(live); // 保存直播间数据信息
		if (null != mulitId) {
			String[] ids = mulitId.split(",");
			for (String id : ids) {
				if (!id.equals("")) {
					LiveBaby liveBaby = new LiveBaby();
					liveBaby.setAddTime(new Date());
					liveBaby.setCreater_id(user.getUsername());
					liveBaby.setGoods_id(CommUtil.null2Long(id));
					liveBaby.setLive_id(CommUtil.null2Long(live.getId())); // 直播间id
					liveBaby.setDeleteStatus(0); // 删除标识
					liveBabyService.addLiveBaby(liveBaby); // 添加直播间宝贝信息
				}
			}
		}

		try {
			// UserDto liveUser = userFeignClient.selectByUserName(userName);
			maps.clear();
			maps.put("to_concern", user.getId());
			List list = liveFollowService.queryPages(maps);
			List msgs = new ArrayList();
			for (LiveFollow lf : list) {
				// 发送站内消息
				MessageDto msg = new MessageDto();
				msg.setAddTime(new Date());
				msg.setDeleteStatus(0);
				msg.setMsg_cat(0);
				msg.setReply_status(0);
				msg.setStatus(0);
				String nickName = user.getNickName();
				if (StringUtils.isBlank(nickName)) {
					StringBuilder sb = new StringBuilder(user.getMobile());
					if (sb.length() >= 11) {
						sb.replace(3, 7, "****");
					}
					nickName = sb.toString();
				}
				if (StringUtils.equals("1", live_status)) {
					msg.setTitle("直播通知");
					msg.setContent("你关注的" + nickName + "正在直播,请及时观看。");
					// TODO 添加公众号推送

				} else {
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
					String format = sdf.format(date); // 将Date类型转换成String类型
					msg.setTitle("预播通知");
					msg.setContent("你关注的" + nickName + "将于" + format + "开始直播,请及时观看哦!");
				}
				msg.setType(2);
				msg.setFromUser_id(1L);
				msg.setToUser_id(lf.getConcern());
				msgs.add(msg);
			}
			messageFeignClient.saveList(msgs);
		} catch (Exception e) {
			logger.error("LiveController >> add_live >> sendMsg error " + e.getMessage());
		}
		HashMap hashMap = new HashMap<>();
		hashMap.put("live", live);
		hashMap.put("nickName", user.getNickName());
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, hashMap); // 请求处理成功
	}

	/**
	 * 添加主播关注数据
	 * 
	 * @param live
	 */
	@RequestMapping("/add_live_follow")
	public ResponseVO add_live_follow(@RequestBody JSONObject json) {
		String concern = json.optString("concern"); // 关注者编号
		String to_concern = json.optString("to_concern"); // 被关注者编号
		if (StringUtils.isEmpty(concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_CONCERN_USERNAME_ISNULL, null); // 关注者userName不能为空
		}
		if (StringUtils.isEmpty(to_concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_USERNAME_ISNULL, null); // 被关注者userName不能为空
		}
		UserDto concernUser = userFeignClient.selectByUserName(concern); // 关注者用户
		if (concernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_CONCERN_ISNULL, null); // 关注者用户不存在
		}
		UserDto toConcernUser = userFeignClient.selectByUserName(to_concern); // 被关注者用户
		if (toConcernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注者用户不存在
		}
		Map maps = new HashMap();
		maps.put("concern", concernUser.getId());
		maps.put("to_concern", toConcernUser.getId());
		LiveFollow lFollow = liveFollowService.getLiveFollow(maps);
		if (null != lFollow) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_FOLLOW, null); // 主播已关注
		}
		LiveFollow liveFollow = new LiveFollow();
		liveFollow.setAddTime(new Date()); // 添加时间
		liveFollow.setConcern(concernUser.getId()); // 关注者
		liveFollow.setTo_concern(toConcernUser.getId()); // 被关注者
		liveFollowService.addLiveFollow(liveFollow); // 关注信息添加
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 添加主播关注数据
	 * 
	 * @param live
	 */
	@RequestMapping("/add_live_follow_new")
	public ResponseVO add_live_follow_new(@RequestBody JSONObject json, HttpServletRequest request) {
		String user_id = json.optString("user_id"); // 被关注者编号

		String tokenStr = request.getHeader("token");
		Long concern = SecurityUserHolder.getTokenUserId(tokenStr);
		if (concern == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(concern);// 关注者用户
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		UserDto toConcernUser = userFeignClient.selectByPrimaryKey(CommUtil.null2Long(user_id)); // 被关注者用户
		if (toConcernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注者用户不存在
		}
		if (user.getId().toString().equals(user_id)) { // 关注者为登陆者
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注者用户不存在
		}

		Map maps = new HashMap();
		maps.put("concern", user.getId());
		maps.put("to_concern", toConcernUser.getId());
		LiveFollow lFollow = liveFollowService.getLiveFollow(maps);
		if (null != lFollow) {
			liveFollowService.deleteLiveFollow(maps); // 删除主播关注数据
			// return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_FOLLOW,
			// null); // 主播已关注
		} else {
			LiveFollow liveFollow = new LiveFollow();
			liveFollow.setAddTime(new Date()); // 添加时间
			liveFollow.setConcern(user.getId()); // 关注者
			liveFollow.setTo_concern(toConcernUser.getId()); // 被关注者
			liveFollowService.addLiveFollow(liveFollow); // 关注信息添加
		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 取消主播关注数据
	 * 
	 * @param live
	 */
	@RequestMapping("/del_live_follow")
	public ResponseVO del_live_follow(@RequestBody JSONObject json) {
		String concern = json.optString("concern"); // 关注者编号
		String to_concern = json.optString("to_concern"); // 被关注者编号
		if (StringUtils.isEmpty(concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_CONCERN_USERNAME_ISNULL, null); // 关注者userName不能为空
		}
		if (StringUtils.isEmpty(to_concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_USERNAME_ISNULL, null); // 被关注者userName不能为空
		}
		UserDto concernUser = userFeignClient.selectByUserName(concern); // 关注者用户
		if (concernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 关注者用户不存在
		}
		UserDto toConcernUser = userFeignClient.selectByUserName(to_concern); // 被关注者用户
		if (toConcernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注者用户不存在
		}
		Map params = new HashMap();
		params.put("concern", concernUser.getId());
		params.put("to_concern", toConcernUser.getId());
		LiveFollow lFollow = liveFollowService.getLiveFollow(params);
		if (null == lFollow) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_NOT_FOLLOW, null); // 还未关注主播
		}
		liveFollowService.deleteLiveFollow(params); // 删除主播关注数据
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 取消主播关注数据
	 * 
	 * @param live
	 */
	@RequestMapping("/del_live_follow_new")
	public ResponseVO del_live_follow_new(@RequestBody JSONObject json, HttpServletRequest request) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}

		String to_concern = json.optString("to_concern"); // 被关注者编号
		if (StringUtils.isEmpty(to_concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_USERNAME_ISNULL, null); // 被关注者userName不能为空
		}
		UserDto toConcernUser = userFeignClient.selectByUserName(to_concern); // 被关注者用户
		if (toConcernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注者用户不存在
		}
		Map params = new HashMap();
		params.put("concern", user.getId());
		params.put("to_concern", toConcernUser.getId());
		LiveFollow lFollow = liveFollowService.getLiveFollow(params);
		if (null == lFollow) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_NOT_FOLLOW, null); // 还未关注主播
		}
		liveFollowService.deleteLiveFollow(params); // 删除主播关注数据
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 关注用户数据信息列表
	 * 
	 * @param live
	 */
	@RequestMapping("/follow_user")
	public ResponseVO follow_user(HttpServletRequest request, @RequestBody JSONObject json) {
		String currentPage = json.optString("currentPage"); // 当前页数
		String pageSize = json.optString("pageSize"); // 数据长度
		String orderBy = json.optString("orderBy"); // 排序字段
		String orderType = json.optString("orderType"); // 排序方式
		List> result = new LinkedList>();
		String userName = json.getString("userName"); // 被关注者编号
		if (StringUtils.isEmpty(userName)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_USERNAME_ISNULL, null); // 用户userName不能为空

		}
		UserDto user = userFeignClient.selectByUserName(userName); // 用户
		if (user == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_DOES_NOT_EXIST, null); // 用户不存在
		}
		Map params = new HashMap();
		if (StringUtils.isNotBlank(currentPage)) {
			params.put("currentPage", CommUtil.null2Int(currentPage));
		}
		if (StringUtils.isNotBlank(pageSize)) {
			params.put("pageSize", CommUtil.null2Int(pageSize));
		}
		if (StringUtils.isNotBlank(orderBy)) {
			params.put("orderBy", orderBy);
		}
		if (StringUtils.isNotBlank(orderType)) {
			params.put("orderType", orderType);
		}
		if (StringUtils.isNotBlank(userName)) {
			params.put("anchor_id", user.getId()); // 被关注用户
		}
		List userDtos = userFeignClient.queryPageList(params);
		SysConfigDto sysConfigDto = sysConfigFeignClient.getSysConfig();
		for (UserDto userDto : userDtos) {
			AccessoryDto acc = null;
			if (userDto.getPhoto_id() != null) {
				acc = accessoryFeignClient.selectByPrimaryKey(userDto.getPhoto_id());
			}
			Map us = new HashMap();
			us.put("user_id", userDto.getId());
			us.put("nickName", userDto.getNickName()); // 用户昵称
			us.put("autograph", ""); // 用户个性签名
			if (null != sysConfigDto) {
				if (null != acc) {
					us.put("photo", sysConfigDto.getImageWebServer() + "/" + acc.getPath() + "/" + acc.getName()); // 用户头像
				} else {
					us.put("photo", sysConfigDto.getImageWebServer() + "/" + sysConfigDto.getMemberIcon().getPath()
							+ "/" + sysConfigDto.getMemberIcon().getName()); // 用户头像
				}
			}
			result.add(us);
		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 关注用户数据信息列表
	 * 
	 * @param live
	 */
	@RequestMapping("/follow_user_new")
	public ResponseVO follow_user_new(HttpServletRequest request, @RequestBody JSONObject json) {
		String currentPage = json.optString("currentPage"); // 当前页数
		String pageSize = json.optString("pageSize"); // 数据长度
		String orderBy = json.optString("orderBy"); // 排序字段
		String orderType = json.optString("orderType"); // 排序方式
		List> result = new LinkedList>();

		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		Map params = new HashMap();
		if (StringUtils.isNotBlank(currentPage)) {
			params.put("currentPage", CommUtil.null2Int(currentPage));
		}
		if (StringUtils.isNotBlank(pageSize)) {
			params.put("pageSize", CommUtil.null2Int(pageSize));
		}
		if (StringUtils.isNotBlank(orderBy)) {
			params.put("orderBy", orderBy);
		}
		if (StringUtils.isNotBlank(orderType)) {
			params.put("orderType", orderType);
		}
		params.put("anchor_id", user.getId()); // 被关注用户
		List userDtos = userFeignClient.queryPageList(params);
		SysConfigDto sysConfigDto = sysConfigFeignClient.getSysConfig();
		for (UserDto userDto : userDtos) {
			AccessoryDto acc = null;
			if (userDto.getPhoto_id() != null) {
				acc = accessoryFeignClient.selectByPrimaryKey(userDto.getPhoto_id());
			}
			Map us = new HashMap();
			us.put("user_id", userDto.getId());
			us.put("nickName", userDto.getNickName()); // 用户昵称
			us.put("autograph", ""); // 用户个性签名
			if (null != sysConfigDto) {
				if (null != acc) {
					us.put("photo", sysConfigDto.getImageWebServer() + "/" + acc.getPath() + "/" + acc.getName()); // 用户头像
				} else {
					us.put("photo", sysConfigDto.getImageWebServer() + "/" + sysConfigDto.getMemberIcon().getPath()
							+ "/" + sysConfigDto.getMemberIcon().getName()); // 用户头像
				}
			}
			result.add(us);
		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null); // 请求处理成功
	}

	/**
	 * 查询直播用户数据信息
	 * 
	 * @param live
	 */
	@RequestMapping("/liveUser")
	public ResponseVO liveUser(@RequestBody JSONObject json) {
		String userName = json.optString("userName"); // 用户编号
		String to_concern = json.optString("to_concern"); // 关注者userName
		if (StringUtils.isEmpty(userName)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_USERNAME_ISNULL, null); // 用户userName不能为空
		}
		if (StringUtils.isEmpty(to_concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_USERNAME_ISNULL, null); // 被关注者userName不能为空
		}
		UserDto userDto = userFeignClient.selectByUserName(userName); // 用户
		if (userDto == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_DOES_NOT_EXIST, null); // 用户不存在
		}
		UserDto toConcernUser = userFeignClient.selectByUserName(to_concern); // 主播用户
		if (toConcernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注用户不存在
		}
		SysConfigDto sysConfigDto = sysConfigFeignClient.getSysConfig();
		Map result = new HashMap();
		AccessoryDto acc = null;
		if (userDto.getPhoto_id() != null) {
			acc = accessoryFeignClient.selectByPrimaryKey(userDto.getPhoto_id());
		}
		Map params = new HashMap();
		params.put("concern", userDto.getId());
		params.put("to_concern", toConcernUser.getId());
		LiveFollow lf = liveFollowService.getLiveFollow(params); // 查询关注主播数据信息
		result.put("nickName", userDto.getNickName()); // 用户昵称
		result.put("autograph", ""); // 用户个性签名
		if (null != sysConfigDto) {
			if (null != acc) {
				result.put("photo", sysConfigDto.getImageWebServer() + "/" + acc.getPath() + acc.getName()); // 用户头像
			} else {
				result.put("photo", sysConfigDto.getImageWebServer() + "/" + sysConfigDto.getMemberIcon().getPath()
						+ "/" + sysConfigDto.getMemberIcon().getName()); // 用户头像
			}
		}
		if (null != lf) {
			result.put("anchor", true); // 是否关注主播
		} else {
			result.put("anchor", false); // 是否关注主播
		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, result);
	}

	/**
	 * 查询直播用户数据信息
	 * 
	 * @param live
	 */
	@RequestMapping("/liveUser_new")
	public ResponseVO liveUser_new(@RequestBody JSONObject json, HttpServletRequest request) {

		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto userDto = userFeignClient.selectByPrimaryKey(user_id);
		if (userDto == null) {
			// 用户不存在
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}

		String to_concern = json.optString("to_concern"); // 关注者userName
		if (StringUtils.isEmpty(to_concern)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_USERNAME_ISNULL, null); // 被关注者userName不能为空
		}
		UserDto toConcernUser = userFeignClient.selectByUserName(to_concern); // 主播用户
		if (toConcernUser == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TOCONCERN_ISNULL, null); // 被关注用户不存在
		}
		SysConfigDto sysConfigDto = sysConfigFeignClient.getSysConfig();
		Map result = new HashMap();
		AccessoryDto acc = null;
		if (userDto.getPhoto_id() != null) {
			acc = accessoryFeignClient.selectByPrimaryKey(userDto.getPhoto_id());
		}
		Map params = new HashMap();
		params.put("concern", userDto.getId());
		params.put("to_concern", toConcernUser.getId());
		LiveFollow lf = liveFollowService.getLiveFollow(params); // 查询关注主播数据信息
		result.put("nickName", userDto.getNickName()); // 用户昵称
		result.put("autograph", ""); // 用户个性签名
		if (null != sysConfigDto) {
			if (null != acc) {
				result.put("photo", sysConfigDto.getImageWebServer() + "/" + acc.getPath() + acc.getName()); // 用户头像
			} else {
				result.put("photo", sysConfigDto.getImageWebServer() + "/" + sysConfigDto.getMemberIcon().getPath()
						+ "/" + sysConfigDto.getMemberIcon().getName()); // 用户头像
			}
		}
		if (null != lf) {
			result.put("anchor", true); // 是否关注主播
		} else {
			result.put("anchor", false); // 是否关注主播
		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, result);
	}

	/**
	 * 个人直播中心
	 */
	@RequestMapping("/liveCenter")
	public Map liveCenter(HttpServletRequest request, @RequestBody JSONObject json) {
		SysConfigDto sysConfigDto = sysConfigFeignClient.getSysConfig();
		String user_id = json.optString("user_id"); // 获取直播用户信息
		if (StringUtils.isEmpty(user_id)) {
			return ResponseCode.buildCodeMap("20001", "用户id不能为空", null);
		}
		List> result = new ArrayList<>();
		UserDto userDto = userFeignClient.selectByUserName(user_id); // 用户
		if (userDto == null) {
			return ResponseCode.buildCodeMap("30001", "用户不存在", null);
		}
		if (null != userDto.getPhoto_id()) {
			AccessoryDto acc = accessoryFeignClient.selectByPrimaryKey(userDto.getPhoto_id()); // 获取头像信息
			Map user = new HashMap();
			user.put("user_id", userDto.getId()); // 用户编号
			user.put("userName", userDto.getUserName1()); // 用户名称
			if (null != sysConfigDto) {
				if (null != acc) {
					user.put("photo", sysConfigDto.getImageWebServer() + "/" + acc.getPath() + acc.getName()); // 用户头像
				} else {
					user.put("photo", sysConfigDto.getImageWebServer() + "/" + sysConfigDto.getMemberIcon().getPath()
							+ "/" + sysConfigDto.getMemberIcon().getName()); // 用户头像
				}
				Map params = new HashMap();
				params.put("anchor_id", userDto.getId()); // 当前用户
				List liveFollows = liveFollowService.queryPages(params);
				user.put("fans", liveFollows.size()); // 粉丝数量
				result.add(user);
			}
		}
		return ResponseCode.buildSuccessMap(result);
	}

	/**
	 * 个人直播中心
	 */
	@RequestMapping("/liveCenter_new")
	public Map liveCenter_new(HttpServletRequest request, @RequestBody JSONObject json) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildCodeMap("508", "token已过期,请重新登录", null);
		}
		UserDto userDto = userFeignClient.selectByPrimaryKey(user_id);
		if (userDto == null) {
			// 用户不存在
			return ResponseCode.buildCodeMap("30001", "用户不存在", null);
		}
		List> result = new ArrayList<>();
		if (null != userDto.getPhoto_id()) {
			AccessoryDto acc = accessoryFeignClient.selectByPrimaryKey(userDto.getPhoto_id()); // 获取头像信息
			Map user = new HashMap();
			user.put("user_id", userDto.getId()); // 用户编号
			user.put("userName", userDto.getUserName1()); // 用户名称
			SysConfigDto sysConfigDto = sysConfigFeignClient.getSysConfig();
			if (null != sysConfigDto) {
				if (null != acc) {
					user.put("photo", sysConfigDto.getImageWebServer() + "/" + acc.getPath() + acc.getName()); // 用户头像
				} else {
					user.put("photo", sysConfigDto.getImageWebServer() + "/" + sysConfigDto.getMemberIcon().getPath()
							+ "/" + sysConfigDto.getMemberIcon().getName()); // 用户头像
				}
				Map params = new HashMap();
				params.put("anchor_id", userDto.getId()); // 当前用户
				List liveFollows = liveFollowService.queryPages(params);
				user.put("fans", liveFollows.size()); // 粉丝数量
				result.add(user);
			}
		}
		return ResponseCode.buildSuccessMap(result);
	}

	/**
	 * 直播账户验证(用户+密码)
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/checking/account", method = RequestMethod.POST)
	public Map checkingAccount(@RequestBody JSONObject json, HttpServletRequest request) {
		String userName = json.optString("userName");
		String password = json.optString("password");
		if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
			ResponseCode.buildCodeMap("10001", "用户名和密码不能为空", null);
		}
		password = Md5Encrypt.md5(password).toLowerCase();
		Map paraMap = new HashMap();
		paraMap.put("userName", userName);
		paraMap.put("password", password);
		Long user_id = userFeignClient.checkingAccount(paraMap);
		if (user_id == null) {
			return ResponseCode.buildCodeMap("10002", "你未开通主播", null);
		}
		// 根据用户id获取登录token
		String token = SecurityUserHolder.getCurrentUser(user_id);
		return ResponseCode.buildSuccessMap(token);
	}

	/**
	 * 直播账户验证(用户)
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/checking/username", method = RequestMethod.POST)
	public Map checkingUsername(@RequestBody JSONObject json, HttpServletRequest request) {
		String userName = json.optString("userName");
		if (StringUtils.isEmpty(userName)) {
			ResponseCode.buildCodeMap("10001", "用户名不能为空", null);
		}
		Map paraMap = new HashMap();
		paraMap.put("userName", userName);
		Long user_id = userFeignClient.checkingUserName(paraMap);
		if (user_id == null) {
			return ResponseCode.buildCodeMap("10002", "你未开通主播", null);
		}
		// 根据用户id获取登录token
		String token = SecurityUserHolder.getCurrentUser(user_id);
		return ResponseCode.buildSuccessMap(token);
	}

	/**
	 * 通过直播间id查询用户
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/getUser", method = RequestMethod.POST)
	public ResponseVO getUser(@RequestBody JSONObject json) {
		String live_id = json.optString("live_id");
		if (StringUtils.isBlank(live_id)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_ID_ISNULL, null); // 直播间id不能为空
		}
		Map maps = new HashMap();
		maps.put("live_num", live_id);
		Live live = liveService.selectByLiveNum(maps);
		UserDto userDto = null;
		if (null != live && live.getCreater_id() != null) {
			userDto = userFeignClient.selectByUserName(live.getCreater_id()); // 获取用户信息
		}

		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, userDto);
	}

	// 直播间分享海报
	@RequestMapping(value = "/liveSharePic", method = RequestMethod.POST)
	public ResponseVO liveSharePic(@RequestBody JSONObject json) {
		String live_id = json.optString("live_id"); // 直播间ID
		String userName = json.optString("username"); // 直播间分享用户
		String anchor_id = json.optString("anchor_id"); // 直播间主播
		if (StringUtils.isBlank(anchor_id)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_ANCHOR_ID_ISNULL, null); // 主播id不能为空
		}
		if (StringUtils.isBlank(live_id)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_ID_ISNULL, null); // 直播间id不能为空
		}
		if (StringUtils.isBlank(userName)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_SHARE_ID_ISNULL, null); // 直播间分享用户名不能为空
		}
		Map maps = new HashMap();
		maps.put("live_num", live_id);
		Live live = liveService.selectByLiveNum(maps);
		if (null == live) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_NO_FIND, null); // 未找到直播间
		}
		if (StringUtils.isBlank(live.getLive_title())) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_TITLE_NO_FIND, null); // 未找到直播间
		}
		if (StringUtils.isBlank(live.getLive_cover())) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_COVER_NO_FIND, null); // 未找到直播间
		}
		if (StringUtils.isBlank(live.getCreater_id())) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_CREATER_ID_NO_FIND, null); // 未找到直播间
		}
		Map params = new HashMap();
		params.put("live_title", live.getLive_title());
		params.put("live_cover", live.getLive_cover());
		params.put("creater_id", live.getCreater_id());
		params.put("live_id", live_id);
		params.put("userName", userName);
		params.put("anchor_id", anchor_id.toString());
		params.put("live_status", live.getLive_status().toString());
		Map result = shareFeignClient.liveSharePicture(params);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, result);

	}

	/**
	 * 查询用户搜索记录
	 */
	@RequestMapping(value = "/userSearchLogList", method = RequestMethod.POST)
	public Map userSearchLogList(@RequestBody JSONObject json, HttpServletRequest request) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildFailMap("token无效", null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildReturnMap(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		HashMap result = new HashMap<>();
		SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig();

		String[] split = sysConfig.getHotSearch().split(",");
		ArrayList arrayList = new ArrayList<>();
		for (int a = 0; a < split.length - 1; a++) {
			arrayList.add(split[a]);
		}

		result.put("hot_search", arrayList);

		Map params = QueryTools.getParams(null, 6, null, null);
		params.put("user_id", user.getId());
		Page list = userSearchLogService.list(params);
		result.put("search_log", list.getResult());

		return ResponseCode.buildSuccessMap(result);

	}

	/**
	 * 清除用户搜索记录
	 */
	@RequestMapping(value = "/delUserSearchLog", method = RequestMethod.POST)
	public Map delUserSearchLog(@RequestBody JSONObject json, HttpServletRequest request) {
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildFailMap("token无效", null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildReturnMap(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}

		userSearchLogService.delUserLog(user.getId());

		return ResponseCode.buildSuccessMap(null);

	}

	/**
	 * 保存搜索记录
	 */
	@RequestMapping(value = "/saveUserSearchLog", method = RequestMethod.POST)
	public Map saveUserSearchLog(@RequestBody JSONObject json, HttpServletRequest request) {
		if (StringUtils.isBlank(json.optString("search_name"))) { // 为空不做操作
			return ResponseCode.buildSuccessMap(null);
		}
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id != null) {
			UserDto user = userFeignClient.selectByPrimaryKey(user_id);
			if (user != null) {// 用户存在
				Map params = QueryTools.getParams(null, 3, null, null);
				params.put("user_id", user.getId());
				params.put("search_name", json.optString("search_name"));
				Page list = userSearchLogService.list(params);
				if (list.getResult().size() < 1) { // 不存在, 保存记录
					UserSearchLog userSearchLog = new UserSearchLog();
					userSearchLog.setUser_id(user_id);
					userSearchLog.setAddTime(new Date());
					userSearchLog.setSearch_name(json.optString("search_name"));
					userSearchLog.setDeleteStatus(0);
					userSearchLogService.saveEntity(userSearchLog);
				} else {
					list.getResult().get(0).setAddTime(new Date()); // 更新时间
					userSearchLogService.updateById(list.getResult().get(0));
				}

			}
		}

		return ResponseCode.buildSuccessMap(null);

	}

	/**
	 * 直播添加购物车商品
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/addLiveGoodsCart", method = RequestMethod.POST)
	public ResponseVO addLiveGoodsCart(@RequestBody JSONObject json, HttpServletRequest request) {

		Long id = CommUtil.null2Long(json.optString("id")); // 商品id
		Integer count = Integer.valueOf(json.optString("count"));
		String gsp = json.optString("gsp");
		String buy_type = json.optString("buy_type");
		String type = json.optString("type");
		String combin_version = json.optString("combin_version");
		String combin_ids = json.optString("combin_ids");
		String userName = json.getString("userName");
		String liverName = json.getString("liverName");

		String liveroom_id = null;
		if (StringUtils.isNotBlank(liveroom_id) && !("-1").equals(liveroom_id)) {
			liveroom_id = json.optString("liveroom_id");
		}
		if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(liverName)) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_USERNAME_ISNULL, null); // 用户userName不能为空

		}
		UserDto user = userFeignClient.selectByUserName(userName); // 用户
		if (user == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.LIVE_USERNAME_ISNULL, null); // 用户不存在
		}

		UserDto liver = userFeignClient.selectByUserName(liverName); // 用户
		if (liver == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.USER_DOES_NOT_EXIST, null); // 用户不存在
		}
		AddGoodsCarFormDto addGoodsCarFormDto = new AddGoodsCarFormDto();
		addGoodsCarFormDto.setId(id);
		addGoodsCarFormDto.setCount(count);
		addGoodsCarFormDto.setGsp(gsp);
		addGoodsCarFormDto.setBuy_type(buy_type);
		addGoodsCarFormDto.setCombin_ids(combin_ids);
		addGoodsCarFormDto.setCombin_version(combin_version);
		addGoodsCarFormDto.setApp_user_id(user.getId());
		addGoodsCarFormDto.setType(type);
		addGoodsCarFormDto.setShare_user_id(liver.getId().toString());
		addGoodsCarFormDto.setLiveroom_id(liveroom_id);

		Map addGoodsCart = goodsCartFeignClient.addGoodsCart(addGoodsCarFormDto);
		HashMap result = new HashMap<>();
		result.put("map", addGoodsCart);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, result);
	}

	/**
	 * 生成直播间推流地址
	 */
	@RequestMapping(value = "/add_live_url", method = RequestMethod.POST)
	public Map add_live_url(@RequestBody JSONObject json, HttpServletRequest request) {
		String imgroup_id = json.optString("imgroup_id");
		String live_id = json.optString("live_id");
		String live_type = json.optString("live_type");
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildFailMap("token无效", null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildReturnMap(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		if (StringUtils.isEmpty(live_id)) {
			return ResponseCode.buildReturnMap(ResponseCode.PARAMETER_ERROR, null);
		}
		if (StringUtils.isEmpty(imgroup_id)) {
			return ResponseCode.buildReturnMap(ResponseCode.LIVE_IMGROUP_ISNULL, null);
		}
		Live live = null;
		if (StringUtils.isNotEmpty(live_type) && live_type.equals("1")) {
			live = liveService.selectByPrimaryKey1(CommUtil.null2Long(live_id));
		} else {
			live = liveService.selectByPrimaryKey(CommUtil.null2Long(live_id));
		}
		if (live == null) {
			return ResponseCode.buildReturnMap(ResponseCode.LIVE_NO_FIND, null);
		}

		HashMap maps = new HashMap<>();
		SysConfigDto sysConfig = sysConfigFeignClient.getSysConfig();
		live.setImgroup_id(imgroup_id); // 聊天室id
		live.setStartTime(new Date()); // 添加时间
		maps.put("to_concern", live.getUser_id());
		maps.put("deleteStatus", 0);
		// 粉丝总数
		Integer selectCount = liveFollowService.selectCount(maps);
		live.setFollow_num(CommUtil.null2Long(selectCount)); // 计算当前粉丝数, 之后结束在统计
		live.setDeleteStatus(0); // 进行相减 拿到本场关注数
		live.setLive_status(1); // 开始直播
		String live_domian = sysConfig.getLive_play_domain();
		String safeUrl = LiveUtils.getSafeUrl(sysConfig.getLive_key(), live_id, 86400000L);
		live.setLive_url(live_domian + "/live/" + live_id + "?" + safeUrl);
		liveService.updateById(live);

		String url = sysConfig.getLive_domain() + "/live/" + live_id + "?" + safeUrl;
		return ResponseCode.buildSuccessMap(url);
	}

	/**
	 * 直播观看人数变化
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/updateLiveAudience")
	public ResponseVO getLiveListAll(@RequestBody JSONObject json) {
		String live_id = json.optString("live_id"); // 直播间id
		String count = json.optString("count"); // 数量
		if (StringUtils.isNotBlank(live_id)) {
			// 查询用户关注的主播
			Live Live = liveService.selectByPrimaryKey(CommUtil.null2Long(live_id));
			if (Live != null && Live.getLive_status() == 1) {
				Live.setAudience_num(CommUtil.null2Long(count));
				liveService.updateAudienceById(CommUtil.null2Long(live_id), CommUtil.null2Long(count));
			}

		}
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null);
	}

	/**
	 * 查询当前直播关注人数
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/getFollowNum")
	public Map getFollowNum(@RequestBody JSONObject json) {
		String live_id = json.optString("live_id"); // 直播间id
		if (StringUtils.isEmpty(live_id)) {
			return ResponseCode.buildReturnMap(ResponseCode.PARAMETER_ERROR, null);
		}
		Live live = liveService.selectByPrimaryKey(CommUtil.null2Long(live_id));
		if (live == null) {
			return ResponseCode.buildReturnMap(ResponseCode.LIVE_NO_FIND, null);
		}
		HashMap maps = new HashMap<>();
		maps.put("to_concern", live.getUser_id());
		maps.put("deleteStatus", 0);
		// 粉丝总数
		Integer Count = liveFollowService.selectCount(maps);
		// 本场关注人数 进行相减 拿到本场关注数
		long liveCount = Count.longValue() - live.getFollow_num().longValue();
		return ResponseCode.buildSuccessMap(liveCount);

	}

	/**
	 * 
	 * 结束直播
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/endLive")
	public Map endLive(@RequestBody JSONObject json, HttpServletRequest request) {
		String tokenStr = request.getHeader("token");
		String live_id = json.optString("live_id"); // 直播间id
		String pralis_num = json.optString("pralis_num"); // 点赞数
		String duration = json.optString("duration"); // 直播间id

		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildReturnMap(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildReturnMap(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		if (StringUtils.isEmpty(live_id)) {
			return ResponseCode.buildReturnMap(ResponseCode.PARAMETER_ERROR, null);
		}
		Live live = liveService.selectByPrimaryKey(CommUtil.null2Long(live_id));
		if (live == null || live.getLive_status() == 2) {
			return ResponseCode.buildReturnMap(ResponseCode.LIVE_NO_FIND, null);
		}
		HashMap maps = new HashMap<>();
		maps.put("to_concern", live.getUser_id());
		maps.put("deleteStatus", 0);
		// 粉丝总数
		Integer Count = liveFollowService.selectCount(maps);
		// 本场关注人数 进行相减 拿到本场关注数
		long liveCount = Count.longValue() - live.getFollow_num().longValue();
		live.setLive_status(2); // 结束直播 改为回播
		live.setFollow_num(liveCount); // 本场关注人数
		live.setDuration(CommUtil.null2Long(duration));
		live.setEndTime(new Date());
		live.setAudience_num(CommUtil.null2Long(
				null == redisUtil.get("NUMBER_" + live.getId()) ? 0 : redisUtil.get("NUMBER_" + live.getId())));// 观看人数
		live.setPralis_num(CommUtil.null2Long(pralis_num));
		liveService.updateById(live);
		return ResponseCode.buildSuccessMap(liveCount);

	}

	/**
	 * 查询当前直播关注人数
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/delLiveById")
	public Map delLiveById(@RequestBody JSONObject json, HttpServletRequest request) {
		String live_id = json.optString("live_id"); //
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		if (user_id == null) {
			return ResponseCode.buildReturnMap(ResponseCode.TOKEN_EXPIRE, null);
		}
		UserDto user = userFeignClient.selectByPrimaryKey(user_id);
		if (user == null) {
			// 用户不存在
			return ResponseCode.buildReturnMap(ResponseCode.USER_NOT_EXISTS_ERROR, null);
		}
		if (StringUtils.isEmpty(live_id)) {
			return ResponseCode.buildReturnMap(ResponseCode.PARAMETER_ERROR, null);
		}
		Live live = liveService.selectByPrimaryKey(CommUtil.null2Long(live_id));
		if (live != null && live.getUser_id().toString().equals(user_id + "")) {
			liveService.deleteLive(live.getId());// 删除
		} else {
			return ResponseCode.buildReturnMap(ResponseCode.PARAMETER_ERROR, null);
		}

		return ResponseCode.buildSuccessMap(null);
	}

	/**
	 * 直播结束接口回调
	 * 
	 * @param params
	 */
	@RequestMapping(value = "/returnEndLiveUrl")
	public void getEndLiveUrl(@RequestBody JSONObject json) {
		String event_type = json.optString("event_type"); //
		String stream_id = json.optString("stream_id"); // 观看人数

		if (event_type.equals("100") && StringUtils.isNotBlank(stream_id)) {
			Live live = liveService.selectByPrimaryKey(CommUtil.null2Long(stream_id));
			if (live != null) {
				String video_url = json.optString("video_url"); //
				live.setLive_url(video_url);
				liveService.updateById(live);
			}
		}
		//
		if (event_type.equals("0") && StringUtils.isNotBlank(stream_id)) {
			Live live = liveService.selectByPrimaryKey(CommUtil.null2Long(stream_id));
			if (live != null && live.getLive_status() == 1) {
				HashMap maps = new HashMap<>();
				maps.put("to_concern", live.getUser_id());
				maps.put("deleteStatus", 0);
				// 粉丝总数
				Integer Count = liveFollowService.selectCount(maps);
				// 本场关注人数 进行相减 拿到本场关注数
				long liveCount = Count.longValue() - live.getFollow_num().longValue();
				live.setLive_status(2); // 结束直播 改为回播
				live.setFollow_num(liveCount); // 本场关注人数
				double div = CommUtil.div(CommUtil.null2Long(json.optString("errcode")), 1000);
				live.setAudience_num(CommUtil.null2Long(
						null == redisUtil.get("NUMBER_" + live.getId()) ? 0 : redisUtil.get("NUMBER_" + live.getId())));// 观看人数
				live.setDuration(CommUtil.null2Long(div));
				long time = new Date().getTime() - live.getStartTime().getTime();
				live.setDuration(CommUtil.null2Long(CommUtil.div(time, 1000)));
				live.setEndTime(new Date());
				liveService.updateById(live);
			}
		}

	}

}
 
  
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

你可能感兴趣的:(跟我学习springcloud,b2b2c商城,java版b2b2c多商家商城,java直播商城,spring,cloud商城,b2b2c电子商务)