七十五、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元领取,领取需要进行用户拉新,拉新后可进行现金奖励等)
特殊营销方案(十):异业联盟(不同行业的联盟销售,如:在某餐饮店面消费后可送附近健身卡优惠券,凭借优惠券可进行线下体验)
特殊营销方案(十一):一键代发营销(商家选择平台商品后放入自己店面销售,用户购买后商家可获取特殊分润提成,商家不需要发货,由平台厂家直接发货,并支持本店面自提)

 

/**
 * Copyright &copy; 2012-2017 <a href="http://minglisoft.cn">HongHu</a> All rights reserved.
 */
package com.honghu.cloud.controller;

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

import javax.servlet.http.HttpServletResponse;

import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.BeanUtils;
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.RestController;

import com.google.common.collect.Maps;
import com.honghu.cloud.bean.Accessory;
import com.honghu.cloud.bean.CommentsInformation;
import com.honghu.cloud.bean.Information;
import com.honghu.cloud.bean.InformationClass;
import com.honghu.cloud.bean.Message;
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.UserDto;
import com.honghu.cloud.feign.AccessoryFeignClient;
import com.honghu.cloud.feign.GoodsFeignClient;
import com.honghu.cloud.feign.UserFeignClient;
import com.honghu.cloud.service.ICommentsInformationService;
import com.honghu.cloud.service.IMessageService;
import com.honghu.cloud.service.IinformationClassService;
import com.honghu.cloud.service.IinformationService;
import com.honghu.cloud.tools.AliSmsUtil;
import com.honghu.cloud.tools.QueryTools;
import com.honghu.cloud.tools.SecurityUserHolder;
import com.honghu.cloud.utils.CommUtil;
import com.honghu.cloud.utils.StringUtils;

import net.sf.json.JSONObject;

/**
 * 资讯Controller
 * @author Administrator
 *
 */
@RestController
@RequestMapping(value = "/information")
public class InformationController {
		
	@Autowired
	private QueryTools queryTools;
	@Autowired
	private IinformationClassService informationClassService;
	@Autowired
	private IinformationService informationService;
	@Autowired
	private ICommentsInformationService commentsInformationService;
	@Autowired
	private UserFeignClient userFeignClient;
	@Autowired
	private IMessageService messageService;
	@Autowired
	private GoodsFeignClient goodsFeignClient;
	@Autowired
	private AccessoryFeignClient accessoryFeignClient;
	
	
	/**
	 * 资讯首页
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value="/informationList", method = RequestMethod.POST)
	public Map<String, Object> informationList(HttpServletRequest request,
			HttpServletResponse response, @RequestBody JSONObject json) {

		String classId = json.optString("classId");
		String currentPage = json.optString("currentPage");
		/*UserDto user = SecurityUserHolder.getCurrentUser(request);
		if (user == null) {
			return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);
		}*/

		HashMap<String, Object> params = Maps.newHashMap();
		// 分类列表  只查一级
		params.put("ic_pid", -1);
		List<InformationClass> cObjs = informationClassService.queryPageList(params);
		// 查询不到分类数据,返回无结果
		if (cObjs == null || cObjs.size() < 1) {
			return ResponseCode.buildEnumMap(ResponseCode.QUERY_NO_DATA, null);
		}

		Map<String, Object> map = queryTools.getParams(currentPage, null, "obj.addTime", "DESC");
		// 没传分类默认查第一条
		if (StringUtils.isBlank(classId)) {
			classId = cObjs.get(0).getId() + "";
		}
		map.put("status", 20);
		map.put("classid", classId);
		map.put("deleteStatus", 0);
		Page<Information> list = informationService.list(map);

		Map<String, Object> result = new HashMap<String, Object>();
		result.put("cObjs", cObjs); // 分类列表
		result.put("count", list.getRowCount());
		result.put("list", list.getResult());

		return ResponseCode.buildSuccessMap(result);
	}
	
	
	/**
	 * 资讯详情
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value="/informationDetails", method = RequestMethod.POST)
	public Map<String, Object> informationDetails(HttpServletRequest request,
			HttpServletResponse response, @RequestBody JSONObject json) {

		String id = json.optString("id");
		Information obj = this.informationService.selectByPrimaryKey(CommUtil.null2Long(id));
		if (obj == null) return ResponseCode.buildEnumMap(ResponseCode.QUERY_NO_DATA, null);
		UserDto user = userFeignClient.selectByPrimaryKey(obj.getAuthor_id());
		String tokenStr = request.getHeader("token");
		Long user_id = SecurityUserHolder.getTokenUserId(tokenStr);
		boolean whetherFans =false;
		if (user_id!=null) {
			whetherFans = userFeignClient.whetherFans(obj.getAuthor_id(),user_id);
		}
		// 查询不到分类数据,返回无结果
		obj.setClicktimes(obj.getClicktimes()+1);
		this.informationService.updateById(obj);

		Map<String, Object> result = new HashMap<String, Object>();
		result.put("obj", obj); // 分类列表
		AccessoryDto photo = null;
		if (user.getPhoto()!=null) {
			 photo = user.getPhoto();
		}
		GoodsDto goods =null;
		if(obj.getGoods_id()!=null){
			 goods = goodsFeignClient.selectByPrimaryKey(obj.getGoods_id());
			 if(goods!=null&&goods.getGoods_main_photo_id()!=null){
				 AccessoryDto accessoryDto = accessoryFeignClient.selectByPrimaryKey(goods.getGoods_main_photo_id());
				 if(accessoryDto!=null){
					 goods.setGoods_main_photo_name(accessoryDto.getName());
					 goods.setGoods_main_photo_path(accessoryDto.getPath());
				 }
			 }
		}
		result.put("goods", goods);
		result.put("photo", photo);
		result.put("whetherfans", whetherFans);
		return ResponseCode.buildSuccessMap(result);
	}
	/**
	 * 删除资讯
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value="/delInformation", method = RequestMethod.POST)
	public Map<String, Object> delInformation(HttpServletRequest request,
			HttpServletResponse response, @RequestBody JSONObject json) {

		String id = json.optString("id");
		UserDto user = SecurityUserHolder.getCurrentUser(request);

		Information obj = this.informationService.selectByPrimaryKey(CommUtil.null2Long(id));
		// 查询不到分类数据,返回无结果
		if (obj == null)
			return ResponseCode.buildEnumMap(ResponseCode.QUERY_NO_DATA, null);
		//作者跟登录人一致,进行删除操作
		if (obj.getAuthor_id().toString().equals(user.getId().toString())) {
			obj.setDeleteStatus(1);
			this.informationService.updateById(obj);
			return ResponseCode.buildSuccessMap(null);
		} else {
			return ResponseCode.buildEnumMap(ResponseCode.QUERY_NO_DATA, null);
		}
	}
	
	/**
	 * 资讯保存
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value="/informationSave", method = RequestMethod.POST)
	public Map<String, Object> informationSave(HttpServletRequest request,
			HttpServletResponse response, @RequestBody JSONObject json) {

		String title = json.optString("title");			//标题
		String content = json.optString("content");		//内容
		String goodsId = json.optString("goodsId");     //商品id
		String coverId = json.optString("coverId");     //封面文件url
		UserDto user = SecurityUserHolder.getCurrentUser(request);//查询用户
		if (user == null) return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);
		

		Information information = new Information();
		information.setAddTime(new Date());
		information.setCoverurl(coverId);
		//information.setCover(CommUtil.null2Long(coverId));//封面
		information.setTitle(title);    				//标题
		information.setArticle(content);
		information.setDeleteStatus(0);
		information.setAuthor_id(user.getId());			//作者id
		information.setAuthor(user.getNickName());			//作者名称
		information.setType(1);						//1为商家
		information.setStatus(10); 				 //待审核
		information.setGoods_id(CommUtil.null2Long(goodsId));  //商品id
		informationService.saveEntity(information);
		Map<String, Object> result = new HashMap<String, Object>();
		return ResponseCode.buildSuccessMap(result);
	}
	
	/**
	 * 我的资讯列表
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value="/userInformation", method = RequestMethod.POST)
	public Map<String, Object> userInformation(HttpServletRequest request,
			HttpServletResponse response, @RequestBody JSONObject json) {
		String currentPage = json.optString("currentPage");
		String status = json.optString("status");
		UserDto user = SecurityUserHolder.getCurrentUser(request);

		// 查询不到分类数据,返回无结果
		if (user == null)
			return ResponseCode.buildEnumMap(ResponseCode.QUERY_NO_DATA, null);

		Map<String, Object> map = queryTools.getParams(currentPage, null, "obj.addTime", "DESC");
		map.put("author_id", user.getId()); // 当前登录用户
		map.put("status", status); // 状态
		map.put("deleteStatus", 0); // 删除状态状态
		Page<Information> list = informationService.list(map);
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("currentPage", currentPage);
		result.put("rowCount", list.getRowCount());
		result.put("result", list.getResult());
		return ResponseCode.buildSuccessMap(result);
	}
	
	
	/**
	 * 评论
	 * @param param 
	 * @return
	 */
	@RequestMapping(path = "/comment", method = RequestMethod.POST)
	public ResponseVO comment(HttpServletRequest request, @RequestBody JSONObject json) {
		
		Long informationId = json.getLong("informationId");
		String replyId = json.getString("replyId");
		String content = json.getString("content");
		if(SecurityUserHolder.getCurrentUser(request) == null){
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		boolean aliSecurity = AliSmsUtil.aliSecurity(content);
		if(!aliSecurity){
			return ResponseCode.buildEnumResponseVO(ResponseCode.ALISECURITY_ERROR, null);
		}
		
		UserDto user = SecurityUserHolder.getCurrentUser(request);
		
		Information information = informationService.selectByPrimaryKey(informationId);
		if(information == null) {
			return ResponseCode.buildEnumResponseVO(ResponseCode.QUERY_NO_DATA, null);
		}	
		CommentsInformation saveComment = new CommentsInformation();
		CommentsInformation comment = null;
		if(StringUtils.isNotBlank(replyId)){
			comment = commentsInformationService.selectByPrimaryKey(Long.parseLong(replyId));
			if(comment == null) {
				return ResponseCode.buildEnumResponseVO(ResponseCode.QUERY_NO_DATA, null);
			}
			if(comment.getParentId() == null) {
				saveComment.setParentId(comment.getId());
			}else {
				saveComment.setParentId(comment.getParentId());
			}
			saveComment.setReplyId(Long.parseLong(replyId));
			commentsInformationService.updateCountReply(comment.getId());
		}
		
		if(user.getId().longValue() == information.getAuthor_id().longValue() ) {
			saveComment.setType(1);
		}		
		saveComment.setEvaluatorsId(user.getId());
		saveComment.setEvaluatorsName(user.getNickName());
		saveComment.setDynamicId(informationId);
		saveComment.setContent(content);
		saveComment.setPublisherId(information.getAuthor_id());
		saveComment.setPublisherName(information.getAuthor());
		saveComment.setAddTime(new Date());
		saveComment.setDeleteStatus(0);
		commentsInformationService.saveEntity(saveComment);
		
		if(StringUtils.isBlank(replyId) && saveComment.getType() != 1){
			try{
				Message dto = new Message();
				dto.setAddTime(new Date());
				dto.setDeleteStatus(0);
				dto.setContent("有人评论了你的发布的资讯,快去看看吧!");
				dto.setMsg_cat(0);
				dto.setReply_status(0);
				dto.setStatus(0);
				dto.setTitle("资讯评论");
				dto.setType(2);
				dto.setFromUser_id(1L);
				dto.setToUser_id(saveComment.getPublisherId());
				Map<String, Object> param = new HashMap<String, Object>(); 
				param.put("type", 1); //1 咨询
				param.put("id", informationId);
				dto.setJump_param(JSONObject.fromObject(param).toString());
				this.messageService.saveEntity(dto);
			}catch(Exception e){}
		}
		
		
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, true);
	}
	
	/**
	 * 获取评论列表
	 * @param param 
	 * 				 @param mid 
	 * @return
	 */
	@RequestMapping(path = "/listComments", method = RequestMethod.POST)
	public ResponseVO listComments(HttpServletRequest request, @RequestBody JSONObject json) { 
		//判断用户是否存在
		Long informationId = json.getLong("informationId");
		String parentId = json.getString("parentId");
		String currentPage = json.optString("currentPage");
		
		if(SecurityUserHolder.getCurrentUser(request) == null){
			return ResponseCode.buildEnumResponseVO(ResponseCode.TOKEN_EXPIRE, null);
		}
		
		Information information = informationService.selectByPrimaryKey(informationId);
		if(information==null){
			return ResponseCode.buildEnumResponseVO(ResponseCode.QUERY_NO_DATA, null);
		}
		Map<String, Object> result = new HashMap<String, Object>();
		if (StringUtils.isNotBlank(parentId)) {
			CommentsInformation commentsinformation = commentsInformationService.selectByPrimaryKey(CommUtil.null2Long(parentId));
			UserDto userdto = userFeignClient.selectByPrimaryKey(commentsinformation.getEvaluatorsId());
			if (userdto!=null) {
				AccessoryDto photo = userdto.getPhoto();
				Accessory accessory = new Accessory();
				BeanUtils.copyProperties(photo, accessory);
				commentsinformation.setPhoto(accessory);
			}
			result.put("commentsinformation", commentsinformation);
		}
		
		
		Map<String,Object> maps= queryTools.getParams(currentPage, "a.add_time", "DESC");
		maps.put("dynamicId", informationId);
		maps.put("parentId", parentId);
		Page<CommentsInformation> list = commentsInformationService.list(maps);	
		
		result.put("list", list);
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, result);
	}
	
	
	/**
	 * 获取评论列表
	 * @param param 
	 * 				 @param mid 
	 * @return
	 */
	@RequestMapping(path = "/delComments", method = RequestMethod.POST)
	public ResponseVO delComments(HttpServletRequest request, @RequestBody JSONObject json) { 
		//判断用户是否存在
		String id = json.optString("id");
		
		CommentsInformation commentsInformation = commentsInformationService.selectByPrimaryKey(CommUtil.null2Long(id));
		if(commentsInformation==null||!commentsInformation.getEvaluatorsId().toString().equals(SecurityUserHolder.getCurrentUserId(request).toString())){
			return ResponseCode.buildEnumResponseVO(ResponseCode.QUERY_NO_DATA, null);
		}
		if (commentsInformation.getParentId()!=null) {
			CommentsInformation commentsInformation1 = commentsInformationService.selectByPrimaryKey(commentsInformation.getParentId());
			if (commentsInformation1!=null) {
				commentsInformation1.setCountReply(commentsInformation1.getCountReply()-1);
				commentsInformationService.updateById(commentsInformation1);
			}
		}
		
		commentsInformationService.deleteById(CommUtil.null2Long(id));
		
		return ResponseCode.buildEnumResponseVO(ResponseCode.SUCCESS, null);
	}
	
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

企业软件定制

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值