This commit is contained in:
韩鹏辉
2024-05-30 11:19:54 +08:00
7 changed files with 28 additions and 27 deletions

View File

@@ -101,26 +101,16 @@ public class LoginContoller {
// @RequestParam(value = "rawData", required = false) String rawData, // @RequestParam(value = "rawData", required = false) String rawData,
// @RequestParam(value = "signature", required = false) String signature // @RequestParam(value = "signature", required = false) String signature
) { ) {
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) { if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
Result.fail("code不能为空"); Result.fail("code不能为空");
} }
String code = map.get("code").toString(); String code = map.get("code").toString();
// String qrCode = map.get("qrCode");
String rawData = map.get("rawData"); String rawData = map.get("rawData");
String signature = map.get("signature"); String signature = map.get("signature");
String encryptedData = map.get("encryptedData");
// String encryptedData = map.get("encryptedData"); String ivStr = map.get("iv");
// // String phone = map.get("phone");
// String ivStr = map.get("iv"); log.info("登录传参:入参:{}",JSONUtil.toJSONString(map));
String phone = map.get("phone");
// 用户非敏感信息rawData // 用户非敏感信息rawData
// 签名signature // 签名signature
JSONObject rawDataJson = JSON.parseObject(rawData); JSONObject rawDataJson = JSON.parseObject(rawData);
@@ -136,12 +126,12 @@ public class LoginContoller {
if (!signature.equals(signature2)) { if (!signature.equals(signature2)) {
return Result.fail("签名校验失败"); return Result.fail("签名校验失败");
} }
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
log.info("登录传参:解码获取手机号{}",data);
String phone =JSONObject.parseObject(data).get("phoneNumber").toString();
String nickName = rawDataJson.getString("nickName"); String nickName = rawDataJson.getString("nickName");
String avatarUrl = rawDataJson.getString("avatarUrl"); String avatarUrl = rawDataJson.getString("avatarUrl");
try { try {
// return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, qrCode, IpUtil.getIpAddr(request));
return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, IpUtil.getIpAddr(request)); return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, IpUtil.getIpAddr(request));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -158,7 +148,7 @@ public class LoginContoller {
* @param map * @param map
* @return * @return
*/ */
@RequestMapping("getPhoneNumber") // @RequestMapping("getPhoneNumber")
public Result getPhoneNumber(@RequestBody Map<String, String> map) { public Result getPhoneNumber(@RequestBody Map<String, String> map) {
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) { if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
@@ -180,12 +170,13 @@ public class LoginContoller {
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr); String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
try { try {
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) { if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber")); return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
} }
} catch (Exception e){ } catch (Exception e){
log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data);
} }
return Result.fail("获取手机号失败"); return Result.fail("获取手机号失败,请重试!");
} }
@Resource @Resource

View File

@@ -23,12 +23,12 @@ public interface TbProductMapper {
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId); Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list); Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
List<ShopGroupInfoVo> selGroups(@Param("type") String type, List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,
@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat, @Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat, @Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat); @Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
List<ShopGroupInfoVo> selHotGroups(@Param("type") String type, List<ShopGroupInfoVo> selHotGroups(@Param("proName") String proName,@Param("type") String type,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat); @Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);

View File

@@ -7,6 +7,7 @@ import lombok.Data;
*/ */
@Data @Data
public class HomeDto extends HomeBaseDto { public class HomeDto extends HomeBaseDto {
private String proName;
/** /**
* 品类 * 品类
*/ */

View File

@@ -56,10 +56,10 @@ public class HomePageService {
//菜单 //菜单
List<SysDict> sysDicts = sysDictMapper.selectByType("home"); List<SysDict> sysDicts = sysDictMapper.selectByType("home");
for (SysDict sysDict : sysDicts) { for (SysDict sysDict : sysDicts) {
if (sysDict.getIsChild().equals("1")) { if (sysDict.getIsChild().equals(1)) {
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId())); sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
} }
sysDict.setIsChild((sysDict.getIsChild() == null || sysDict.getIsChild().equals("0")) ? false : true); sysDict.setIsChild((sysDict.getIsChild() == null || sysDict.getIsChild().equals(0)) ? false : true);
} }
homeUpVO.setMenu(sysDicts); homeUpVO.setMenu(sysDicts);
/** /**

View File

@@ -133,7 +133,7 @@ public class LoginService {
//展示描述 //展示描述
//图标 //图标
// map.put("", ); // map.put("", );
log.info("登录结果:" + JSONUtil.toJSONString(map)); log.info("登录传参 结果:" + JSONUtil.toJSONString(map));
return Result.success(CodeEnum.SUCCESS, map); return Result.success(CodeEnum.SUCCESS, map);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@@ -186,6 +186,9 @@ public class ProductService {
homeDto.setPage(1); homeDto.setPage(1);
homeDto.setSize(4); homeDto.setSize(4);
} }
if (homeDto.getType().equals("near")) {
homeDto.setDistanceInKm("1");
}
PageHelper.startPage(homeDto.getPage(), homeDto.getSize()); PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
//经纬度(附近一km) //经纬度(附近一km)
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint( Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
@@ -202,12 +205,12 @@ public class ProductService {
stTime = enTime - 3600000L * 2; stTime = enTime - 3600000L * 2;
} }
shopGroupInfoVos = tbProductMapper.selHotGroups( shopGroupInfoVos = tbProductMapper.selHotGroups(
homeDto.getType(), homeDto.getProName(),homeDto.getType(),
DateUtils.getStrTime(new Date(stTime)), DateUtils.getStrTime(new Date(enTime)), DateUtils.getStrTime(new Date(stTime)), DateUtils.getStrTime(new Date(enTime)),
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat()); homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
} else { } else {
shopGroupInfoVos = tbProductMapper.selGroups( shopGroupInfoVos = tbProductMapper.selGroups(
homeDto.getType(), homeDto.getProName(),homeDto.getType(),
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0], topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0], topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat()); homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());

View File

@@ -961,6 +961,9 @@
info.`status`='1' info.`status`='1'
AND pro.is_combo = '1' AND pro.is_combo = '1'
AND info.cities = #{cities} AND info.cities = #{cities}
<if test="proName != null and proName != ''">
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%') AND group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if> </if>
@@ -1005,6 +1008,9 @@
<where> <where>
info.`status`='1' info.`status`='1'
AND info.cities = #{cities} AND info.cities = #{cities}
<if test="proName != null and proName != ''">
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%') AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if> </if>