• java版工程管理系统Spring Cloud+Spring Boot+Mybatis实现工程管理系统源码


    @源码地址来源:http://minglisoft.cn/hhcloud
    

    1. @源码地址来源:http://minglisoft.cn/hhcloud
    2. @获取源码+wx: haiwabbc2
    3. /**
    4. * Copyright © 2012-2017 HongHu All rights reserved.
    5. */
    6. package com.honghu.cloud.controller;
    7. import java.math.BigDecimal;
    8. import java.util.ArrayList;
    9. import java.util.Date;
    10. import java.util.HashMap;
    11. import java.util.List;
    12. import java.util.Map;
    13. import java.util.Set;
    14. import javax.servlet.http.HttpServletRequest;
    15. import javax.servlet.http.HttpServletResponse;
    16. import org.apache.commons.lang.StringUtils;
    17. import org.springframework.beans.BeanUtils;
    18. import org.springframework.beans.factory.annotation.Autowired;
    19. import org.springframework.web.bind.annotation.RequestBody;
    20. import org.springframework.web.bind.annotation.RequestMapping;
    21. import org.springframework.web.bind.annotation.RequestMethod;
    22. import org.springframework.web.bind.annotation.RequestParam;
    23. import org.springframework.web.bind.annotation.RestController;
    24. import com.alibaba.fastjson.JSON;
    25. import com.google.common.collect.Lists;
    26. import com.google.common.collect.Maps;
    27. import com.honghu.cloud.bean.ComExamine;
    28. import com.honghu.cloud.bean.Store;
    29. import com.honghu.cloud.bean.StoreGrade;
    30. import com.honghu.cloud.bean.StorePoint;
    31. import com.honghu.cloud.bean.WareHouse;
    32. import com.honghu.cloud.code.ResponseCode;
    33. import com.honghu.cloud.common.page.Page;
    34. import com.honghu.cloud.configure.StoreVisitMqClient;
    35. import com.honghu.cloud.dto.AreaDto;
    36. import com.honghu.cloud.dto.CouponDto;
    37. import com.honghu.cloud.dto.CouponInfoDto;
    38. import com.honghu.cloud.dto.FavoriteDto;
    39. import com.honghu.cloud.dto.FloorDto;
    40. import com.honghu.cloud.dto.GoodsCartDto;
    41. import com.honghu.cloud.dto.GoodsClassDto;
    42. import com.honghu.cloud.dto.GoodsDto;
    43. import com.honghu.cloud.dto.H5LevelBannerDto;
    44. import com.honghu.cloud.dto.MenuDto;
    45. import com.honghu.cloud.dto.ModularClassDto;
    46. import com.honghu.cloud.dto.PlatformPayDto;
    47. import com.honghu.cloud.dto.ShipAddressDto;
    48. import com.honghu.cloud.dto.UserDto;
    49. import com.honghu.cloud.dto.UserGoodsClassDto;
    50. import com.honghu.cloud.dto.WareHouseDto;
    51. import com.honghu.cloud.feign.AccessoryFeignClient;
    52. import com.honghu.cloud.feign.AreaFeignClient;
    53. import com.honghu.cloud.feign.CouponFeignClient;
    54. import com.honghu.cloud.feign.CouponInfoFeignClient;
    55. import com.honghu.cloud.feign.FavoriteFeignClient;
    56. import com.honghu.cloud.feign.FloorFeignClient;
    57. import com.honghu.cloud.feign.GoodsClassFeignClient;
    58. import com.honghu.cloud.feign.GoodsFeignClient;
    59. import com.honghu.cloud.feign.IconViewFeignClient;
    60. import com.honghu.cloud.feign.MenuFeignClient;
    61. import com.honghu.cloud.feign.ModularClassFeignClient;
    62. import com.honghu.cloud.feign.OrderFormFeignClient;
    63. import com.honghu.cloud.feign.PlatformPayFeignClient;
    64. import com.honghu.cloud.feign.ShipAddressFeignClient;
    65. import com.honghu.cloud.feign.StoreVisitLogFeignClient;
    66. import com.honghu.cloud.feign.TXTemplateFeignClient;
    67. import com.honghu.cloud.feign.UserFeignClient;
    68. import com.honghu.cloud.feign.UserGoodsClassFeignClient;
    69. import com.honghu.cloud.service.IComExamineService;
    70. import com.honghu.cloud.service.IOpeningTimeService;
    71. import com.honghu.cloud.service.IStoreGradeService;
    72. import com.honghu.cloud.service.IStorePointService;
    73. import com.honghu.cloud.service.IStoreService;
    74. import com.honghu.cloud.service.IStoreVisitLogService;
    75. import com.honghu.cloud.service.IWareHouseService;
    76. import com.honghu.cloud.service.impl.StoreVisitLogServiceImpl;
    77. import com.honghu.cloud.tools.QueryTools;
    78. import com.honghu.cloud.tools.SecurityUserHolder;
    79. import com.honghu.cloud.tools.StoreTools;
    80. import com.honghu.cloud.utils.CommUtil;
    81. import com.honghu.cloud.utils.Exceptions;
    82. import lombok.extern.slf4j.Slf4j;
    83. import net.sf.json.JSONObject;
    84. /**
    85. * 店铺Controller
    86. *
    87. * @author Administrator
    88. * @param
    89. *
    90. */
    91. @Slf4j
    92. @RestController
    93. @RequestMapping(value = "/store")
    94. public class StoreController {
    95. @Autowired
    96. private IStoreService storeService;
    97. @Autowired
    98. private IWareHouseService wareHouseService;
    99. @Autowired
    100. private AccessoryFeignClient accessoryFeignClient;
    101. @Autowired
    102. private IStorePointService storePointService;
    103. @Autowired
    104. private AreaFeignClient areaFeignClient;
    105. @Autowired
    106. private IStoreGradeService storeGradeService;
    107. @Autowired
    108. private GoodsClassFeignClient goodsClassFeignClient;
    109. @Autowired
    110. private ModularClassFeignClient modularClassFeignClient;
    111. @Autowired
    112. private IStoreVisitLogService storeVisitLogService;
    113. @Autowired
    114. private StoreTools storeTools;
    115. @Autowired
    116. private PlatformPayFeignClient platformPayFeignClient;
    117. @Autowired
    118. private UserFeignClient userFeignClient;
    119. @Autowired
    120. private MenuFeignClient menuFeignClient;
    121. @Autowired
    122. private FavoriteFeignClient favoriteFeignClient;
    123. @Autowired
    124. private GoodsFeignClient goodsFeignClient;
    125. @Autowired
    126. private QueryTools queryTools;
    127. @Autowired
    128. private FloorFeignClient floorFeignClient;
    129. @Autowired
    130. private UserGoodsClassFeignClient UserGoodsClassFeignClient;
    131. @Autowired
    132. private StoreVisitMqClient storeVisitMqClient;
    133. @Autowired
    134. private OrderFormFeignClient orderFormFeignClient;
    135. @Autowired
    136. private StoreVisitLogFeignClient storeVisitLogFeignClient;
    137. @Autowired
    138. private ShipAddressFeignClient shipAddressFeignClient;
    139. @Autowired
    140. private IOpeningTimeService openingTimeService;
    141. @Autowired
    142. private IconViewFeignClient iconViewFeignClient;
    143. @Autowired
    144. private CouponFeignClient couponFeignClient;
    145. @Autowired
    146. private IComExamineService comExamineService;
    147. @Autowired
    148. private CouponInfoFeignClient couponInfoFeignClient;
    149. @Autowired
    150. private TXTemplateFeignClient tXTemplateFeignClient;
    151. /**
    152. * 查询店铺
    153. *
    154. * @param congelationDto
    155. * @return
    156. */
    157. @RequestMapping(value = "/apiForFeign/queryPageList", method = RequestMethod.POST)
    158. public List queryPageList(@RequestBody Map params, @RequestParam("begin") Integer begin,
    159. @RequestParam("max") Integer max) {
    160. return storeService.queryPageList(params, begin, max);
    161. }
    162. @RequestMapping(value = "/apiForFeign/selectCount", method = RequestMethod.POST)
    163. public int selectCount(@RequestBody Map params) {
    164. return storeService.selectCount(params);
    165. }
    166. @RequestMapping(value = "/apiForFeign/selectByPrimaryKey", method = RequestMethod.GET)
    167. public Store selectByPrimaryKey(@RequestParam("id") Long id) {
    168. Store store = storeService.selectByPrimaryKey(id);
    169. if (store==null) {
    170. return null;
    171. }
    172. // 店铺logo
    173. if (store != null && store.getStore_logo_id() != null) {
    174. store.setStore_logo(accessoryFeignClient.selectByPrimaryKey(store.getStore_logo_id()));
    175. }
    176. // 查询店铺评分统计
    177. store.setPoint(storePointService.getStoreByStoreId(id));
    178. // 公司所在地完整的父级地址信息
    179. if (store.getLicense_c_area_id() != null) {
    180. store.setLicense_c_area(areaFeignClient.selectByPrimaryKey(store.getLicense_c_area_id()));
    181. }
    182. return store;
    183. }
    184. @RequestMapping(value = "/apiForFeign/selectStoreAndWare", method = RequestMethod.GET)
    185. public Store selectStoreAndWare(@RequestParam("id") Long id) {
    186. Store store = storeService.selectByPrimaryKey(id);
    187. if (store==null) {
    188. return null;
    189. }
    190. // 店铺logo
    191. if (store != null && store.getStore_logo_id() != null) {
    192. store.setStore_logo(accessoryFeignClient.selectByPrimaryKey(store.getStore_logo_id()));
    193. }
    194. // 查询店铺评分统计
    195. store.setPoint(storePointService.getStoreByStoreId(id));
    196. // 公司所在地完整的父级地址信息
    197. if (store.getLicense_c_area_id() != null) {
    198. store.setLicense_c_area(areaFeignClient.selectByPrimaryKey(store.getLicense_c_area_id()));
    199. }
    200. if (store.getLicense_c_area_id() != null) {
    201. store.setLicense_c_area(areaFeignClient.selectByPrimaryKey(store.getLicense_c_area_id()));
    202. }
    203. if (store.getWarehouse_id() != null) {
    204. WareHouse wareHouse = wareHouseService.selectByPrimaryKey(store.getWarehouse_id());
    205. WareHouseDto wareHouseDto = new WareHouseDto();
    206. BeanUtils.copyProperties(wareHouse, wareHouseDto);
    207. store.setWarehouse(wareHouseDto);
    208. }
    209. return store;
    210. }
    211. @RequestMapping(value = "/apiForFeign/updateById", method = RequestMethod.POST)
    212. public void updateById(@RequestBody Store obj) {
    213. storeService.updateById(obj);
    214. }
    215. // 查询外卖店铺是否在营业中
    216. @RequestMapping(value = "/apiForFeign/openingDoor", method = RequestMethod.GET)
    217. public boolean openingDoor(@RequestParam("id") Long id) {
    218. return openingTimeService.openingDoor(id);
    219. }
    220. /**
    221. * 手机店铺
    222. *
    223. * @param request
    224. * @param response
    225. * @param id
    226. * @return
    227. */
    228. @RequestMapping(value = "/store", method = RequestMethod.POST)
    229. public Map store(HttpServletRequest request, HttpServletResponse response,
    230. @RequestBody JSONObject json) {
    231. String id = json.optString("id");
    232. String currentPage = json.optString("currentPage");
    233. String key = json.optString("key");
    234. String sa_id = json.optString("sa_id");
    235. String sa_name = json.optString("sa_name");
    236. Map result = new HashMap();
    237. Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));
    238. if (store == null) {
    239. return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);
    240. }
    241. // 查询开店的人
    242. UserDto user = userFeignClient.getUserByStoreId(store.getId());
    243. store.setUser(user);
    244. result.put("store", store);
    245. if ((CommUtil.null2Int(store.getStore_status()) == 25) || (CommUtil.null2Int(store.getStore_status()) == 26)) {
    246. return ResponseCode.buildCodeMap("20002", "店铺因为合同到期现已关闭,如有疑问请联系商城客服", null);
    247. } else if (store.getStore_status() < 15) {
    248. return ResponseCode.buildCodeMap("20003", "店铺未正常营业", null);
    249. } else if (store.getStore_status() == 20) {
    250. return ResponseCode.buildCodeMap("20004", "店铺因为违反商城相关规定现已关闭,如有疑问请联系商城客服", null);
    251. }
    252. // 查询是否收藏店铺 if (SecurityUserHolder.getCurrentUser(request) != null) {
    253. Map params = Maps.newHashMap();
    254. params.put("user_id", SecurityUserHolder.getCurrentUserId(request));
    255. params.put("store_id", CommUtil.null2Long(id));
    256. List list = this.favoriteFeignClient.queryPageList(params);
    257. if (null != list && list.size() > 0) {
    258. result.put("all_col", Integer.valueOf(1));
    259. }
    260. // banner
    261. params.clear();
    262. params.put("edit_mo", "5");
    263. params.put("store_id", id);
    264. List bannerFloor = floorFeignClient.queryPages(params);
    265. if (bannerFloor.size() > 0) {
    266. result.put("bannerFloor", bannerFloor.get(0));
    267. }
    268. // VR
    269. params.put("edit_mo", "1");
    270. List vrFloor = floorFeignClient.queryPages(params);
    271. if (vrFloor != null && vrFloor.size() > 0) {
    272. result.put("vrFloor", vrFloor.get(0));
    273. }
    274. // custom
    275. params.put("edit_mo", "6");
    276. params.put("orderBy", "sequence");
    277. params.put("orderType", "asc");
    278. List customFloor = floorFeignClient.queryPages(params);
    279. result.put("customFloor", customFloor);
    280. // 店铺发货地址
    281. if (StringUtils.isBlank(sa_id) || StringUtils.isBlank(sa_name)) {
    282. params.clear();
    283. params.put("store_id", CommUtil.null2Long(id));
    284. List saList = shipAddressFeignClient.queryPages(params);
    285. if (saList != null && saList.size() > 0) {
    286. sa_id = saList.get(0).getId().toString();
    287. sa_name = saList.get(0).getSa_name();
    288. }
    289. }
    290. // 店铺的商品
    291. Map maps = queryTools.getParams(currentPage, 12, "obj.addTime", "desc");
    292. maps.put("goods_store_id", store.getId()); // 店铺ID
    293. maps.put("goods_status", 0); // 商品审核状态
    294. maps.put("honghu_goods_name", key);
    295. Map goodsList = goodsFeignClient.list(maps);
    296. result.put("goodsList", goodsList);
    297. result.put("key", key);
    298. result.put("id", id);
    299. result.put("sa_id", sa_id);
    300. result.put("sa_name", sa_name);
    301. // result.put("share_user_id", share_user_id);
    302. // 查询店铺是否显示手机号
    303. ModularClassDto ModularClassDto = modularClassFeignClient.selectByPrimaryKey(store.getMc_id());
    304. result.put("showphone", ModularClassDto.isShow_phone());
    305. maps.clear();
    306. maps.put("store_id", store.getId());
    307. maps.put("coupon_end_time_able", "coupon_end_time_able");
    308. List couponlist = couponFeignClient.queryPageList(maps);
    309. result.put("couponlist", couponlist);
    310. try {
    311. String current_ip = CommUtil.getIpAddr(request);
    312. JSONObject jsonMsg = new JSONObject();
    313. jsonMsg.put("source", "1"); // 来源(1.小程序,2.app)
    314. jsonMsg.put("store_id", id);
    315. jsonMsg.put("user_id", SecurityUserHolder.getCurrentUserId(request));
    316. jsonMsg.put("access_ip", current_ip);
    317. storeVisitMqClient.sendStoreVisitMsg(jsonMsg);
    318. } catch (Exception e) {
    319. log.error("记录用户访问店铺数据失败:" + Exceptions.getStackTraceAsString(e));
    320. ;
    321. }
    322. return ResponseCode.buildSuccessMap(result);
    323. }
    324. @RequestMapping(value = "/storeAgentGoods", method = RequestMethod.POST)
    325. public Map storeAgentGoods(HttpServletRequest request, HttpServletResponse response,
    326. @RequestBody JSONObject json) {
    327. String id = json.optString("id");
    328. String currentPage = json.optString("currentPage");
    329. String key = json.optString("key");
    330. Map maps = queryTools.getParams(currentPage, 12, "obj.addTime", "desc");
    331. maps.put("agent_sid", Long.parseLong(id));
    332. maps.put("goods_status", 0); // 商品审核状态
    333. if(StringUtils.isNotBlank(key)){
    334. maps.put("honghu_goods_name", key);
    335. }
    336. maps.put("no_goods_store_id", Long.parseLong(id));
    337. Map goodsList = goodsFeignClient.list(maps);
    338. return ResponseCode.buildSuccessMap(goodsList);
    339. }
    340. /**
    341. * 商品分类-ajax
    342. *
    343. * @param request
    344. * @param response
    345. * @param ugc_id
    346. * 商品类别
    347. * @param store_id
    348. * 商店编号
    349. * @param orderBy
    350. * 分组类型
    351. * @param orderType
    352. * 排序方式
    353. * @param currentPage
    354. * @param all
    355. * @param ty
    356. * 底部图标首页访问路径的判断标识
    357. * @return
    358. */
    359. @RequestMapping(value = "/store_type_list", method = RequestMethod.POST)
    360. public Map store_type_list(HttpServletRequest request, HttpServletResponse response,
    361. @RequestBody JSONObject json) {
    362. String storeId = json.optString("storeId");
    363. Map result = new HashMap();
    364. result.put("storeId", storeId);
    365. Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(storeId)); // 根据店铺ID查询店铺信息
    366. if (store == null) {
    367. return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);
    368. }
    369. // 店铺信息
    370. result.put("store", store);
    371. UserDto user = userFeignClient.getUserByStoreId(store.getId());
    372. if (user == null) {
    373. result.put("ugcs", null);// 商品分类集合
    374. return ResponseCode.buildSuccessMap(result);
    375. // return ResponseCode.buildCodeMap("20005", "开店用户信息异常!", null);
    376. }
    377. // 商品分类集合
    378. Map maps = Maps.newHashMap();
    379. maps.put("user_id", user.getId());
    380. maps.put("deleteStatus", 0);
    381. maps.put("parent", "-1");
    382. maps.put("dispaly", 1);
    383. maps.put("orderBy", "obj.sequence");
    384. maps.put("orderType", "ASC");
    385. List ugcs = this.UserGoodsClassFeignClient.queryPageList(maps); // 商品分类集合
    386. result.put("ugcs", ugcs);// 商品分类集合
    387. // 店铺分类信息
    388. return ResponseCode.buildSuccessMap(result);
    389. }
    390. /**
    391. * 名片
    392. * @param request
    393. * @param response
    394. * @param store_id
    395. * 店铺编号
    396. * @param ty 底部图标首页访问路径的判断标识
    397. * @return
    398. * @throws Exception
    399. */
    400. @RequestMapping(value = "/business_card", method = RequestMethod.POST)
    401. public Map business_card(HttpServletRequest request, HttpServletResponse response,
    402. @RequestBody JSONObject json) {
    403. Long storeId = json.optLong("storeId");
    404. Store store = this.storeService.selectByPrimaryKey(storeId); // 查询商店信息
    405. if (store == null) {
    406. return ResponseCode.buildCodeMap("20001", "不存在该店铺信息!", null);
    407. }
    408. Map result = new HashMap();
    409. if(store.getArea_id() != null){
    410. String areainfo = areaFeignClient.genericAreaInfo(store.getArea_id(), "");
    411. store.setStore_address(areainfo+store.getStore_address());
    412. }
    413. result.put("store", store);
    414. Map params = Maps.newHashMap();
    415. // 查询是否用户是否收藏
    416. UserDto currentUser = SecurityUserHolder.getCurrentUser(request);
    417. if (currentUser != null) {
    418. params.clear();
    419. params.put("user_id", currentUser.getId());
    420. params.put("store_id", CommUtil.null2Long(storeId));
    421. List list = this.favoriteFeignClient.queryPageList(params);
    422. if (null != list && list.size() > 0) {
    423. result.put("all_col", Integer.valueOf(1));
    424. }
    425. //result.put("user", currentUser);
    426. }// 查询店铺是否显示手机号
    427. ModularClassDto ModularClassDto = modularClassFeignClient.selectByPrimaryKey(store.getMc_id());
    428. result.put("showphone", ModularClassDto.isShow_phone());
    429. //用户的banner
    430. FloorDto floor = floorFeignClient.selectStoreBanner(storeId);
    431. result.put("floor", floor);
    432. return ResponseCode.buildSuccessMap(result);
    433. }
    434. /**
    435. * 手机店铺中商品(全部宝贝)
    436. *
    437. * @param request
    438. * @param response
    439. * @param id
    440. * @return
    441. */
    442. @RequestMapping(value = "/store_goods_new", method = RequestMethod.POST)
    443. public Map store_goods_new(HttpServletRequest request, HttpServletResponse response,
    444. @RequestBody JSONObject json) {
    445. String orderBy = json.optString("orderBy");
    446. String orderType = json.optString("orderType");
    447. String keyword = json.optString("keyword");
    448. String storeId = json.optString("storeId");
    449. String currentPage = json.optString("currentPage");
    450. String ugc_id = json.optString("ugc_id");
    451. if ((orderBy == null) || ("".equals(orderBy))) {
    452. orderBy = "goods_salenum";
    453. } else if (CommUtil.null2String(orderBy).equals("store_salenum")) {
    454. orderBy = "goods_salenum";// 销量
    455. } else if (CommUtil.null2String(orderBy).equals("goods_collect")) {
    456. orderBy = "goods_collect";// 人气
    457. } else if (CommUtil.null2String(orderBy).equals("well_evaluate")) {
    458. orderBy = "well_evaluate";// 评分高(综合)
    459. } else if (CommUtil.null2String(orderBy).equals("store_price")) {
    460. orderBy = "store_price"; // 价格
    461. }
    462. if (CommUtil.null2String(orderType).equals("asc") || CommUtil.null2String(orderType).equals("ASC")) {
    463. orderType = "ASC";
    464. } else {
    465. orderType = "DESC";
    466. }
    467. Map maps = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);
    468. if (StringUtils.isNotBlank(ugc_id)) {
    469. maps.put("ugc_id", ugc_id);
    470. }
    471. if (StringUtils.isNotBlank(keyword)) {
    472. maps.put("honghu_goods_name", keyword);
    473. }
    474. maps.put("goods_store_id", storeId);
    475. maps.put("enough_reduce", "enough_reduce");
    476. maps.put("goods_status", 0);
    477. Map goodsList = this.goodsFeignClient.list(maps);
    478. Map result = new HashMap();
    479. result.put("goodsList", goodsList);
    480. result.put("orderBy", orderBy);
    481. result.put("orderType", orderType);
    482. result.put("keyword", keyword);
    483. result.put("storeId", storeId);
    484. result.put("currentPage", currentPage);
    485. result.put("ugc_id", ugc_id);
    486. return ResponseCode.buildSuccessMap(result);
    487. }
    488. /**
    489. *
    490. * @param request
    491. * @param response
    492. * @param id
    493. * @return
    494. */
    495. /*
    496. * @RequestMapping({ "/store_user_goods_class" }) public ModelAndView
    497. * store_user_goods_class(HttpServletRequest request, HttpServletResponse
    498. * response, String id) { ModelAndView mv = new
    499. * HongHuJModelAndView("/weixin/store_user_goods_class.html",
    500. * this.configService.getSysConfig(),
    501. * this.userConfigService.getUserConfig(), 1, request, response); Store
    502. * store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if
    503. * (store != null) { Map params = Maps.newHashMap(); params.put("user_id",
    504. * store.getUser().getId()); params.put("display", Boolean.valueOf(true));
    505. * params.put("parent", -1); params.put("orderBy", "sequence");
    506. * params.put("orderBy", "sequence"); params.put("orderType", "asc");
    507. *
    508. * List ugcs =
    509. * this.userGoodsClassService.queryPageList(params);
    510. *
    511. * result.put("ugcs", ugcs); } return mv; }
    512. *
    513. *//**
    514. * 店铺活动
    515. *
    516. * @param request
    517. * @param response
    518. * @param id
    519. * @return
    520. */
    521. /*
    522. * @RequestMapping({ "/store_activity" }) public ModelAndView
    523. * store_activity(HttpServletRequest request, HttpServletResponse response,
    524. * String id) { ModelAndView mv = new
    525. * HongHuJModelAndView("/weixin/store_activity.html",
    526. * this.configService.getSysConfig(),
    527. * this.userConfigService.getUserConfig(), 1, request, response); if ((id !=
    528. * null) && (!"".equals(id))) { Store store =
    529. * this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if (store
    530. * != null) { result.put("store", store); Map map = Maps.newHashMap();
    531. * map.put("ag_goods_goods_store_id", store.getId()); map.put("ag_status",
    532. * 1);
    533. *
    534. * List ags = this.activityGoodsService.queryPageList(map);
    535. *
    536. * Set ids = new HashSet(); for (ActivityGoods ag : ags) { if (ag.getAct()
    537. * != null) { ids.add(ag.getAct().getId()); } } if (null != ids &&
    538. * ids.size() > 0) { Map paras = Maps.newHashMap(); paras.put("ids", ids);
    539. *
    540. * List list = this.activityService.queryPageList(paras);
    541. *
    542. * result.put("objs", list); } } } return mv; }
    543. *
    544. *//**
    545. * 活动商品列表
    546. *
    547. * @param request
    548. * @param response
    549. * @param act_id
    550. * @param id
    551. * @return
    552. */
    553. /*
    554. * @RequestMapping({ "/activity_goods_list" }) public ModelAndView
    555. * activity_goods_list(HttpServletRequest request, HttpServletResponse
    556. * response, String act_id, String id) { ModelAndView mv = new
    557. * HongHuJModelAndView("/weixin/activity_goods_list.html",
    558. * this.configService.getSysConfig(),
    559. * this.userConfigService.getUserConfig(), 1, request, response); Activity
    560. * act =
    561. * this.activityService.selectByPrimaryKey(CommUtil.null2Long(act_id)); if
    562. * ((id != null) && (!"".equals(id)) && (act != null)) { Map
    563. * maps = this.hongHuQueryTools.getParams(null, "addTime", "desc");
    564. * maps.put("ag_goods_goods_store_id", CommUtil.null2Long(id));
    565. * maps.put("act_id", CommUtil.null2Long(act_id)); maps.put("ag_status", 1);
    566. *
    567. * IPageList pList = this.activityGoodsService.list(maps);
    568. * CommUtil.saveIPageList2ModelAndView("", "", "", pList, mv); }
    569. * result.put("act_id", act_id); if ((id != null) && (!"".equals(id))) {
    570. * Store store =
    571. * this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if (store
    572. * != null) { result.put("store", store); } } return mv; }
    573. *
    574. *
    575. *
    576. *//**
    577. * 店铺分类列表
    578. *
    579. * @param request
    580. * @param response
    581. * @param id
    582. * @return
    583. */
    584. /*
    585. * @RequestMapping({ "/store_class_list" }) public ModelAndView
    586. * store_class_list(HttpServletRequest request, HttpServletResponse
    587. * response, String id) { ModelAndView mv = new
    588. * HongHuJModelAndView("/weixin/store_class_list.html",
    589. * this.configService.getSysConfig(),
    590. * this.userConfigService.getUserConfig(), 1, request, response); Store
    591. * store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id)); if
    592. * (store != null) { Map params = Maps.newHashMap(); params.put("user_id",
    593. * store.getUser().getId()); params.put("display", Boolean.valueOf(true));
    594. * params.put("parent", Boolean.valueOf(true)); params.put("orderBy",
    595. * "sequence"); params.put("orderType", "asc");
    596. *
    597. * List ugcs =
    598. * this.userGoodsClassService.queryPageList(params);
    599. *
    600. * result.put("store", store); result.put("ugcs", ugcs); } return mv; }
    601. *
    602. *//**
    603. * 店铺商品
    604. *
    605. * @param request
    606. * @param response
    607. * @param ugc_id
    608. * @param store_id
    609. * @param keyword
    610. * @param orderBy
    611. * @param orderType
    612. * @param currentPage
    613. * @param all
    614. * @return
    615. */
    616. /*
    617. * @RequestMapping({ "/store_goods" }) public ModelAndView
    618. * store_goods(HttpServletRequest request, HttpServletResponse response,
    619. * String ugc_id, String store_id, String keyword, String orderBy, String
    620. * orderType, String currentPage, String all) { ModelAndView mv = new
    621. * HongHuJModelAndView("weixin/store_goods.html",
    622. * this.configService.getSysConfig(),
    623. * this.userConfigService.getUserConfig(), 1, request, response);
    624. * Map maps = this.hongHuQueryTools.getParams(currentPage,
    625. * 12, orderBy, orderType); if (!"all".equals(all)) { mv = new
    626. * HongHuJModelAndView("weixin/store_goods_data.html",
    627. * this.configService.getSysConfig(),
    628. * this.userConfigService.getUserConfig(), 1, request, response); } if
    629. * ((orderBy == null) || (orderBy.equals(""))) { orderBy = "goods_salenum";
    630. * } if ((orderType == null) || (orderType.equals(""))) { orderType =
    631. * "desc"; } if ((currentPage == null) || ("".equals(currentPage))) {
    632. * currentPage = "1"; } Store store =
    633. * this.storeService.selectByPrimaryKey(CommUtil.null2Long(store_id)); if
    634. * (store != null) { result.put("store", store); maps.put("goods_store_id",
    635. * store.getId());
    636. *
    637. * maps.put("goods_status", 0); if ((keyword != null) &&
    638. * (!keyword.equals(""))) { maps.put("goods_name_like", keyword);
    639. * result.put("keyword", keyword); }
    640. *
    641. * UserGoodsClass ugc =
    642. * this.userGoodsClassService.selectByPrimaryKey(CommUtil.null2Long(ugc_id))
    643. * ; if (ugc != null) { result.put("ugc", ugc); Set ids =
    644. * genericUserGcIds(ugc); List ugc_list =
    645. * Lists.newArrayList(); for (Long g_id : ids) { UserGoodsClass temp_ugc =
    646. * this.userGoodsClassService.selectByPrimaryKey(g_id);
    647. * ugc_list.add(temp_ugc); }
    648. *
    649. * List goods_ugcs_ugc_ids = Lists.newArrayList();
    650. *
    651. * for (int i = 0; i < ugc_list.size(); i++) { UserGoodsClass userGoodsClass
    652. * = ugc_list.get(i); goods_ugcs_ugc_ids.add(userGoodsClass.getId()); }
    653. * maps.put("goods_ugcs_ugc_ids", goods_ugcs_ugc_ids); }
    654. *
    655. * if ((orderBy != null) && (!orderBy.equals(""))) { result.put("orderBy",
    656. * orderBy); result.put("orderType", orderType); }
    657. *
    658. * IPageList pList = this.goodsService.list(maps); result.put("objs",
    659. * pList.getResult()); result.put("totalPage",
    660. * Integer.valueOf(pList.getPages())); String url =
    661. * this.configService.getSysConfig().getAddress();
    662. * CommUtil.saveIPageList2ModelAndView(url + "/goods_list", "", "", pList,
    663. * mv); } else { mv = new HongHuJModelAndView("error.html",
    664. * this.configService.getSysConfig(),
    665. * this.userConfigService.getUserConfig(), 1, request, response);
    666. * result.put("op_title", "请求参数错误"); result.put("url",
    667. * CommUtil.getURL(request) + "/index"); } return mv; }
    668. *
    669. *//**
    670. * 店铺商品
    671. *
    672. * @param request
    673. * @param response
    674. * @param ugc_id
    675. * @param store_id
    676. * @param keyword
    677. * @param orderBy
    678. * @param orderType
    679. * @param currentPage
    680. * @param all
    681. * @return
    682. */
    683. /*
    684. * @RequestMapping({ "/store_items" }) public ModelAndView
    685. * store_items(HttpServletRequest request, HttpServletResponse response,
    686. * String ugc_id, String store_id, String keyword, String orderBy, String
    687. * orderType, String currentPage, String all) { ModelAndView mv = new
    688. * HongHuJModelAndView("weixin/store_goods.html",
    689. * this.configService.getSysConfig(),
    690. * this.userConfigService.getUserConfig(), 1, request, response);
    691. *
    692. * Map maps = this.hongHuQueryTools.getParams(currentPage,
    693. * 12, orderBy, orderType);
    694. *
    695. * if (!"all".equals(all)) { mv = new
    696. * HongHuJModelAndView("weixin/store_goods_data.html",
    697. * this.configService.getSysConfig(),
    698. * this.userConfigService.getUserConfig(), 1, request, response); } if
    699. * ((orderBy == null) || (orderBy.equals(""))) { orderBy = "goods_salenum";
    700. * } if ((orderType == null) || (orderType.equals(""))) { orderType =
    701. * "desc"; } if ((currentPage == null) || ("".equals(currentPage))) {
    702. * currentPage = "1"; } Store store =
    703. * this.storeService.selectByPrimaryKey(CommUtil.null2Long(store_id)); if
    704. * (store != null) { result.put("store", store);
    705. *
    706. * maps.put("goods_store_id", store.getId());
    707. *
    708. * maps.put("goods_status", 0);
    709. *
    710. * if ((keyword != null) && (!keyword.equals(""))) {
    711. * maps.put("goods_name_like", keyword); result.put("keyword", keyword); }
    712. *
    713. * UserGoodsClass ugc =
    714. * this.userGoodsClassService.selectByPrimaryKey(CommUtil.null2Long(ugc_id))
    715. * ; if (ugc != null) { result.put("ugc", ugc); Set ids =
    716. * genericUserGcIds(ugc); List ugc_list =
    717. * Lists.newArrayList(); for (Long g_id : ids) { UserGoodsClass temp_ugc =
    718. * this.userGoodsClassService.selectByPrimaryKey(g_id);
    719. * ugc_list.add(temp_ugc); }
    720. *
    721. * List goods_ugcs_ugc_ids = Lists.newArrayList();
    722. *
    723. * for (int i = 0; i < ugc_list.size(); i++) {
    724. * goods_ugcs_ugc_ids.add(ugc_list.get(i).getId()); }
    725. * maps.put("goods_ugcs_ugc_ids", goods_ugcs_ugc_ids);
    726. *
    727. * }
    728. *
    729. * IPageList pList = this.goodsService.list(maps); result.put("objs",
    730. * pList.getResult()); result.put("totalPage",
    731. * Integer.valueOf(pList.getPages())); String url =
    732. * this.configService.getSysConfig().getAddress();
    733. * CommUtil.saveIPageList2ModelAndView(url + "/goods_list", "", "", pList,
    734. * mv); } else { mv = new HongHuJModelAndView("error.html",
    735. * this.configService.getSysConfig(),
    736. * this.userConfigService.getUserConfig(), 1, request, response);
    737. * result.put("op_title", "请求参数错误"); result.put("url",
    738. * CommUtil.getURL(request) + "/index"); } return mv; }
    739. *
    740. *//**
    741. *
    742. * @param request
    743. * @param response
    744. * @param id
    745. * @return
    746. */
    747. /*
    748. * @RequestMapping({ "/store_head" }) public ModelAndView
    749. * store_head(HttpServletRequest request, HttpServletResponse response,
    750. * String id) { ModelAndView mv = new
    751. * HongHuJModelAndView("/weixin/store_head.html",
    752. * this.configService.getSysConfig(),
    753. * this.userConfigService.getUserConfig(), 1, request, response); Store
    754. * store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));
    755. * result.put("store", store); return mv; }
    756. *
    757. *//**
    758. *
    759. * @param request
    760. * @param response
    761. * @param id
    762. * @return
    763. */
    764. /*
    765. * @RequestMapping({ "/store_foot" }) public ModelAndView
    766. * store_foot(HttpServletRequest request, HttpServletResponse response,
    767. * String id) { ModelAndView mv = new
    768. * HongHuJModelAndView("/weixin/store_foot.html",
    769. * this.configService.getSysConfig(),
    770. * this.userConfigService.getUserConfig(), 1, request, response); Store
    771. * store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(id));
    772. * result.put("store", store); return mv; }
    773. *
    774. *//**
    775. *
    776. * @param ugc
    777. * @return
    778. *//*
    779. * private Set genericUserGcIds(UserGoodsClass ugc) { Set ids =
    780. * new HashSet(); ids.add(ugc.getId()); for (UserGoodsClass child :
    781. * ugc.getChilds()) { Set cids = genericUserGcIds(child); for
    782. * (Long cid : cids) { ids.add(cid); } ids.add(child.getId()); } return
    783. * ids; }
    784. *
    785. */
    786. /**
    787. * 用户申请开店
    788. *
    789. * @param request
    790. * @param response
    791. * @return
    792. */
    793. @RequestMapping({ "/buyer/user_store_add" })
    794. public Map user_store_add(HttpServletRequest request, HttpServletResponse response,
    795. @RequestBody JSONObject json) {
    796. Map result = Maps.newHashMap();
    797. Map params = Maps.newHashMap();
    798. String type = json.optString("type");
    799. UserDto user = SecurityUserHolder.getCurrentUser(request);
    800. Store store = null;
    801. if (user != null) {
    802. params.clear();
    803. params.put("user_id", user.getId());
    804. store = this.storeService.queryByProperty(params);
    805. }
    806. params.clear();
    807. List grades = this.storeGradeService.queryPageList(params);
    808. result.put("storeGrades", grades);
    809. result.put("user", user);
    810. params.clear();
    811. params.put("parent", -1);
    812. params.put("level", 0);
    813. List gcs = this.goodsClassFeignClient.queryPageList(params);
    814. result.put("goodsClass", gcs);
    815. if (store != null) {
    816. if (StringUtils.isNotEmpty(type)) {
    817. store.setStore_status(0); // 重新提交
    818. storeService.updateById(store);
    819. }
    820. // 跳转审核页面
    821. result.put("store", store);
    822. }
    823. // 查询店铺保证金购买记录
    824. params.clear();
    825. params.put("user_id", user.getId());
    826. params.put("pay_status", 1);
    827. PlatformPayDto platformPay = platformPayFeignClient.findUserDepositPay(params);
    828. if (platformPay != null && platformPay.getPay_status() == 1) {
    829. result.put("deposit_mark", "true");
    830. }
    831. params.clear();
    832. List modularclass = modularClassFeignClient.queryPageList(params);
    833. result.put("modularclass", modularclass);
    834. result.put("usecard", false);
    835. return ResponseCode.buildSuccessMap(result);
    836. }
    837. /**
    838. * 店铺保存
    839. *
    840. * @param request
    841. * @param response
    842. * @param id
    843. * @param store_status
    844. * @param currentPage
    845. * @param cmd
    846. * @param list_url
    847. * @param add_url
    848. * @param user_id
    849. * @param grade_id
    850. * @param area_id
    851. * @param validity
    852. * @param gc_main_id_clone
    853. * @param gc_detail_ids
    854. * @param gc_detail_info
    855. * @param serve_ids
    856. * @param cart_session
    857. * @return String trueName, String id, String store_name, String cmd, String
    858. * user_id, String storeGrades, String validity, String gc_main_id,
    859. * String gc_detail_ds, String telephone, String gc_detail_info,
    860. * String serve_ids, String recommend, String store_add_session,
    861. * String gc_id, String mc_id,
    862. * @throws Exception
    863. */
    864. @RequestMapping({ "/store_save" })
    865. public Map store_save(HttpServletRequest request, HttpServletResponse response,
    866. @RequestBody JSONObject json) {
    867. String store_name = json.optString("store_name"); // 店铺名称
    868. String trueName = json.optString("trueName"); // 真实姓名
    869. String telephone = json.optString("telephone"); // 电话号码
    870. String recommend = json.optString("recommend"); // 推荐人
    871. String mc_id = json.optString("mc_id"); // 行业
    872. String warehouse_id = json.optString("warehouse_id"); // 仓库地址id
    873. String storeGrades = json.optString("storeGrades"); // 店铺种类
    874. String gc_main_id = json.optString("gc_main_id"); // 主营类目
    875. String gc_id = json.optString("gc_id"); // 分类list
    876. String store_type = json.optString("store_type"); // 店铺类型 0 为个人 ,1 为公司
    877. String area_id = json.optString("area_id"); // 地址id
    878. String lat = json.optString("lat"); // 经纬度
    879. String lng = json.optString("lng");
    880. String area_name = json.optString("area_name"); // 详细地址名称
    881. String bank_permit_image_id = json.optString("bank_permit_image_id"); // 开户许可证
    882. String food_license_id = json.optString("food_license_id"); // 开户许可证
    883. // String serve_ids = json.optString("serve_ids");
    884. String license_legal_idCard_image_id = json.optString("license_legal_idCard_image_id"); // 身份证正面
    885. String license_legal_idCard_image2_id = json.optString("license_legal_idCard_image2_id");// 身份证反面
    886. String license_image_id = json.optString("license_img_id"); // 开户许可证 id
    887. String bank_c_account = json.optString("bank_c_account"); // 开户行账号
    888. String bank_account_name = json.optString("bank_account_name"); // 银行开户名
    889. String bank_name = json.optString("bank_name"); // 开户行支行名称
    890. UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));
    891. Store store = null;
    892. if (user.getStore_id() != null) {
    893. store = this.storeService.selectByPrimaryKey(user.getStore_id());
    894. } else {
    895. store = new Store();
    896. }
    897. store.setStore_status(5);
    898. if ((null != user) && (null != user.getId())) {
    899. store.setUser(user);
    900. store.setStore_name(store_name);
    901. store.setStore_ower(trueName);
    902. store.setLng(Double.valueOf(lng));
    903. store.setLat(Double.valueOf(lat));
    904. store.setArea_id(CommUtil.null2Long(area_id));
    905. store.setStore_address(area_name); // 详细地址
    906. store.setStore_telephone(telephone); // 店铺电话号码
    907. store.setRecommend(recommend); // 推荐人
    908. store.setGc_main_id(CommUtil.null2Long(gc_main_id));
    909. store.setAddTime(new Date());
    910. if (StringUtils.isNotEmpty(mc_id)) {
    911. store.setMc_id(CommUtil.null2Long(mc_id)); // 店铺所属行业
    912. }
    913. if (StringUtils.isNotEmpty(warehouse_id)) {
    914. store.setWarehouse_id(CommUtil.null2Long(warehouse_id)); // 店铺配送仓库地址
    915. }
    916. if (StringUtils.isNotBlank(storeGrades)) {
    917. store.setGrade_id(CommUtil.null2Long(storeGrades));
    918. }
    919. if (StringUtils.isNotBlank(store_type)) {
    920. store.setStore_type(Integer.valueOf(store_type)); // 店铺类型
    921. }
    922. if (StringUtils.isNotBlank(bank_c_account)) {
    923. store.setBank_c_account(bank_c_account); // 开户行账号
    924. }
    925. if (StringUtils.isNotBlank(bank_account_name)) {
    926. store.setBank_account_name(bank_account_name); // 银行开户名
    927. }
    928. if (StringUtils.isNotBlank(bank_name)) {
    929. store.setBank_name(bank_name); // 开户行支行名称
    930. }
    931. // 保存店铺位置坐标
    932. if (StringUtils.isNotBlank(gc_id)) {
    933. String[] str = gc_id.split(",");
    934. List list = Lists.newArrayList();
    935. Map map = Maps.newHashMap();
    936. List gc_list = Lists.newArrayList();
    937. GoodsClassDto parent = null;
    938. for (int b = 1; b < str.length; b++) {
    939. GoodsClassDto gc = this.goodsClassFeignClient.selectByPrimaryKey(CommUtil.null2Long(str[b]));
    940. parent = gc.getParent();
    941. }
    942. List gc_mains = this.storeTools.query_store_detail_MainGc(store.getGc_detail_info());
    943. for (GoodsClassDto gc_main : gc_mains) {
    944. Map map_main = this.storeTools.query_MainGc_Map(CommUtil.null2String(gc_main.getId()),
    945. store.getGc_detail_info());
    946. list.add(map_main);
    947. }
    948. for (int a = 0; a < str.length; a++) {
    949. GoodsClassDto gc = this.goodsClassFeignClient.selectByPrimaryKey(CommUtil.null2Long(str[a]));
    950. if (null == gc) {
    951. continue;
    952. }
    953. Set detail_info = this.storeTools.query_store_DetailGc(store.getGc_detail_info());
    954. if (((Set) detail_info).size() == 0) {
    955. gc_list.add(gc.getId());
    956. } else {
    957. int m = 0;
    958. for (GoodsClassDto gc2 : detail_info) {
    959. if (gc.getId().equals(gc2.getId())) {
    960. m++;
    961. }
    962. }
    963. if (m == ((Set) detail_info).size()) {
    964. gc_list.add(gc.getId());
    965. }
    966. }
    967. if (gc.getParent_id() != null) {
    968. parent = goodsClassFeignClient.selectByPrimaryKey(gc.getParent_id());
    969. }
    970. }
    971. map.put("m_id", parent.getId());
    972. map.put("gc_list", gc_list);
    973. list.add(map);
    974. store.setGc_detail_info(JSON.toJSONString(list));
    975. }
    976. }
    977. Map params = Maps.newHashMap();
    978. // 1、搜索出所有父菜单
    979. params.clear();
    980. params.put("parent", -1);
    981. params.put("type", "SELLER");
    982. List menus = this.menuFeignClient.list(params);
    983. List ms = Lists.newArrayList();
    984. // 2、通过父菜单获取所有子菜单
    985. for (MenuDto menu : menus) {
    986. ms.add(menu);
    987. ms.addAll(menu.getAllChilds());
    988. }
    989. this.userFeignClient.deleteUserMenu(user.getId());
    990. this.userFeignClient.saveUserMenu(user.getId(), ms);
    991. // 处理图片
    992. if (StringUtils.isNotBlank(license_legal_idCard_image_id)) { // 身份证正面
    993. store.setLicense_legal_idCard_image_id(CommUtil.null2Long(license_legal_idCard_image_id));
    994. }
    995. if (StringUtils.isNotBlank(license_legal_idCard_image2_id)) { // 身份证背面
    996. store.setLicense_legal_idCard_image2_id(CommUtil.null2Long(license_legal_idCard_image2_id));
    997. }
    998. if (StringUtils.isNotBlank(license_image_id)) { // 营业执照
    999. store.setLicense_image_id(CommUtil.null2Long(license_image_id));
    1000. }
    1001. if (StringUtils.isNotBlank(bank_permit_image_id)) { // 营业执照
    1002. store.setBank_permit_image_id(CommUtil.null2Long(bank_permit_image_id));
    1003. }
    1004. if (StringUtils.isNotBlank(food_license_id)) { // 营业执照
    1005. store.setFood_license_id(CommUtil.null2Long(food_license_id));
    1006. }
    1007. if (store.getId() == null) {
    1008. this.storeService.saveEntity(store);
    1009. //通知用户审核
    1010. try{
    1011. params = new HashMap();
    1012. params.put("kind", "店铺");
    1013. params.put("nickname", user.getNickName());
    1014. tXTemplateFeignClient.auditNsgNote(params);
    1015. }catch(Exception e){
    1016. log.error("StoreController >> store_save >> auditNsgNote " + e.getMessage());
    1017. }
    1018. } else {
    1019. this.storeService.updateById(store);
    1020. }
    1021. if (store.getPoint() == null) {
    1022. StorePoint sp = new StorePoint();
    1023. sp.setAddTime(new Date());
    1024. sp.setStore(store);
    1025. sp.setStore_evaluate(BigDecimal.valueOf(0L));
    1026. sp.setDescription_evaluate(BigDecimal.valueOf(0L));
    1027. sp.setService_evaluate(BigDecimal.valueOf(0L));
    1028. sp.setShip_evaluate(BigDecimal.valueOf(0L));
    1029. this.storePointService.saveEntity(sp);
    1030. }
    1031. user.setStore_id(store.getId());
    1032. this.userFeignClient.updateById(user);
    1033. return ResponseCode.buildSuccessMap(null);
    1034. }
    1035. /**
    1036. * 我的店铺
    1037. *
    1038. * @param request
    1039. * @param response
    1040. * @param json
    1041. * @return
    1042. */
    1043. @RequestMapping(value = "/my_store", method = RequestMethod.POST)
    1044. public Map my_store(HttpServletRequest request, HttpServletResponse response) {
    1045. Map resultMap = new HashMap();
    1046. UserDto user = SecurityUserHolder.getCurrentUser(request);
    1047. if (user == null) {
    1048. return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);
    1049. }
    1050. user = userFeignClient.selectByPrimaryKey(user.getId());
    1051. Store store = storeService.selectByPrimaryKey(user.getStore_id());
    1052. if (store == null) {
    1053. return ResponseCode.buildCodeMap("20002", "无法找到该店铺", null);
    1054. }
    1055. resultMap.put("store", store);
    1056. return ResponseCode.buildSuccessMap(resultMap);
    1057. }
    1058. @RequestMapping(value = "/save_my_store", method = RequestMethod.POST)
    1059. public Map save_my_store(HttpServletRequest request, HttpServletResponse response,
    1060. @RequestBody JSONObject json) {
    1061. String store_name = json.optString("store_name");
    1062. String store_info = json.optString("store_info");
    1063. Long mobile_logo_id = json.optLong("mobile_logo_id");
    1064. Long store_photo_id = json.optLong("store_photo_id");
    1065. if (StringUtils.isBlank(store_name) || StringUtils.isBlank(store_info) || mobile_logo_id == null
    1066. || store_photo_id == null) {
    1067. return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);
    1068. }
    1069. UserDto user = SecurityUserHolder.getCurrentUser(request);
    1070. if (user == null) {
    1071. return ResponseCode.buildEnumMap(ResponseCode.TOKEN_EXPIRE, null);
    1072. }
    1073. Store store = storeService.selectByPrimaryKey(user.getId());
    1074. if (store == null) {
    1075. return ResponseCode.buildCodeMap("20002", "无法找到该店铺", null);
    1076. }
    1077. store.setStore_name(store_name);
    1078. store.setStore_info(store_info);
    1079. store.setMobile_logo_id(mobile_logo_id);
    1080. store.setStore_photo_id(store_photo_id);
    1081. storeService.updateById(store);
    1082. return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, null);
    1083. }
    1084. /**
    1085. * 去逛街
    1086. *
    1087. * @param request
    1088. * @param response
    1089. * @param search
    1090. * 店铺名称搜索
    1091. * @param id
    1092. * 店铺id
    1093. * @param orderBy
    1094. * 分组类型
    1095. * @param orderType
    1096. * 排序方式
    1097. * @return
    1098. */
    1099. @RequestMapping(value = "/go_shopping", method = RequestMethod.POST)
    1100. public Map go_shopping(HttpServletRequest request, HttpServletResponse response,
    1101. @RequestBody JSONObject json) {
    1102. String currentPage = json.optString("currentPage");
    1103. String search = json.optString("search");
    1104. String orderBy = json.optString("orderBy");
    1105. String orderType = json.optString("orderType");
    1106. String lat = json.optString("lat");
    1107. String lng = json.optString("lng");
    1108. String gb_id = json.optString("gb_id");
    1109. String mc_id = json.optString("mc_id");
    1110. String newShop = json.optString("newShop");
    1111. if (StringUtils.isBlank(lat) || StringUtils.isBlank(lng) || StringUtils.isBlank(currentPage)) {
    1112. return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);
    1113. }
    1114. Map result = new HashMap();
    1115. Map params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);
    1116. params.put("notakeaway", "yes");
    1117. if (CommUtil.null2String(orderType).equals("")) {
    1118. orderType = "desc";
    1119. }
    1120. if ((orderBy == null) || ("".equals(orderBy)) || "comprehensive".equals(orderBy)) {
    1121. // 综合
    1122. params.put("orderBy", "obj.deposit " + orderType
    1123. + ", obj.fileId desc, avg(sp.store_evaluate) desc, count(goods.goods_salenum)");
    1124. } else if (CommUtil.null2String(orderBy).equals("well_evaluate")) {
    1125. // 评分
    1126. params.put("orderBy", "IFNULL(avg(sp.store_evaluate), 5)");
    1127. } else if (CommUtil.null2String(orderBy).equals("store_distance")) {
    1128. // 距离
    1129. params.put("orderBy", "distance");
    1130. }
    1131. Map map = Maps.newHashMap();
    1132. if (StringUtils.isNotBlank(search)) {
    1133. params.put("search_key", search); // 商店名称模糊匹配
    1134. }else{ //存在搜索的情况,就不做区域限制
    1135. String city = areaFeignClient.getCoordinate(lat, lng);
    1136. map.put("level", 1);
    1137. map.put("areaName", city);
    1138. List list = areaFeignClient.queryPageList(map);
    1139. if (list.size() <= 0) {
    1140. // 如果查询不到,就设定地址为深圳
    1141. map.clear();
    1142. map.put("level", 1);
    1143. map.put("areaName", "深圳市");
    1144. list = areaFeignClient.queryPageList(map);
    1145. }
    1146. AreaDto area = list.get(0);
    1147. params.put("area_id", area.getId());
    1148. }
    1149. params.put("lat", lat);
    1150. params.put("lng", lng);
    1151. params.put("orderType", orderType);
    1152. params.put("group_by", "sa.id");
    1153. if (StringUtils.isNotEmpty(gb_id)) {
    1154. params.put("screen_gb_id", gb_id); // 品牌
    1155. }
    1156. if (StringUtils.isNotEmpty(newShop)) {
    1157. params.put("screen_newShop", newShop); // 新店
    1158. }
    1159. if (StringUtils.isNotEmpty(mc_id)) {
    1160. params.put("screen_mc_id", CommUtil.null2Long(mc_id)); // 行业
    1161. }
    1162. Page pList = this.storeService.goShoppingPage(params);
    1163. Page recomList = null;
    1164. if (pList.getRowCount() <= 10) {
    1165. // 没有数据获取默认地方深圳的数据
    1166. map.clear();
    1167. map.put("level", 1);
    1168. map.put("areaName", "深圳市");
    1169. List list = areaFeignClient.queryPageList(map);
    1170. AreaDto area = list.get(0);
    1171. params.clear();
    1172. params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);
    1173. params.put("notakeaway", "yes");
    1174. params.put("orderBy", "obj.deposit " + orderType
    1175. + ", obj.fileId desc, avg(sp.store_evaluate) desc, count(goods.goods_salenum)");
    1176. params.put("lat", lat);
    1177. params.put("lng", lng);
    1178. params.put("orderType", orderType);
    1179. params.put("group_by", "sa.id");
    1180. params.put("area_id", area.getId());
    1181. recomList = this.storeService.goShoppingPage(params);
    1182. }
    1183. //地图上的名称
    1184. /*if (pList.getResult()!=null&&pList.getResult().size()>0) {
    1185. for (Store store : pList.getResult()) {
    1186. if (store.getStore_name().length()>4) {
    1187. store.setStore_map_name(store.getStore_name().substring(0, 5)+"..");
    1188. }else{
    1189. store.setStore_map_name(store.getStore_name());
    1190. }
    1191. }
    1192. }*/
    1193. result.put("recomList", recomList);
    1194. result.put("pList", pList);
    1195. result.put("currentPage", currentPage);
    1196. result.put("search", search);
    1197. result.put("orderBy", orderBy);
    1198. result.put("orderType", orderType);
    1199. result.put("lat", lat);
    1200. result.put("lng", lng);
    1201. result.put("gb_id", gb_id);
    1202. result.put("mc_id", mc_id);
    1203. result.put("newShop", newShop);
    1204. return result;
    1205. }
    1206. // 获取行业信息
    1207. @RequestMapping(value = "/allModularClass", method = RequestMethod.GET)
    1208. public Map allModularClass() {
    1209. Map params = Maps.newHashMap();
    1210. List mcList = modularClassFeignClient.queryPageList(params);
    1211. return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, mcList);
    1212. }
    1213. /**
    1214. * 手机店铺首页
    1215. *
    1216. * @param request
    1217. * @param response
    1218. * @param id
    1219. * @return
    1220. */
    1221. @RequestMapping(value = "/home", method = RequestMethod.GET)
    1222. public Map home(HttpServletRequest request, HttpServletResponse response) {
    1223. Long login_user_id = SecurityUserHolder.getCurrentUserId(request);
    1224. UserDto user = userFeignClient.selectByPrimaryKey(login_user_id);
    1225. if (user.getStore_id() == null) {
    1226. return ResponseCode.buildCodeMap("40001", "未开店", null);
    1227. }
    1228. user.setStore_id(user.getStore_id());
    1229. /**
    1230. * 查询订单、退款售后统计{wait_pay_num:待付款,wait_send_num:待发货,return_goods_num:退款售后,wait_evaluate_num:待评价,
    1231. * return_num:退款中,today_order_num:今日订单数,today_order_price:今日总成交额,lastday_order_price:昨日成交金额}
    1232. */
    1233. Map orderStatis = orderFormFeignClient.orderStoreStatis(user.getStore_id());
    1234. /** 查询商品统计{today_collect:今日收藏,today_look:今日浏览,today_cart_num:今日购物车} **/
    1235. Map goodsStatis = goodsFeignClient.goodsStoreStatis(user.getStore_id());
    1236. orderStatis.putAll(goodsStatis);
    1237. /** 查询店铺访问统计{today_visit:今日总访客,today_flow:今日总流量,lastday_visit:昨日总访客} **/
    1238. Map visitStatis = storeVisitLogService.visitStoreStatis(user.getStore_id());
    1239. orderStatis.putAll(visitStatis);
    1240. return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, orderStatis);
    1241. }
    1242. // 外卖店铺
    1243. @RequestMapping(value = "/takeaway_shop", method = RequestMethod.POST)
    1244. public Map takeaway_shop(HttpServletRequest request, HttpServletResponse response,
    1245. @RequestBody JSONObject json) {
    1246. String currentPage = json.optString("currentPage");
    1247. String search = json.optString("search");
    1248. String orderBy = json.optString("orderBy");
    1249. String orderType = json.optString("orderType");
    1250. String lat = json.optString("lat");
    1251. String lng = json.optString("lng");
    1252. String gb_id = json.optString("gb_id");
    1253. String newShop = json.optString("newShop");
    1254. String mc_id = json.optString("mc_id"); // 行业
    1255. String free_delivery = json.optString("free_delivery"); // 免费配送
    1256. String full_reduction = json.optString("full_reduction"); // 满就减
    1257. String full_send = json.optString("full_send"); // 满就送
    1258. String invoice = json.optString("invoice"); // 发票
    1259. if (StringUtils.isBlank(lat) || StringUtils.isBlank(lng) || StringUtils.isBlank(currentPage)) {
    1260. return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);
    1261. }
    1262. Map result = new HashMap();
    1263. List hlbList = iconViewFeignClient.selectByHmId(6L);
    1264. result.put("hlbList", hlbList);
    1265. Map params = queryTools.getParams(currentPage, 12, "obj." + orderBy, orderType);
    1266. params.put("takeaway", "yes");
    1267. if (CommUtil.null2String(orderType).equals("")) {
    1268. orderType = "desc";
    1269. }
    1270. if ((orderBy == null) || ("".equals(orderBy)) || "comprehensive".equals(orderBy)) {
    1271. // 综合
    1272. params.put("orderBy", "obj.deposit " + orderType
    1273. + ", obj.fileId desc, avg(sp.store_evaluate) desc, count(goods.goods_salenum)");
    1274. } else if (CommUtil.null2String(orderBy).equals("well_evaluate")) {
    1275. // 评分
    1276. params.put("orderBy", "IFNULL(avg(sp.store_evaluate), 5)");
    1277. } else if (CommUtil.null2String(orderBy).equals("store_distance")) {
    1278. // 距离
    1279. params.put("orderBy", "distance");
    1280. orderType = "ASC";
    1281. } else if (CommUtil.null2String(orderBy).equals("store_salenum")) {
    1282. // 销量 ORDER BY store_salenum DESC
    1283. params.put("orderBy", "store_salenum");
    1284. orderType = "DESC";
    1285. } else if (CommUtil.null2String(orderBy).equals("send_money")) {
    1286. // 起送价最低 ORDER BY send_money ASC
    1287. params.put("orderBy", "obj.send_money");
    1288. orderType = "ASC";
    1289. } else if (CommUtil.null2String(orderBy).equals("delivery_money")) {
    1290. // 配送费最低 ORDER BY delivery_money ASC
    1291. params.put("orderBy", "obj.delivery_money");
    1292. orderType = "ASC";
    1293. } else if (CommUtil.null2String(orderBy).equals("prepare_time")) {
    1294. // 配送速度最快 ORDER BY prepare_time ASC
    1295. params.put("orderBy", "obj.prepare_time");
    1296. orderType = "ASC";
    1297. }
    1298. if (StringUtils.isNotBlank(search)) {
    1299. params.put("search_key", search); // 商店名称模糊匹配
    1300. }
    1301. if (StringUtils.isNotBlank(free_delivery)) {
    1302. params.put("free_delivery", free_delivery); // 免费配送
    1303. }
    1304. if (StringUtils.isNotBlank(full_reduction)) {
    1305. params.put("full_reduction", full_reduction); // 满就减
    1306. }
    1307. if (StringUtils.isNotBlank(full_send)) {
    1308. params.put("full_send", full_send); // 满就送
    1309. }
    1310. if (StringUtils.isNotBlank(invoice)) {
    1311. params.put("invoice", invoice); // 发票
    1312. }
    1313. if (StringUtils.isNotBlank(mc_id)) {
    1314. params.put("screen_mc_id", mc_id); // 行业
    1315. }
    1316. String city = areaFeignClient.getCoordinate(lat, lng);
    1317. Map map = Maps.newHashMap();
    1318. map.put("level", 1);
    1319. map.put("areaName", city);
    1320. List list = areaFeignClient.queryPageList(map);
    1321. if (list.size() <= 0) {
    1322. // 如果查询不到,就设定地址为北京
    1323. map.clear();
    1324. map.put("level", 1);
    1325. map.put("areaName", "北京市");
    1326. list = areaFeignClient.queryPageList(map);
    1327. }
    1328. AreaDto area = list.get(0);
    1329. params.put("area_id", area.getId());
    1330. params.put("lat", lat);
    1331. params.put("lng", lng);
    1332. params.put("orderType", orderType);
    1333. params.put("group_by", "sa.id");
    1334. if (StringUtils.isNotEmpty(gb_id)) {
    1335. params.put("screen_gb_id", gb_id); // 品牌
    1336. }
    1337. if (StringUtils.isNotEmpty(newShop)) {
    1338. params.put("screen_newShop", newShop); // 新店
    1339. }
    1340. Page pList = this.storeService.goShoppingPage(params);
    1341. List ids = new ArrayList();
    1342. for (Store store : pList.getResult()) {
    1343. ids.add(store.getId());
    1344. }
    1345. List goodsList = goodsFeignClient.getRecommendGoods(ids);
    1346. Map> goodsResult = new HashMap>();
    1347. for (Long id : ids) {
    1348. List goodsMap = new ArrayList();
    1349. for (GoodsDto goodsDto : goodsList) {
    1350. if (id.longValue() == goodsDto.getGoods_store_id().longValue()) {
    1351. goodsMap.add(goodsDto);
    1352. }
    1353. }
    1354. goodsResult.put(id, goodsMap);
    1355. }
    1356. for (Store store : pList.getResult()) {
    1357. store.setRecommendList(goodsResult.get(store.getId()));
    1358. }
    1359. result.put("pList", pList);
    1360. result.put("currentPage", currentPage);
    1361. result.put("search", search);
    1362. result.put("orderBy", orderBy);
    1363. result.put("orderType", orderType);
    1364. result.put("lat", lat);
    1365. result.put("lng", lng);
    1366. result.put("gb_id", gb_id);
    1367. result.put("newShop", newShop);
    1368. result.put("free_delivery", free_delivery); // 免费配送
    1369. result.put("full_reduction", full_reduction); // 满就减
    1370. result.put("full_send", full_send); // 满就送
    1371. result.put("invoice", invoice); // 发票
    1372. return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);
    1373. }
    1374. // 外卖店铺
    1375. @RequestMapping(value = "/takeaway_shop_count", method = RequestMethod.POST)
    1376. public Map takeaway_shop_count(HttpServletRequest request, HttpServletResponse response,
    1377. @RequestBody JSONObject json) {
    1378. String search = json.optString("search");
    1379. String lat = json.optString("lat");
    1380. String lng = json.optString("lng");
    1381. String gb_id = json.optString("gb_id");
    1382. String newShop = json.optString("newShop");
    1383. String free_delivery = json.optString("free_delivery"); // 免费配送
    1384. String full_reduction = json.optString("full_reduction"); // 满就减
    1385. String full_send = json.optString("full_send"); // 满就送
    1386. String invoice = json.optString("invoice"); // 发票
    1387. if (StringUtils.isBlank(lat) || StringUtils.isBlank(lng)) {
    1388. return ResponseCode.buildEnumMap(ResponseCode.REQ_CANNOT_EMPTY, null);
    1389. }
    1390. Map result = new HashMap();
    1391. Map params = Maps.newHashMap();
    1392. params.put("takeaway", "yes");
    1393. if (StringUtils.isNotBlank(search)) {
    1394. params.put("search_key", search); // 商店名称模糊匹配
    1395. }
    1396. if (StringUtils.isNotBlank(free_delivery)) {
    1397. params.put("free_delivery", free_delivery); // 免费配送
    1398. }
    1399. if (StringUtils.isNotBlank(full_reduction)) {
    1400. params.put("full_reduction", full_reduction); // 满就减
    1401. }
    1402. if (StringUtils.isNotBlank(full_send)) {
    1403. params.put("full_send", full_send); // 满就送
    1404. }
    1405. if (StringUtils.isNotBlank(invoice)) {
    1406. params.put("invoice", invoice); // 发票
    1407. }
    1408. String city = areaFeignClient.getCoordinate(lat, lng);
    1409. Map map = Maps.newHashMap();
    1410. map.put("level", 1);
    1411. map.put("areaName", city);
    1412. List list = areaFeignClient.queryPageList(map);
    1413. if (list.size() <= 0) {
    1414. // 如果查询不到,就设定地址为北京
    1415. map.clear();
    1416. map.put("level", 1);
    1417. map.put("areaName", "北京市");
    1418. list = areaFeignClient.queryPageList(map);
    1419. }
    1420. AreaDto area = list.get(0);
    1421. params.put("area_id", area.getId());
    1422. params.put("lat", lat);
    1423. params.put("lng", lng);
    1424. if (StringUtils.isNotEmpty(gb_id)) {
    1425. params.put("screen_gb_id", gb_id); // 品牌
    1426. }
    1427. if (StringUtils.isNotEmpty(newShop)) {
    1428. params.put("screen_newShop", newShop); // 新店
    1429. }
    1430. int count = this.storeService.goShoppingCount(params);
    1431. result.put("count", count);
    1432. result.put("search", search);
    1433. result.put("lat", lat);
    1434. result.put("lng", lng);
    1435. result.put("gb_id", gb_id);
    1436. result.put("newShop", newShop);
    1437. result.put("free_delivery", free_delivery); // 免费配送
    1438. result.put("full_reduction", full_reduction); // 满就减
    1439. result.put("full_send", full_send); // 满就送
    1440. result.put("invoice", invoice); // 发票
    1441. return ResponseCode.buildEnumMap(ResponseCode.SUCCESS, result);
    1442. }
    1443. /**
    1444. * 用户申请开店
    1445. *
    1446. * @param request
    1447. * @param response
    1448. * @return
    1449. */
    1450. @RequestMapping({ "/buyer/user_store_check" })
    1451. public Map user_store_check(HttpServletRequest request, HttpServletResponse response,
    1452. @RequestBody JSONObject json) {
    1453. Map result = Maps.newHashMap();
    1454. Map params = Maps.newHashMap();
    1455. UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));
    1456. Store store = null;
    1457. if (user != null) {
    1458. params.clear();
    1459. params.put("user_id", user.getId());
    1460. store = this.storeService.queryByProperty(params);
    1461. }
    1462. result.put("user", user);
    1463. result.put("store", store);
    1464. ModularClassDto modularClassDto = null;
    1465. if (store != null) {
    1466. modularClassDto = modularClassFeignClient.selectByStoreId(store.getId());
    1467. }
    1468. result.put("modularclass", modularClassDto);
    1469. return ResponseCode.buildSuccessMap(result);
    1470. }
    1471. /**
    1472. * 修改银行卡信息
    1473. *
    1474. * @param request
    1475. * @param response
    1476. * @return
    1477. */
    1478. @RequestMapping({ "/buyer/storeModifyComExamine" })
    1479. public Map storeModifyComExamine(HttpServletRequest request, HttpServletResponse response,
    1480. @RequestBody ComExamine comExamine) {
    1481. Map result = Maps.newHashMap();
    1482. UserDto user = userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUserId(request));
    1483. Store store = null;
    1484. if (user != null && user.getStore_id() != null) {
    1485. store = storeService.selectByPrimaryKey(user.getStore_id());
    1486. }
    1487. if (store == null) {
    1488. return ResponseCode.buildFailMap("用户信息有误", null);
    1489. }
    1490. comExamine.setAddTime(new Date());
    1491. comExamine.setDeleteStatus(0);
    1492. comExamine.setStore_id(store.getId());
    1493. comExamine.setUser_id(user.getId());
    1494. comExamine.setStatus(0);
    1495. if (comExamine.getId() != null) {
    1496. comExamineService.updateById(comExamine);
    1497. } else {
    1498. comExamineService.saveEntity(comExamine);
    1499. }
    1500. return ResponseCode.buildSuccessMap(result);
    1501. }
    1502. /**
    1503. * 修改银行卡信息
    1504. *
    1505. * @param request
    1506. * @param response
    1507. * @return
    1508. */
    1509. @RequestMapping({ "/coupon_itme" })
    1510. public Map coupon_itme(HttpServletRequest request, HttpServletResponse response,
    1511. @RequestBody JSONObject json) {
    1512. Map result = Maps.newHashMap();
    1513. Store store = null;
    1514. String id = json.optString("id");
    1515. String coupon_id = json.optString("coupon_id");
    1516. store = storeService.selectByPrimaryKey(CommUtil.null2Long(id));
    1517. if (store == null) {
    1518. return ResponseCode.buildFailMap("信息有误", null);
    1519. }
    1520. result.put("coupon_id", CommUtil.null2Long(coupon_id));
    1521. result.put("free_status", 1);
    1522. result.put("user_id", SecurityUserHolder.getCurrentUserId(request));
    1523. List queryPageList = couponInfoFeignClient.queryPageList(result);
    1524. if (queryPageList == null||queryPageList.size()<1) {
    1525. return ResponseCode.buildFailMap("信息有误", null);
    1526. }
    1527. if (store.getArea_id() != null) {
    1528. AreaDto areaDto = areaFeignClient.selectByPrimaryKeyFullParent(store.getArea_id());
    1529. if (areaDto != null) {
    1530. String store_address = store.getStore_address();
    1531. store.setStore_address(areaDto.getParent().getParent().getAreaName() + areaDto.getParent().getAreaName()
    1532. + areaDto.getAreaName() + store_address);
    1533. }
    1534. }
    1535. CouponDto couponDto = couponFeignClient.selectByPrimaryKey(CommUtil.null2Long(coupon_id));
    1536. result.clear();
    1537. result.put("couponDto", couponDto);
    1538. result.put("couponinfodto", queryPageList.get(0));
    1539. result.put("store", store);
    1540. return ResponseCode.buildSuccessMap(result);
    1541. }
    1542. }
    @源码地址来源:http://minglisoft.cn/hhcloud
  • 相关阅读:
    记录npm的版本问题
    数据仓库原理(二)
    Linux CentOS 8(iptables的配置与管理)
    『现学现忘』Git基础 — 37、标签tag(二)
    [发现了好东西] MS teams 使用-表情小窗口
    编程狂人|妙用Java 8中的 Function接口 消灭if...else...
    NoVNC(Client)+TigerVNC(Server)搭建流程
    linux部署jar包脚本和注册开机启动
    webpack学习笔记
    java基于Springboot+vue的学生公寓宿舍管理系统 elementui
  • 原文地址:https://blog.csdn.net/m0_61571842/article/details/126146075