feat(新增): 小程序登录接口
This commit is contained in:
parent
2fa9b39d14
commit
b53976500a
|
@ -15,6 +15,7 @@
|
|||
<file url="file://$PROJECT_DIR$/model/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/model/src/main/resources-filtered" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/service-client/service-product-client/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/service-client/service-region-client/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/service-client/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/service-client/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/service-gateway/src/main/java" charset="UTF-8" />
|
||||
|
|
|
@ -11,27 +11,25 @@ import lombok.Data;
|
|||
@ApiModel(description = "RegionWare")
|
||||
@TableName("region_ware")
|
||||
public class RegionWare extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty(value = "开通区域")
|
||||
@TableField("region_id")
|
||||
private Long regionId;
|
||||
|
||||
@ApiModelProperty(value = "开通区域")
|
||||
@TableField("region_id")
|
||||
private Long regionId;
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
@TableField("region_name")
|
||||
private String regionName;
|
||||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
@TableField("region_name")
|
||||
private String regionName;
|
||||
@ApiModelProperty(value = "仓库")
|
||||
@TableField("ware_id")
|
||||
private Long wareId;
|
||||
|
||||
@ApiModelProperty(value = "仓库")
|
||||
@TableField("ware_id")
|
||||
private Long wareId;
|
||||
|
||||
@ApiModelProperty(value = "仓库名称")
|
||||
@TableField("ware_name")
|
||||
private String wareName;
|
||||
|
||||
@ApiModelProperty(value = "状态(0:未开通 1:已开通)")
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "仓库名称")
|
||||
@TableField("ware_name")
|
||||
private String wareName;
|
||||
|
||||
@ApiModelProperty(value = "状态(0:未开通 1:已开通)")
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
<url>https://maven.apache.org</url>
|
||||
<modules>
|
||||
<module>service-product-client</module>
|
||||
<module>service-region-client</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>service-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>service-region-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>service-region-client</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
package com.atguigu.ssyx.client.region;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(value = "service-sys", path = "/admin/sys/regionWare")
|
||||
public interface RegionFeignClient {
|
||||
// 根据RegionId查询WareId
|
||||
@GetMapping("getWareId")
|
||||
Long getWareId(@RequestParam Long regionId);
|
||||
}
|
|
@ -2,8 +2,8 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.activity.CouponRange;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface CouponRangeMapper extends BaseMapper<CouponRange> {
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.activity.Seckill;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @author bunny
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface SecKillMapper extends BaseMapper<Seckill> {
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.activity.SeckillSkuNotice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @author bunny
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface SecKillSkuNoticeMapper extends BaseMapper<SeckillSkuNotice> {
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.activity.SeckillTime;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SeckillTimeMapper extends BaseMapper<SeckillTime> {
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.atguigu.ssyx.activity.mapper;
|
|||
|
||||
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @author bunny
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Mapper
|
||||
public interface SkuInfoMapper extends BaseMapper<SkuInfo> {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?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.atguigu.ssyx.activity.mapper.CouponRangeMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?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.atguigu.ssyx.activity.mapper.SeckillSkuMapper">
|
||||
<mapper namespace="com.atguigu.ssyx.activity.mapper.SecKillSkuMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.atguigu.ssyx.sys.api;
|
||||
|
||||
import com.atguigu.ssyx.model.sys.RegionWare;
|
||||
import com.atguigu.ssyx.sys.service.RegionWareService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(value = "RegionWare管理", tags = "RegionWare管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/sys/regionWare")
|
||||
public class RegionWareInnerController {
|
||||
@Autowired
|
||||
private RegionWareService regionWareService;
|
||||
|
||||
@ApiOperation(value = "根据RegionId查询WareId")
|
||||
@GetMapping("getWareId")
|
||||
public Long getWareId(@RequestParam Long regionId) {
|
||||
RegionWare regionWare = regionWareService.getOne(Wrappers.<RegionWare>lambdaQuery().eq(RegionWare::getRegionId, regionId));
|
||||
return regionWare.getWareId();
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ spring:
|
|||
|
||||
mybatis-plus:
|
||||
type-enums-package: com.atguigu.ssyx.enums # 加上枚举类型
|
||||
type-aliases-package: com.atguigu.ssyx # 配置每个包前缀
|
||||
type-aliases-package: com.atguigu.ssyx.model # 配置每个包前缀
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.atguigu</groupId>
|
||||
<artifactId>service-product-client</artifactId>
|
||||
<artifactId>service-region-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -1,162 +0,0 @@
|
|||
package com.atguigu.ssyx.user.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 团长表
|
||||
* </p>
|
||||
*
|
||||
* @author bunny
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class Leader implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 区域id
|
||||
*/
|
||||
private Long regionId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idNo;
|
||||
|
||||
/**
|
||||
* 身份证图片路径
|
||||
*/
|
||||
private String idNoUrl1;
|
||||
|
||||
/**
|
||||
* 身份证图片路径
|
||||
*/
|
||||
private String idNoUrl2;
|
||||
|
||||
/**
|
||||
* 提货点名称
|
||||
*/
|
||||
private String takeName;
|
||||
|
||||
/**
|
||||
* 提货点类型;1->宝妈;2->便利店店主;3->快递站点;4->物业中心
|
||||
*/
|
||||
private String takeType;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private Long province;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private Long city;
|
||||
|
||||
/**
|
||||
* 区域code
|
||||
*/
|
||||
private Long district;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private BigDecimal latitude;
|
||||
|
||||
/**
|
||||
* 有无门店
|
||||
*/
|
||||
private String haveStore;
|
||||
|
||||
/**
|
||||
* 门店照片
|
||||
*/
|
||||
private String storePath;
|
||||
|
||||
/**
|
||||
* 营业时间
|
||||
*/
|
||||
private String workTime;
|
||||
|
||||
/**
|
||||
* 营业状态
|
||||
*/
|
||||
private Integer workStatus;
|
||||
|
||||
/**
|
||||
* 审核状态(0:提交审核 1:审核通过 -1:审核未通过)
|
||||
*/
|
||||
private Integer checkStatus;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private LocalDateTime checkTime;
|
||||
|
||||
/**
|
||||
* 审核用户
|
||||
*/
|
||||
private String checkUser;
|
||||
|
||||
/**
|
||||
* 审核内容
|
||||
*/
|
||||
private String checkContent;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记(0:不可用 1:可用)
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package com.atguigu.ssyx.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会员提货记录表
|
||||
* </p>
|
||||
*
|
||||
* @author bunny
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UserDelivery implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 团长id
|
||||
*/
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
private Long wareId;
|
||||
|
||||
/**
|
||||
* 是否默认
|
||||
*/
|
||||
private String isDefault;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记(0:不可用 1:可用)
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.atguigu.ssyx.user.mapper;
|
||||
|
||||
import com.atguigu.ssyx.user.entity.Leader;
|
||||
import com.atguigu.ssyx.model.user.Leader;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atguigu.ssyx.user.mapper;
|
||||
|
||||
import com.atguigu.ssyx.user.entity.UserDelivery;
|
||||
import com.atguigu.ssyx.model.user.UserDelivery;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atguigu.ssyx.user.service;
|
||||
|
||||
import com.atguigu.ssyx.user.entity.Leader;
|
||||
import com.atguigu.ssyx.model.user.Leader;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atguigu.ssyx.user.service;
|
||||
|
||||
import com.atguigu.ssyx.user.entity.UserDelivery;
|
||||
import com.atguigu.ssyx.model.user.UserDelivery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atguigu.ssyx.user.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.user.entity.Leader;
|
||||
import com.atguigu.ssyx.model.user.Leader;
|
||||
import com.atguigu.ssyx.user.mapper.LeaderMapper;
|
||||
import com.atguigu.ssyx.user.service.LeaderService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.atguigu.ssyx.user.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.user.entity.UserDelivery;
|
||||
import com.atguigu.ssyx.model.user.UserDelivery;
|
||||
import com.atguigu.ssyx.user.mapper.UserDeliveryMapper;
|
||||
import com.atguigu.ssyx.user.service.UserDeliveryService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.atguigu.ssyx.user.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.client.region.RegionFeignClient;
|
||||
import com.atguigu.ssyx.enums.UserType;
|
||||
import com.atguigu.ssyx.model.user.Leader;
|
||||
import com.atguigu.ssyx.model.user.User;
|
||||
import com.atguigu.ssyx.user.entity.Leader;
|
||||
import com.atguigu.ssyx.user.entity.UserDelivery;
|
||||
import com.atguigu.ssyx.model.user.UserDelivery;
|
||||
import com.atguigu.ssyx.user.mapper.UserMapper;
|
||||
import com.atguigu.ssyx.user.service.LeaderService;
|
||||
import com.atguigu.ssyx.user.service.UserDeliveryService;
|
||||
|
@ -23,6 +24,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
private UserDeliveryService userDeliveryService;
|
||||
@Autowired
|
||||
private LeaderService leaderService;
|
||||
@Autowired
|
||||
private RegionFeignClient regionFeignClient;
|
||||
|
||||
/**
|
||||
* 先根据openid进行数据库查询
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
@ -44,7 +45,7 @@ public class WeiXinApiServiceImpl implements WeiXinApiService {
|
|||
String result = HttpClientUtils.get(accessTokenUrl);
|
||||
// 请求微信接口服,返回两个值 session_key 和 openId
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String accessToken = jsonObject.getString("session_key");
|
||||
// String accessToken = jsonObject.getString("session_key");
|
||||
String openId = jsonObject.getString("openid");
|
||||
// 先根据openid进行数据库查询
|
||||
User user = userService.getUserByOpenId(openId);
|
||||
|
|
Loading…
Reference in New Issue