This commit is contained in:
韩鹏辉 2024-05-30 11:19:54 +08:00
commit 2e1755404e
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 = "signature", required = false) String signature
) {
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
Result.fail("code不能为空");
}
String code = map.get("code").toString();
// String qrCode = map.get("qrCode");
String rawData = map.get("rawData");
String signature = map.get("signature");
// String encryptedData = map.get("encryptedData");
//
// String ivStr = map.get("iv");
String phone = map.get("phone");
String encryptedData = map.get("encryptedData");
String ivStr = map.get("iv");
// String phone = map.get("phone");
log.info("登录传参:入参:{}",JSONUtil.toJSONString(map));
// 用户非敏感信息rawData
// 签名signature
JSONObject rawDataJson = JSON.parseObject(rawData);
@ -136,12 +126,12 @@ public class LoginContoller {
if (!signature.equals(signature2)) {
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 avatarUrl = rawDataJson.getString("avatarUrl");
try {
// return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, qrCode, IpUtil.getIpAddr(request));
return loginService.wxCustomLogin(openid, avatarUrl, nickName, phone, IpUtil.getIpAddr(request));
} catch (Exception e) {
e.printStackTrace();
@ -158,7 +148,7 @@ public class LoginContoller {
* @param map
* @return
*/
@RequestMapping("getPhoneNumber")
// @RequestMapping("getPhoneNumber")
public Result getPhoneNumber(@RequestBody Map<String, String> map) {
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);
try {
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"));
}
} catch (Exception e){
log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data);
}
return Result.fail("获取手机号失败");
return Result.fail("获取手机号失败,请重试!");
}
@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 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("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
@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("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
public class HomeDto extends HomeBaseDto {
private String proName;
/**
* 品类
*/

View File

@ -56,10 +56,10 @@ public class HomePageService {
//菜单
List<SysDict> sysDicts = sysDictMapper.selectByType("home");
for (SysDict sysDict : sysDicts) {
if (sysDict.getIsChild().equals("1")) {
if (sysDict.getIsChild().equals(1)) {
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);
/**

View File

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

View File

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

View File

@ -961,6 +961,9 @@
info.`status`='1'
AND pro.is_combo = '1'
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 != ''">
AND group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if>
@ -1005,6 +1008,9 @@
<where>
info.`status`='1'
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 != ''">
AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if>