Kaynağa Gözat

完善多渠道用户和小程序首页

wang 3 hafta önce
ebeveyn
işleme
da71e12125
17 değiştirilmiş dosya ile 576 ekleme ve 491 silme
  1. 2 1
      yami-shop-api/src/main/java/com/yami/shop/api/controller/CategoryController.java
  2. 5 4
      yami-shop-api/src/main/java/com/yami/shop/api/controller/SearchController.java
  3. 45 47
      yami-shop-api/src/main/java/com/yami/shop/api/controller/ShopDetailController.java
  4. 199 198
      yami-shop-api/src/main/java/com/yami/shop/api/controller/UserRegisterController.java
  5. 5 6
      yami-shop-api/src/main/java/com/yami/shop/api/listener/ConfirmOrderListener.java
  6. 28 25
      yami-shop-bean/src/main/java/com/yami/shop/bean/app/param/UserRegisterParam.java
  7. 5 0
      yami-shop-bean/src/main/java/com/yami/shop/bean/dto/SearchProdDto.java
  8. 16 0
      yami-shop-bean/src/main/java/com/yami/shop/bean/dto/ShopCategoryDto.java
  9. 0 52
      yami-shop-bean/src/main/java/com/yami/shop/bean/enums/DvyType.java
  10. 2 0
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/User.java
  11. 2 0
      yami-shop-security/yami-shop-security-comment/src/main/java/com/yami/shop/security/comment/token/AuthenticationToken.java
  12. 2 1
      yami-shop-service/src/main/java/com/yami/shop/dao/ShopDetailMapper.java
  13. 59 55
      yami-shop-service/src/main/java/com/yami/shop/service/ShopDetailService.java
  14. 4 0
      yami-shop-service/src/main/java/com/yami/shop/service/impl/ProductServiceImpl.java
  15. 16 7
      yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopDetailServiceImpl.java
  16. 1 0
      yami-shop-service/src/main/java/com/yami/shop/service/impl/SkuServiceImpl.java
  17. 185 95
      yami-shop-service/src/main/resources/mapper/ShopDetailMapper.xml

+ 2 - 1
yami-shop-api/src/main/java/com/yami/shop/api/controller/CategoryController.java

@@ -58,7 +58,8 @@ public class CategoryController {
             @ApiImplicitParam(name = "shopId", value = "店铺id", required = false, dataType = "Long")
     })
 
-    public ResponseEntity<IPage<CategoryDto>> categoryInfo(@RequestParam(value = "parentId", defaultValue = "0") Long parentId, @RequestParam(value = "shopId",required = false) Long shopId,
+    public ResponseEntity<IPage<CategoryDto>> categoryInfo(@RequestParam(value = "parentId", defaultValue = "0") Long parentId,
+                                                           @RequestParam(value = "shopId",required = false) Long shopId,
                                                            @RequestParam(value = "current", defaultValue = "1") Integer current,
                                                            @RequestParam(value = "size", defaultValue = "10") Integer size) {
         IPage<Category> categories = categoryService.listByParentIdAndShopId(parentId,shopId, current, size);

+ 5 - 4
yami-shop-api/src/main/java/com/yami/shop/api/controller/SearchController.java

@@ -12,6 +12,7 @@ package com.yami.shop.api.controller;
 
 
 import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.app.param.SearchParam;
 import com.yami.shop.bean.dto.HotSearchDto;
@@ -51,7 +52,7 @@ public class SearchController {
             @ApiImplicitParam(name = "number", value = "取数", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "sort", value = "是否按照顺序(0 否 1是)", required = false, dataType = "Integer"),
     })
-    public ResponseEntity<List<HotSearchDto>> hotSearchByShopId(Long shopId,Integer number,Integer sort) {
+    public ResponseEntity<List<HotSearchDto>> hotSearchByShopId(Long shopId, Integer number, Integer sort) {
         List<HotSearchDto> list = hotSearchService.getHotSearchDtoByshopId(shopId);
 
         return getListResponseEntity(number, sort, list);
@@ -63,16 +64,16 @@ public class SearchController {
             @ApiImplicitParam(name = "number", value = "取数", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "sort", value = "是否按照顺序(0 否 1是)", required = false, dataType = "Integer"),
     })
-    public ResponseEntity<List<HotSearchDto>> hotSearch(Integer number,Integer sort) {
+    public ResponseEntity<List<HotSearchDto>> hotSearch(Integer number, Integer sort) {
         List<HotSearchDto> list = hotSearchService.getHotSearchDtoByshopId(0L);
         return getListResponseEntity(number, sort, list);
     }
 
     private ResponseEntity<List<HotSearchDto>> getListResponseEntity(Integer number, Integer sort, List<HotSearchDto> list) {
-        if(sort == null || sort == 0){
+        if (sort == null || sort == 0) {
             Collections.shuffle(list);
         }
-        if(!CollectionUtil.isNotEmpty(list) || list.size()< number){
+        if (!CollectionUtil.isNotEmpty(list) || list.size() < number) {
             return ResponseEntity.ok(list);
         }
         return ResponseEntity.ok(list.subList(0, number));

+ 45 - 47
yami-shop-api/src/main/java/com/yami/shop/api/controller/ShopDetailController.java

@@ -32,7 +32,6 @@ import java.util.Objects;
 
 
 /**
- *
  * @author lgh on 2018/08/29.
  */
 @RestController
@@ -43,52 +42,51 @@ public class ShopDetailController {
 
     private final ShopDetailService shopDetailService;
 
-	private final UserCollectionShopService userCollectionShopService;
-
-	@GetMapping("/headInfo")
-	@ApiOperation(value = "店铺头部信息", notes = "获取的店铺头部信息")
-	public ResponseEntity<ShopHeadInfoDto> getShopHeadInfo(Long shopId) {
-		ShopHeadInfoDto shopHeadInfoDto = new ShopHeadInfoDto();
-		// 粉丝数量
-		int fansCount = userCollectionShopService.count(new LambdaQueryWrapper<UserCollectionShop>().eq(UserCollectionShop::getShopId, shopId));
-		ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(shopId);
-		if(!Objects.equals(shopDetail.getShopStatus(),1)){
-			shopHeadInfoDto.setShopStatus(shopDetail.getShopStatus());
-			return ResponseEntity.ok(shopHeadInfoDto);
-		}
-		shopHeadInfoDto.setShopId(shopId);
-		shopHeadInfoDto.setShopLogo(shopDetail.getShopLogo());
-		shopHeadInfoDto.setShopName(shopDetail.getShopName());
+    private final UserCollectionShopService userCollectionShopService;
+
+    @GetMapping("/headInfo")
+    @ApiOperation(value = "店铺头部信息", notes = "获取的店铺头部信息")
+    public ResponseEntity<ShopHeadInfoDto> getShopHeadInfo(Long shopId) {
+        ShopHeadInfoDto shopHeadInfoDto = new ShopHeadInfoDto();
+        // 粉丝数量
+        int fansCount = userCollectionShopService.count(new LambdaQueryWrapper<UserCollectionShop>().eq(UserCollectionShop::getShopId, shopId));
+        ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(shopId);
+        if (!Objects.equals(shopDetail.getShopStatus(), 1)) {
+            shopHeadInfoDto.setShopStatus(shopDetail.getShopStatus());
+            return ResponseEntity.ok(shopHeadInfoDto);
+        }
+        shopHeadInfoDto.setShopId(shopId);
+        shopHeadInfoDto.setShopLogo(shopDetail.getShopLogo());
+        shopHeadInfoDto.setShopName(shopDetail.getShopName());
         shopHeadInfoDto.setIntro(shopDetail.getIntro());
-		shopHeadInfoDto.setFansCount(fansCount);
-		shopHeadInfoDto.setTel(shopDetail.getTel());
-		shopHeadInfoDto.setThirdPartyCode(shopDetail.getThirdPartyCode());
-		return ResponseEntity.ok(shopHeadInfoDto);
-	}
-
-	@GetMapping("/hotShops")
-	@ApiOperation(value = "热门店铺", notes = "热门店铺")
-	public ResponseEntity<List<ShopHeadInfoDto>> hotShops() {
-		List<ShopHeadInfoDto> hotShopsHead =  shopDetailService.listHotShopsHead();
-
-		return ResponseEntity.ok(hotShopsHead);
-	}
-
-
-
-	@GetMapping("/searchShops")
-	@ApiOperation(value = "搜索店铺", notes = "根据店铺名称搜索店铺")
-	public ResponseEntity<Page<ShopHeadInfoDto>> searchShops(PageParam<ShopHeadInfoDto> page,ShopHeadInfoDto shopHeadInfoDto) {
-		Page<ShopHeadInfoDto> hotShopsHeadPage =  shopDetailService.searchShops(page,shopHeadInfoDto);
-
-		return ResponseEntity.ok(hotShopsHeadPage);
-	}
-
-	@GetMapping("/neighborShop")
-	@ApiOperation("根据经纬度获取最近店铺")
-	public ResponseEntity<ShopHeadInfoDto> neighborShop(@RequestParam("lat") String lat,
-														  @RequestParam("lon") String lon) {
-		return shopDetailService.neighborShop(lat, lon);
-	}
+        shopHeadInfoDto.setFansCount(fansCount);
+        shopHeadInfoDto.setTel(shopDetail.getTel());
+        shopHeadInfoDto.setThirdPartyCode(shopDetail.getThirdPartyCode());
+        return ResponseEntity.ok(shopHeadInfoDto);
+    }
+
+    @GetMapping("/hotShops")
+    @ApiOperation(value = "热门店铺", notes = "热门店铺")
+    public ResponseEntity<List<ShopHeadInfoDto>> hotShops() {
+        List<ShopHeadInfoDto> hotShopsHead = shopDetailService.listHotShopsHead();
+
+        return ResponseEntity.ok(hotShopsHead);
+    }
+
+
+    @GetMapping("/searchShops")
+    @ApiOperation(value = "搜索店铺", notes = "根据店铺名称搜索店铺")
+    public ResponseEntity<Page<ShopHeadInfoDto>> searchShops(PageParam<ShopHeadInfoDto> page, ShopHeadInfoDto shopHeadInfoDto) {
+        Page<ShopHeadInfoDto> hotShopsHeadPage = shopDetailService.searchShops(page, shopHeadInfoDto);
+
+        return ResponseEntity.ok(hotShopsHeadPage);
+    }
+
+    @GetMapping("/neighborShop")
+    @ApiOperation("根据经纬度获取最近店铺")
+    public ResponseEntity<ShopHeadInfoDto> neighborShop(@RequestParam("lat") String lat,
+                                                        @RequestParam("lon") String lon, @RequestParam("platform") Integer platform) {
+        return shopDetailService.neighborShop(lat, lon, platform);
+    }
 
 }

+ 199 - 198
yami-shop-api/src/main/java/com/yami/shop/api/controller/UserRegisterController.java

@@ -55,209 +55,210 @@ import java.util.Objects;
 
 /**
  * 用户信息
+ *
  * @author LGH
  */
 @RestController
 @RequestMapping("/user")
-@Api(tags="用户注册相关接口")
+@Api(tags = "用户注册相关接口")
 @AllArgsConstructor
 public class UserRegisterController {
 
-	private final UserService userService;
-
-	private final SmsLogService smsLogService;
-
-	private final AppConnectService appConnectService;
-
-	private final LoginAuthSuccessHandler loginAuthSuccessHandler;
-
-	private final WxConfig wxConfig;
-
-	private final YamiUserDetailsService yamiUserDetailsService;
-
-	private final PasswordEncoder passwordEncoder;
-
-
-	public static final String CHECK_REGISTER_SMS_FLAG = "checkRegisterSmsFlag";
-
-	public static final String CHECK_UPDATE_PWD_SMS_FLAG = "updatePwdSmsFlag";
-
-	@PutMapping("/sendRegisterSms")
-	@ApiOperation(value="发送注册验证码", notes="发送注册验证码")
-	public ResponseEntity<Void> register(@Valid @RequestBody SendSmsParam sendSmsParam) {
-		if (userService.count(new LambdaQueryWrapper<User>().eq(User::getUserMobile, sendSmsParam.getMobile())) > 0) {
-			throw new GlobalException("该手机号已注册,无法重新注册");
-		}
-		// 每个手机号每分钟只能发十个注册的验证码,免得接口被利用
-		smsLogService.sendSms(SmsType.REGISTER, sendSmsParam.getMobile(), sendSmsParam.getMobile(), Maps.newHashMap());
-		return ResponseEntity.ok().build();
-	}
-
-	@PutMapping("/checkRegisterSms")
-	@ApiOperation(value="校验验证码", notes="校验验证码返回校验成功的标识")
-	public ResponseEntity<String> register(@Valid @RequestBody CheckRegisterSmsParam checkRegisterSmsParam) {
-		// 每个ip每分钟只能发十个注册的验证码,免得接口被利用
-		if (!smsLogService.checkValidCode(checkRegisterSmsParam.getMobile(), checkRegisterSmsParam.getValidCode(), SmsType.REGISTER)){
-			throw new GlobalException("验证码有误或已过期");
-		}
-		String checkRegisterSmsFlag = IdUtil.simpleUUID();
-		RedisUtil.set(CHECK_REGISTER_SMS_FLAG + checkRegisterSmsFlag, checkRegisterSmsParam.getMobile(), 600);
-		return ResponseEntity.ok(checkRegisterSmsFlag);
-	}
-
-	@PutMapping("/sendBindSms")
-	@ApiOperation(value="发送绑定验证码", notes="发送绑定验证码")
-	public ResponseEntity<Void> bindSms(@Valid @RequestBody SendSmsParam sendSmsParam) {
-		// 每个手机号每分钟只能发十个注册的验证码,免得接口被利用
-		smsLogService.sendSms(SmsType.VALID, sendSmsParam.getMobile(), sendSmsParam.getMobile(), Maps.newHashMap());
-		return ResponseEntity.ok().build();
-	}
-
-	@PutMapping("/registerOrBindUser")
-	@ApiOperation(value="注册或绑定手机号", notes="用户注册或绑定手机号接口")
-	public ResponseEntity<Void> register(HttpServletRequest request, HttpServletResponse response, @Valid @RequestBody UserRegisterParam userRegisterParam) {
-
-		String mobile = userRegisterParam.getMobile();
-		AppConnect appConnect = null;
-		User user = null;
-		String bizUserId = null;
-
-
-		// 正在进行注册,通过验证码校验
-		if (Objects.equals(userRegisterParam.getRegisterOrBind(), 1)) {
-
-			// 看看有没有校验验证码成功的标识
-			userService.validate(userRegisterParam, CHECK_REGISTER_SMS_FLAG + userRegisterParam.getCheckRegisterSmsFlag());
-			// 正在进行申请注册
-			if (userService.count(new LambdaQueryWrapper<User>().eq(User::getUserMobile,userRegisterParam.getMobile())) > 0) {
-				throw new GlobalException("手机号已存在,无法注册");
-			}
-		}
-		// 小程序注册/绑定手机号
-		else {
-			YamiUser yamiUser =  SecurityUtils.getUser();
-			appConnect = appConnectService.getByBizUserId(yamiUser.getBizUserId(), yamiUser.getAppType());
-			bizUserId = yamiUser.getBizUserId();
-			// 通过微信手机号校验
-			if (Objects.equals(2, userRegisterParam.getValidateType())) {
-				try {
-					WxMaPhoneNumberInfo wxMaPhoneNumberInfo = wxConfig.getWxMaService().getUserService().getPhoneNoInfo(yamiUser.getSessionKey(), userRegisterParam.getEncryptedData(), userRegisterParam.getIvStr());
-					mobile = wxMaPhoneNumberInfo.getPhoneNumber();
-
-				} catch (Exception e) {
-					throw new GlobalException("授权失败,请重新授权");
-				}
-				if (StrUtil.isBlank(mobile)) {
-					throw new GlobalException("无法获取用户手机号信息");
-				}
-				user = yamiUserDetailsService.loadUserByMobileOrUserName(mobile, 0);
-			}
-			// 通过账号密码校验
-			else if (Objects.equals(3, userRegisterParam.getValidateType())) {
-				user = yamiUserDetailsService.loadUserByMobileOrUserName(mobile, 0);
-				if (user == null) {
-					throw new GlobalException("账号或密码不正确");
-				}
-				String encodedPassword = user.getLoginPassword();
-				String rawPassword = userRegisterParam.getPassword();
-				// 密码不正确
-				if (StrUtil.isBlank(encodedPassword) || !passwordEncoder.matches(rawPassword,encodedPassword)){
-					throw new GlobalException("账号或密码不正确");
-				}
-			}
-			// 通过验证码校验
-			else {
-				if (!smsLogService.checkValidCode(userRegisterParam.getMobile(), userRegisterParam.getValidCode(), SmsType.VALID)){
-					throw new GlobalException("验证码有误或已过期");
-				}
-			}
-		}
-
-		Date now = new Date();
-
-		// 尝试用手机号获取用户信息
-		if (user == null && StrUtil.isNotBlank(mobile)) {
-			user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile,mobile));
-		}
-
-		// 新建用户
-		if (user == null) {
-			user = new User();
-			if (StrUtil.isBlank(userRegisterParam.getUserName())) {
-				userRegisterParam.setUserName(mobile);
-			}
-
-			// 如果有用户名,就判断用户名格式是否正确
-			if (!PrincipalUtil.isUserName(userRegisterParam.getUserName())) {
-				throw new GlobalException("用户名应由4-16位数字字母下划线组成");
-			}
-
-			user.setModifyTime(now);
-			user.setUserRegtime(now);
-			user.setUserRegip(IPHelper.getIpAddr());
-			user.setStatus(1);
-
-			user.setPic(userRegisterParam.getImg());
-			user.setUserMobile(mobile);
-			user.setUserName(userRegisterParam.getUserName());
-			if (StrUtil.isNotBlank(userRegisterParam.getPassword())) {
-				user.setLoginPassword(passwordEncoder.encode(userRegisterParam.getPassword()));
-			}
-			// 用户名就是默认的昵称
-			user.setNickName(StrUtil.isBlank(userRegisterParam.getNickName())? userRegisterParam.getUserName(): userRegisterParam.getNickName());
-		}
-
-
-		appConnectService.registerOrBindUser(user, appConnect, userRegisterParam.getAppType());
-
-
-		//进行授权登录
-		UserDetails userDetails = yamiUserDetailsService.getYamiUser(userRegisterParam.getAppType(),user, bizUserId);
-		AuthenticationToken authenticationToken = new AuthenticationToken();
-		authenticationToken.setPrincipal(user.getUserMobile());
-		authenticationToken.setCredentials(user.getLoginPassword());
-		authenticationToken.setPrincipal(userDetails.getUsername());
-		authenticationToken.setDetails(userDetails);
-		authenticationToken.setAuthenticated(true);
-		loginAuthSuccessHandler.onAuthenticationSuccess(request,response,authenticationToken);
-
-		return ResponseEntity.ok().build();
-	}
-
-
-	@PutMapping("/checkUpdatePwdSms")
-	@ApiOperation(value="修改密码校验验证码", notes="校验验证码返回校验成功的标识")
-	public ResponseEntity<String> checkUpdatePwdSms(@Valid @RequestBody CheckRegisterSmsParam checkRegisterSmsParam) {
-		User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, checkRegisterSmsParam.getMobile()));
-		if (user == null) {
-			throw new GlobalException("无法获取用户信息");
-		}
-		if (!smsLogService.checkValidCode(user.getUserMobile(), checkRegisterSmsParam.getValidCode(), SmsType.UPDATE_PASSWORD)){
-			throw new GlobalException("验证码有误或已过期");
-		}
-		String checkRegisterSmsFlag = IdUtil.simpleUUID();
-		RedisUtil.set(CHECK_UPDATE_PWD_SMS_FLAG + checkRegisterSmsFlag, checkRegisterSmsParam.getMobile(), 600);
-		return ResponseEntity.ok(checkRegisterSmsFlag);
-	}
-
-	@PutMapping("/updatePwd")
-	@ApiOperation(value="修改密码", notes="修改密码")
-	public ResponseEntity<Void> updatePwd(@Valid @RequestBody UserRegisterParam userRegisterParam) {
-		User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, userRegisterParam.getMobile()));
-		if (user == null) {
-			throw new GlobalException("无法获取用户信息");
-		}
-		// 看看有没有校验验证码成功的标识
-		userService.validate(userRegisterParam, CHECK_UPDATE_PWD_SMS_FLAG + userRegisterParam.getCheckRegisterSmsFlag());
-		if (StrUtil.isBlank(userRegisterParam.getPassword())) {
-			throw new GlobalException("新密码不能为空");
-		}
-		if (StrUtil.equals(passwordEncoder.encode(userRegisterParam.getPassword()),user.getLoginPassword())) {
-			throw new GlobalException("新密码不能与原密码相同!");
-		}
-		user.setModifyTime(new Date());
-		user.setLoginPassword(passwordEncoder.encode(userRegisterParam.getPassword()));
-		userService.updateById(user);
-		return ResponseEntity.ok().build();
-	}
+    private final UserService userService;
+
+    private final SmsLogService smsLogService;
+
+    private final AppConnectService appConnectService;
+
+    private final LoginAuthSuccessHandler loginAuthSuccessHandler;
+
+    private final WxConfig wxConfig;
+
+    private final YamiUserDetailsService yamiUserDetailsService;
+
+    private final PasswordEncoder passwordEncoder;
+
+
+    public static final String CHECK_REGISTER_SMS_FLAG = "checkRegisterSmsFlag";
+
+    public static final String CHECK_UPDATE_PWD_SMS_FLAG = "updatePwdSmsFlag";
+
+    @PutMapping("/sendRegisterSms")
+    @ApiOperation(value = "发送注册验证码", notes = "发送注册验证码")
+    public ResponseEntity<Void> register(@Valid @RequestBody SendSmsParam sendSmsParam) {
+        if (userService.count(new LambdaQueryWrapper<User>().eq(User::getUserMobile, sendSmsParam.getMobile())) > 0) {
+            throw new GlobalException("该手机号已注册,无法重新注册");
+        }
+        // 每个手机号每分钟只能发十个注册的验证码,免得接口被利用
+        smsLogService.sendSms(SmsType.REGISTER, sendSmsParam.getMobile(), sendSmsParam.getMobile(), Maps.newHashMap());
+        return ResponseEntity.ok().build();
+    }
+
+    @PutMapping("/checkRegisterSms")
+    @ApiOperation(value = "校验验证码", notes = "校验验证码返回校验成功的标识")
+    public ResponseEntity<String> register(@Valid @RequestBody CheckRegisterSmsParam checkRegisterSmsParam) {
+        // 每个ip每分钟只能发十个注册的验证码,免得接口被利用
+        if (!smsLogService.checkValidCode(checkRegisterSmsParam.getMobile(), checkRegisterSmsParam.getValidCode(), SmsType.REGISTER)) {
+            throw new GlobalException("验证码有误或已过期");
+        }
+        String checkRegisterSmsFlag = IdUtil.simpleUUID();
+        RedisUtil.set(CHECK_REGISTER_SMS_FLAG + checkRegisterSmsFlag, checkRegisterSmsParam.getMobile(), 600);
+        return ResponseEntity.ok(checkRegisterSmsFlag);
+    }
+
+    @PutMapping("/sendBindSms")
+    @ApiOperation(value = "发送绑定验证码", notes = "发送绑定验证码")
+    public ResponseEntity<Void> bindSms(@Valid @RequestBody SendSmsParam sendSmsParam) {
+        // 每个手机号每分钟只能发十个注册的验证码,免得接口被利用
+        smsLogService.sendSms(SmsType.VALID, sendSmsParam.getMobile(), sendSmsParam.getMobile(), Maps.newHashMap());
+        return ResponseEntity.ok().build();
+    }
+
+    @PutMapping("/registerOrBindUser")
+    @ApiOperation(value = "注册或绑定手机号", notes = "用户注册或绑定手机号接口")
+    public ResponseEntity<Void> register(HttpServletRequest request, HttpServletResponse response, @Valid @RequestBody UserRegisterParam userRegisterParam) {
+
+        String mobile = userRegisterParam.getMobile();
+        AppConnect appConnect = null;
+        User user = null;
+        String bizUserId = null;
+
+
+        // 正在进行注册,通过验证码校验
+        if (Objects.equals(userRegisterParam.getRegisterOrBind(), 1)) {
+
+            // 看看有没有校验验证码成功的标识
+            userService.validate(userRegisterParam, CHECK_REGISTER_SMS_FLAG + userRegisterParam.getCheckRegisterSmsFlag());
+            // 正在进行申请注册
+            if (userService.count(new LambdaQueryWrapper<User>().eq(User::getUserMobile, userRegisterParam.getMobile())) > 0) {
+                throw new GlobalException("手机号已存在,无法注册");
+            }
+        }
+        // 小程序注册/绑定手机号
+        else {
+            // 检查用户是否已经认证,只有在认证状态下才获取用户信息
+                YamiUser yamiUser = SecurityUtils.getUser();
+                appConnect = appConnectService.getByBizUserId(yamiUser.getBizUserId(), yamiUser.getAppType());
+                bizUserId = yamiUser.getBizUserId();
+                // 通过微信手机号校验
+                if (Objects.equals(2, userRegisterParam.getValidateType())) {
+                    try {
+                        WxMaPhoneNumberInfo wxMaPhoneNumberInfo = wxConfig.getWxMaService().getUserService().getPhoneNoInfo(yamiUser.getSessionKey(), userRegisterParam.getEncryptedData(), userRegisterParam.getIvStr());
+                        mobile = wxMaPhoneNumberInfo.getPhoneNumber();
+
+                    } catch (Exception e) {
+                        throw new GlobalException("授权失败,请重新授权");
+                    }
+                    if (StrUtil.isBlank(mobile)) {
+                        throw new GlobalException("无法获取用户手机号信息");
+                    }
+                    user = yamiUserDetailsService.loadUserByMobileOrUserName(mobile, 0);
+                }
+                // 通过账号密码校验
+                else if (Objects.equals(3, userRegisterParam.getValidateType())) {
+                    user = yamiUserDetailsService.loadUserByMobileOrUserName(mobile, 0);
+                    if (user == null) {
+                        throw new GlobalException("账号或密码不正确");
+                    }
+                    String encodedPassword = user.getLoginPassword();
+                    String rawPassword = userRegisterParam.getPassword();
+                    // 密码不正确
+                    if (StrUtil.isBlank(encodedPassword) || !passwordEncoder.matches(rawPassword, encodedPassword)) {
+                        throw new GlobalException("账号或密码不正确");
+                    }
+                }
+                // 通过验证码校验
+                else {
+                    if (!smsLogService.checkValidCode(userRegisterParam.getMobile(), userRegisterParam.getValidCode(), SmsType.VALID)) {
+                        throw new GlobalException("验证码有误或已过期");
+                    }
+                }
+        }
+
+        Date now = new Date();
+        if (user == null && StrUtil.isNotBlank(mobile)) {
+            user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, mobile).eq(User::getPlatform, userRegisterParam.getPlatform()));
+        }
+
+        // 新建用户
+        if (user == null) {
+            user = new User();
+            if (StrUtil.isBlank(userRegisterParam.getUserName())) {
+                userRegisterParam.setUserName(mobile);
+            }
+
+            // 如果有用户名,就判断用户名格式是否正确
+            if (!PrincipalUtil.isUserName(userRegisterParam.getUserName())) {
+                throw new GlobalException("用户名应由4-16位数字字母下划线组成");
+            }
+
+            user.setModifyTime(now);
+            user.setUserRegtime(now);
+            user.setUserRegip(IPHelper.getIpAddr());
+            user.setStatus(1);
+			user.setPlatform(userRegisterParam.getPlatform());
+            user.setPic(userRegisterParam.getImg());
+            user.setUserMobile(mobile);
+            user.setUserName(userRegisterParam.getUserName());
+            if (StrUtil.isNotBlank(userRegisterParam.getPassword())) {
+                user.setLoginPassword(passwordEncoder.encode(userRegisterParam.getPassword()));
+            }
+            // 用户名就是默认的昵称
+            user.setNickName(StrUtil.isBlank(userRegisterParam.getNickName()) ? userRegisterParam.getUserName() : userRegisterParam.getNickName());
+        }
+
+
+        appConnectService.registerOrBindUser(user, appConnect, userRegisterParam.getAppType());
+
+
+        //进行授权登录
+        UserDetails userDetails = yamiUserDetailsService.getYamiUser(userRegisterParam.getAppType(), user, bizUserId);
+        AuthenticationToken authenticationToken = new AuthenticationToken();
+        authenticationToken.setPrincipal(user.getUserMobile());
+        authenticationToken.setCredentials(user.getLoginPassword());
+        authenticationToken.setPrincipal(userDetails.getUsername());
+        authenticationToken.setDetails(userDetails);
+        authenticationToken.setAuthenticated(true);
+//        authenticationToken.setPlatform(user.getPlatform());
+        loginAuthSuccessHandler.onAuthenticationSuccess(request, response, authenticationToken);
+
+        return ResponseEntity.ok().build();
+    }
+
+
+    @PutMapping("/checkUpdatePwdSms")
+    @ApiOperation(value = "修改密码校验验证码", notes = "校验验证码返回校验成功的标识")
+    public ResponseEntity<String> checkUpdatePwdSms(@Valid @RequestBody CheckRegisterSmsParam checkRegisterSmsParam) {
+        User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, checkRegisterSmsParam.getMobile()));
+        if (user == null) {
+            throw new GlobalException("无法获取用户信息");
+        }
+        if (!smsLogService.checkValidCode(user.getUserMobile(), checkRegisterSmsParam.getValidCode(), SmsType.UPDATE_PASSWORD)) {
+            throw new GlobalException("验证码有误或已过期");
+        }
+        String checkRegisterSmsFlag = IdUtil.simpleUUID();
+        RedisUtil.set(CHECK_UPDATE_PWD_SMS_FLAG + checkRegisterSmsFlag, checkRegisterSmsParam.getMobile(), 600);
+        return ResponseEntity.ok(checkRegisterSmsFlag);
+    }
+
+    @PutMapping("/updatePwd")
+    @ApiOperation(value = "修改密码", notes = "修改密码")
+    public ResponseEntity<Void> updatePwd(@Valid @RequestBody UserRegisterParam userRegisterParam) {
+        User user = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, userRegisterParam.getMobile()));
+        if (user == null) {
+            throw new GlobalException("无法获取用户信息");
+        }
+        // 看看有没有校验验证码成功的标识
+        userService.validate(userRegisterParam, CHECK_UPDATE_PWD_SMS_FLAG + userRegisterParam.getCheckRegisterSmsFlag());
+        if (StrUtil.isBlank(userRegisterParam.getPassword())) {
+            throw new GlobalException("新密码不能为空");
+        }
+        if (StrUtil.equals(passwordEncoder.encode(userRegisterParam.getPassword()), user.getLoginPassword())) {
+            throw new GlobalException("新密码不能与原密码相同!");
+        }
+        user.setModifyTime(new Date());
+        user.setLoginPassword(passwordEncoder.encode(userRegisterParam.getPassword()));
+        userService.updateById(user);
+        return ResponseEntity.ok().build();
+    }
 }

+ 5 - 6
yami-shop-api/src/main/java/com/yami/shop/api/listener/ConfirmOrderListener.java

@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.yami.shop.bean.app.dto.ShopCartItemDto;
 import com.yami.shop.bean.app.dto.ShopCartOrderDto;
 import com.yami.shop.bean.app.param.OrderParam;
-import com.yami.shop.bean.enums.DvyType;
 import com.yami.shop.bean.event.ConfirmOrderEvent;
 import com.yami.shop.bean.model.FreightFeeReduction;
 import com.yami.shop.bean.model.Product;
@@ -105,11 +104,11 @@ public class ConfirmOrderListener {
             shopCartItem.setActualTotal(shopCartItem.getProductTotalAmount());
             shopCartOrderDto.setTotalWeight(Arith.add(shopCartOrderDto.getTotalWeight(), Arith.mul(shopCartItem.getWeight(), shopCartItem.getProdCount())));
         }
-
-        if (userAddr != null && !Objects.equals(orderParam.getDvyType(), DvyType.FETCH.value())) {
-            // 将所有订单传入处理,计算运费
-            transfee = transportManagerService.calculateTransfeeSecond2(shopCartItems.get(0).getShopId(), userAddr);
-        }
+//TODO wangjian
+//        if (userAddr != null && !Objects.equals(orderParam.getDvyType(), DvyType.FETCH.value())) {
+//            // 将所有订单传入处理,计算运费
+//            transfee = transportManagerService.calculateTransfeeSecond2(shopCartItems.get(0).getShopId(), userAddr);
+//        }
 
         Double freeTransfee = 0.0;
         List<FreightFeeReduction> feeReductions = freightFeeReductionService.list(new LambdaQueryWrapper<FreightFeeReduction>()

+ 28 - 25
yami-shop-bean/src/main/java/com/yami/shop/bean/app/param/UserRegisterParam.java

@@ -19,43 +19,46 @@ import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Pattern;
 
 @Data
-@ApiModel(value= "设置用户信息")
+@ApiModel(value = "设置用户信息")
 public class UserRegisterParam {
 
-	@ApiModelProperty(value = "密码")
-	private String password;
+    @ApiModelProperty(value = "密码")
+    private String password;
 
-	@ApiModelProperty(value = "手机号")
-	private String mobile;
+    @ApiModelProperty(value = "手机号")
+    private String mobile;
 
-	@ApiModelProperty(value = "验证码")
-	private String validCode;
+    @ApiModelProperty(value = "验证码")
+    private String validCode;
 
-	@ApiModelProperty(value = "微信小程序的encryptedData")
-	private String encryptedData;
+    @ApiModelProperty(value = "微信小程序的encryptedData")
+    private String encryptedData;
 
-	@ApiModelProperty(value = "微信小程序的ivStr")
-	private String ivStr;
+    @ApiModelProperty(value = "微信小程序的ivStr")
+    private String ivStr;
 
-	@ApiModelProperty(value = "头像")
-	private String img;
+    @ApiModelProperty(value = "头像")
+    private String img;
 
-	@ApiModelProperty(value = "昵称")
-	private String nickName;
+    @ApiModelProperty(value = "昵称")
+    private String nickName;
 
-	@ApiModelProperty(value = "用户名")
-	private String userName;
+    @ApiModelProperty(value = "用户名")
+    private String userName;
 
-	@ApiModelProperty(value = "应用类型 1小程序 2微信公众号 3 PC 4 h5")
-	private Integer appType;
+    @ApiModelProperty(value = "应用类型 1小程序 2微信公众号 3 PC 4 h5")
+    private Integer appType;
 
-	@ApiModelProperty(value = "校验登陆注册验证码成功的标识")
-	private String checkRegisterSmsFlag;
+    @ApiModelProperty(value = "校验登陆注册验证码成功的标识")
+    private String checkRegisterSmsFlag;
 
-	@ApiModelProperty(value = "验证类型 1验证码验证 2 小程序encryptedData验证 3 密码验证 ")
-	private Integer validateType;
+    @ApiModelProperty(value = "验证类型 1验证码验证 2 小程序encryptedData验证 3 密码验证 ")
+    private Integer validateType;
 
-	@ApiModelProperty(value = "验证类型 1注册 2绑定 ")
-	private Integer registerOrBind;
+    @ApiModelProperty(value = "验证类型 1注册 2绑定 ")
+    private Integer registerOrBind;
+
+    @ApiModelProperty(value = "平台 1即使零售企业用户 2夫妻店 3 市民请集合C端 ")
+    private Integer platform;
 
 }

+ 5 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/dto/SearchProdDto.java

@@ -60,4 +60,9 @@ public class SearchProdDto {
     @ApiModelProperty(value = "sku列表")
     private List<SkuDto> skuList;
 
+    @ApiModelProperty(value = "banners图片列表")
+    private List<String> banners;
+
+
+
 }

+ 16 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/dto/ShopCategoryDto.java

@@ -0,0 +1,16 @@
+package com.yami.shop.bean.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * TODO
+ *
+ * @author mr wang
+ * @version 1.0.0
+ * @since 2025-09-23
+ */
+@Data
+@ApiModel("门店类目数据")
+public class ShopCategoryDto {
+}

+ 0 - 52
yami-shop-bean/src/main/java/com/yami/shop/bean/enums/DvyType.java

@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
- *
- * https://www.gz-yami.com/
- *
- * 未经允许,不可做商业用途!
- *
- * 版权所有,侵权必究!
- */
-
-package com.yami.shop.bean.enums;
-
-/**
- * 配送类型
- */
-public enum DvyType {
-
-    /**
-     * 快递
-     */
-    DELIVERY(1),
-    /**
-     * 自提
-     */
-    FETCH(2),
-
-    /**
-     * 无需快递
-     */
-    NOT_DELIVERY(3)
-    ;
-
-    private Integer num;
-
-    public Integer value() {
-        return num;
-    }
-
-    DvyType(Integer num) {
-        this.num = num;
-    }
-
-    public static DvyType instance(Integer value) {
-        DvyType[] enums = values();
-        for (DvyType statusEnum : enums) {
-            if (statusEnum.value().equals(value)) {
-                return statusEnum;
-            }
-        }
-        return null;
-    }
-}

+ 2 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/model/User.java

@@ -150,4 +150,6 @@ public class User implements Serializable {
      */
     @TableField(exist = false)
     private String levelName;
+
+    private Integer platform;
 }

+ 2 - 0
yami-shop-security/yami-shop-security-comment/src/main/java/com/yami/shop/security/comment/token/AuthenticationToken.java

@@ -21,6 +21,7 @@ import java.util.Collection;
 
 /**
  * 自定义AbstractAuthenticationToken,
+ *
  * @author LGH
  */
 @Getter
@@ -55,6 +56,7 @@ public class AuthenticationToken implements Authentication,
      * app类型 见com.yami.shop.security.comment.enums.App
      */
     private Integer appType;
+//    private Integer platform;
 
     /**
      * 0 用户名或手机号 1短信验证码

+ 2 - 1
yami-shop-service/src/main/java/com/yami/shop/dao/ShopDetailMapper.java

@@ -44,6 +44,7 @@ public interface ShopDetailMapper extends BaseMapper<ShopDetail> {
 
     /**
      * 根据海博编码查询门店信息
+     *
      * @param hbStationId 海博门店编码
      * @return
      */
@@ -61,7 +62,7 @@ public interface ShopDetailMapper extends BaseMapper<ShopDetail> {
     ShopDetail selectShopDetailById(@Param("shopId") Long shopId);
 
     List<ShopDetail> neighborShop(@Param("lat") String lat,
-                        @Param("lon") String lon);
+                                  @Param("lon") String lon, @Param("platform") Integer platform);
 
 
 }

+ 59 - 55
yami-shop-service/src/main/java/com/yami/shop/service/ShopDetailService.java

@@ -24,83 +24,87 @@ import org.springframework.http.ResponseEntity;
 import java.util.List;
 
 /**
- *
  * @author lgh on 2018/08/29.
  */
 public interface ShopDetailService extends IService<ShopDetail> {
 
-	void updateShopDetail(ShopDetail shopDetail,ShopDetail dbShopDetail);
+    void updateShopDetail(ShopDetail shopDetail, ShopDetail dbShopDetail);
 
-	void deleteShopDetailByShopId(Long id);
+    void deleteShopDetailByShopId(Long id);
 
-	/**
-	 * 根据店铺id获取店铺信息
-	 * @param shopId
-	 * @return
-	 */
-	ShopDetail getShopDetailByShopId(Long shopId);
+    /**
+     * 根据店铺id获取店铺信息
+     *
+     * @param shopId
+     * @return
+     */
+    ShopDetail getShopDetailByShopId(Long shopId);
 
-	void removeShopDetailCacheByShopId(Long shopId);
+    void removeShopDetailCacheByShopId(Long shopId);
 
-	/**
-	 * 根据店铺的手机号(登陆账号),获取店铺信息
-	 *
-	 * @param mobile 手机号
-	 * @return
-	 */
-	ShopDetail getShopByMobile(@Param("mobile") String mobile);
+    /**
+     * 根据店铺的手机号(登陆账号),获取店铺信息
+     *
+     * @param mobile 手机号
+     * @return
+     */
+    ShopDetail getShopByMobile(@Param("mobile") String mobile);
 
-	void updatePasswordByUserName(String username, String newPassword);
+    void updatePasswordByUserName(String username, String newPassword);
 
-	/**
-	 * 根据用户id查询店铺信息
-	 */
-	ShopDetail getShopDetailByUserId(String userId);
+    /**
+     * 根据用户id查询店铺信息
+     */
+    ShopDetail getShopDetailByUserId(String userId);
 
-	/**
-	 * 申请开店铺
-	 */
-	void applyShop(String userId, ShopDetailParam shopDetailParam);
+    /**
+     * 申请开店铺
+     */
+    void applyShop(String userId, ShopDetailParam shopDetailParam);
 
-	/**
-	 * 审核商家信息
-	 */
-	boolean audit(ShopAuditing shopAuditing);
+    /**
+     * 审核商家信息
+     */
+    boolean audit(ShopAuditing shopAuditing);
 
-	/**
-	 *  平台 --下线活动商品
-	 */
+    /**
+     * 平台 --下线活动商品
+     */
     void offline(ShopDetail shopDetail, String offlineReason, Long sysUserId);
 
-	/**
-	 * 申请审核
-	 */
-	void auditApply(Long eventId, Long handleId, String reapplyReason);
-
-	/**
-	 * 审核下线商店
-	 */
-	void auditOfflineShop(OfflineHandleEventAuditParam offlineHandleEventAuditParam, Long sysUserId);
-
-	/**
-	 * 热门店铺
-	 * @return
-	 */
+    /**
+     * 申请审核
+     */
+    void auditApply(Long eventId, Long handleId, String reapplyReason);
+
+    /**
+     * 审核下线商店
+     */
+    void auditOfflineShop(OfflineHandleEventAuditParam offlineHandleEventAuditParam, Long sysUserId);
+
+    /**
+     * 热门店铺
+     *
+     * @return
+     */
     List<ShopHeadInfoDto> listHotShopsHead();
 
-	/**
-	 * 分页搜索店铺
-	 * @param page
-	 * @param shopHeadInfoDto
-	 * @return
-	 */
+    /**
+     * 分页搜索店铺
+     *
+     * @param page
+     * @param shopHeadInfoDto
+     * @return
+     */
     Page<ShopHeadInfoDto> searchShops(PageParam<ShopHeadInfoDto> page, ShopHeadInfoDto shopHeadInfoDto);
 
     void insertDetail(ShopDetail shopDetail);
 
-	int checkMobile(String mobile, Long shopId);
+    int checkMobile(String mobile, Long shopId);
 
-	void updatePasswordOrMobile(Long shopId, String password, String mobile);
+    void updatePasswordOrMobile(Long shopId, String password, String mobile);
 
     ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon);
+
+    ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon, Integer platform);
 }

+ 4 - 0
yami-shop-service/src/main/java/com/yami/shop/service/impl/ProductServiceImpl.java

@@ -210,7 +210,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         String lat = searchParam.getLat();
         String lon = searchParam.getLon();
         String distance = searchParam.getDistance();
+
         if (StringUtils.isNotEmpty(lat) && StringUtils.isNotEmpty(lon) && StringUtils.isNotEmpty(distance)) {
+            //TODO wangjian 查询渠道商已经存在的店铺
             List<ShopDetail> shopDetails = productMapper.queryShop(lat, lon, distance);
             List<Long> shopIds = shopDetails.stream().map(ShopDetail::getShopId).collect(Collectors.toList());
             if (CollectionUtil.isEmpty(shopDetails)) {
@@ -238,6 +240,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         for (SearchProdDto searchProdDto : searchProdDtoPage.getRecords()) {
             List<Sku> skus = skuMapper.listByProdId(searchProdDto.getProdId());
             List<SkuDto> skuList = new ArrayList<>();
+            //TODO wangjian 查询具体的价格
             skus.forEach(sku -> {
                 SkuDto skuDto = new SkuDto();
                 skuDto.setSkuName(sku.getSkuName());
@@ -731,6 +734,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         }
         productIPage.getRecords().forEach(product -> {
             List<Sku> skus = skuMapper.selectList(Wrappers.<Sku>lambdaQuery().eq(Sku::getProdId, product.getProdId()));
+            //TODO wangjian 查询具体的价格
             product.setSkuList(skus);
         });
         return productIPage;

+ 16 - 7
yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopDetailServiceImpl.java

@@ -259,7 +259,7 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
 
     @Override
     public Page<ShopHeadInfoDto> searchShops(PageParam<ShopHeadInfoDto> page, ShopHeadInfoDto shopHeadInfoDto) {
-        return shopDetailMapper.searchShops(page,shopHeadInfoDto);
+        return shopDetailMapper.searchShops(page, shopHeadInfoDto);
     }
 
     @Override
@@ -270,7 +270,7 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
         shopDetail.setCreateTime(date);
         shopDetail.setUpdateTime(date);
         shopDetail.setPassword(passwordEncoder.encode(shopDetail.getPassword()));
-        if (this.checkMobile(shopDetail.getMobile(),null)>0){
+        if (this.checkMobile(shopDetail.getMobile(), null) > 0) {
             throw new GlobalException("该账号已存在,请重新输入");
         }
         shopDetailMapper.insert(shopDetail);
@@ -288,9 +288,9 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
 
     @Override
     public int checkMobile(String mobile, Long shopId) {
-        return  count(new LambdaQueryWrapper<ShopDetail>()
+        return count(new LambdaQueryWrapper<ShopDetail>()
                 .eq(ShopDetail::getMobile, mobile)
-                .ne(Objects.nonNull(shopId),ShopDetail::getShopId,shopId)
+                .ne(Objects.nonNull(shopId), ShopDetail::getShopId, shopId)
         );
     }
 
@@ -300,8 +300,8 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
         ShopDetail shopDetail = new ShopDetail();
         shopDetail.setShopId(shopId);
         shopDetail.setPassword(passwordEncoder.encode(password));
-        if (Objects.nonNull(mobile)){
-            if (this.checkMobile(shopDetail.getMobile(),shopId)>0){
+        if (Objects.nonNull(mobile)) {
+            if (this.checkMobile(shopDetail.getMobile(), shopId) > 0) {
                 throw new GlobalException("该账号已存在,请重新输入");
             }
             shopDetail.setMobile(mobile);
@@ -311,7 +311,16 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
 
     @Override
     public ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon) {
-        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon);
+        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon,null);
+        ShopHeadInfoDto dto = new ShopHeadInfoDto();
+        dto.setShopId(shopDetails.get(0).getShopId());
+        dto.setShopName(shopDetails.get(0).getShopName());
+        return ResponseEntity.ok(dto);
+    }
+
+    @Override
+    public ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon,Integer platform) {
+        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon,platform);
         ShopHeadInfoDto dto = new ShopHeadInfoDto();
         dto.setShopId(shopDetails.get(0).getShopId());
         dto.setShopName(shopDetails.get(0).getShopName());

+ 1 - 0
yami-shop-service/src/main/java/com/yami/shop/service/impl/SkuServiceImpl.java

@@ -36,6 +36,7 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
 	@Override
 	@Cacheable(cacheNames = "skuList", key = "#prodId")
 	public List<Sku> listByProdId(Long prodId) {
+		//TODO wangjian 查询具体的价格
 		return skuMapper.listByProdId(prodId);
 	}
 

+ 185 - 95
yami-shop-service/src/main/resources/mapper/ShopDetailMapper.xml

@@ -1,59 +1,82 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yami.shop.dao.ShopDetailMapper">
-  <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.ShopDetail">
-    <!--
-      WARNING - @mbg.generated
-    -->
-    <id column="shop_id" jdbcType="BIGINT" property="shopId" />
-    <result column="shop_name" jdbcType="VARCHAR" property="shopName" />
-    <result column="out_station_no" jdbcType="VARCHAR" property="outStationNo" />
-    <result column="user_id" jdbcType="VARCHAR" property="userId" />
-    <result column="intro" jdbcType="VARCHAR" property="intro" />
-    <result column="shop_owner" jdbcType="VARCHAR" property="shopOwner" />
-    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
-    <result column="tel" jdbcType="VARCHAR" property="tel" />
-    <result column="shop_lat" jdbcType="VARCHAR" property="shopLat" />
-    <result column="shop_lng" jdbcType="VARCHAR" property="shopLng" />
-    <result column="shop_address" jdbcType="VARCHAR" property="shopAddress" />
-    <result column="province" jdbcType="VARCHAR" property="province" />
-    <result column="province_id" jdbcType="BIGINT" property="provinceId" />
-    <result column="city" jdbcType="VARCHAR" property="city" />
-    <result column="city_id" jdbcType="BIGINT" property="cityId" />
-    <result column="area" jdbcType="VARCHAR" property="area" />
-    <result column="area_id" jdbcType="BIGINT" property="areaId" />
-    <result column="shop_logo" jdbcType="VARCHAR" property="shopLogo" />
-    <result column="shop_status" jdbcType="TINYINT" property="shopStatus" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="is_distribution" jdbcType="TINYINT" property="isDistribution" />
-    <result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
-    <result column="identity_card_front" jdbcType="VARCHAR" property="identityCardFront" />
-    <result column="identity_card_later" jdbcType="VARCHAR" property="identityCardLater" />
-    <result column="shop_code" jdbcType="VARCHAR" property="shopCode" />
-    <result column="map_type" jdbcType="VARCHAR" property="mapType" />
-    <result column="category" jdbcType="VARCHAR" property="category" />
-    <result column="sync" jdbcType="TINYINT" property="sync" />
+    <resultMap id="BaseResultMap" type="com.yami.shop.bean.model.ShopDetail">
+        <!--
+          WARNING - @mbg.generated
+        -->
+        <id column="shop_id" jdbcType="BIGINT" property="shopId"/>
+        <result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
+        <result column="out_station_no" jdbcType="VARCHAR" property="outStationNo"/>
+        <result column="user_id" jdbcType="VARCHAR" property="userId"/>
+        <result column="intro" jdbcType="VARCHAR" property="intro"/>
+        <result column="shop_owner" jdbcType="VARCHAR" property="shopOwner"/>
+        <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
+        <result column="tel" jdbcType="VARCHAR" property="tel"/>
+        <result column="shop_lat" jdbcType="VARCHAR" property="shopLat"/>
+        <result column="shop_lng" jdbcType="VARCHAR" property="shopLng"/>
+        <result column="shop_address" jdbcType="VARCHAR" property="shopAddress"/>
+        <result column="province" jdbcType="VARCHAR" property="province"/>
+        <result column="province_id" jdbcType="BIGINT" property="provinceId"/>
+        <result column="city" jdbcType="VARCHAR" property="city"/>
+        <result column="city_id" jdbcType="BIGINT" property="cityId"/>
+        <result column="area" jdbcType="VARCHAR" property="area"/>
+        <result column="area_id" jdbcType="BIGINT" property="areaId"/>
+        <result column="shop_logo" jdbcType="VARCHAR" property="shopLogo"/>
+        <result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="is_distribution" jdbcType="TINYINT" property="isDistribution"/>
+        <result column="business_license" jdbcType="VARCHAR" property="businessLicense"/>
+        <result column="identity_card_front" jdbcType="VARCHAR" property="identityCardFront"/>
+        <result column="identity_card_later" jdbcType="VARCHAR" property="identityCardLater"/>
+        <result column="shop_code" jdbcType="VARCHAR" property="shopCode"/>
+        <result column="map_type" jdbcType="VARCHAR" property="mapType"/>
+        <result column="category" jdbcType="VARCHAR" property="category"/>
+        <result column="sync" jdbcType="TINYINT" property="sync"/>
 
-  </resultMap>
-  <select id="getShopByMobile" resultMap="BaseResultMap">
-    select * from tz_shop_detail where mobile = #{mobile}
-  </select>
+    </resultMap>
+    <select id="getShopByMobile" resultMap="BaseResultMap">
+        select *
+        from tz_shop_detail
+        where mobile = #{mobile}
+    </select>
     <update id="updatePasswordByUserName">
-      update tz_shop_detail set `password` = #{newPassword} where mobile = #{username}
+        update tz_shop_detail
+        set `password` = #{newPassword}
+        where mobile = #{username}
 
     </update>
 
-  <select id="getShopDetailByUserId" resultMap="BaseResultMap">
-      select * from tz_shop_detail where user_id = #{userId}
-  </select>
+    <select id="getShopDetailByUserId" resultMap="BaseResultMap">
+        select *
+        from tz_shop_detail
+        where user_id = #{userId}
+    </select>
 
-  <update id="updateStatus">
-     UPDATE tz_shop_detail sd SET sd.`update_time` = NOW(),sd.`shop_status` = #{status}
-     WHERE sd.`shop_id` = #{shopId}
-  </update>
+    <update id="updateStatus">
+        UPDATE tz_shop_detail sd
+        SET sd.`update_time` = NOW(),
+            sd.`shop_status` = #{status}
+        WHERE sd.`shop_id` = #{shopId}
+    </update>
     <select id="listHotShopsHead" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
-      SELECT
+        SELECT sd.`shop_id`,
+               sd.`out_station_no`,
+               sd.`shop_name`,
+               sd.`shop_logo`,
+               sd.shop_status,
+               COUNT(ucs.`shop_id`) fansCount,
+               sd.`tel`
+        FROM tz_shop_detail sd
+                 LEFT JOIN `tz_user_collection_shop` ucs
+                           ON ucs.`shop_id` = sd.`shop_id`
+        GROUP BY sd.`shop_id`
+        HAVING sd.shop_status = 1
+        ORDER BY fansCount DESC LIMIT 8
+    </select>
+    <select id="searchShops" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
+        SELECT
         sd.`shop_id`,
         sd.`out_station_no`,
         sd.`shop_name`,
@@ -61,67 +84,134 @@
         sd.shop_status,
         COUNT(ucs.`shop_id`) fansCount,
         sd.`tel`
-      FROM
+        FROM
         tz_shop_detail sd
-          LEFT JOIN `tz_user_collection_shop` ucs
-                    ON ucs.`shop_id` = sd.`shop_id`
-      GROUP BY sd.`shop_id`
-      HAVING sd.shop_status = 1
-      ORDER BY fansCount DESC
-      LIMIT 8
+        LEFT JOIN `tz_user_collection_shop` ucs
+        ON ucs.`shop_id` = sd.`shop_id`
+        GROUP BY sd.`shop_id`
+        HAVING sd.shop_status = 1
+        <if test="shopHeadInfoDto.shopName != null and shopHeadInfoDto.shopName != ''">
+            and sd.`shop_name` like concat('%', #{shopHeadInfoDto.shopName}, '%')
+        </if>
+        ORDER BY fansCount DESC
     </select>
-  <select id="searchShops" resultType="com.yami.shop.bean.app.dto.ShopHeadInfoDto">
-    SELECT
-    sd.`shop_id`,
-    sd.`out_station_no`,
-    sd.`shop_name`,
-    sd.`shop_logo`,
-    sd.shop_status,
-    COUNT(ucs.`shop_id`) fansCount,
-    sd.`tel`
-    FROM
-    tz_shop_detail sd
-    LEFT JOIN `tz_user_collection_shop` ucs
-    ON ucs.`shop_id` = sd.`shop_id`
-    GROUP BY sd.`shop_id`
-    HAVING sd.shop_status = 1
-    <if test="shopHeadInfoDto.shopName != null and shopHeadInfoDto.shopName != ''">
-      and sd.`shop_name` like concat('%', #{shopHeadInfoDto.shopName}, '%')
-    </if>
-    ORDER BY fansCount DESC
-  </select>
     <select id="selectShopDetailById" resultType="com.yami.shop.bean.model.ShopDetail">
-      select shop_id,out_station_no,shop_name,user_id,intro,shop_owner,mobile,tel,shop_lat,shop_lng,shop_address,province,province_id,city,city_id,area,area_id,
-      shop_logo,shop_status,create_time,update_time,is_distribution,business_license,identity_card_front,identity_card_later,sync,category,third_party_code
-      from tz_shop_detail
-      where shop_id = #{shopId}
+        select shop_id,
+               out_station_no,
+               shop_name,
+               user_id,
+               intro,
+               shop_owner,
+               mobile,
+               tel,
+               shop_lat,
+               shop_lng,
+               shop_address,
+               province,
+               province_id,
+               city,
+               city_id,
+               area,
+               area_id,
+               shop_logo,
+               shop_status,
+               create_time,
+               update_time,
+               is_distribution,
+               business_license,
+               identity_card_front,
+               identity_card_later,
+               sync,
+               category,
+               third_party_code
+        from tz_shop_detail
+        where shop_id = #{shopId}
     </select>
+
     <select id="neighborShop" resultType="com.yami.shop.bean.model.ShopDetail">
-      select
+        select
         sd.shop_id,
         shop_name,
-        ( 6371 * acos( cos( radians(#{lat}) ) * cos( radians( shop_lat ) ) * cos( radians( shop_lng ) - radians(#{lon}) ) + sin( radians(#{lat}) ) * sin( radians( shop_lat ) ) ) ) distance
-      from
+        ( 6371 * acos( cos( radians(#{lat}) ) * cos( radians( shop_lat ) ) * cos( radians( shop_lng ) - radians(#{lon})
+        ) + sin( radians(#{lat}) ) * sin( radians( shop_lat ) ) ) ) distance
+        from
         tz_shop_detail sd
-          right join tz_transport2 tp on tp.shop_id = sd.shop_id
-      where shop_status = 1
-      order by
+        right join tz_transport2 tp on tp.shop_id = sd.shop_id
+        right join tz_channel_shop tcs on tcs.shop_id = sd.shop_id
+        where shop_status = 1
+        <if test="null != platform">
+            tcs.`channel_id`= #{platform} and tcs.`is_delete`=0
+        </if>
+        order by
         distance
     </select>
 
 
-  <select id="selectByOutStationNo" resultType="com.yami.shop.bean.model.ShopDetail">
-    select shop_id,out_station_no,shop_name,user_id,intro,shop_owner,mobile,tel,shop_lat,shop_lng,shop_address,province,province_id,city,city_id,area,area_id,
-           shop_logo,shop_status,create_time,update_time,is_distribution,business_license,identity_card_front,identity_card_later,sync,category,third_party_code
-    from tz_shop_detail
-    where out_station_no = #{outStationNo}
-  </select>
+    <select id="selectByOutStationNo" resultType="com.yami.shop.bean.model.ShopDetail">
+        select shop_id,
+               out_station_no,
+               shop_name,
+               user_id,
+               intro,
+               shop_owner,
+               mobile,
+               tel,
+               shop_lat,
+               shop_lng,
+               shop_address,
+               province,
+               province_id,
+               city,
+               city_id,
+               area,
+               area_id,
+               shop_logo,
+               shop_status,
+               create_time,
+               update_time,
+               is_distribution,
+               business_license,
+               identity_card_front,
+               identity_card_later,
+               sync,
+               category,
+               third_party_code
+        from tz_shop_detail
+        where out_station_no = #{outStationNo}
+    </select>
 
-  <select id="selectByHbStationId" resultType="com.yami.shop.bean.model.ShopDetail">
-    select shop_id,hb_station_id, out_station_no,shop_name,user_id,intro,shop_owner,mobile,tel,shop_lat,shop_lng,shop_address,province,province_id,city,city_id,area,area_id,
-           shop_logo,shop_status,create_time,update_time,is_distribution,business_license,identity_card_front,identity_card_later,sync,category,third_party_code
-    from tz_shop_detail
-    where hb_station_id = #{hbStationId}
-  </select>
+    <select id="selectByHbStationId" resultType="com.yami.shop.bean.model.ShopDetail">
+        select shop_id,
+               hb_station_id,
+               out_station_no,
+               shop_name,
+               user_id,
+               intro,
+               shop_owner,
+               mobile,
+               tel,
+               shop_lat,
+               shop_lng,
+               shop_address,
+               province,
+               province_id,
+               city,
+               city_id,
+               area,
+               area_id,
+               shop_logo,
+               shop_status,
+               create_time,
+               update_time,
+               is_distribution,
+               business_license,
+               identity_card_front,
+               identity_card_later,
+               sync,
+               category,
+               third_party_code
+        from tz_shop_detail
+        where hb_station_id = #{hbStationId}
+    </select>
 
 </mapper>