@源码地址来源:http:
package com.honghu.cloud.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
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;
@RequestMapping(value = "/store")
public class StoreController {
private IStoreService storeService;
private IWareHouseService wareHouseService;
private AccessoryFeignClient accessoryFeignClient;
private IStorePointService storePointService;
private AreaFeignClient areaFeignClient;
private IStoreGradeService storeGradeService;
private GoodsClassFeignClient goodsClassFeignClient;
private ModularClassFeignClient modularClassFeignClient;
private IStoreVisitLogService storeVisitLogService;
private StoreTools storeTools;
private PlatformPayFeignClient platformPayFeignClient;
private UserFeignClient userFeignClient;
private MenuFeignClient menuFeignClient;
private FavoriteFeignClient favoriteFeignClient;
private GoodsFeignClient goodsFeignClient;
private QueryTools queryTools;
private FloorFeignClient floorFeignClient;
private UserGoodsClassFeignClient UserGoodsClassFeignClient;
private StoreVisitMqClient storeVisitMqClient;
private OrderFormFeignClient orderFormFeignClient;
private StoreVisitLogFeignClient storeVisitLogFeignClient;
private ShipAddressFeignClient shipAddressFeignClient;
private IOpeningTimeService openingTimeService;
private IconViewFeignClient iconViewFeignClient;
private CouponFeignClient couponFeignClient;
private IComExamineService comExamineService;
private CouponInfoFeignClient couponInfoFeignClient;
private TXTemplateFeignClient tXTemplateFeignClient;
@RequestMapping(value = "/apiForFeign/queryPageList", method = RequestMethod.POST)
public List queryPageList(@RequestBody Map 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 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 && 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()));
@RequestMapping(value = "/apiForFeign/selectStoreAndWare", method = RequestMethod.GET)
public Store selectStoreAndWare(@RequestParam("id") Long id) {
Store store = storeService.selectByPrimaryKey(id);
if (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);
@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);
@RequestMapping(value = "/store", method = RequestMethod.POST)
public Map 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 result = new HashMap();
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));
return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);
UserDto user = userFeignClient.getUserByStoreId(store.getId());
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);
Map params = Maps.newHashMap();
params.put("user_id", SecurityUserHolder.getCurrentUserId(request));
params.put("store_id", CommUtil.null2Long(id));
List list = this.favoriteFeignClient.queryPageList(params);
if (null != list && list.size() > 0) {
result.put("all_col", Integer.valueOf(1));
params.put("edit_mo", "5");
params.put("store_id", id);
List bannerFloor = floorFeignClient.queryPages(params);
if (bannerFloor.size() > 0) {
result.put("bannerFloor", bannerFloor.get(0));
params.put("edit_mo", "1");
List vrFloor = floorFeignClient.queryPages(params);
if (vrFloor != null && vrFloor.size() > 0) {
result.put("vrFloor", vrFloor.get(0));
params.put("edit_mo", "6");
params.put("orderBy", "sequence");
params.put("orderType", "asc");
List customFloor = floorFeignClient.queryPages(params);
result.put("customFloor", customFloor);
if (StringUtils.isBlank(sa_id) || StringUtils.isBlank(sa_name)) {
params.put("store_id", CommUtil.null2Long(id));
List 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 maps = queryTools.getParams(currentPage, 12, "obj.addTime", "desc");
maps.put("goods_store_id", store.getId());
maps.put("goods_status", 0);
maps.put("honghu_goods_name", key);
Map goodsList = goodsFeignClient.list(maps);
result.put("goodsList", goodsList);
result.put("sa_id", sa_id);
result.put("sa_name", sa_name);
ModularClassDto ModularClassDto = modularClassFeignClient.selectByPrimaryKey(store.getMc_id());
result.put("showphone", ModularClassDto.isShow_phone());
maps.put("store_id", store.getId());
maps.put("coupon_end_time_able", "coupon_end_time_able");
List couponlist = couponFeignClient.queryPageList(maps);
result.put("couponlist", couponlist);
String current_ip = CommUtil.getIpAddr(request);
JSONObject jsonMsg = new JSONObject();
jsonMsg.put("source", "1");
jsonMsg.put("store_id", id);
jsonMsg.put("user_id", SecurityUserHolder.getCurrentUserId(request));
jsonMsg.put("access_ip", current_ip);
storeVisitMqClient.sendStoreVisitMsg(jsonMsg);
log.error("记录用户访问店铺数据失败:" + Exceptions.getStackTraceAsString(e));
return ResponseCode.buildSuccessMap(result);
@RequestMapping(value = "/storeAgentGoods", method = RequestMethod.POST)
public Map storeAgentGoods(HttpServletRequest request, HttpServletResponse response,
@RequestBody JSONObject json) {
String id = json.optString("id");
String currentPage = json.optString("currentPage");
String key = json.optString("key");
Map 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 goodsList = goodsFeignClient.list(maps);
return ResponseCode.buildSuccessMap(goodsList);
@RequestMapping(value = "/store_type_list", method = RequestMethod.POST)
public Map store_type_list(HttpServletRequest request, HttpServletResponse response,
@RequestBody JSONObject json) {
String storeId = json.optString("storeId");
Map result = new HashMap();
result.put("storeId", storeId);
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(storeId));
return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);
result.put("store", store);
UserDto user = userFeignClient.getUserByStoreId(store.getId());
result.put("ugcs", null);
return ResponseCode.buildSuccessMap(result);
Map maps = Maps.newHashMap();
maps.put("user_id", user.getId());
maps.put("deleteStatus", 0);
maps.put("parent", "-1");
maps.put("orderBy", "obj.sequence");
maps.put("orderType", "ASC");
List ugcs = this.UserGoodsClassFeignClient.queryPageList(maps);
result.put("ugcs", ugcs);
return ResponseCode.buildSuccessMap(result);
@RequestMapping(value = "/business_card", method = RequestMethod.POST)
public Map business_card(HttpServletRequest request, HttpServletResponse response,
@RequestBody JSONObject json) {
Long storeId = json.optLong("storeId");
Store store = this.storeService.selectByPrimaryKey(storeId);
return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);
Map result = new HashMap();
if(store.getArea_id() != null){
String areainfo = areaFeignClient.genericAreaInfo(store.getArea_id(), "");
store.setStore_address(areainfo+store.getStore_address());
result.put("store", store);
Map params = Maps.newHashMap();
UserDto currentUser = SecurityUserHolder.getCurrentUser(request);
if (currentUser != null) {
params.put("user_id", currentUser.getId());
params.put("store_id", CommUtil.null2Long(storeId));
List list = this.favoriteFeignClient.queryPageList(params);
if (null != list && list.size() > 0) {
result.put("all_col", Integer.valueOf(1));
ModularClassDto ModularClassDto = modularClassFeignClient.selectByPrimaryKey(store.getMc_id());
result.put("showphone", ModularClassDto.isShow_phone());
FloorDto floor = floorFeignClient.selectStoreBanner(storeId);
result.put("floor", floor);
return ResponseCode.buildSuccessMap(result);
@RequestMapping(value = "/store_goods_new", method = RequestMethod.POST)
public Map 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")) {
if (CommUtil.null2String(orderType).equals("asc") || CommUtil.null2String(orderType).equals("ASC")) {
Map 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 goodsList = this.goodsFeignClient.list(maps);
Map result = new HashMap();
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);
@RequestMapping({ "/buyer/user_store_add" })
public Map user_store_add(HttpServletRequest request, HttpServletResponse response,
@RequestBody JSONObject json) {
Map result = Maps.newHashMap();
Map params = Maps.newHashMap();
String type = json.optString("type");
UserDto user = SecurityUserHolder.getCurrentUser(request);
params.put("user_id", user.getId());
store = this.storeService.queryByProperty(params);
List grades = this.storeGradeService.queryPageList(params);
result.put("storeGrades", grades);
result.put("user", user);
params.put("parent", -1);
List gcs = this.goodsClassFeignClient.queryPageList(params);
result.put("goodsClass", gcs);
if (StringUtils.isNotEmpty(type)) {
store.setStore_status(0);
storeService.updateById(store);
result.put("store", store);
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");
List modularclass = modularClassFeignClient.queryPageList(params);
result.put("modularclass", modularclass);
result.put("usecard", false);
return ResponseCode.buildSuccessMap(result);
@RequestMapping({ "/store_save" })
public Map 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");
String storeGrades = json.optString("storeGrades");
String gc_main_id = json.optString("gc_main_id");
String gc_id = json.optString("gc_id");
String store_type = json.optString("store_type");
String area_id = json.optString("area_id");
String 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 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");
String 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));
if (user.getStore_id() != null) {
store = this.storeService.selectByPrimaryKey(user.getStore_id());
store.setStore_status(5);
if ((null != user) && (null != user.getId())) {
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 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]));
List 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());
for (int a = 0; a < str.length; a++) {
GoodsClassDto gc = this.goodsClassFeignClient.selectByPrimaryKey(CommUtil.null2Long(str[a]));
Set detail_info = this.storeTools.query_store_DetailGc(store.getGc_detail_info());
if (((Set) detail_info).size() == 0) {
for (GoodsClassDto gc2 : detail_info) {
if (gc.getId().equals(gc2.getId())) {
if (m == ((Set) detail_info).size()) {
if (gc.getParent_id() != null) {
parent = goodsClassFeignClient.selectByPrimaryKey(gc.getParent_id());
map.put("m_id", parent.getId());
map.put("gc_list", gc_list);
store.setGc_detail_info(JSON.toJSONString(list));
Map params = Maps.newHashMap();
params.put("parent", -1);
params.put("type", "SELLER");
List menus = this.menuFeignClient.list(params);
List ms = Lists.newArrayList();
for (MenuDto menu : menus) {
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);
params.put("kind", "店铺");
params.put("nickname", user.getNickName());
tXTemplateFeignClient.auditNsgNote(params);
log.error("StoreController >> store_save >> auditNsgNote " + e.getMessage());
this.storeService.updateById(store);
if (store.getPoint() == null) {
StorePoint sp = new StorePoint();
sp.setAddTime(new Date());
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);
@RequestMapping(value = "/my_store", method = RequestMethod.POST)
public Map my_store(HttpServletRequest request, HttpServletResponse response) {
Map resultMap = new HashMap();
UserDto user = SecurityUserHolder.getCurrentUser(request);
return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);
user = userFeignClient.selectByPrimaryKey(user.getId());
Store store = storeService.selectByPrimaryKey(user.getStore_id());
return ResponseCode.buildCodeMap("20002", "无法找到该店铺", null);
resultMap.put("store", store);
return ResponseCode.buildSuccessMap(resultMap);
@RequestMapping(value = "/save_my_store", method = RequestMethod.POST)
public Map 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);
return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);
Store store = storeService.selectByPrimaryKey(user.getId());
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);
@RequestMapping(value = "/go_shopping", method = RequestMethod.POST)
public Map 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 result = new HashMap();
Map params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);
params.put("notakeaway", "yes");
if (CommUtil.null2String(orderType).equals("")) {
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 map = Maps.newHashMap();
if (StringUtils.isNotBlank(search)) {
params.put("search_key", search);
String city = areaFeignClient.getCoordinate(lat, lng);
map.put("areaName", city);
List
list = areaFeignClient.queryPageList(map); map.put("areaName", "深圳市");
list = areaFeignClient.queryPageList(map);
AreaDto area = list.get(0);
params.put("area_id", area.getId());
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 pList = this.storeService.goShoppingPage(params);
if (pList.getRowCount() <= 10) {
map.put("areaName", "深圳市");
List
list = areaFeignClient.queryPageList(map); AreaDto area = list.get(0);
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("orderType", orderType);
params.put("group_by", "sa.id");
params.put("area_id", area.getId());
recomList = this.storeService.goShoppingPage(params);
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("gb_id", gb_id);
result.put("mc_id", mc_id);
result.put("newShop", newShop);
@RequestMapping(value = "/allModularClass", method = RequestMethod.GET)
public Map allModularClass() {
Map params = Maps.newHashMap();
List mcList = modularClassFeignClient.queryPageList(params);
return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, mcList);
@RequestMapping(value = "/home", method = RequestMethod.GET)
public Map 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());
Map orderStatis = orderFormFeignClient.orderStoreStatis(user.getStore_id());
Map goodsStatis = goodsFeignClient.goodsStoreStatis(user.getStore_id());
orderStatis.putAll(goodsStatis);
Map visitStatis = storeVisitLogService.visitStoreStatis(user.getStore_id());
orderStatis.putAll(visitStatis);
return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, orderStatis);
@RequestMapping(value = "/takeaway_shop", method = RequestMethod.POST)
public Map 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 result = new HashMap();
List hlbList = iconViewFeignClient.selectByHmId(6L);
result.put("hlbList", hlbList);
Map params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);
params.put("takeaway", "yes");
if (CommUtil.null2String(orderType).equals("")) {
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");
} else if (CommUtil.null2String(orderBy).equals("store_salenum")) {
params.put("orderBy", "store_salenum");
} else if (CommUtil.null2String(orderBy).equals("send_money")) {
params.put("orderBy", "obj.send_money");
} else if (CommUtil.null2String(orderBy).equals("delivery_money")) {
params.put("orderBy", "obj.delivery_money");
} else if (CommUtil.null2String(orderBy).equals("prepare_time")) {
params.put("orderBy", "obj.prepare_time");
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 map = Maps.newHashMap();
map.put("areaName", city);
List
list = areaFeignClient.queryPageList(map); map.put("areaName", "北京市");
list = areaFeignClient.queryPageList(map);
AreaDto area = list.get(0);
params.put("area_id", area.getId());
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 pList = this.storeService.goShoppingPage(params);
List ids = new ArrayList();
for (Store store : pList.getResult()) {
List goodsList = goodsFeignClient.getRecommendGoods(ids);
Map> goodsResult = new HashMap>();
List goodsMap = new ArrayList();
for (GoodsDto goodsDto : goodsList) {
if (id.longValue() == goodsDto.getGoods_store_id().longValue()) {
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("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 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 result = new HashMap();
Map 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 map = Maps.newHashMap();
map.put("areaName", city);
List
list = areaFeignClient.queryPageList(map); map.put("areaName", "北京市");
list = areaFeignClient.queryPageList(map);
AreaDto area = list.get(0);
params.put("area_id", area.getId());
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("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({ "/buyer/user_store_check" })
public Map user_store_check(HttpServletRequest request, HttpServletResponse response,
@RequestBody JSONObject json) {
Map result = Maps.newHashMap();
Map params = Maps.newHashMap();
UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));
params.put("user_id", user.getId());
store = this.storeService.queryByProperty(params);
result.put("user", user);
result.put("store", store);
ModularClassDto modularClassDto = null;
modularClassDto = modularClassFeignClient.selectByStoreId(store.getId());
result.put("modularclass", modularClassDto);
return ResponseCode.buildSuccessMap(result);
@RequestMapping({ "/buyer/storeModifyComExamine" })
public Map storeModifyComExamine(HttpServletRequest request, HttpServletResponse response,
@RequestBody ComExamine comExamine) {
Map result = Maps.newHashMap();
UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));
if (user != null && user.getStore_id() != null) {
store = storeService.selectByPrimaryKey(user.getStore_id());
return ResponseCode.buildFailMap("用户信息有误", null);
comExamine.setAddTime(new Date());
comExamine.setDeleteStatus(0);
comExamine.setStore_id(store.getId());
comExamine.setUser_id(user.getId());
if (comExamine.getId() != null) {
comExamineService.updateById(comExamine);
comExamineService.saveEntity(comExamine);
return ResponseCode.buildSuccessMap(result);
@RequestMapping({ "/coupon_itme" })
public Map coupon_itme(HttpServletRequest request, HttpServletResponse response,
@RequestBody JSONObject json) {
Map result = Maps.newHashMap();
String id = json.optString("id");
String coupon_id = json.optString("coupon_id");
store = storeService.selectByPrimaryKey(CommUtil.null2Long(id));
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 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());
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.put("couponDto", couponDto);
result.put("couponinfodto", queryPageList.get(0));
result.put("store", store);
return ResponseCode.buildSuccessMap(result);

@源码地址来源:http: