源码地址来源: https://minglisoft.cn/honghu2/business.html
/*** Copyright &copy; 2012-2017 <a href="http://minglisoft.cn">HongHu</a> All rights reserved.*/
package com.honghu.cloud.controller;import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.commons.lang.StringUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.honghu.cloud.bean.ComExamine;
import com.honghu.cloud.bean.Store;
import com.honghu.cloud.bean.StoreGrade;
import com.honghu.cloud.bean.StorePoint;
import com.honghu.cloud.bean.WareHouse;
import com.honghu.cloud.code.ResponseCode;
import com.honghu.cloud.common.page.Page;
import com.honghu.cloud.configure.StoreVisitMqClient;
import com.honghu.cloud.dto.AreaDto;
import com.honghu.cloud.dto.CouponDto;
import com.honghu.cloud.dto.CouponInfoDto;
import com.honghu.cloud.dto.FavoriteDto;
import com.honghu.cloud.dto.FloorDto;
import com.honghu.cloud.dto.GoodsCartDto;
import com.honghu.cloud.dto.GoodsClassDto;
import com.honghu.cloud.dto.GoodsDto;
import com.honghu.cloud.dto.H5LevelBannerDto;
import com.honghu.cloud.dto.MenuDto;
import com.honghu.cloud.dto.ModularClassDto;
import com.honghu.cloud.dto.PlatformPayDto;
import com.honghu.cloud.dto.ShipAddressDto;
import com.honghu.cloud.dto.UserDto;
import com.honghu.cloud.dto.UserGoodsClassDto;
import com.honghu.cloud.dto.WareHouseDto;
import com.honghu.cloud.feign.AccessoryFeignClient;
import com.honghu.cloud.feign.AreaFeignClient;
import com.honghu.cloud.feign.CouponFeignClient;
import com.honghu.cloud.feign.CouponInfoFeignClient;
import com.honghu.cloud.feign.FavoriteFeignClient;
import com.honghu.cloud.feign.FloorFeignClient;
import com.honghu.cloud.feign.GoodsClassFeignClient;
import com.honghu.cloud.feign.GoodsFeignClient;
import com.honghu.cloud.feign.IconViewFeignClient;
import com.honghu.cloud.feign.MenuFeignClient;
import com.honghu.cloud.feign.ModularClassFeignClient;
import com.honghu.cloud.feign.OrderFormFeignClient;
import com.honghu.cloud.feign.PlatformPayFeignClient;
import com.honghu.cloud.feign.ShipAddressFeignClient;
import com.honghu.cloud.feign.StoreVisitLogFeignClient;
import com.honghu.cloud.feign.TXTemplateFeignClient;
import com.honghu.cloud.feign.UserFeignClient;
import com.honghu.cloud.feign.UserGoodsClassFeignClient;
import com.honghu.cloud.service.IComExamineService;
import com.honghu.cloud.service.IOpeningTimeService;
import com.honghu.cloud.service.IStoreGradeService;
import com.honghu.cloud.service.IStorePointService;
import com.honghu.cloud.service.IStoreService;
import com.honghu.cloud.service.IStoreVisitLogService;
import com.honghu.cloud.service.IWareHouseService;
import com.honghu.cloud.service.impl.StoreVisitLogServiceImpl;
import com.honghu.cloud.tools.QueryTools;
import com.honghu.cloud.tools.SecurityUserHolder;
import com.honghu.cloud.tools.StoreTools;
import com.honghu.cloud.utils.CommUtil;
import com.honghu.cloud.utils.Exceptions;import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;/*** 店铺Controller* * @author Administrator* @param <E>**/
@Slf4j
@RestController
@RequestMapping(value = "/store")
public class StoreController<E> {@Autowiredprivate IStoreService storeService;@Autowiredprivate IWareHouseService wareHouseService;@Autowiredprivate AccessoryFeignClient accessoryFeignClient;@Autowiredprivate IStorePointService storePointService;@Autowiredprivate AreaFeignClient areaFeignClient;@Autowiredprivate IStoreGradeService storeGradeService;@Autowiredprivate GoodsClassFeignClient goodsClassFeignClient;@Autowiredprivate ModularClassFeignClient modularClassFeignClient;@Autowiredprivate IStoreVisitLogService storeVisitLogService;@Autowiredprivate StoreTools storeTools;@Autowiredprivate PlatformPayFeignClient platformPayFeignClient;@Autowiredprivate UserFeignClient userFeignClient;@Autowiredprivate MenuFeignClient menuFeignClient;@Autowiredprivate FavoriteFeignClient favoriteFeignClient;@Autowiredprivate GoodsFeignClient goodsFeignClient;@Autowiredprivate QueryTools queryTools;@Autowiredprivate FloorFeignClient floorFeignClient;@Autowiredprivate UserGoodsClassFeignClient UserGoodsClassFeignClient;@Autowiredprivate StoreVisitMqClient storeVisitMqClient;@Autowiredprivate OrderFormFeignClient orderFormFeignClient;@Autowiredprivate StoreVisitLogFeignClient storeVisitLogFeignClient;@Autowiredprivate ShipAddressFeignClient shipAddressFeignClient;@Autowiredprivate IOpeningTimeService openingTimeService;@Autowiredprivate IconViewFeignClient iconViewFeignClient;@Autowiredprivate CouponFeignClient couponFeignClient;@Autowiredprivate IComExamineService comExamineService;@Autowiredprivate CouponInfoFeignClient couponInfoFeignClient;@Autowiredprivate TXTemplateFeignClient tXTemplateFeignClient;/*** 查询店铺* * @param congelationDto* @return*/@RequestMapping(value = "/apiForFeign/queryPageList", method = RequestMethod.POST)public List<Store> queryPageList(@RequestBody Map<String, Object> params, @RequestParam("begin") Integer begin,@RequestParam("max") Integer max) {return storeService.queryPageList(params, begin, max);}@RequestMapping(value = "/apiForFeign/selectCount", method = RequestMethod.POST)public int selectCount(@RequestBody Map<String, Object> params) {return storeService.selectCount(params);}@RequestMapping(value = "/apiForFeign/selectByPrimaryKey", method = RequestMethod.GET)public Store selectByPrimaryKey(@RequestParam("id") Long id) {Store store = storeService.selectByPrimaryKey(id);if (store==null) {return null;}// 店铺logoif (store != null && store.getStore_logo_id() != null) {store.setStore_logo(accessoryFeignClient.selectByPrimaryKey(store.getStore_logo_id()));}// 查询店铺评分统计store.setPoint(storePointService.getStoreByStoreId(id));// 公司所在地完整的父级地址信息if (store.getLicense_c_area_id() != null) {store.setLicense_c_area(areaFeignClient.selectByPrimaryKey(store.getLicense_c_area_id()));}return store;}@RequestMapping(value = "/apiForFeign/selectStoreAndWare", method = RequestMethod.GET)public Store selectStoreAndWare(@RequestParam("id") Long id) {Store store = storeService.selectByPrimaryKey(id);if (store==null) {return null;}// 店铺logoif (store != null && store.getStore_logo_id() != null) {store.setStore_logo(accessoryFeignClient.selectByPrimaryKey(store.getStore_logo_id()));}// 查询店铺评分统计store.setPoint(storePointService.getStoreByStoreId(id));// 公司所在地完整的父级地址信息if (store.getLicense_c_area_id() != null) {store.setLicense_c_area(areaFeignClient.selectByPrimaryKey(store.getLicense_c_area_id()));}if (store.getLicense_c_area_id() != null) {store.setLicense_c_area(areaFeignClient.selectByPrimaryKey(store.getLicense_c_area_id()));}if (store.getWarehouse_id() != null) {WareHouse wareHouse = wareHouseService.selectByPrimaryKey(store.getWarehouse_id());WareHouseDto wareHouseDto = new WareHouseDto();BeanUtils.copyProperties(wareHouse, wareHouseDto);store.setWarehouse(wareHouseDto);}return store;}@RequestMapping(value = "/apiForFeign/updateById", method = RequestMethod.POST)public void updateById(@RequestBody Store obj) {storeService.updateById(obj);}// 查询外卖店铺是否在营业中@RequestMapping(value = "/apiForFeign/openingDoor", method = RequestMethod.GET)public boolean openingDoor(@RequestParam("id") Long id) {return openingTimeService.openingDoor(id);}/*** 手机店铺* * @param request* @param response* @param id* @return*/@RequestMapping(value = "/store", method = RequestMethod.POST)public Map<String, Object> store(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String id = json.optString("id");String currentPage = json.optString("currentPage");String key = json.optString("key");String sa_id = json.optString("sa_id");String sa_name = json.optString("sa_name");Map<String, Object> result = new HashMap<String, Object>();Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));if (store == null) {return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);}// 查询开店的人UserDto user = userFeignClient.getUserByStoreId(store.getId());store.setUser(user);result.put("store", store);if ((CommUtil.null2Int(store.getStore_status()) == 25) || (CommUtil.null2Int(store.getStore_status()) == 26)) {return ResponseCode.buildCodeMap("20002", "店铺因为合同到期现已关闭,如有疑问请联系商城客服", null);} else if (store.getStore_status() < 15) {return ResponseCode.buildCodeMap("20003", "店铺未正常营业", null);} else if (store.getStore_status() == 20) {return ResponseCode.buildCodeMap("20004", "店铺因为违反商城相关规定现已关闭,如有疑问请联系商城客服", null);}// 查询是否收藏店铺 if (SecurityUserHolder.getCurrentUser(request) != null) {Map<String, Object> params = Maps.newHashMap();params.put("user_id", SecurityUserHolder.getCurrentUserId(request));params.put("store_id", CommUtil.null2Long(id));List<FavoriteDto> list = this.favoriteFeignClient.queryPageList(params);if (null != list && list.size() > 0) {result.put("all_col", Integer.valueOf(1));}// bannerparams.clear();params.put("edit_mo", "5");params.put("store_id", id);List<FloorDto> bannerFloor = floorFeignClient.queryPages(params);if (bannerFloor.size() > 0) {result.put("bannerFloor", bannerFloor.get(0));}// VRparams.put("edit_mo", "1");List<FloorDto> vrFloor = floorFeignClient.queryPages(params);if (vrFloor != null && vrFloor.size() > 0) {result.put("vrFloor", vrFloor.get(0));}// customparams.put("edit_mo", "6");params.put("orderBy", "sequence");params.put("orderType", "asc");List<FloorDto> customFloor = floorFeignClient.queryPages(params);result.put("customFloor", customFloor);// 店铺发货地址if (StringUtils.isBlank(sa_id) || StringUtils.isBlank(sa_name)) {params.clear();params.put("store_id", CommUtil.null2Long(id));List<ShipAddressDto> saList = shipAddressFeignClient.queryPages(params);if (saList != null && saList.size() > 0) {sa_id = saList.get(0).getId().toString();sa_name = saList.get(0).getSa_name();}}// 店铺的商品Map<String, Object> maps = queryTools.getParams(currentPage, 12, "obj.addTime", "desc");maps.put("goods_store_id", store.getId()); // 店铺IDmaps.put("goods_status", 0); // 商品审核状态maps.put("honghu_goods_name", key);Map<String, Object> goodsList = goodsFeignClient.list(maps);result.put("goodsList", goodsList);result.put("key", key);result.put("id", id);result.put("sa_id", sa_id);result.put("sa_name", sa_name);// result.put("share_user_id", share_user_id);// 查询店铺是否显示手机号ModularClassDto ModularClassDto = modularClassFeignClient.selectByPrimaryKey(store.getMc_id());result.put("showphone", ModularClassDto.isShow_phone());maps.clear();maps.put("store_id", store.getId());maps.put("coupon_end_time_able", "coupon_end_time_able");List<CouponDto> couponlist = couponFeignClient.queryPageList(maps);result.put("couponlist", couponlist);try {String current_ip = CommUtil.getIpAddr(request);JSONObject jsonMsg = new JSONObject();jsonMsg.put("source", "1"); // 来源(1.小程序,2.app)jsonMsg.put("store_id", id);jsonMsg.put("user_id", SecurityUserHolder.getCurrentUserId(request));jsonMsg.put("access_ip", current_ip);storeVisitMqClient.sendStoreVisitMsg(jsonMsg);} catch (Exception e) {log.error("记录用户访问店铺数据失败:" + Exceptions.getStackTraceAsString(e));;}return ResponseCode.buildSuccessMap(result);}@RequestMapping(value = "/storeAgentGoods", method = RequestMethod.POST)public Map<String, Object> storeAgentGoods(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String id = json.optString("id");String currentPage = json.optString("currentPage");String key = json.optString("key");Map<String, Object> maps = queryTools.getParams(currentPage, 12, "obj.addTime", "desc");maps.put("agent_sid", Long.parseLong(id));maps.put("goods_status", 0); // 商品审核状态if(StringUtils.isNotBlank(key)){maps.put("honghu_goods_name", key);}maps.put("no_goods_store_id", Long.parseLong(id));Map<String, Object> goodsList = goodsFeignClient.list(maps);return ResponseCode.buildSuccessMap(goodsList);}/*** 商品分类-ajax* * @param request* @param response* @param ugc_id*            商品类别* @param store_id*            商店编号* @param orderBy*            分组类型* @param orderType*            排序方式* @param currentPage* @param all* @param ty*            底部图标首页访问路径的判断标识* @return*/@RequestMapping(value = "/store_type_list", method = RequestMethod.POST)public Map<String, Object> store_type_list(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String storeId = json.optString("storeId");Map<String, Object> result = new HashMap<String, Object>();result.put("storeId", storeId);Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(storeId)); // 根据店铺ID查询店铺信息if (store == null) {return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);}// 店铺信息result.put("store", store);UserDto user = userFeignClient.getUserByStoreId(store.getId());if (user == null) {result.put("ugcs", null);// 商品分类集合return ResponseCode.buildSuccessMap(result);// return ResponseCode.buildCodeMap("20005", "开店用户信息异常!", null);}// 商品分类集合Map<String, Object> maps = Maps.newHashMap();maps.put("user_id", user.getId());maps.put("deleteStatus", 0);maps.put("parent", "-1");maps.put("dispaly", 1);maps.put("orderBy", "obj.sequence");maps.put("orderType", "ASC");List<UserGoodsClassDto> ugcs = this.UserGoodsClassFeignClient.queryPageList(maps); // 商品分类集合result.put("ugcs", ugcs);// 商品分类集合// 店铺分类信息return ResponseCode.buildSuccessMap(result);}/*** 名片* @param request* @param response* @param store_id*            店铺编号* @param ty 底部图标首页访问路径的判断标识* @return* @throws Exception*/@RequestMapping(value = "/business_card", method = RequestMethod.POST)public Map<String, Object> business_card(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {Long storeId = json.optLong("storeId");Store store = this.storeService.selectByPrimaryKey(storeId); // 查询商店信息if (store == null) {return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);} Map<String, Object> result = new HashMap<String, Object>();if(store.getArea_id() != null){String areainfo = areaFeignClient.genericAreaInfo(store.getArea_id(), "");store.setStore_address(areainfo+store.getStore_address());}result.put("store", store);Map<String, Object> params = Maps.newHashMap();// 查询是否用户是否收藏UserDto currentUser = SecurityUserHolder.getCurrentUser(request);if (currentUser != null) {params.clear();params.put("user_id", currentUser.getId());params.put("store_id", CommUtil.null2Long(storeId));List<FavoriteDto> list = this.favoriteFeignClient.queryPageList(params);if (null != list && list.size() > 0) {result.put("all_col", Integer.valueOf(1));}//result.put("user", currentUser);}// 查询店铺是否显示手机号ModularClassDto ModularClassDto = modularClassFeignClient.selectByPrimaryKey(store.getMc_id());result.put("showphone", ModularClassDto.isShow_phone());//用户的bannerFloorDto floor = floorFeignClient.selectStoreBanner(storeId);result.put("floor", floor);return ResponseCode.buildSuccessMap(result);}/*** 手机店铺中商品(全部宝贝)* * @param request* @param response* @param id* @return*/@RequestMapping(value = "/store_goods_new", method = RequestMethod.POST)public Map<String, Object> store_goods_new(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String orderBy = json.optString("orderBy");String orderType = json.optString("orderType");String keyword = json.optString("keyword");String storeId = json.optString("storeId");String currentPage = json.optString("currentPage");String ugc_id = json.optString("ugc_id");if ((orderBy == null) || ("".equals(orderBy))) {orderBy = "goods_salenum";} else if (CommUtil.null2String(orderBy).equals("store_salenum")) {orderBy = "goods_salenum";// 销量} else if (CommUtil.null2String(orderBy).equals("goods_collect")) {orderBy = "goods_collect";// 人气} else if (CommUtil.null2String(orderBy).equals("well_evaluate")) {orderBy = "well_evaluate";// 评分高(综合)} else if (CommUtil.null2String(orderBy).equals("store_price")) {orderBy = "store_price"; // 价格}if (CommUtil.null2String(orderType).equals("asc") || CommUtil.null2String(orderType).equals("ASC")) {orderType = "ASC";} else {orderType = "DESC";}Map<String, Object> maps = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);if (StringUtils.isNotBlank(ugc_id)) {maps.put("ugc_id", ugc_id);}if (StringUtils.isNotBlank(keyword)) {maps.put("honghu_goods_name", keyword);}maps.put("goods_store_id", storeId);maps.put("enough_reduce", "enough_reduce");maps.put("goods_status", 0);Map<String, Object> goodsList = this.goodsFeignClient.list(maps);Map<String, Object> result = new HashMap<String, Object>();result.put("goodsList", goodsList);result.put("orderBy", orderBy);result.put("orderType", orderType);result.put("keyword", keyword);result.put("storeId", storeId);result.put("currentPage", currentPage);result.put("ugc_id", ugc_id);return ResponseCode.buildSuccessMap(result);}/*** * @param request* @param response* @param id* @return*//** @RequestMapping({ "/store_user_goods_class" }) public ModelAndView* store_user_goods_class(HttpServletRequest request, HttpServletResponse* response, String id) { ModelAndView mv = new* HongHuJModelAndView("/weixin/store_user_goods_class.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); Store* store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if* (store != null) { Map params = Maps.newHashMap(); params.put("user_id",* store.getUser().getId()); params.put("display", Boolean.valueOf(true));* params.put("parent", -1); params.put("orderBy", "sequence");* params.put("orderBy", "sequence"); params.put("orderType", "asc");* * List<UserGoodsClass> ugcs =* this.userGoodsClassService.queryPageList(params);* * result.put("ugcs", ugcs); } return mv; }* *//*** 店铺活动* * @param request* @param response* @param id* @return*//** @RequestMapping({ "/store_activity" }) public ModelAndView* store_activity(HttpServletRequest request, HttpServletResponse response,* String id) { ModelAndView mv = new* HongHuJModelAndView("/weixin/store_activity.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); if ((id !=* null) && (!"".equals(id))) { Store store =* this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if (store* != null) { result.put("store", store); Map map = Maps.newHashMap();* map.put("ag_goods_goods_store_id", store.getId()); map.put("ag_status",* 1);* * List<ActivityGoods> ags = this.activityGoodsService.queryPageList(map);* * Set ids = new HashSet(); for (ActivityGoods ag : ags) { if (ag.getAct()* != null) { ids.add(ag.getAct().getId()); } } if (null != ids &&* ids.size() > 0) { Map paras = Maps.newHashMap(); paras.put("ids", ids);* * List list = this.activityService.queryPageList(paras);* * result.put("objs", list); } } } return mv; }* *//*** 活动商品列表* * @param request* @param response* @param act_id* @param id* @return*//** @RequestMapping({ "/activity_goods_list" }) public ModelAndView* activity_goods_list(HttpServletRequest request, HttpServletResponse* response, String act_id, String id) { ModelAndView mv = new* HongHuJModelAndView("/weixin/activity_goods_list.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); Activity* act =* this.activityService.selectByPrimaryKey(CommUtil.null2Long(act_id)); if* ((id != null) && (!"".equals(id)) && (act != null)) { Map<String, Object>* maps = this.hongHuQueryTools.getParams(null, "addTime", "desc");* maps.put("ag_goods_goods_store_id", CommUtil.null2Long(id));* maps.put("act_id", CommUtil.null2Long(act_id)); maps.put("ag_status", 1);* * IPageList pList = this.activityGoodsService.list(maps);* CommUtil.saveIPageList2ModelAndView("", "", "", pList, mv); }* result.put("act_id", act_id); if ((id != null) && (!"".equals(id))) {* Store store =* this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if (store* != null) { result.put("store", store); } } return mv; }* * * *//*** 店铺分类列表* * @param request* @param response* @param id* @return*//** @RequestMapping({ "/store_class_list" }) public ModelAndView* store_class_list(HttpServletRequest request, HttpServletResponse* response, String id) { ModelAndView mv = new* HongHuJModelAndView("/weixin/store_class_list.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); Store* store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if* (store != null) { Map params = Maps.newHashMap(); params.put("user_id",* store.getUser().getId()); params.put("display", Boolean.valueOf(true));* params.put("parent", Boolean.valueOf(true)); params.put("orderBy",* "sequence"); params.put("orderType", "asc");* * List<UserGoodsClass> ugcs =* this.userGoodsClassService.queryPageList(params);* * result.put("store", store); result.put("ugcs", ugcs); } return mv; }* *//*** 店铺商品* * @param request* @param response* @param ugc_id* @param store_id* @param keyword* @param orderBy* @param orderType* @param currentPage* @param all* @return*//** @RequestMapping({ "/store_goods" }) public ModelAndView* store_goods(HttpServletRequest request, HttpServletResponse response,* String ugc_id, String store_id, String keyword, String orderBy, String* orderType, String currentPage, String all) { ModelAndView mv = new* HongHuJModelAndView("weixin/store_goods.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response);* Map<String, Object> maps = this.hongHuQueryTools.getParams(currentPage,* 12, orderBy, orderType); if (!"all".equals(all)) { mv = new* HongHuJModelAndView("weixin/store_goods_data.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); } if* ((orderBy == null) || (orderBy.equals(""))) { orderBy = "goods_salenum";* } if ((orderType == null) || (orderType.equals(""))) { orderType =* "desc"; } if ((currentPage == null) || ("".equals(currentPage))) {* currentPage = "1"; } Store store =* this.storeService.selectByPrimaryKey(CommUtil.null2Long(store_id)); if* (store != null) { result.put("store", store); maps.put("goods_store_id",* store.getId());* * maps.put("goods_status", 0); if ((keyword != null) &&* (!keyword.equals(""))) { maps.put("goods_name_like", keyword);* result.put("keyword", keyword); }* * UserGoodsClass ugc =* this.userGoodsClassService.selectByPrimaryKey(CommUtil.null2Long(ugc_id))* ; if (ugc != null) { result.put("ugc", ugc); Set<Long> ids =* genericUserGcIds(ugc); List<UserGoodsClass> ugc_list =* Lists.newArrayList(); for (Long g_id : ids) { UserGoodsClass temp_ugc =* this.userGoodsClassService.selectByPrimaryKey(g_id);* ugc_list.add(temp_ugc); }* * List<Long> goods_ugcs_ugc_ids = Lists.newArrayList();* * for (int i = 0; i < ugc_list.size(); i++) { UserGoodsClass userGoodsClass* = ugc_list.get(i); goods_ugcs_ugc_ids.add(userGoodsClass.getId()); }* maps.put("goods_ugcs_ugc_ids", goods_ugcs_ugc_ids); }* * if ((orderBy != null) && (!orderBy.equals(""))) { result.put("orderBy",* orderBy); result.put("orderType", orderType); }* * IPageList pList = this.goodsService.list(maps); result.put("objs",* pList.getResult()); result.put("totalPage",* Integer.valueOf(pList.getPages())); String url =* this.configService.getSysConfig().getAddress();* CommUtil.saveIPageList2ModelAndView(url + "/goods_list", "", "", pList,* mv); } else { mv = new HongHuJModelAndView("error.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response);* result.put("op_title", "请求参数错误"); result.put("url",* CommUtil.getURL(request) + "/index"); } return mv; }* *//*** 店铺商品* * @param request* @param response* @param ugc_id* @param store_id* @param keyword* @param orderBy* @param orderType* @param currentPage* @param all* @return*//** @RequestMapping({ "/store_items" }) public ModelAndView* store_items(HttpServletRequest request, HttpServletResponse response,* String ugc_id, String store_id, String keyword, String orderBy, String* orderType, String currentPage, String all) { ModelAndView mv = new* HongHuJModelAndView("weixin/store_goods.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response);* * Map<String, Object> maps = this.hongHuQueryTools.getParams(currentPage,* 12, orderBy, orderType);* * if (!"all".equals(all)) { mv = new* HongHuJModelAndView("weixin/store_goods_data.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); } if* ((orderBy == null) || (orderBy.equals(""))) { orderBy = "goods_salenum";* } if ((orderType == null) || (orderType.equals(""))) { orderType =* "desc"; } if ((currentPage == null) || ("".equals(currentPage))) {* currentPage = "1"; } Store store =* this.storeService.selectByPrimaryKey(CommUtil.null2Long(store_id)); if* (store != null) { result.put("store", store);* * maps.put("goods_store_id", store.getId());* * maps.put("goods_status", 0);* * if ((keyword != null) && (!keyword.equals(""))) {* maps.put("goods_name_like", keyword); result.put("keyword", keyword); }* * UserGoodsClass ugc =* this.userGoodsClassService.selectByPrimaryKey(CommUtil.null2Long(ugc_id))* ; if (ugc != null) { result.put("ugc", ugc); Set<Long> ids =* genericUserGcIds(ugc); List<UserGoodsClass> ugc_list =* Lists.newArrayList(); for (Long g_id : ids) { UserGoodsClass temp_ugc =* this.userGoodsClassService.selectByPrimaryKey(g_id);* ugc_list.add(temp_ugc); }* * List<Long> goods_ugcs_ugc_ids = Lists.newArrayList();* * for (int i = 0; i < ugc_list.size(); i++) {* goods_ugcs_ugc_ids.add(ugc_list.get(i).getId()); }* maps.put("goods_ugcs_ugc_ids", goods_ugcs_ugc_ids);* * }* * IPageList pList = this.goodsService.list(maps); result.put("objs",* pList.getResult()); result.put("totalPage",* Integer.valueOf(pList.getPages())); String url =* this.configService.getSysConfig().getAddress();* CommUtil.saveIPageList2ModelAndView(url + "/goods_list", "", "", pList,* mv); } else { mv = new HongHuJModelAndView("error.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response);* result.put("op_title", "请求参数错误"); result.put("url",* CommUtil.getURL(request) + "/index"); } return mv; }* *//*** * @param request* @param response* @param id* @return*//** @RequestMapping({ "/store_head" }) public ModelAndView* store_head(HttpServletRequest request, HttpServletResponse response,* String id) { ModelAndView mv = new* HongHuJModelAndView("/weixin/store_head.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); Store* store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));* result.put("store", store); return mv; }* *//*** * @param request* @param response* @param id* @return*//** @RequestMapping({ "/store_foot" }) public ModelAndView* store_foot(HttpServletRequest request, HttpServletResponse response,* String id) { ModelAndView mv = new* HongHuJModelAndView("/weixin/store_foot.html",* this.configService.getSysConfig(),* this.userConfigService.getUserConfig(), 1, request, response); Store* store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));* result.put("store", store); return mv; }* *//*** * @param ugc* @return*//** private Set<Long> genericUserGcIds(UserGoodsClass ugc) { Set ids =* new HashSet(); ids.add(ugc.getId()); for (UserGoodsClass child :* ugc.getChilds()) { Set<Long> cids = genericUserGcIds(child); for* (Long cid : cids) { ids.add(cid); } ids.add(child.getId()); } return* ids; }* *//*** 用户申请开店* * @param request* @param response* @return*/@RequestMapping({ "/buyer/user_store_add" })public Map<String, Object> user_store_add(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {Map<String, Object> result = Maps.newHashMap();Map<String, Object> params = Maps.newHashMap();String type = json.optString("type");UserDto user = SecurityUserHolder.getCurrentUser(request);Store store = null;if (user != null) {params.clear();params.put("user_id", user.getId());store = this.storeService.queryByProperty(params);}params.clear();List<StoreGrade> grades = this.storeGradeService.queryPageList(params);result.put("storeGrades", grades);result.put("user", user);params.clear();params.put("parent", -1);params.put("level", 0);List<GoodsClassDto> gcs = this.goodsClassFeignClient.queryPageList(params);result.put("goodsClass", gcs);if (store != null) {if (StringUtils.isNotEmpty(type)) {store.setStore_status(0); // 重新提交storeService.updateById(store);}// 跳转审核页面result.put("store", store);}// 查询店铺保证金购买记录params.clear();params.put("user_id", user.getId());params.put("pay_status", 1);PlatformPayDto platformPay = platformPayFeignClient.findUserDepositPay(params);if (platformPay != null && platformPay.getPay_status() == 1) {result.put("deposit_mark", "true");}params.clear();List<ModularClassDto> modularclass = modularClassFeignClient.queryPageList(params);result.put("modularclass", modularclass);result.put("usecard", false);return ResponseCode.buildSuccessMap(result);}/*** 店铺保存* * @param request* @param response* @param id* @param store_status* @param currentPage* @param cmd* @param list_url* @param add_url* @param user_id* @param grade_id* @param area_id* @param validity* @param gc_main_id_clone* @param gc_detail_ids* @param gc_detail_info* @param serve_ids* @param cart_session* @return String trueName, String id, String store_name, String cmd, String*         user_id, String storeGrades, String validity, String gc_main_id,*         String gc_detail_ds, String telephone, String gc_detail_info,*         String serve_ids, String recommend, String store_add_session,*         String gc_id, String mc_id,* @throws Exception*/@RequestMapping({ "/store_save" })public Map<String, Object> store_save(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String store_name = json.optString("store_name"); // 店铺名称String trueName = json.optString("trueName"); // 真实姓名String telephone = json.optString("telephone"); // 电话号码String recommend = json.optString("recommend"); // 推荐人String mc_id = json.optString("mc_id"); // 行业String warehouse_id = json.optString("warehouse_id"); // 仓库地址idString storeGrades = json.optString("storeGrades"); // 店铺种类String gc_main_id = json.optString("gc_main_id"); // 主营类目String gc_id = json.optString("gc_id"); // 分类listString store_type = json.optString("store_type"); // 店铺类型 0 为个人 ,1 为公司String area_id = json.optString("area_id"); // 地址idString lat = json.optString("lat"); // 经纬度String lng = json.optString("lng");String area_name = json.optString("area_name"); // 详细地址名称String bank_permit_image_id = json.optString("bank_permit_image_id"); // 开户许可证String food_license_id = json.optString("food_license_id"); // 开户许可证// String serve_ids = json.optString("serve_ids");String license_legal_idCard_image_id = json.optString("license_legal_idCard_image_id"); // 身份证正面String license_legal_idCard_image2_id = json.optString("license_legal_idCard_image2_id");// 身份证反面String license_image_id = json.optString("license_img_id"); // 开户许可证 idString bank_c_account = json.optString("bank_c_account"); // 开户行账号String bank_account_name = json.optString("bank_account_name"); // 银行开户名String bank_name = json.optString("bank_name"); // 开户行支行名称UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));Store store = null;if (user.getStore_id() != null) {store = this.storeService.selectByPrimaryKey(user.getStore_id());} else {store = new Store();}store.setStore_status(5);if ((null != user) && (null != user.getId())) {store.setUser(user);store.setStore_name(store_name);store.setStore_ower(trueName);store.setLng(Double.valueOf(lng));store.setLat(Double.valueOf(lat));store.setArea_id(CommUtil.null2Long(area_id));store.setStore_address(area_name); // 详细地址store.setStore_telephone(telephone); // 店铺电话号码store.setRecommend(recommend); // 推荐人store.setGc_main_id(CommUtil.null2Long(gc_main_id));store.setAddTime(new Date());if (StringUtils.isNotEmpty(mc_id)) {store.setMc_id(CommUtil.null2Long(mc_id)); // 店铺所属行业}if (StringUtils.isNotEmpty(warehouse_id)) {store.setWarehouse_id(CommUtil.null2Long(warehouse_id)); // 店铺配送仓库地址}if (StringUtils.isNotBlank(storeGrades)) {store.setGrade_id(CommUtil.null2Long(storeGrades));}if (StringUtils.isNotBlank(store_type)) {store.setStore_type(Integer.valueOf(store_type)); // 店铺类型}if (StringUtils.isNotBlank(bank_c_account)) {store.setBank_c_account(bank_c_account); // 开户行账号}if (StringUtils.isNotBlank(bank_account_name)) {store.setBank_account_name(bank_account_name); // 银行开户名}if (StringUtils.isNotBlank(bank_name)) {store.setBank_name(bank_name); // 开户行支行名称}// 保存店铺位置坐标if (StringUtils.isNotBlank(gc_id)) {String[] str = gc_id.split(",");List<Map> list = Lists.newArrayList();Map<String, Object> map = Maps.newHashMap();List gc_list = Lists.newArrayList();GoodsClassDto parent = null;for (int b = 1; b < str.length; b++) {GoodsClassDto gc = this.goodsClassFeignClient.selectByPrimaryKey(CommUtil.null2Long(str[b]));parent = gc.getParent();}List<GoodsClassDto> gc_mains = this.storeTools.query_store_detail_MainGc(store.getGc_detail_info());for (GoodsClassDto gc_main : gc_mains) {Map map_main = this.storeTools.query_MainGc_Map(CommUtil.null2String(gc_main.getId()),store.getGc_detail_info());list.add(map_main);}for (int a = 0; a < str.length; a++) {GoodsClassDto gc = this.goodsClassFeignClient.selectByPrimaryKey(CommUtil.null2Long(str[a]));if (null == gc) {continue;}Set<GoodsClassDto> detail_info = this.storeTools.query_store_DetailGc(store.getGc_detail_info());if (((Set) detail_info).size() == 0) {gc_list.add(gc.getId());} else {int m = 0;for (GoodsClassDto gc2 : detail_info) {if (gc.getId().equals(gc2.getId())) {m++;}}if (m == ((Set) detail_info).size()) {gc_list.add(gc.getId());}}if (gc.getParent_id() != null) {parent = goodsClassFeignClient.selectByPrimaryKey(gc.getParent_id());}}map.put("m_id", parent.getId());map.put("gc_list", gc_list);list.add(map);store.setGc_detail_info(JSON.toJSONString(list));}}Map<String, Object> params = Maps.newHashMap();// 1、搜索出所有父菜单params.clear();params.put("parent", -1);params.put("type", "SELLER");List<MenuDto> menus = this.menuFeignClient.list(params);List<MenuDto> ms = Lists.newArrayList();// 2、通过父菜单获取所有子菜单for (MenuDto menu : menus) {ms.add(menu);ms.addAll(menu.getAllChilds());}this.userFeignClient.deleteUserMenu(user.getId());this.userFeignClient.saveUserMenu(user.getId(), ms);// 处理图片if (StringUtils.isNotBlank(license_legal_idCard_image_id)) { // 身份证正面store.setLicense_legal_idCard_image_id(CommUtil.null2Long(license_legal_idCard_image_id));}if (StringUtils.isNotBlank(license_legal_idCard_image2_id)) { // 身份证背面store.setLicense_legal_idCard_image2_id(CommUtil.null2Long(license_legal_idCard_image2_id));}if (StringUtils.isNotBlank(license_image_id)) { // 营业执照store.setLicense_image_id(CommUtil.null2Long(license_image_id));}if (StringUtils.isNotBlank(bank_permit_image_id)) { // 营业执照store.setBank_permit_image_id(CommUtil.null2Long(bank_permit_image_id));}if (StringUtils.isNotBlank(food_license_id)) { // 营业执照store.setFood_license_id(CommUtil.null2Long(food_license_id));}if (store.getId() == null) {this.storeService.saveEntity(store);//通知用户审核try{params = new HashMap<String, Object>();params.put("kind", "店铺");params.put("nickname", user.getNickName());tXTemplateFeignClient.auditNsgNote(params);}catch(Exception e){log.error("StoreController >> store_save >> auditNsgNote  " + e.getMessage());}} else {this.storeService.updateById(store);}if (store.getPoint() == null) {StorePoint sp = new StorePoint();sp.setAddTime(new Date());sp.setStore(store);sp.setStore_evaluate(BigDecimal.valueOf(0L));sp.setDescription_evaluate(BigDecimal.valueOf(0L));sp.setService_evaluate(BigDecimal.valueOf(0L));sp.setShip_evaluate(BigDecimal.valueOf(0L));this.storePointService.saveEntity(sp);}user.setStore_id(store.getId());this.userFeignClient.updateById(user);return ResponseCode.buildSuccessMap(null);}/*** 我的店铺* * @param request* @param response* @param json* @return*/@RequestMapping(value = "/my_store", method = RequestMethod.POST)public Map<String, Object> my_store(HttpServletRequest request, HttpServletResponse response) {Map<String, Object> resultMap = new HashMap<String, Object>();UserDto user = SecurityUserHolder.getCurrentUser(request);if (user == null) {return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);}user = userFeignClient.selectByPrimaryKey(user.getId());Store store = storeService.selectByPrimaryKey(user.getStore_id());if (store == null) {return ResponseCode.buildCodeMap("20002", "无法找到该店铺", null);}resultMap.put("store", store);return ResponseCode.buildSuccessMap(resultMap);}@RequestMapping(value = "/save_my_store", method = RequestMethod.POST)public Map<String, Object> save_my_store(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String store_name = json.optString("store_name");String store_info = json.optString("store_info");Long mobile_logo_id = json.optLong("mobile_logo_id");Long store_photo_id = json.optLong("store_photo_id");if (StringUtils.isBlank(store_name) || StringUtils.isBlank(store_info) || mobile_logo_id == null|| store_photo_id == null) {return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);}UserDto user = SecurityUserHolder.getCurrentUser(request);if (user == null) {return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);}Store store = storeService.selectByPrimaryKey(user.getId());if (store == null) {return ResponseCode.buildCodeMap("20002", "无法找到该店铺", null);}store.setStore_name(store_name);store.setStore_info(store_info);store.setMobile_logo_id(mobile_logo_id);store.setStore_photo_id(store_photo_id);storeService.updateById(store);return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, null);}/*** 去逛街* * @param request* @param response* @param search*            店铺名称搜索* @param id*            店铺id* @param orderBy*            分组类型* @param orderType*            排序方式* @return*/@RequestMapping(value = "/go_shopping", method = RequestMethod.POST)public Map<String, Object> go_shopping(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String currentPage = json.optString("currentPage");String search = json.optString("search");String orderBy = json.optString("orderBy");String orderType = json.optString("orderType");String lat = json.optString("lat");String lng = json.optString("lng");String gb_id = json.optString("gb_id");String mc_id = json.optString("mc_id");String newShop = json.optString("newShop");if (StringUtils.isBlank(lat) || StringUtils.isBlank(lng) || StringUtils.isBlank(currentPage)) {return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);}Map<String, Object> result = new HashMap<String, Object>();Map<String, Object> params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);params.put("notakeaway", "yes");if (CommUtil.null2String(orderType).equals("")) {orderType = "desc";}if ((orderBy == null) || ("".equals(orderBy)) || "comprehensive".equals(orderBy)) {// 综合params.put("orderBy", "obj.deposit  " + orderType+ ", obj.fileId desc, avg(sp.store_evaluate) desc, count(goods.goods_salenum)");} else if (CommUtil.null2String(orderBy).equals("well_evaluate")) {// 评分params.put("orderBy", "IFNULL(avg(sp.store_evaluate), 5)");} else if (CommUtil.null2String(orderBy).equals("store_distance")) {// 距离params.put("orderBy", "distance");}Map<String, Object> map = Maps.newHashMap();if (StringUtils.isNotBlank(search)) {params.put("search_key", search); // 商店名称模糊匹配}else{  //存在搜索的情况,就不做区域限制String city = areaFeignClient.getCoordinate(lat, lng);map.put("level", 1);map.put("areaName", city);List<AreaDto> list = areaFeignClient.queryPageList(map);if (list.size() <= 0) {// 如果查询不到,就设定地址为深圳map.clear();map.put("level", 1);map.put("areaName", "深圳市");list = areaFeignClient.queryPageList(map);}AreaDto area = list.get(0);params.put("area_id", area.getId());}params.put("lat", lat);params.put("lng", lng);params.put("orderType", orderType);params.put("group_by", "sa.id");if (StringUtils.isNotEmpty(gb_id)) {params.put("screen_gb_id", gb_id); // 品牌}if (StringUtils.isNotEmpty(newShop)) {params.put("screen_newShop", newShop); // 新店}if (StringUtils.isNotEmpty(mc_id)) {params.put("screen_mc_id", CommUtil.null2Long(mc_id)); // 行业}Page<Store> pList = this.storeService.goShoppingPage(params);Page<Store> recomList = null;if (pList.getRowCount() <= 10) {// 没有数据获取默认地方深圳的数据map.clear();map.put("level", 1);map.put("areaName", "深圳市");List<AreaDto> list = areaFeignClient.queryPageList(map);AreaDto area = list.get(0);params.clear();params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);params.put("notakeaway", "yes");params.put("orderBy", "obj.deposit  " + orderType+ ", obj.fileId desc, avg(sp.store_evaluate) desc, count(goods.goods_salenum)");params.put("lat", lat);params.put("lng", lng);params.put("orderType", orderType);params.put("group_by", "sa.id");params.put("area_id", area.getId());recomList = this.storeService.goShoppingPage(params);}//地图上的名称/*if (pList.getResult()!=null&&pList.getResult().size()>0) {for (Store store : pList.getResult()) {if (store.getStore_name().length()>4) {store.setStore_map_name(store.getStore_name().substring(0, 5)+"..");}else{store.setStore_map_name(store.getStore_name());}}}*/result.put("recomList", recomList);result.put("pList", pList);result.put("currentPage", currentPage);result.put("search", search);result.put("orderBy", orderBy);result.put("orderType", orderType);result.put("lat", lat);result.put("lng", lng);result.put("gb_id", gb_id);result.put("mc_id", mc_id);result.put("newShop", newShop);return result;}// 获取行业信息@RequestMapping(value = "/allModularClass", method = RequestMethod.GET)public Map<String, Object> allModularClass() {Map<String, Object> params = Maps.newHashMap();List<ModularClassDto> mcList = modularClassFeignClient.queryPageList(params);return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, mcList);}/*** 手机店铺首页* * @param request* @param response* @param id* @return*/@RequestMapping(value = "/home", method = RequestMethod.GET)public Map<String, Object> home(HttpServletRequest request, HttpServletResponse response) {Long login_user_id = SecurityUserHolder.getCurrentUserId(request);UserDto user = userFeignClient.selectByPrimaryKey(login_user_id);if (user.getStore_id() == null) {return ResponseCode.buildCodeMap("40001", "未开店", null);}user.setStore_id(user.getStore_id());/*** 查询订单、退款售后统计{wait_pay_num:待付款,wait_send_num:待发货,return_goods_num:退款售后,wait_evaluate_num:待评价,* return_num:退款中,today_order_num:今日订单数,today_order_price:今日总成交额,lastday_order_price:昨日成交金额}*/Map<String, Object> orderStatis = orderFormFeignClient.orderStoreStatis(user.getStore_id());/** 查询商品统计{today_collect:今日收藏,today_look:今日浏览,today_cart_num:今日购物车} **/Map<String, Object> goodsStatis = goodsFeignClient.goodsStoreStatis(user.getStore_id());orderStatis.putAll(goodsStatis);/** 查询店铺访问统计{today_visit:今日总访客,today_flow:今日总流量,lastday_visit:昨日总访客} **/Map<String, Object> visitStatis = storeVisitLogService.visitStoreStatis(user.getStore_id());orderStatis.putAll(visitStatis);return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, orderStatis);}// 外卖店铺@RequestMapping(value = "/takeaway_shop", method = RequestMethod.POST)public Map<String, Object> takeaway_shop(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String currentPage = json.optString("currentPage");String search = json.optString("search");String orderBy = json.optString("orderBy");String orderType = json.optString("orderType");String lat = json.optString("lat");String lng = json.optString("lng");String gb_id = json.optString("gb_id");String newShop = json.optString("newShop");String mc_id = json.optString("mc_id"); // 行业String free_delivery = json.optString("free_delivery"); // 免费配送String full_reduction = json.optString("full_reduction"); // 满就减String full_send = json.optString("full_send"); // 满就送String invoice = json.optString("invoice"); // 发票if (StringUtils.isBlank(lat) || StringUtils.isBlank(lng) || StringUtils.isBlank(currentPage)) {return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);}Map<String, Object> result = new HashMap<String, Object>();List<H5LevelBannerDto> hlbList = iconViewFeignClient.selectByHmId(6L);result.put("hlbList", hlbList);Map<String, Object> params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);params.put("takeaway", "yes");if (CommUtil.null2String(orderType).equals("")) {orderType = "desc";}if ((orderBy == null) || ("".equals(orderBy)) || "comprehensive".equals(orderBy)) {// 综合params.put("orderBy", "obj.deposit  " + orderType+ ", obj.fileId desc, avg(sp.store_evaluate) desc, count(goods.goods_salenum)");} else if (CommUtil.null2String(orderBy).equals("well_evaluate")) {// 评分params.put("orderBy", "IFNULL(avg(sp.store_evaluate), 5)");} else if (CommUtil.null2String(orderBy).equals("store_distance")) {// 距离params.put("orderBy", "distance");orderType = "ASC";} else if (CommUtil.null2String(orderBy).equals("store_salenum")) {// 销量 ORDER BY store_salenum DESCparams.put("orderBy", "store_salenum");orderType = "DESC";} else if (CommUtil.null2String(orderBy).equals("send_money")) {// 起送价最低 ORDER BY send_money ASCparams.put("orderBy", "obj.send_money");orderType = "ASC";} else if (CommUtil.null2String(orderBy).equals("delivery_money")) {// 配送费最低 ORDER BY delivery_money ASCparams.put("orderBy", "obj.delivery_money");orderType = "ASC";} else if (CommUtil.null2String(orderBy).equals("prepare_time")) {// 配送速度最快 ORDER BY prepare_time ASCparams.put("orderBy", "obj.prepare_time");orderType = "ASC";}if (StringUtils.isNotBlank(search)) {params.put("search_key", search); // 商店名称模糊匹配}if (StringUtils.isNotBlank(free_delivery)) {params.put("free_delivery", free_delivery); // 免费配送}if (StringUtils.isNotBlank(full_reduction)) {params.put("full_reduction", full_reduction); // 满就减}if (StringUtils.isNotBlank(full_send)) {params.put("full_send", full_send); // 满就送}if (StringUtils.isNotBlank(invoice)) {params.put("invoice", invoice); // 发票}if (StringUtils.isNotBlank(mc_id)) {params.put("screen_mc_id", mc_id); // 行业}String city = areaFeignClient.getCoordinate(lat, lng);Map<String, Object> map = Maps.newHashMap();map.put("level", 1);map.put("areaName", city);List<AreaDto> list = areaFeignClient.queryPageList(map);if (list.size() <= 0) {// 如果查询不到,就设定地址为北京map.clear();map.put("level", 1);map.put("areaName", "北京市");list = areaFeignClient.queryPageList(map);}AreaDto area = list.get(0);params.put("area_id", area.getId());params.put("lat", lat);params.put("lng", lng);params.put("orderType", orderType);params.put("group_by", "sa.id");if (StringUtils.isNotEmpty(gb_id)) {params.put("screen_gb_id", gb_id); // 品牌}if (StringUtils.isNotEmpty(newShop)) {params.put("screen_newShop", newShop); // 新店}Page<Store> pList = this.storeService.goShoppingPage(params);List<Long> ids = new ArrayList<Long>();for (Store store : pList.getResult()) {ids.add(store.getId());}List<GoodsDto> goodsList = goodsFeignClient.getRecommendGoods(ids);Map<Long, List<GoodsDto>> goodsResult = new HashMap<Long, List<GoodsDto>>();for (Long id : ids) {List<GoodsDto> goodsMap = new ArrayList<GoodsDto>();for (GoodsDto goodsDto : goodsList) {if (id.longValue() == goodsDto.getGoods_store_id().longValue()) {goodsMap.add(goodsDto);}}goodsResult.put(id, goodsMap);}for (Store store : pList.getResult()) {store.setRecommendList(goodsResult.get(store.getId()));}result.put("pList", pList);result.put("currentPage", currentPage);result.put("search", search);result.put("orderBy", orderBy);result.put("orderType", orderType);result.put("lat", lat);result.put("lng", lng);result.put("gb_id", gb_id);result.put("newShop", newShop);result.put("free_delivery", free_delivery); // 免费配送result.put("full_reduction", full_reduction); // 满就减result.put("full_send", full_send); // 满就送result.put("invoice", invoice); // 发票return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}// 外卖店铺@RequestMapping(value = "/takeaway_shop_count", method = RequestMethod.POST)public Map<String, Object> takeaway_shop_count(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {String search = json.optString("search");String lat = json.optString("lat");String lng = json.optString("lng");String gb_id = json.optString("gb_id");String newShop = json.optString("newShop");String free_delivery = json.optString("free_delivery"); // 免费配送String full_reduction = json.optString("full_reduction"); // 满就减String full_send = json.optString("full_send"); // 满就送String invoice = json.optString("invoice"); // 发票if (StringUtils.isBlank(lat) || StringUtils.isBlank(lng)) {return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);}Map<String, Object> result = new HashMap<String, Object>();Map<String, Object> params = Maps.newHashMap();params.put("takeaway", "yes");if (StringUtils.isNotBlank(search)) {params.put("search_key", search); // 商店名称模糊匹配}if (StringUtils.isNotBlank(free_delivery)) {params.put("free_delivery", free_delivery); // 免费配送}if (StringUtils.isNotBlank(full_reduction)) {params.put("full_reduction", full_reduction); // 满就减}if (StringUtils.isNotBlank(full_send)) {params.put("full_send", full_send); // 满就送}if (StringUtils.isNotBlank(invoice)) {params.put("invoice", invoice); // 发票}String city = areaFeignClient.getCoordinate(lat, lng);Map<String, Object> map = Maps.newHashMap();map.put("level", 1);map.put("areaName", city);List<AreaDto> list = areaFeignClient.queryPageList(map);if (list.size() <= 0) {// 如果查询不到,就设定地址为北京map.clear();map.put("level", 1);map.put("areaName", "北京市");list = areaFeignClient.queryPageList(map);}AreaDto area = list.get(0);params.put("area_id", area.getId());params.put("lat", lat);params.put("lng", lng);if (StringUtils.isNotEmpty(gb_id)) {params.put("screen_gb_id", gb_id); // 品牌}if (StringUtils.isNotEmpty(newShop)) {params.put("screen_newShop", newShop); // 新店}int count = this.storeService.goShoppingCount(params);result.put("count", count);result.put("search", search);result.put("lat", lat);result.put("lng", lng);result.put("gb_id", gb_id);result.put("newShop", newShop);result.put("free_delivery", free_delivery); // 免费配送result.put("full_reduction", full_reduction); // 满就减result.put("full_send", full_send); // 满就送result.put("invoice", invoice); // 发票return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);}/*** 用户申请开店* * @param request* @param response* @return*/@RequestMapping({ "/buyer/user_store_check" })public Map<String, Object> user_store_check(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {Map<String, Object> result = Maps.newHashMap();Map<String, Object> params = Maps.newHashMap();UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));Store store = null;if (user != null) {params.clear();params.put("user_id", user.getId());store = this.storeService.queryByProperty(params);}result.put("user", user);result.put("store", store);ModularClassDto modularClassDto = null;if (store != null) {modularClassDto = modularClassFeignClient.selectByStoreId(store.getId());}result.put("modularclass", modularClassDto);return ResponseCode.buildSuccessMap(result);}/*** 修改银行卡信息* * @param request* @param response* @return*/@RequestMapping({ "/buyer/storeModifyComExamine" })public Map<String, Object> storeModifyComExamine(HttpServletRequest request, HttpServletResponse response,@RequestBody ComExamine comExamine) {Map<String, Object> result = Maps.newHashMap();UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));Store store = null;if (user != null && user.getStore_id() != null) {store = storeService.selectByPrimaryKey(user.getStore_id());}if (store == null) {return ResponseCode.buildFailMap("用户信息有误", null);}comExamine.setAddTime(new Date());comExamine.setDeleteStatus(0);comExamine.setStore_id(store.getId());comExamine.setUser_id(user.getId());comExamine.setStatus(0);if (comExamine.getId() != null) {comExamineService.updateById(comExamine);} else {comExamineService.saveEntity(comExamine);}return ResponseCode.buildSuccessMap(result);}/*** 修改银行卡信息* * @param request* @param response* @return*/@RequestMapping({ "/coupon_itme" })public Map<String, Object> coupon_itme(HttpServletRequest request, HttpServletResponse response,@RequestBody JSONObject json) {Map<String, Object> result = Maps.newHashMap();Store store = null;String id = json.optString("id");String coupon_id = json.optString("coupon_id");store = storeService.selectByPrimaryKey(CommUtil.null2Long(id));if (store == null) {return ResponseCode.buildFailMap("信息有误", null);}result.put("coupon_id", CommUtil.null2Long(coupon_id));result.put("free_status", 1);result.put("user_id", SecurityUserHolder.getCurrentUserId(request));List<CouponInfoDto> queryPageList = couponInfoFeignClient.queryPageList(result);if (queryPageList == null||queryPageList.size()<1) {return ResponseCode.buildFailMap("信息有误", null);}if (store.getArea_id() != null) {AreaDto areaDto = areaFeignClient.selectByPrimaryKeyFullParent(store.getArea_id());if (areaDto != null) {String store_address = store.getStore_address();store.setStore_address(areaDto.getParent().getParent().getAreaName() + areaDto.getParent().getAreaName()+ areaDto.getAreaName() + store_address);}}CouponDto couponDto = couponFeignClient.selectByPrimaryKey(CommUtil.null2Long(coupon_id));result.clear();result.put("couponDto", couponDto);result.put("couponinfodto", queryPageList.get(0));result.put("store", store);return ResponseCode.buildSuccessMap(result);}}
 源码地址来源: https://minglisoft.cn/honghu2/business.html

java版Spring Cloud+Spring Boot+mybatis+MQ前后端分离 分布式微服务架构相关推荐

  1. Java版知识付费源码 Spring Cloud+Spring Boot+Mybatis+uniapp+前后端分离实现知识付费平台

    提供职业教育.企业培训.知识付费系统搭建服务.系统功能包含:录播课.直播课.题库.营销.公司组织架构.员工入职培训等. 提供私有化部署,免费售后,专业技术指导,支持PC.APP.H5.小程序多终端同步 ...

  2. java版微信小程序多商家入驻前后端分离商城源码 Spring Cloud+Spring Boot+mybatis+security+uniapp+Redis+MQ+VR全景+b2b2c

    @源码地址来源: https://minglisoft.cn/honghu2/business.html 微信小程序登录代码: /*** Copyright © 2012-2017 <a hre ...

  3. spring boot 与 iview 前后端分离架构之开发环境基于docker的部署的实现(三十六)

    spring boot 与 iview 前后端分离架构之开发环境基于docker的后端的部署的实现(三十六) 公众号 基于docker的后端的部署 安装mysql数据库 创建数据库 安装redis 安 ...

  4. (五)Debian Linux中部署Spring Boot + Vue的前后端分离项目详细过程(arm64/aarch64架构下)

    专题系列往期文章目录 (一)移动端安卓手机改造成linux服务器&Linux中安装软件踩坑历险记 (二)Debian Linux系统中安装oracle JDK1.8详细过程(arm64/aar ...

  5. java前后端分离框架_Spring Boot 入门及前后端分离项目实践

    本课程是一个 Spring Boot 技术栈的实战类课程,课程共分为 3 个部分,前面两个部分为基础环境准备和相关概念介绍,第三个部分是 Spring Boot 项目实践开发.Spring Boot ...

  6. 基于若依开发的 Java EE 分布式微服务架构平台

    Admin Cloud 是一套企业级的多租户权限管理开发平台,基于 Admin Plus.iCRUD 和 若依.提供单体版和微服务版双版本.单体版(基于 Spring Boot) 和 微服务版(基于  ...

  7. 电商技术总结之SpringCloud+SpringBoot+mybatis+uniapp 前后端分离 b2b2c o2o 微服务商城电商之手机端首页模块设计分析

    近期我参与了公司电子商务平台中"首页"模块设计, 电商平台首页功能大概分为几个区域,如下: 一.导航区域: 左上角定位入口 搜索功能入口 消息通知入口 商品分类入口 二.广告区域: ...

  8. Vue+SpringBoot+Mybatis+Mysql前后端分离案例

    Vue+SpringBoot+Mybatis+Mysql前后端分离案例(二) 前端开发 main.js代码如下 import Vue from 'vue' import App from './App ...

  9. 记一次Spring boot 和Vue前后端分离的入门培训

    点击上方 好好学java ,选择 星标 公众号 重磅资讯.干货,第一时间送达今日推荐:2020年7月程序员工资统计,平均14357元,又跌了,扎心个人原创100W+访问量博客:点击前往,查看更多 作者 ...

最新文章

  1. 战地1如何修改服务器地址,《战地1》服务器加入方法一览
  2. Android---Activity 生命周期(三)Stopping Activity Restarting Activity
  3. HDU 6127 Hard challenge(极角 + 二分)
  4. 知识点总结vector创建二维数组
  5. python中接口测试垃圾数据如何清理_巧用PyUnit中unittest特性解决接口测试产生脏数据问题...
  6. gephi导入边数据时,和节点数据不在一个工作区
  7. linux rdma测试,硬件RDMA的驱动配置和测试
  8. 北京地铁规划大全(图),买房子可以参考一下
  9. 虚拟机里linux7关不了,虚拟机上CentOS 7关闭防火墙操作
  10. 智慧城市特效(建筑颜色渐变、飞线、扫光、扫描、光墙、线路、水、道路线条、锥形标、漫游)three+shader
  11. 产品设计的基本原则是什么
  12. 防止mdf文件被非法附加后修改的一个简单实现方案
  13. Oracle字符集设置
  14. 汇编语言程序设计-钱晓捷(第五版)学习笔记目录
  15. php中如何从键盘获取,在javascript中如何获取键盘的keyCode
  16. 抓包工具神器,fiddler全解
  17. java开发小公司跳槽华为od笔试面试过程
  18. 计算机电脑设置音量,电脑声卡设置步骤【图文教程】
  19. Kodi+Alist v3 挂载阿里云盘他人分享链接打造在线影视库
  20. 微信推出史上最简单「拍一拍」新功能,仅需一行代码,好友们都玩疯了!

热门文章

  1. 迅为4412开发板Linux驱动教程之GPIO的初始化
  2. 20-NSString-foundation
  3. cas131274-22-1|三特丁基磷四氟硼酸盐|四氟硼酸三叔丁基膦|分子式:C12H28BF4P
  4. 如何正确运用计算机,如何使用电脑?使用电脑正确方法
  5. iOS中对图片拉伸的四种方式
  6. CakePHP中文教程1
  7. python游戏开发之小乌龟逃离鲨海
  8. 登陆页面实现保存帐号密码功能
  9. 21支团队获公司专利大奖 新技术新专利成亮点
  10. mac appstore磁盘空间不足_最强mac虚拟机Parallels Desktop 16 有哪些重要的新增功能?...